diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..95b32fe8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +max_line_length = 120 +tab_width = 2 +trim_trailing_whitespace = true diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..ba316e18 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,7 @@ +# Set line endings. +* text eol=lf + +# Explicitly mark binary files. +*.png binary +*.jpg binary +*.ico binary diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..b93f807d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: CI/CD + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build-node: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + node-version: [18.x, 20.x, 22.x] + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Install dependencies + run: npm install + + - name: Run Tests + run: npm run test + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + flags: unittests diff --git a/.gitignore b/.gitignore index 1a829597..a2ddf93a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,11 @@ +.idea .rvmrc .DS_Store -node_modules npm-debug.log -dist -docs -f64 \ No newline at end of file +/.dts +/.vscode +/coverage +/dist +/docs +/html +/node_modules diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 8b741a6d..00000000 --- a/.npmignore +++ /dev/null @@ -1,10 +0,0 @@ -.rvmrc -npm-debug.log -docs -f64 -scripts -src -tests -tsconfig.json -tsconfig64.json -typedoc.json \ No newline at end of file diff --git a/README-CDN.md b/README-CDN.md new file mode 100644 index 00000000..8d12062c --- /dev/null +++ b/README-CDN.md @@ -0,0 +1,29 @@ +[![NPM Version](https://img.shields.io/npm/v/gl-matrix.svg)](https://www.npmjs.com/package/gl-matrix) +[![License](https://img.shields.io/badge/license-MIT-yellowgreen.svg?style=flat)](https://github.com/typhonjs-svelte/trie-search/blob/main/LICENSE) +[![Build Status](https://github.com/toji/gl-matrix/workflows/CI/CD/badge.svg)](#) +[![Coverage](https://img.shields.io/codecov/c/github/toji/gl-matrix.svg)](https://codecov.io/github/toji/gl-matrix) +[![API Docs](https://img.shields.io/badge/API%20Documentation-476ff0)](https://glmatrix.net/docs/v4/) + +`gl-matrix` is a versatile and high-performance JavaScript / TypeScript library for vector and matrix operations, +optimized for real-time 3D graphics APIs such as WebGL and WebGPU. + +This documentation resource separates the CDN / pre-built distribution resources from the main Node distribution API +documentation. Additional, information regarding using `gl-matrix` with modern ESM CDNs and capabilities such as +[import maps](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap) and enabling type +declarations when developing web apps with the CDN resources is forthcoming, so stay tuned as these docs will be updated +in the next beta release. + +--- + +There are multiple distribution methods to utilize `gl-matrix` from legacy module systems like +[RequireJS](https://requirejs.org/) to modern ES Module (ESM) oriented CDNs. If you are not using Node / NPM and +bundling `gl-matrix` directly into your project / product various pre-built versions are available on most CDNs that +automatically make NPM package available for consumption online in a web application deployment. + +Pre-built ESM and ES5 / UMD bundles are available in the `/dist-cdn` directory checked into the `gl-matrix` repo. +The `gl-matrix/cdn` and `gl-matrix/cdn/f64` exports are linked to the types and pre-built all-inclusive CDN ESM +bundles. `gl-matrix/types/cdn/umd` and `gl-matrix/types/cdn/umd/64` provide type declarations for the UMD bundles when +used as an `IIFE`. + + + diff --git a/README.md b/README.md index 35beae90..9f37c2fb 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,25 @@ -## Fast, flexible vector and matrix math for JavaScript - [![NPM Version](https://img.shields.io/npm/v/gl-matrix.svg)](https://www.npmjs.com/package/gl-matrix) -[![Build Status](https://travis-ci.org/toji/gl-matrix.svg)](https://travis-ci.org/toji/gl-matrix) - -glMatrix is a high performance, very flexible library for vector and matrix operations in JavaScript/TypeScript, designed for the needs of realtime 3D graphics APIs like WebGL and WebGPU. - -## Docs - -Documentation is available at [https://glmatrix.net/docs/v4/](https://glmatrix.net/docs/v4/) - -## Using Float64Array - -If your use case requires additional precision beyond the default 32-bit floats used by default, you can instead use a 64-bit verions of the library by importing from the `f64/` directory of your chosen build type. For example: - -```js -import { Vec3 } from './gl-matrix/dist/esm/f64/vec3.js'; -``` - -If you have a need to mix and match the 64 bit and 32 bit versions, you can do so by importing them as different names: - -```js -import { Vec3 as Vec3F32 } from './gl-matrix/dist/esm/vec3.js'; -import { Vec3 as Vec3F64 } from './gl-matrix/dist/esm/f64/vec3.js'; -``` - -All API calls are identical between the two versions, the only difference is the type of TypedArray which the classes extend. \ No newline at end of file +[![License](https://img.shields.io/badge/license-MIT-yellowgreen.svg?style=flat)](https://github.com/typhonjs-svelte/trie-search/blob/main/LICENSE) +[![Build Status](https://github.com/toji/gl-matrix/workflows/CI/CD/badge.svg)](#) +[![Coverage](https://img.shields.io/codecov/c/github/toji/gl-matrix.svg)](https://codecov.io/github/toji/gl-matrix) +[![API Docs](https://img.shields.io/badge/API%20Documentation-476ff0)](https://glmatrix.net/docs/v4/) + +`gl-matrix` is a versatile and high-performance JavaScript / TypeScript library for vector and matrix operations, +optimized for real-time 3D graphics APIs such as WebGL and WebGPU. + +Javascript has evolved into a language capable of handling realtime 3D graphics and computationally intensive tasks such +as physics simulations. These types of applications demand high performance vector and matrix math which is something +that Javascript doesn't provide by default. `gl-matrix` to the rescue! + +`gl-matrix` is designed to perform vector and matrix operations stupidly fast! By hand-tuning each function for maximum +performance and encouraging efficient usage patterns through API conventions `gl-matrix` will help you get the most out +of your Javascript engine in the browser or preferred Javascript runtime. + +## What's new in 4.0? +`gl-matrix` 4.0 is the result of a lot of excellent feedback from the community, and features: + +- Revamped and consistent API (not backward compatible with 3.x, see: Classic API) +- Even more optimizations! +- Written in Typescript. +- A cleaner code base, broken up by type. +- A more complete unit testing suite. diff --git a/assets/docs/favicon.ico b/assets/docs/favicon.ico new file mode 100644 index 00000000..6038e83d Binary files /dev/null and b/assets/docs/favicon.ico differ diff --git a/assets/icon/gl-matrix-icon-512.webp b/assets/icon/gl-matrix-icon-512.webp new file mode 100644 index 00000000..3a4cf40c Binary files /dev/null and b/assets/icon/gl-matrix-icon-512.webp differ diff --git a/assets/icon/gl-matrix-icon-64.webp b/assets/icon/gl-matrix-icon-64.webp new file mode 100644 index 00000000..ce4c8695 Binary files /dev/null and b/assets/icon/gl-matrix-icon-64.webp differ diff --git a/assets/icon/gl-matrix-icon-mono-64.webp b/assets/icon/gl-matrix-icon-mono-64.webp new file mode 100644 index 00000000..2ae64c0c Binary files /dev/null and b/assets/icon/gl-matrix-icon-mono-64.webp differ diff --git a/dist-cdn/cjs/2022/gl-matrix-f32.cjs b/dist-cdn/cjs/2022/gl-matrix-f32.cjs new file mode 100644 index 00000000..73a696c6 --- /dev/null +++ b/dist-cdn/cjs/2022/gl-matrix-f32.cjs @@ -0,0 +1,9536 @@ +// gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library. +// @author Brandon Jones +// @author Colin MacKenzie IV +// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md) +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/cdn/index.ts +var cdn_exports = {}; +__export(cdn_exports, { + EnableSwizzles: () => EnableSwizzles, + Mat2: () => Mat2, + Mat2d: () => Mat2d, + Mat3: () => Mat3, + Mat4: () => Mat4, + Quat: () => Quat, + Quat2: () => Quat2, + Vec2: () => Vec2, + Vec3: () => Vec3, + Vec4: () => Vec4, + mat2: () => Mat2, + mat2d: () => Mat2d, + mat3: () => Mat3, + mat4: () => Mat4, + quat: () => Quat, + quat2: () => Quat2, + toDegree: () => toDegree, + toRadian: () => toRadian, + vec2: () => Vec2, + vec3: () => Vec3, + vec4: () => Vec4 +}); +module.exports = __toCommonJS(cdn_exports); + +// src/common/index.ts +var GLM_EPSILON = 1e-6; + +// src/_lib/f32/Mat2.ts +var Mat2 = class _Mat2 extends Float32Array { + static #IDENTITY_2X2 = new Float32Array([ + 1, + 0, + 0, + 1 + ]); + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 4: + super(values); + break; + case 2: + super(values[0], values[1], 4); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v + ]); + } else { + super(v, 0, 4); + } + break; + default: + super(_Mat2.#IDENTITY_2X2); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat2.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat2.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat2} into `this`. + * + * @param a the source vector + * @returns `this` + * @category Methods + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat2.identity(this) + * + * @returns `this` + * @category Methods + */ + identity() { + this.set(_Mat2.#IDENTITY_2X2); + return this; + } + /** + * Multiplies this {@link Mat2} against another one + * Equivalent to `Mat2.multiply(this, this, b);` + * + * @param b - The second operand + * @returns `this` + * @category Methods + */ + multiply(b) { + return _Mat2.multiply(this, this, b); + } + /** + * Alias for {@link Mat2.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat2} + * Equivalent to `Mat2.transpose(this, this);` + * + * @returns `this` + * @category Methods + */ + transpose() { + return _Mat2.transpose(this, this); + } + /** + * Inverts this {@link Mat2} + * Equivalent to `Mat4.invert(this, this);` + * + * @returns `this` + * @category Methods + */ + invert() { + return _Mat2.invert(this, this); + } + /** + * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2.scale(this, this, v);` + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + * @category Methods + */ + scale(v) { + return _Mat2.scale(this, this, v); + } + /** + * Rotates this {@link Mat2} by the given angle around the given axis + * Equivalent to `Mat2.rotate(this, this, rad);` + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + * @category Methods + */ + rotate(rad) { + return _Mat2.rotate(this, this, rad); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2}. + */ + static get BYTE_LENGTH() { + return 4 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat2} + * @category Static + * + * @returns A new {@link Mat2} + */ + static create() { + return new _Mat2(); + } + /** + * Creates a new {@link Mat2} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2} + */ + static clone(a) { + return new _Mat2(a); + } + /** + * Copy the values from one {@link Mat2} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Create a new {@link Mat2} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2} + */ + static fromValues(...values) { + return new _Mat2(...values); + } + /** + * Set the components of a {@link Mat2} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + return out; + } + /** + * Set a {@link Mat2} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out, a) { + if (out === a) { + const a1 = a[1]; + out[1] = a[2]; + out[2] = a1; + } else { + out[0] = a[0]; + out[1] = a[2]; + out[2] = a[1]; + out[3] = a[3]; + } + return out; + } + /** + * Inverts a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + let det = a0 * a3 - a2 * a1; + if (!det) { + return null; + } + det = 1 / det; + out[0] = a3 * det; + out[1] = -a1 * det; + out[2] = -a2 * det; + out[3] = a0 * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out, a) { + const a0 = a[0]; + out[0] = a[3]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a0; + return out; + } + /** + * Calculates the determinant of a {@link Mat2} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + return a[0] * a[3] - a[2] * a[1]; + } + /** + * Adds two {@link Mat2}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + return out; + } + /** + * Alias for {@link Mat2.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat2}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + out[0] = a0 * b0 + a2 * b1; + out[1] = a1 * b0 + a3 * b1; + out[2] = a0 * b2 + a2 * b3; + out[3] = a1 * b2 + a3 * b3; + return out; + } + /** + * Alias for {@link Mat2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Rotates a {@link Mat2} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out, a, rad) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = a0 * c + a2 * s; + out[1] = a1 * c + a3 * s; + out[2] = a0 * -s + a2 * c; + out[3] = a1 * -s + a3 * c; + return out; + } + /** + * Scales the {@link Mat2} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0 * v0; + out[1] = a1 * v0; + out[2] = a2 * v1; + out[3] = a3 * v1; + return out; + } + /** + * Creates a {@link Mat2} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = -s; + out[3] = c; + return out; + } + /** + * Creates a {@link Mat2} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = v[1]; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat2} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]); + } + /** + * Multiply each element of a {@link Mat2} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + return out; + } + /** + * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + return out; + } + /** + * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix + * @category Static + * + * @param L - the lower triangular matrix + * @param D - the diagonal matrix + * @param U - the upper triangular matrix + * @param a - the input matrix to factorize + */ + static LDU(L, D, U, a) { + L[2] = a[2] / a[0]; + U[0] = a[0]; + U[1] = a[1]; + U[3] = a[3] - L[2] * U[1]; + return [L, D, U]; + } + /** + * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + /** + * Returns whether two {@link Mat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)); + } + /** + * Returns a string representation of a {@link Mat2} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat2(${a.join(", ")})`; + } +}; +Mat2.prototype.mul = Mat2.prototype.multiply; +Mat2.mul = Mat2.multiply; +Mat2.sub = Mat2.subtract; + +// src/_lib/f32/Mat2d.ts +var Mat2d = class _Mat2d extends Float32Array { + static #IDENTITY_2X3 = new Float32Array([ + 1, + 0, + 0, + 1, + 0, + 0 + ]); + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 6: + super(values); + break; + case 2: + super(values[0], values[1], 6); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v, + v, + v + ]); + } else { + super(v, 0, 6); + } + break; + default: + super(_Mat2d.#IDENTITY_2X3); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat2d.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat2d.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Mat2d} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat2d.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this.set(_Mat2d.#IDENTITY_2X3); + return this; + } + /** + * Multiplies this {@link Mat2d} against another one + * Equivalent to `Mat2d.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b) { + return _Mat2d.multiply(this, this, b); + } + /** + * Alias for {@link Mat2d.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Translate this {@link Mat2d} by the given vector + * Equivalent to `Mat2d.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v) { + return _Mat2d.translate(this, this, v); + } + /** + * Rotates this {@link Mat2d} by the given angle around the given axis + * Equivalent to `Mat2d.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad) { + return _Mat2d.rotate(this, this, rad); + } + /** + * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2d.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v) { + return _Mat2d.scale(this, this, v); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2d}. + */ + static get BYTE_LENGTH() { + return 6 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat2d} + * @category Static + * + * @returns A new {@link Mat2d} + */ + static create() { + return new _Mat2d(); + } + /** + * Creates a new {@link Mat2d} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2d} + */ + static clone(a) { + return new _Mat2d(a); + } + /** + * Copy the values from one {@link Mat2d} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + return out; + } + /** + * Create a new {@link Mat2d} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2d} + */ + static fromValues(...values) { + return new _Mat2d(...values); + } + /** + * Set the components of a {@link Mat2d} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + return out; + } + /** + * Set a {@link Mat2d} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Inverts a {@link Mat2d} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const aa = a[0]; + const ab = a[1]; + const ac = a[2]; + const ad = a[3]; + const atx = a[4]; + const aty = a[5]; + let det = aa * ad - ab * ac; + if (!det) { + return null; + } + det = 1 / det; + out[0] = ad * det; + out[1] = -ab * det; + out[2] = -ac * det; + out[3] = aa * det; + out[4] = (ac * aty - ad * atx) * det; + out[5] = (ab * atx - aa * aty) * det; + return out; + } + /** + * Calculates the determinant of a {@link Mat2d} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + return a[0] * a[3] - a[1] * a[2]; + } + /** + * Adds two {@link Mat2d}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + return out; + } + /** + * Alias for {@link Mat2d.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat2d}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + out[0] = a0 * b0 + a2 * b1; + out[1] = a1 * b0 + a3 * b1; + out[2] = a0 * b2 + a2 * b3; + out[3] = a1 * b2 + a3 * b3; + out[4] = a0 * b4 + a2 * b5 + a4; + out[5] = a1 * b4 + a3 * b5 + a5; + return out; + } + /** + * Alias for {@link Mat2d.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat2d} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0; + out[1] = a1; + out[2] = a2; + out[3] = a3; + out[4] = a0 * v0 + a2 * v1 + a4; + out[5] = a1 * v0 + a3 * v1 + a5; + return out; + } + /** + * Rotates a {@link Mat2d} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out, a, rad) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = a0 * c + a2 * s; + out[1] = a1 * c + a3 * s; + out[2] = a0 * -s + a2 * c; + out[3] = a1 * -s + a3 * c; + out[4] = a4; + out[5] = a5; + return out; + } + /** + * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0 * v0; + out[1] = a1 * v0; + out[2] = a2 * v1; + out[3] = a3 * v1; + out[4] = a4; + out[5] = a5; + return out; + } + // TODO: Got to fromRotation + /** + * Creates a {@link Mat2d} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = v[0]; + out[5] = v[1]; + return out; + } + /** + * Creates a {@link Mat2d} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = -s; + out[3] = c; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Creates a {@link Mat2d} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = v[1]; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat2d} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1); + } + /** + * Multiply each element of a {@link Mat2d} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + return out; + } + /** + * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + return out; + } + /** + * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5]; + } + /** + * Returns whether two {@link Mat2d}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)); + } + /** + * Returns a string representation of a {@link Mat2d} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat2d(${a.join(", ")})`; + } +}; +Mat2d.mul = Mat2d.multiply; +Mat2d.sub = Mat2d.subtract; + +// src/_lib/f32/Mat3.ts +var Mat3 = class _Mat3 extends Float32Array { + static #IDENTITY_3X3 = new Float32Array([ + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1 + ]); + /** + * Create a {@link Mat3}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 9: + super(values); + break; + case 2: + super(values[0], values[1], 9); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v, + v, + v, + v, + v, + v + ]); + } else { + super(v, 0, 9); + } + break; + default: + super(_Mat3.#IDENTITY_3X3); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat3.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat3.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat3.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this.set(_Mat3.#IDENTITY_3X3); + return this; + } + /** + * Multiplies this {@link Mat3} against another one + * Equivalent to `Mat3.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b) { + return _Mat3.multiply(this, this, b); + } + /** + * Alias for {@link Mat3.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat3} + * Equivalent to `Mat3.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose() { + return _Mat3.transpose(this, this); + } + /** + * Inverts this {@link Mat3} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + return _Mat3.invert(this, this); + } + /** + * Translate this {@link Mat3} by the given vector + * Equivalent to `Mat3.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v) { + return _Mat3.translate(this, this, v); + } + /** + * Rotates this {@link Mat3} by the given angle around the given axis + * Equivalent to `Mat3.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad) { + return _Mat3.rotate(this, this, rad); + } + /** + * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat3.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v) { + return _Mat3.scale(this, this, v); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat3}. + */ + static get BYTE_LENGTH() { + return 9 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat3} + * @category Static + * + * @returns A new {@link Mat3} + */ + static create() { + return new _Mat3(); + } + /** + * Creates a new {@link Mat3} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat3} + */ + static clone(a) { + return new _Mat3(a); + } + /** + * Copy the values from one {@link Mat3} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + return out; + } + /** + * Create a new {@link Mat3} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat3} + */ + static fromValues(...values) { + return new _Mat3(...values); + } + /** + * Set the components of a {@link Mat3} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + out[6] = values[6]; + out[7] = values[7]; + out[8] = values[8]; + return out; + } + /** + * Set a {@link Mat3} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out, a) { + if (out === a) { + const a01 = a[1], a02 = a[2], a12 = a[5]; + out[1] = a[3]; + out[2] = a[6]; + out[3] = a01; + out[5] = a[7]; + out[6] = a02; + out[7] = a12; + } else { + out[0] = a[0]; + out[1] = a[3]; + out[2] = a[6]; + out[3] = a[1]; + out[4] = a[4]; + out[5] = a[7]; + out[6] = a[2]; + out[7] = a[5]; + out[8] = a[8]; + } + return out; + } + /** + * Inverts a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const a00 = a[0], a01 = a[1], a02 = a[2]; + const a10 = a[3], a11 = a[4], a12 = a[5]; + const a20 = a[6], a21 = a[7], a22 = a[8]; + const b01 = a22 * a11 - a12 * a21; + const b11 = -a22 * a10 + a12 * a20; + const b21 = a21 * a10 - a11 * a20; + let det = a00 * b01 + a01 * b11 + a02 * b21; + if (!det) { + return null; + } + det = 1 / det; + out[0] = b01 * det; + out[1] = (-a22 * a01 + a02 * a21) * det; + out[2] = (a12 * a01 - a02 * a11) * det; + out[3] = b11 * det; + out[4] = (a22 * a00 - a02 * a20) * det; + out[5] = (-a12 * a00 + a02 * a10) * det; + out[6] = b21 * det; + out[7] = (-a21 * a00 + a01 * a20) * det; + out[8] = (a11 * a00 - a01 * a10) * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out, a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + out[0] = a11 * a22 - a12 * a21; + out[1] = a02 * a21 - a01 * a22; + out[2] = a01 * a12 - a02 * a11; + out[3] = a12 * a20 - a10 * a22; + out[4] = a00 * a22 - a02 * a20; + out[5] = a02 * a10 - a00 * a12; + out[6] = a10 * a21 - a11 * a20; + out[7] = a01 * a20 - a00 * a21; + out[8] = a00 * a11 - a01 * a10; + return out; + } + /** + * Calculates the determinant of a {@link Mat3} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20); + } + /** + * Adds two {@link Mat3}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + out[8] = a[8] + b[8]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + out[6] = a[6] - b[6]; + out[7] = a[7] - b[7]; + out[8] = a[8] - b[8]; + return out; + } + /** + * Alias for {@link Mat3.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat3}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + let b0 = b[0]; + let b1 = b[1]; + let b2 = b[2]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20; + out[1] = b0 * a01 + b1 * a11 + b2 * a21; + out[2] = b0 * a02 + b1 * a12 + b2 * a22; + b0 = b[3]; + b1 = b[4]; + b2 = b[5]; + out[3] = b0 * a00 + b1 * a10 + b2 * a20; + out[4] = b0 * a01 + b1 * a11 + b2 * a21; + out[5] = b0 * a02 + b1 * a12 + b2 * a22; + b0 = b[6]; + b1 = b[7]; + b2 = b[8]; + out[6] = b0 * a00 + b1 * a10 + b2 * a20; + out[7] = b0 * a01 + b1 * a11 + b2 * a21; + out[8] = b0 * a02 + b1 * a12 + b2 * a22; + return out; + } + /** + * Alias for {@link Mat3.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat3} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + const x = v[0]; + const y = v[1]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a10; + out[4] = a11; + out[5] = a12; + out[6] = x * a00 + y * a10 + a20; + out[7] = x * a01 + y * a11 + a21; + out[8] = x * a02 + y * a12 + a22; + return out; + } + /** + * Rotates a {@link Mat3} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out, a, rad) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c * a00 + s * a10; + out[1] = c * a01 + s * a11; + out[2] = c * a02 + s * a12; + out[3] = c * a10 - s * a00; + out[4] = c * a11 - s * a01; + out[5] = c * a12 - s * a02; + out[6] = a20; + out[7] = a21; + out[8] = a22; + return out; + } + /** + * Scales the {@link Mat3} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const x = v[0]; + const y = v[1]; + out[0] = x * a[0]; + out[1] = x * a[1]; + out[2] = x * a[2]; + out[3] = y * a[3]; + out[4] = y * a[4]; + out[5] = y * a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + return out; + } + /** + * Creates a {@link Mat3} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = v[0]; + out[7] = v[1]; + out[8] = 1; + return out; + } + /** + * Creates a {@link Mat3} from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat3.identity(dest); + * mat3.rotate(dest, dest, rad); + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = 0; + out[3] = -s; + out[4] = c; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Creates a {@link Mat3} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = v[1]; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Copies the upper-left 3x3 values of a {@link Mat2d} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 2x3 matrix + * @returns `out` + */ + static fromMat2d(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = 0; + out[3] = a[2]; + out[4] = a[3]; + out[5] = 0; + out[6] = a[4]; + out[7] = a[5]; + out[8] = 1; + return out; + } + /** + * Calculates a {@link Mat3} from the given quaternion + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param q - {@link Quat} to create matrix from + * @returns `out` + */ + static fromQuat(out, q) { + 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; + out[0] = 1 - yy - zz; + out[3] = yx - wz; + out[6] = zx + wy; + out[1] = yx + wz; + out[4] = 1 - xx - zz; + out[7] = zy - wx; + out[2] = zx - wy; + out[5] = zy + wx; + out[8] = 1 - xx - yy; + return out; + } + /** + * Copies the upper-left 3x3 values of a {@link Mat4} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 4x4 matrix + * @returns `out` + */ + static fromMat4(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[4]; + out[4] = a[5]; + out[5] = a[6]; + out[6] = a[8]; + out[7] = a[9]; + out[8] = a[10]; + return out; + } + /** + * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix + * @category Static + * + * @param {mat3} out mat3 receiving operation result + * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out, a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + return out; + } + /** + * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out, a) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const bx = a[4]; + const by = a[5]; + const bz = a[6]; + const cx = a[8]; + const cy = a[9]; + const cz = a[10]; + out[0] = by * cz - cz * cy; + out[1] = bz * cx - cx * cz; + out[2] = bx * cy - cy * cx; + out[3] = cy * az - cz * ay; + out[4] = cz * ax - cx * az; + out[5] = cx * ay - cy * ax; + out[6] = ay * bz - az * by; + out[7] = az * bx - ax * bz; + out[8] = ax * by - ay * bx; + return out; + } + /** + * Generates a 2D projection matrix with the given bounds + * @category Static + * + * @param out mat3 frustum matrix will be written into + * @param width Width of your gl context + * @param height Height of gl context + * @returns `out` + */ + static projection(out, width, height) { + out[0] = 2 / width; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = -2 / height; + out[5] = 0; + out[6] = -1; + out[7] = 1; + out[8] = 1; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat3} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt( + a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + ); + } + /** + * Multiply each element of a {@link Mat3} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + out[8] = a[8] * b; + return out; + } + /** + * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + out[6] = a[6] + b[6] * scale; + out[7] = a[7] + b[7] * scale; + out[8] = a[8] + b[8] * scale; + return out; + } + /** + * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8]; + } + /** + * Returns whether two {@link Mat3}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const a8 = a[8]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + const b8 = b[8]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)); + } + /** + * Returns a string representation of a {@link Mat3} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat3(${a.join(", ")})`; + } +}; +Mat3.prototype.mul = Mat3.prototype.multiply; +Mat3.mul = Mat3.multiply; +Mat3.sub = Mat3.subtract; + +// src/_lib/f32/Mat4.ts +var Mat4 = class _Mat4 extends Float32Array { + static #IDENTITY_4X4 = new Float32Array([ + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 + ]); + /** + * Temporary variable to prevent repeated allocations in the algorithms within Mat4. + * These are declared as TypedArrays to aid in tree-shaking. + */ + static #TMP_VEC3 = new Float32Array(3); + /** + * Create a {@link Mat4}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 16: + super(values); + break; + case 2: + super(values[0], values[1], 16); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v + ]); + } else { + super(v, 0, 16); + } + break; + default: + super(_Mat4.#IDENTITY_4X4); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat4.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat4.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat4.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this.set(_Mat4.#IDENTITY_4X4); + return this; + } + /** + * Multiplies this {@link Mat4} against another one + * Equivalent to `Mat4.multiply(this, this, b);` + * @category Methods + * + * @param b - The second operand + * @returns `this` + */ + multiply(b) { + return _Mat4.multiply(this, this, b); + } + /** + * Alias for {@link Mat4.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat4} + * Equivalent to `Mat4.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose() { + return _Mat4.transpose(this, this); + } + /** + * Inverts this {@link Mat4} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + return _Mat4.invert(this, this); + } + /** + * Translate this {@link Mat4} by the given vector + * Equivalent to `Mat4.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to translate by + * @returns `this` + */ + translate(v) { + return _Mat4.translate(this, this, v); + } + /** + * Rotates this {@link Mat4} by the given angle around the given axis + * Equivalent to `Mat4.rotate(this, this, rad, axis);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `this` + */ + rotate(rad, axis) { + return _Mat4.rotate(this, this, rad, axis); + } + /** + * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat4.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to scale the matrix by + * @returns `this` + */ + scale(v) { + return _Mat4.scale(this, this, v); + } + /** + * Rotates this {@link Mat4} by the given angle around the X axis + * Equivalent to `Mat4.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateX(rad) { + return _Mat4.rotateX(this, this, rad); + } + /** + * Rotates this {@link Mat4} by the given angle around the Y axis + * Equivalent to `Mat4.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateY(rad) { + return _Mat4.rotateY(this, this, rad); + } + /** + * Rotates this {@link Mat4} by the given angle around the Z axis + * Equivalent to `Mat4.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateZ(rad) { + return _Mat4.rotateZ(this, this, rad); + } + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveNO(fovy, aspect, near, far) { + return _Mat4.perspectiveNO(this, fovy, aspect, near, far); + } + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveZO(fovy, aspect, near, far) { + return _Mat4.perspectiveZO(this, fovy, aspect, near, far); + } + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoNO(left, right, bottom, top, near, far) { + return _Mat4.orthoNO(this, left, right, bottom, top, near, far); + } + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoZO(left, right, bottom, top, near, far) { + return _Mat4.orthoZO(this, left, right, bottom, top, near, far); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat4}. + */ + static get BYTE_LENGTH() { + return 16 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat4} + * @category Static + * + * @returns A new {@link Mat4} + */ + static create() { + return new _Mat4(); + } + /** + * Creates a new {@link Mat4} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat4} + */ + static clone(a) { + return new _Mat4(a); + } + /** + * Copy the values from one {@link Mat4} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + /** + * Create a new mat4 with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat4} + */ + static fromValues(...values) { + return new _Mat4(...values); + } + /** + * Set the components of a mat4 to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + out[6] = values[6]; + out[7] = values[7]; + out[8] = values[8]; + out[9] = values[9]; + out[10] = values[10]; + out[11] = values[11]; + out[12] = values[12]; + out[13] = values[13]; + out[14] = values[14]; + out[15] = values[15]; + return out; + } + /** + * Set a {@link Mat4} to the identity matrix + * @category Static + * + * @param out - The receiving Matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out, a) { + if (out === a) { + const a01 = a[1], a02 = a[2], a03 = a[3]; + const a12 = a[6], a13 = a[7]; + const a23 = a[11]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a01; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a02; + out[9] = a12; + out[11] = a[14]; + out[12] = a03; + out[13] = a13; + out[14] = a23; + } else { + out[0] = a[0]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a[1]; + out[5] = a[5]; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a[2]; + out[9] = a[6]; + out[10] = a[10]; + out[11] = a[14]; + out[12] = a[3]; + out[13] = a[7]; + out[14] = a[11]; + out[15] = a[15]; + } + return out; + } + /** + * Inverts a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out, a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + out[0] = a11 * b11 - a12 * b10 + a13 * b09; + out[1] = a02 * b10 - a01 * b11 - a03 * b09; + out[2] = a31 * b05 - a32 * b04 + a33 * b03; + out[3] = a22 * b04 - a21 * b05 - a23 * b03; + out[4] = a12 * b08 - a10 * b11 - a13 * b07; + out[5] = a00 * b11 - a02 * b08 + a03 * b07; + out[6] = a32 * b02 - a30 * b05 - a33 * b01; + out[7] = a20 * b05 - a22 * b02 + a23 * b01; + out[8] = a10 * b10 - a11 * b08 + a13 * b06; + out[9] = a01 * b08 - a00 * b10 - a03 * b06; + out[10] = a30 * b04 - a31 * b02 + a33 * b00; + out[11] = a21 * b02 - a20 * b04 - a23 * b00; + out[12] = a11 * b07 - a10 * b09 - a12 * b06; + out[13] = a00 * b09 - a01 * b07 + a02 * b06; + out[14] = a31 * b01 - a30 * b03 - a32 * b00; + out[15] = a20 * b03 - a21 * b01 + a22 * b00; + return out; + } + /** + * Calculates the determinant of a {@link Mat4} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b0 = a00 * a11 - a01 * a10; + const b1 = a00 * a12 - a02 * a10; + const b2 = a01 * a12 - a02 * a11; + const b3 = a20 * a31 - a21 * a30; + const b4 = a20 * a32 - a22 * a30; + const b5 = a21 * a32 - a22 * a31; + const b6 = a00 * b5 - a01 * b4 + a02 * b3; + const b7 = a10 * b5 - a11 * b4 + a12 * b3; + const b8 = a20 * b2 - a21 * b1 + a22 * b0; + const b9 = a30 * b2 - a31 * b1 + a32 * b0; + return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9; + } + /** + * Multiplies two {@link Mat4}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + let b0 = b[0]; + let b1 = b[1]; + let b2 = b[2]; + let b3 = b[3]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[4]; + b1 = b[5]; + b2 = b[6]; + b3 = b[7]; + out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[8]; + b1 = b[9]; + b2 = b[10]; + b3 = b[11]; + out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[12]; + b1 = b[13]; + b2 = b[14]; + b3 = b[15]; + out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + return out; + } + /** + * Alias for {@link Mat4.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat4} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const x = v[0]; + const y = v[1]; + const z = v[2]; + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a03; + out[4] = a10; + out[5] = a11; + out[6] = a12; + out[7] = a13; + out[8] = a20; + out[9] = a21; + out[10] = a22; + out[11] = a23; + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + return out; + } + /** + * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec3} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const x = v[0]; + const y = v[1]; + const z = v[2]; + out[0] = a[0] * x; + out[1] = a[1] * x; + out[2] = a[2] * x; + out[3] = a[3] * x; + out[4] = a[4] * y; + out[5] = a[5] * y; + out[6] = a[6] * y; + out[7] = a[7] * y; + out[8] = a[8] * z; + out[9] = a[9] * z; + out[10] = a[10] * z; + out[11] = a[11] * z; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + /** + * Rotates a {@link Mat4} by the given angle around the given axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if axis has a length of 0 + */ + static rotate(out, a, rad, axis) { + let x = axis[0]; + let y = axis[1]; + let z = axis[2]; + let len = Math.sqrt(x * x + y * y + z * z); + if (len < GLM_EPSILON) { + return null; + } + len = 1 / len; + x *= len; + y *= len; + z *= len; + const s = Math.sin(rad); + const c = Math.cos(rad); + const t = 1 - c; + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const b00 = x * x * t + c; + const b01 = y * x * t + z * s; + const b02 = z * x * t - y * s; + const b10 = x * y * t - z * s; + const b11 = y * y * t + c; + const b12 = z * y * t + x * s; + const b20 = x * z * t + y * s; + const b21 = y * z * t - x * s; + const b22 = z * z * t + c; + out[0] = a00 * b00 + a10 * b01 + a20 * b02; + out[1] = a01 * b00 + a11 * b01 + a21 * b02; + out[2] = a02 * b00 + a12 * b01 + a22 * b02; + out[3] = a03 * b00 + a13 * b01 + a23 * b02; + out[4] = a00 * b10 + a10 * b11 + a20 * b12; + out[5] = a01 * b10 + a11 * b11 + a21 * b12; + out[6] = a02 * b10 + a12 * b11 + a22 * b12; + out[7] = a03 * b10 + a13 * b11 + a23 * b12; + out[8] = a00 * b20 + a10 * b21 + a20 * b22; + out[9] = a01 * b20 + a11 * b21 + a21 * b22; + out[10] = a02 * b20 + a12 * b21 + a22 * b22; + out[11] = a03 * b20 + a13 * b21 + a23 * b22; + if (a !== out) { + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + return out; + } + /** + * Rotates a matrix by the given angle around the X axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateX(out, a, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + if (a !== out) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[4] = a10 * c + a20 * s; + out[5] = a11 * c + a21 * s; + out[6] = a12 * c + a22 * s; + out[7] = a13 * c + a23 * s; + out[8] = a20 * c - a10 * s; + out[9] = a21 * c - a11 * s; + out[10] = a22 * c - a12 * s; + out[11] = a23 * c - a13 * s; + return out; + } + /** + * Rotates a matrix by the given angle around the Y axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateY(out, a, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + if (a !== out) { + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[0] = a00 * c - a20 * s; + out[1] = a01 * c - a21 * s; + out[2] = a02 * c - a22 * s; + out[3] = a03 * c - a23 * s; + out[8] = a00 * s + a20 * c; + out[9] = a01 * s + a21 * c; + out[10] = a02 * s + a22 * c; + out[11] = a03 * s + a23 * c; + return out; + } + /** + * Rotates a matrix by the given angle around the Z axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateZ(out, a, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + if (a !== out) { + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[0] = a00 * c + a10 * s; + out[1] = a01 * c + a11 * s; + out[2] = a02 * c + a12 * s; + out[3] = a03 * c + a13 * s; + out[4] = a10 * c - a00 * s; + out[5] = a11 * c - a01 * s; + out[6] = a12 * c - a02 * s; + out[7] = a13 * c - a03 * s; + return out; + } + /** + * Creates a {@link Mat4} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Creates a {@link Mat4} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = v[1]; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = v[2]; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a {@link Mat4} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotate(dest, dest, rad, axis); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if `axis` has a length of 0 + */ + static fromRotation(out, rad, axis) { + let x = axis[0]; + let y = axis[1]; + let z = axis[2]; + let len = Math.sqrt(x * x + y * y + z * z); + if (len < GLM_EPSILON) { + return null; + } + len = 1 / len; + x *= len; + y *= len; + z *= len; + const s = Math.sin(rad); + const c = Math.cos(rad); + const t = 1 - c; + out[0] = x * x * t + c; + out[1] = y * x * t + z * s; + out[2] = z * x * t - y * s; + out[3] = 0; + out[4] = x * y * t - z * s; + out[5] = y * y * t + c; + out[6] = z * y * t + x * s; + out[7] = 0; + out[8] = x * z * t + y * s; + out[9] = y * z * t - x * s; + out[10] = z * z * t + c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateX(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromXRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = c; + out[6] = s; + out[7] = 0; + out[8] = 0; + out[9] = -s; + out[10] = c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateY(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromYRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = 0; + out[2] = -s; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = s; + out[9] = 0; + out[10] = c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateZ(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromZRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = 0; + out[3] = 0; + out[4] = -s; + out[5] = c; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @returns `out` + */ + static fromRotationTranslation(out, q, v) { + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Sets a {@link Mat4} from a {@link Quat2}. + * @category Static + * + * @param out - Matrix + * @param a - Dual Quaternion + * @returns `out` + */ + static fromQuat2(out, a) { + const bx = -a[0]; + const by = -a[1]; + const bz = -a[2]; + const bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const magnitude = bx * bx + by * by + bz * bz + bw * bw; + if (magnitude > 0) { + _Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude; + _Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude; + _Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude; + } else { + _Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; + _Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; + _Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + } + _Mat4.fromRotationTranslation(out, a, _Mat4.#TMP_VEC3); + return out; + } + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out, a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[3] = 0; + out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[7] = 0; + out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out, a) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const bx = a[4]; + const by = a[5]; + const bz = a[6]; + const cx = a[8]; + const cy = a[9]; + const cz = a[10]; + out[0] = by * cz - cz * cy; + out[1] = bz * cx - cx * cz; + out[2] = bx * cy - cy * cx; + out[3] = 0; + out[4] = cy * az - cz * ay; + out[5] = cz * ax - cx * az; + out[6] = cx * ay - cy * ax; + out[7] = 0; + out[8] = ay * bz - az * by; + out[9] = az * bx - ax * bz; + out[10] = ax * by - ay * bx; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Returns the translation vector component of a transformation + * matrix. If a matrix is built with fromRotationTranslation, + * the returned vector will be the same as the translation vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive translation component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getTranslation(out, mat) { + out[0] = mat[12]; + out[1] = mat[13]; + out[2] = mat[14]; + return out; + } + /** + * Returns the scaling factor component of a transformation + * matrix. If a matrix is built with fromRotationTranslationScale + * with a normalized Quaternion parameter, the returned vector will be + * the same as the scaling vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive scaling factor component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getScaling(out, mat) { + const m11 = mat[0]; + const m12 = mat[1]; + const m13 = mat[2]; + const m21 = mat[4]; + const m22 = mat[5]; + const m23 = mat[6]; + const m31 = mat[8]; + const m32 = mat[9]; + const m33 = mat[10]; + out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + return out; + } + /** + * Returns a quaternion representing the rotational component + * of a transformation matrix. If a matrix is built with + * fromRotationTranslation, the returned quaternion will be the + * same as the quaternion originally supplied. + * @category Static + * + * @param out - Quaternion to receive the rotation component + * @param mat - Matrix to be decomposed (input) + * @return `out` + */ + static getRotation(out, mat) { + _Mat4.getScaling(_Mat4.#TMP_VEC3, mat); + const is1 = 1 / _Mat4.#TMP_VEC3[0]; + const is2 = 1 / _Mat4.#TMP_VEC3[1]; + const is3 = 1 / _Mat4.#TMP_VEC3[2]; + const sm11 = mat[0] * is1; + const sm12 = mat[1] * is2; + const sm13 = mat[2] * is3; + const sm21 = mat[4] * is1; + const sm22 = mat[5] * is2; + const sm23 = mat[6] * is3; + const sm31 = mat[8] * is1; + const sm32 = mat[9] * is2; + const sm33 = mat[10] * is3; + const trace = sm11 + sm22 + sm33; + let S = 0; + if (trace > 0) { + S = Math.sqrt(trace + 1) * 2; + out[3] = 0.25 * S; + out[0] = (sm23 - sm32) / S; + out[1] = (sm31 - sm13) / S; + out[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2; + out[3] = (sm23 - sm32) / S; + out[0] = 0.25 * S; + out[1] = (sm12 + sm21) / S; + out[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2; + out[3] = (sm31 - sm13) / S; + out[0] = (sm12 + sm21) / S; + out[1] = 0.25 * S; + out[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2; + out[3] = (sm12 - sm21) / S; + out[0] = (sm31 + sm13) / S; + out[1] = (sm23 + sm32) / S; + out[2] = 0.25 * S; + } + return out; + } + /** + * Decomposes a transformation matrix into its rotation, translation + * and scale components. Returns only the rotation component + * @category Static + * + * @param out_r - Quaternion to receive the rotation component + * @param out_t - Vector to receive the translation vector + * @param out_s - Vector to receive the scaling factor + * @param mat - Matrix to be decomposed (input) + * @returns `out_r` + */ + static decompose(out_r, out_t, out_s, mat) { + out_t[0] = mat[12]; + out_t[1] = mat[13]; + out_t[2] = mat[14]; + const m11 = mat[0]; + const m12 = mat[1]; + const m13 = mat[2]; + const m21 = mat[4]; + const m22 = mat[5]; + const m23 = mat[6]; + const m31 = mat[8]; + const m32 = mat[9]; + const m33 = mat[10]; + out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + const is1 = 1 / out_s[0]; + const is2 = 1 / out_s[1]; + const is3 = 1 / out_s[2]; + const sm11 = m11 * is1; + const sm12 = m12 * is2; + const sm13 = m13 * is3; + const sm21 = m21 * is1; + const sm22 = m22 * is2; + const sm23 = m23 * is3; + const sm31 = m31 * is1; + const sm32 = m32 * is2; + const sm33 = m33 * is3; + const trace = sm11 + sm22 + sm33; + let S = 0; + if (trace > 0) { + S = Math.sqrt(trace + 1) * 2; + out_r[3] = 0.25 * S; + out_r[0] = (sm23 - sm32) / S; + out_r[1] = (sm31 - sm13) / S; + out_r[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2; + out_r[3] = (sm23 - sm32) / S; + out_r[0] = 0.25 * S; + out_r[1] = (sm12 + sm21) / S; + out_r[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2; + out_r[3] = (sm31 - sm13) / S; + out_r[0] = (sm12 + sm21) / S; + out_r[1] = 0.25 * S; + out_r[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2; + out_r[3] = (sm12 - sm21) / S; + out_r[0] = (sm31 + sm13) / S; + out_r[1] = (sm23 + sm32) / S; + out_r[2] = 0.25 * S; + } + return out_r; + } + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @returns `out` + */ + static fromRotationTranslationScale(out, q, v, s) { + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + const sx = s[0]; + const sy = s[1]; + const sz = s[2]; + out[0] = (1 - (yy + zz)) * sx; + out[1] = (xy + wz) * sx; + out[2] = (xz - wy) * sx; + out[3] = 0; + out[4] = (xy - wz) * sy; + out[5] = (1 - (xx + zz)) * sy; + out[6] = (yz + wx) * sy; + out[7] = 0; + out[8] = (xz + wy) * sz; + out[9] = (yz - wx) * sz; + out[10] = (1 - (xx + yy)) * sz; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the + * given origin. This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * mat4.translate(dest, origin); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * mat4.translate(dest, negativeOrigin); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @param o - The origin vector around which to scale and rotate + * @returns `out` + */ + static fromRotationTranslationScaleOrigin(out, q, v, s, o) { + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + const sx = s[0]; + const sy = s[1]; + const sz = s[2]; + const ox = o[0]; + const oy = o[1]; + const oz = o[2]; + const out0 = (1 - (yy + zz)) * sx; + const out1 = (xy + wz) * sx; + const out2 = (xz - wy) * sx; + const out4 = (xy - wz) * sy; + const out5 = (1 - (xx + zz)) * sy; + const out6 = (yz + wx) * sy; + const out8 = (xz + wy) * sz; + const out9 = (yz - wx) * sz; + const out10 = (1 - (xx + yy)) * sz; + out[0] = out0; + out[1] = out1; + out[2] = out2; + out[3] = 0; + out[4] = out4; + out[5] = out5; + out[6] = out6; + out[7] = 0; + out[8] = out8; + out[9] = out9; + out[10] = out10; + out[11] = 0; + out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz); + out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz); + out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); + out[15] = 1; + return out; + } + /** + * Calculates a 4x4 matrix from the given quaternion + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Quaternion to create matrix from + * @returns `out` + */ + static fromQuat(out, q) { + 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; + out[0] = 1 - yy - zz; + out[1] = yx + wz; + out[2] = zx - wy; + out[3] = 0; + out[4] = yx - wz; + out[5] = 1 - xx - zz; + out[6] = zy + wx; + out[7] = 0; + out[8] = zx + wy; + out[9] = zy - wx; + out[10] = 1 - xx - yy; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumNO(out, left, right, bottom, top, near, far = Infinity) { + const rl = 1 / (right - left); + const tb = 1 / (top - bottom); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + /** + * Alias for {@link Mat4.frustumNO} + * @category Static + * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly + */ + static frustum(out, left, right, bottom, top, near, far = Infinity) { + return out; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumZO(out, left, right, bottom, top, near, far = Infinity) { + const rl = 1 / (right - left); + const tb = 1 / (top - bottom); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = far * nf; + out[14] = far * near * nf; + } else { + out[10] = -1; + out[14] = -near; + } + return out; + } + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveNO(out, fovy, aspect, near, far = Infinity) { + const f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + /** + * Alias for {@link Mat4.perspectiveNO} + * @category Static + * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static perspective(out, fovy, aspect, near, far = Infinity) { + return out; + } + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveZO(out, fovy, aspect, near, far = Infinity) { + const f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = far * nf; + out[14] = far * near * nf; + } else { + out[10] = -1; + out[14] = -near; + } + return out; + } + /** + * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating + * projection matrices to be used with the still experimental WebVR API. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + * @deprecated + */ + static perspectiveFromFieldOfView(out, fov, near, far) { + const upTan = Math.tan(fov.upDegrees * Math.PI / 180); + const downTan = Math.tan(fov.downDegrees * Math.PI / 180); + const leftTan = Math.tan(fov.leftDegrees * Math.PI / 180); + const rightTan = Math.tan(fov.rightDegrees * Math.PI / 180); + const xScale = 2 / (leftTan + rightTan); + const yScale = 2 / (upTan + downTan); + out[0] = xScale; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = yScale; + out[6] = 0; + out[7] = 0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = (upTan - downTan) * yScale * 0.5; + out[10] = far / (near - far); + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = far * near / (near - far); + out[15] = 0; + return out; + } + /** + * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoNO(out, left, right, bottom, top, near, far) { + const lr = 1 / (left - right); + const bt = 1 / (bottom - top); + const nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; + } + /** + * Alias for {@link Mat4.orthoNO} + * @category Static + * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static ortho(out, left, right, bottom, top, near, far) { + return out; + } + /** + * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoZO(out, left, right, bottom, top, near, far) { + const lr = 1 / (left - right); + const bt = 1 / (bottom - top); + const nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = near * nf; + out[15] = 1; + return out; + } + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that + * actually makes an object look at another object, you should use targetTo instead. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param center - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static lookAt(out, eye, center, up) { + const eyex = eye[0]; + const eyey = eye[1]; + const eyez = eye[2]; + const upx = up[0]; + const upy = up[1]; + const upz = up[2]; + const centerx = center[0]; + const centery = center[1]; + const centerz = center[2]; + if (Math.abs(eyex - centerx) < GLM_EPSILON && Math.abs(eyey - centery) < GLM_EPSILON && Math.abs(eyez - centerz) < GLM_EPSILON) { + return _Mat4.identity(out); + } + let z0 = eyex - centerx; + let z1 = eyey - centery; + let z2 = eyez - centerz; + let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + z0 *= len; + z1 *= len; + z2 *= len; + let x0 = upy * z2 - upz * z1; + let x1 = upz * z0 - upx * z2; + let x2 = upx * z1 - upy * z0; + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + if (!len) { + x0 = 0; + x1 = 0; + x2 = 0; + } else { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + let y0 = z1 * x2 - z2 * x1; + let y1 = z2 * x0 - z0 * x2; + let y2 = z0 * x1 - z1 * x0; + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + if (!len) { + y0 = 0; + y1 = 0; + y2 = 0; + } else { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + out[0] = x0; + out[1] = y0; + out[2] = z0; + out[3] = 0; + out[4] = x1; + out[5] = y1; + out[6] = z1; + out[7] = 0; + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); + out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); + out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + return out; + } + /** + * Generates a matrix that makes something look at something else. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param target - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static targetTo(out, eye, target, up) { + const eyex = eye[0]; + const eyey = eye[1]; + const eyez = eye[2]; + const upx = up[0]; + const upy = up[1]; + const upz = up[2]; + let z0 = eyex - target[0]; + let z1 = eyey - target[1]; + let z2 = eyez - target[2]; + let len = z0 * z0 + z1 * z1 + z2 * z2; + if (len > 0) { + len = 1 / Math.sqrt(len); + z0 *= len; + z1 *= len; + z2 *= len; + } + let x0 = upy * z2 - upz * z1; + let x1 = upz * z0 - upx * z2; + let x2 = upx * z1 - upy * z0; + len = x0 * x0 + x1 * x1 + x2 * x2; + if (len > 0) { + len = 1 / Math.sqrt(len); + x0 *= len; + x1 *= len; + x2 *= len; + } + out[0] = x0; + out[1] = x1; + out[2] = x2; + out[3] = 0; + out[4] = z1 * x2 - z2 * x1; + out[5] = z2 * x0 - z0 * x2; + out[6] = z0 * x1 - z1 * x0; + out[7] = 0; + out[8] = z0; + out[9] = z1; + out[10] = z2; + out[11] = 0; + out[12] = eyex; + out[13] = eyey; + out[14] = eyez; + out[15] = 1; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat4} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt( + a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + a[9] * a[9] + a[10] * a[10] + a[11] * a[11] + a[12] * a[12] + a[13] * a[13] + a[14] * a[14] + a[15] * a[15] + ); + } + /** + * Adds two {@link Mat4}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + out[8] = a[8] + b[8]; + out[9] = a[9] + b[9]; + out[10] = a[10] + b[10]; + out[11] = a[11] + b[11]; + out[12] = a[12] + b[12]; + out[13] = a[13] + b[13]; + out[14] = a[14] + b[14]; + out[15] = a[15] + b[15]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + out[6] = a[6] - b[6]; + out[7] = a[7] - b[7]; + out[8] = a[8] - b[8]; + out[9] = a[9] - b[9]; + out[10] = a[10] - b[10]; + out[11] = a[11] - b[11]; + out[12] = a[12] - b[12]; + out[13] = a[13] - b[13]; + out[14] = a[14] - b[14]; + out[15] = a[15] - b[15]; + return out; + } + /** + * Alias for {@link Mat4.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiply each element of the matrix by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + out[8] = a[8] * b; + out[9] = a[9] * b; + out[10] = a[10] * b; + out[11] = a[11] * b; + out[12] = a[12] * b; + out[13] = a[13] * b; + out[14] = a[14] * b; + out[15] = a[15] * b; + return out; + } + /** + * Adds two mat4's after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + out[6] = a[6] + b[6] * scale; + out[7] = a[7] + b[7] * scale; + out[8] = a[8] + b[8] * scale; + out[9] = a[9] + b[9] * scale; + out[10] = a[10] + b[10] * scale; + out[11] = a[11] + b[11] * scale; + out[12] = a[12] + b[12] * scale; + out[13] = a[13] + b[13] * scale; + out[14] = a[14] + b[14] * scale; + out[15] = a[15] + b[15] * scale; + return out; + } + /** + * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15]; + } + /** + * Returns whether two {@link Mat4}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const a8 = a[8]; + const a9 = a[9]; + const a10 = a[10]; + const a11 = a[11]; + const a12 = a[12]; + const a13 = a[13]; + const a14 = a[14]; + const a15 = a[15]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + const b8 = b[8]; + const b9 = b[9]; + const b10 = b[10]; + const b11 = b[11]; + const b12 = b[12]; + const b13 = b[13]; + const b14 = b[14]; + const b15 = b[15]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15)); + } + /** + * Returns a string representation of a {@link Mat4} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat4(${a.join(", ")})`; + } +}; +Mat4.prototype.mul = Mat4.prototype.multiply; +Mat4.sub = Mat4.subtract; +Mat4.mul = Mat4.multiply; +Mat4.frustum = Mat4.frustumNO; +Mat4.perspective = Mat4.perspectiveNO; +Mat4.ortho = Mat4.orthoNO; + +// src/_lib/f32/Vec3.ts +var Vec3 = class _Vec3 extends Float32Array { + /** + * Create a {@link Vec3}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 3: + super(values); + break; + case 2: + super(values[0], values[1], 3); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v]); + } else { + super(v, 0, 3); + } + break; + } + default: + super(3); + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z() { + return this[2]; + } + set z(value) { + this[2] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r() { + return this[0]; + } + set r(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g() { + return this[1]; + } + set g(value) { + this[1] = value; + } + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b() { + return this[2]; + } + set b(value) { + this[2] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec3.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec3.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag() { + return this.squaredMagnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec3.str(this);` + * + * @category Accessors + */ + get str() { + return _Vec3.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Adds a {@link Vec3} to `this`. + * Equivalent to `Vec3.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b) { + this[0] += b[0]; + this[1] += b[1]; + this[2] += b[2]; + return this; + } + /** + * Subtracts a {@link Vec3} from `this`. + * Equivalent to `Vec3.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + this[2] -= b[2]; + return this; + } + /** + * Alias for {@link Vec3.subtract} + * @category Methods + */ + sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec3}. + * Equivalent to `Vec3.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + this[2] *= b[2]; + return this; + } + /** + * Alias for {@link Vec3.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec3}. + * Equivalent to `Vec3.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + this[2] /= b[2]; + return this; + } + /** + * Alias for {@link Vec3.divide} + * @category Methods + */ + div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec3.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b) { + this[0] *= b; + this[1] *= b; + this[2] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + this[2] += b[2] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b) { + return _Vec3.distance(this, b); + } + /** + * Alias for {@link Vec3.distance} + * @category Methods + */ + dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b) { + return _Vec3.squaredDistance(this, b); + } + /** + * Alias for {@link Vec3.squaredDistance} + * @category Methods + */ + sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec3.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate() { + this[0] *= -1; + this[1] *= -1; + this[2] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec3.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + this[2] = 1 / this[2]; + return this; + } + /** + * Sets each component of `this` to its absolute value. + * Equivalent to `Vec3.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + this[2] = Math.abs(this[2]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec3}. + * Equivalent to `Vec3.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b) { + return this[0] * b[0] + this[1] * b[1] + this[2] * b[2]; + } + /** + * Normalize `this`. + * Equivalent to `Vec3.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize() { + return _Vec3.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec3}. + */ + static get BYTE_LENGTH() { + return 3 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty vec3 + * @category Static + * + * @returns a new 3D vector + */ + static create() { + return new _Vec3(); + } + /** + * Creates a new vec3 initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 3D vector + */ + static clone(a) { + return new _Vec3(a); + } + /** + * Calculates the magnitude (length) of a {@link Vec3} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Creates a new vec3 initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns a new 3D vector + */ + static fromValues(x, y, z) { + return new _Vec3(x, y, z); + } + /** + * Copy the values from one vec3 to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + return out; + } + /** + * Set the components of a vec3 to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns `out` + */ + static set(out, x, y, z) { + out[0] = x; + out[1] = y; + out[2] = z; + return out; + } + /** + * Adds two {@link Vec3}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + return out; + } + /** + * Alias for {@link Vec3.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return [0, 0, 0]; + } + /** + * Multiplies two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + return out; + } + /** + * Alias for {@link Vec3.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return [0, 0, 0]; + } + /** + * Divides two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + out[2] = a[2] / b[2]; + return out; + } + /** + * Alias for {@link Vec3.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out, a, b) { + return [0, 0, 0]; + } + /** + * Math.ceil the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + out[2] = Math.ceil(a[2]); + return out; + } + /** + * Math.floor the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + out[2] = Math.floor(a[2]); + return out; + } + /** + * Returns the minimum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + return out; + } + /** + * Returns the maximum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + return out; + } + /** + * symmetric round the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + /* + static round(out: Vec3Like, a: Readonly): Vec3Like { + out[0] = glMatrix.round(a[0]); + out[1] = glMatrix.round(a[1]); + out[2] = glMatrix.round(a[2]); + return out; + }*/ + /** + * Scales a vec3 by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out, a, scale) { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + return out; + } + /** + * Adds two vec3's after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredDistance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a, b) { + return 0; + } + /** + * Calculates the squared length of a vec3 + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredLength} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrLen(a, b) { + return 0; + } + /** + * Negates the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + return out; + } + /** + * Returns the inverse of the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + out[2] = 1 / a[2]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec3} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + out[2] = Math.abs(a[2]); + return out; + } + /** + * Normalize a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out, a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + let len = x * x + y * y + z * z; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + out[2] = a[2] * len; + return out; + } + /** + * Calculates the dot product of two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; + } + /** + * Computes the cross product of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static cross(out, a, b) { + const ax = a[0], ay = a[1], az = a[2]; + const bx = b[0], by = b[1], bz = b[2]; + out[0] = ay * bz - az * by; + out[1] = az * bx - ax * bz; + out[2] = ax * by - ay * bx; + return out; + } + /** + * Performs a linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + return out; + } + /** + * Performs a spherical linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out, a, b, t) { + const angle = Math.acos(Math.min(Math.max(_Vec3.dot(a, b), -1), 1)); + const sinTotal = Math.sin(angle); + const ratioA = Math.sin((1 - t) * angle) / sinTotal; + const ratioB = Math.sin(t * angle) / sinTotal; + out[0] = ratioA * a[0] + ratioB * b[0]; + out[1] = ratioA * a[1] + ratioB * b[1]; + out[2] = ratioA * a[2] + ratioB * b[2]; + return out; + } + /** + * Performs a hermite interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static hermite(out, a, b, c, d, t) { + const factorTimes2 = t * t; + const factor1 = factorTimes2 * (2 * t - 3) + 1; + const factor2 = factorTimes2 * (t - 2) + t; + const factor3 = factorTimes2 * (t - 1); + const factor4 = factorTimes2 * (3 - 2 * t); + out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; + out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; + out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; + return out; + } + /** + * Performs a bezier interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static bezier(out, a, b, c, d, t) { + const inverseFactor = 1 - t; + const inverseFactorTimesTwo = inverseFactor * inverseFactor; + const factorTimes2 = t * t; + const factor1 = inverseFactorTimesTwo * inverseFactor; + const factor2 = 3 * t * inverseFactorTimesTwo; + const factor3 = 3 * factorTimes2 * inverseFactor; + const factor4 = factorTimes2 * t; + out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; + out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; + out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; + return out; + } + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned + * @returns `out` + */ + /* + static random(out: Vec3Like, scale) { + scale = scale === undefined ? 1.0 : scale; + + let r = glMatrix.RANDOM() * 2.0 * Math.PI; + let z = glMatrix.RANDOM() * 2.0 - 1.0; + let zScale = Math.sqrt(1.0 - z * z) * scale; + + out[0] = Math.cos(r) * zScale; + out[1] = Math.sin(r) * zScale; + out[2] = z * scale; + return out; + }*/ + /** + * Transforms the vec3 with a mat4. + * 4th vector component is implicitly '1' + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out, a, m) { + const x = a[0], y = a[1], z = a[2]; + const w = m[3] * x + m[7] * y + m[11] * z + m[15] || 1; + out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; + out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; + out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; + return out; + } + /** + * Transforms the vec3 with a mat3. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - the 3x3 matrix to transform with + * @returns `out` + */ + static transformMat3(out, a, m) { + const x = a[0], y = a[1], z = a[2]; + out[0] = x * m[0] + y * m[3] + z * m[6]; + out[1] = x * m[1] + y * m[4] + z * m[7]; + out[2] = x * m[2] + y * m[5] + z * m[8]; + return out; + } + /** + * Transforms the vec3 with a quat + * Can also be used for dual quaternions. (Multiply it with the real part) + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out, a, q) { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const w2 = q[3] * 2; + const x = a[0]; + const y = a[1]; + const z = a[2]; + const uvx = qy * z - qz * y; + const uvy = qz * x - qx * z; + const uvz = qx * y - qy * x; + const uuvx = (qy * uvz - qz * uvy) * 2; + const uuvy = (qz * uvx - qx * uvz) * 2; + const uuvz = (qx * uvy - qy * uvx) * 2; + out[0] = x + uvx * w2 + uuvx; + out[1] = y + uvy * w2 + uuvy; + out[2] = z + uvz * w2 + uuvz; + return out; + } + /** + * Rotate a 3D vector around the x-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateX(out, a, b, rad) { + const by = b[1]; + const bz = b[2]; + const py = a[1] - by; + const pz = a[2] - bz; + out[0] = a[0]; + out[1] = py * Math.cos(rad) - pz * Math.sin(rad) + by; + out[2] = py * Math.sin(rad) + pz * Math.cos(rad) + bz; + return out; + } + /** + * Rotate a 3D vector around the y-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateY(out, a, b, rad) { + const bx = b[0]; + const bz = b[2]; + const px = a[0] - bx; + const pz = a[2] - bz; + out[0] = pz * Math.sin(rad) + px * Math.cos(rad) + bx; + out[1] = a[1]; + out[2] = pz * Math.cos(rad) - px * Math.sin(rad) + bz; + return out; + } + /** + * Rotate a 3D vector around the z-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateZ(out, a, b, rad) { + const bx = b[0]; + const by = b[1]; + const px = a[0] - bx; + const py = a[1] - by; + out[0] = px * Math.cos(rad) - py * Math.sin(rad) + bx; + out[1] = px * Math.sin(rad) + py * Math.cos(rad) + by; + out[2] = b[2]; + return out; + } + /** + * Get the angle between two 3D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static 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 mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz)); + const cosine = mag && _Vec3.dot(a, b) / mag; + return Math.acos(Math.min(Math.max(cosine, -1), 1)); + } + /** + * Set the components of a vec3 to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + return out; + } + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Vec3(${a.join(", ")})`; + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)); + } +}; +Vec3.prototype.sub = Vec3.prototype.subtract; +Vec3.prototype.mul = Vec3.prototype.multiply; +Vec3.prototype.div = Vec3.prototype.divide; +Vec3.prototype.dist = Vec3.prototype.distance; +Vec3.prototype.sqrDist = Vec3.prototype.squaredDistance; +Vec3.sub = Vec3.subtract; +Vec3.mul = Vec3.multiply; +Vec3.div = Vec3.divide; +Vec3.dist = Vec3.distance; +Vec3.sqrDist = Vec3.squaredDistance; +Vec3.sqrLen = Vec3.squaredLength; +Vec3.mag = Vec3.magnitude; +Vec3.length = Vec3.magnitude; +Vec3.len = Vec3.magnitude; + +// src/_lib/f32/Vec4.ts +var Vec4 = class _Vec4 extends Float32Array { + /** + * Create a {@link Vec4}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 4: + super(values); + break; + case 2: + super(values[0], values[1], 4); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v, v]); + } else { + super(v, 0, 4); + } + break; + } + default: + super(4); + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z() { + return this[2]; + } + set z(value) { + this[2] = value; + } + /** + * The w component of the vector. Equivalent to `this[3];` + * @category Vector Components + */ + get w() { + return this[3]; + } + set w(value) { + this[3] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r() { + return this[0]; + } + set r(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g() { + return this[1]; + } + set g(value) { + this[1] = value; + } + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b() { + return this[2]; + } + set b(value) { + this[2] = value; + } + /** + * The a component of the vector. Equivalent to `this[3];` + * @category Color Components + */ + get a() { + return this[3]; + } + set a(value) { + this[3] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec4.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + const w = this[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Vec4.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec4.str(this);` + * + * @category Accessors + */ + get str() { + return _Vec4.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + super.set(a); + return this; + } + /** + * Adds a {@link Vec4} to `this`. + * Equivalent to `Vec4.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b) { + this[0] += b[0]; + this[1] += b[1]; + this[2] += b[2]; + this[3] += b[3]; + return this; + } + /** + * Subtracts a {@link Vec4} from `this`. + * Equivalent to `Vec4.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + this[2] -= b[2]; + this[3] -= b[3]; + return this; + } + /** + * Alias for {@link Vec4.subtract} + * @category Methods + */ + sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec4}. + * Equivalent to `Vec4.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + this[2] *= b[2]; + this[3] *= b[3]; + return this; + } + /** + * Alias for {@link Vec4.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec4}. + * Equivalent to `Vec4.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + this[2] /= b[2]; + this[3] /= b[3]; + return this; + } + /** + * Alias for {@link Vec4.divide} + * @category Methods + */ + div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec4.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b) { + this[0] *= b; + this[1] *= b; + this[2] *= b; + this[3] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + this[2] += b[2] * scale; + this[3] += b[3] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b) { + return _Vec4.distance(this, b); + } + /** + * Alias for {@link Vec4.distance} + * @category Methods + */ + dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b) { + return _Vec4.squaredDistance(this, b); + } + /** + * Alias for {@link Vec4.squaredDistance} + * @category Methods + */ + sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec4.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate() { + this[0] *= -1; + this[1] *= -1; + this[2] *= -1; + this[3] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec4.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + this[2] = 1 / this[2]; + this[3] = 1 / this[3]; + return this; + } + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec4.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + this[2] = Math.abs(this[2]); + this[3] = Math.abs(this[3]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec4}. + * Equivalent to `Vec4.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b) { + return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3]; + } + /** + * Normalize `this`. + * Equivalent to `Vec4.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize() { + return _Vec4.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec4}. + */ + static get BYTE_LENGTH() { + return 4 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty {@link Vec4} + * @category Static + * + * @returns a new 4D vector + */ + static create() { + return new _Vec4(); + } + /** + * Creates a new {@link Vec4} initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 4D vector + */ + static clone(a) { + return new _Vec4(a); + } + /** + * Creates a new {@link Vec4} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new 4D vector + */ + static fromValues(x, y, z, w) { + return new _Vec4(x, y, z, w); + } + /** + * Copy the values from one {@link Vec4} to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Vec4} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + static set(out, x, y, z, w) { + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = w; + return out; + } + /** + * Adds two {@link Vec4}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + return out; + } + /** + * Alias for {@link Vec4.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + out[3] = a[3] * b[3]; + return out; + } + /** + * Alias for {@link Vec4.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Divides two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + out[2] = a[2] / b[2]; + out[3] = a[3] / b[3]; + return out; + } + /** + * Alias for {@link Vec4.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out, a, b) { + return out; + } + /** + * Math.ceil the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + out[2] = Math.ceil(a[2]); + out[3] = Math.ceil(a[3]); + return out; + } + /** + * Math.floor the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + out[2] = Math.floor(a[2]); + out[3] = Math.floor(a[3]); + return out; + } + /** + * Returns the minimum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + out[3] = Math.min(a[3], b[3]); + return out; + } + /** + * Returns the maximum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + out[3] = Math.max(a[3], b[3]); + return out; + } + /** + * Math.round the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + static round(out, a) { + out[0] = Math.round(a[0]); + out[1] = Math.round(a[1]); + out[2] = Math.round(a[2]); + out[3] = Math.round(a[3]); + return out; + } + /** + * Scales a {@link Vec4} by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out, a, scale) { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + out[3] = a[3] * scale; + return out; + } + /** + * Adds two {@link Vec4}'s after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + const w = b[3] - a[3]; + return Math.hypot(x, y, z, w); + } + /** + * Alias for {@link Vec4.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + const w = b[3] - a[3]; + return x * x + y * y + z * z + w * w; + } + /** + * Alias for {@link Vec4.squaredDistance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a, b) { + return 0; + } + /** + * Calculates the magnitude (length) of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate length of + * @returns length of `a` + */ + static magnitude(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Vec4.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + return x * x + y * y + z * z + w * w; + } + /** + * Alias for {@link Vec4.squaredLength} + * @category Static + */ + static sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = -a[3]; + return out; + } + /** + * Returns the inverse of the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + out[2] = 1 / a[2]; + out[3] = 1 / a[3]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec4} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + out[2] = Math.abs(a[2]); + out[3] = Math.abs(a[3]); + return out; + } + /** + * Normalize a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out, a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + let len = x * x + y * y + z * z + w * w; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = x * len; + out[1] = y * len; + out[2] = z * len; + out[3] = w * len; + return out; + } + /** + * Calculates the dot product of two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + /** + * Returns the cross-product of three vectors in a 4-dimensional space + * @category Static + * + * @param out the receiving vector + * @param u - the first vector + * @param v - the second vector + * @param w - the third vector + * @returns result + */ + static cross(out, u, v, w) { + const a = v[0] * w[1] - v[1] * w[0]; + const b = v[0] * w[2] - v[2] * w[0]; + const c = v[0] * w[3] - v[3] * w[0]; + const d = v[1] * w[2] - v[2] * w[1]; + const e = v[1] * w[3] - v[3] * w[1]; + const f = v[2] * w[3] - v[3] * w[2]; + const g = u[0]; + const h = u[1]; + const i = u[2]; + const j = u[3]; + out[0] = h * f - i * e + j * d; + out[1] = -(g * f) + i * c - j * b; + out[2] = g * e - h * c + j * a; + out[3] = -(g * d) + h * b - i * a; + return out; + } + /** + * Performs a linear interpolation between two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + out[3] = aw + t * (b[3] - aw); + return out; + } + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns `out` + */ + /* + static random(out: Vec4Like, scale): Vec4Like { + scale = scale || 1.0; + + // Marsaglia, George. Choosing a Point from the Surface of a + // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646. + // http://projecteuclid.org/euclid.aoms/1177692644; + var v1, v2, v3, v4; + var s1, s2; + do { + v1 = glMatrix.RANDOM() * 2 - 1; + v2 = glMatrix.RANDOM() * 2 - 1; + s1 = v1 * v1 + v2 * v2; + } while (s1 >= 1); + do { + v3 = glMatrix.RANDOM() * 2 - 1; + v4 = glMatrix.RANDOM() * 2 - 1; + s2 = v3 * v3 + v4 * v4; + } while (s2 >= 1); + + var d = Math.sqrt((1 - s1) / s2); + out[0] = scale * v1; + out[1] = scale * v2; + out[2] = scale * v3 * d; + out[3] = scale * v4 * d; + return out; + }*/ + /** + * Transforms the {@link Vec4} with a {@link Mat4}. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out, a, m) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; + out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; + out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; + out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; + return out; + } + /** + * Transforms the {@link Vec4} with a {@link Quat} + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out, a, q) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + const ix = qw * x + qy * z - qz * y; + const iy = qw * y + qz * x - qx * z; + const iz = qw * z + qx * y - qy * x; + const iw = -qx * x - qy * y - qz * z; + out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy; + out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz; + out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Vec4} to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 0; + return out; + } + /** + * Returns a string representation of a {@link Vec4} + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Vec4(${a.join(", ")})`; + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)); + } +}; +Vec4.prototype.sub = Vec4.prototype.subtract; +Vec4.prototype.mul = Vec4.prototype.multiply; +Vec4.prototype.div = Vec4.prototype.divide; +Vec4.prototype.dist = Vec4.prototype.distance; +Vec4.prototype.sqrDist = Vec4.prototype.squaredDistance; +Vec4.sub = Vec4.subtract; +Vec4.mul = Vec4.multiply; +Vec4.div = Vec4.divide; +Vec4.dist = Vec4.distance; +Vec4.sqrDist = Vec4.squaredDistance; +Vec4.sqrLen = Vec4.squaredLength; +Vec4.mag = Vec4.magnitude; +Vec4.length = Vec4.magnitude; +Vec4.len = Vec4.magnitude; + +// src/_lib/f32/Quat.ts +var Quat = class _Quat extends Float32Array { + static #DEFAULT_ANGLE_ORDER = "zyx"; + // Temporary variables to prevent repeated allocations in the algorithms within Quat. + // These are declared as TypedArrays to aid in tree-shaking. + static #TMP_QUAT1 = new Float32Array(4); + static #TMP_QUAT2 = new Float32Array(4); + static #TMP_MAT3 = new Float32Array(9); + static #TMP_VEC3 = new Float32Array(3); + static #X_UNIT_VEC3 = new Float32Array([1, 0, 0]); + static #Y_UNIT_VEC3 = new Float32Array([0, 1, 0]); + /** + * Create a {@link Quat}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 4: + super(values); + break; + case 2: + super(values[0], values[1], 4); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v, v]); + } else { + super(v, 0, 4); + } + break; + } + default: + super(4); + this[3] = 1; + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the quaternion. Equivalent to `this[0];` + * @category Quaternion Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the quaternion. Equivalent to `this[1];` + * @category Quaternion Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + /** + * The z component of the quaternion. Equivalent to `this[2];` + * @category Quaternion Components + */ + get z() { + return this[2]; + } + set z(value) { + this[2] = value; + } + /** + * The w component of the quaternion. Equivalent to `this[3];` + * @category Quaternion Components + */ + get w() { + return this[3]; + } + set w(value) { + this[3] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Quat.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + const w = this[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Quat.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * A string representation of `this` + * Equivalent to `Quat.str(this);` + * + * @category Accessors + */ + get str() { + return _Quat.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Quat} into `this`. + * @category Methods + * + * @param a the source quaternion + * @returns `this` + */ + copy(a) { + super.set(a); + return this; + } + /** + * Set `this` to the identity quaternion + * Equivalent to Quat.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this[0] = 0; + this[1] = 0; + this[2] = 0; + this[3] = 1; + return this; + } + /** + * Multiplies `this` by a {@link Quat}. + * Equivalent to `Quat.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + return _Quat.multiply(this, this, b); + } + /** + * Alias for {@link Quat.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Rotates `this` by the given angle about the X axis + * Equivalent to `Quat.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateX(rad) { + return _Quat.rotateX(this, this, rad); + } + /** + * Rotates `this` by the given angle about the Y axis + * Equivalent to `Quat.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateY(rad) { + return _Quat.rotateY(this, this, rad); + } + /** + * Rotates `this` by the given angle about the Z axis + * Equivalent to `Quat.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateZ(rad) { + return _Quat.rotateZ(this, this, rad); + } + /** + * Inverts `this` + * Equivalent to `Quat.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + return _Quat.invert(this, this); + } + /** + * Scales `this` by a scalar number + * Equivalent to `Quat.scale(this, this, scale);` + * @category Methods + * + * @param scale - amount to scale the vector by + * @returns `this` + */ + scale(scale) { + this[0] *= scale; + this[1] *= scale; + this[2] *= scale; + this[3] *= scale; + return this; + } + /** + * Calculates the dot product of `this` and another {@link Quat} + * Equivalent to `Quat.dot(this, b);` + * @category Methods + * + * @param b - the second operand + * @returns dot product of `this` and b + */ + dot(b) { + return _Quat.dot(this, b); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat}. + */ + static get BYTE_LENGTH() { + return 4 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new identity quat + * @category Static + * + * @returns a new quaternion + */ + static create() { + return new _Quat(); + } + /** + * Set a quat to the identity quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + static identity(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * @category Static + * + * @param out - the receiving quaternion + * @param axis - the axis around which to rotate + * @param rad - the angle in radians + * @returns `out` + **/ + static setAxisAngle(out, axis, rad) { + rad *= 0.5; + const s = Math.sin(rad); + out[0] = s * axis[0]; + out[1] = s * axis[1]; + out[2] = s * axis[2]; + out[3] = Math.cos(rad); + return out; + } + /** + * Gets the rotation axis and angle for a given + * quaternion. If a quaternion is created with + * setAxisAngle, this method will return the same + * values as provided in the original parameter list + * OR functionally equivalent values. + * Example: The quaternion formed by axis [0, 0, 1] and + * angle -90 is the same as the quaternion formed by + * [0, 0, 1] and 270. This method favors the latter. + * @category Static + * + * @param out_axis - Vector receiving the axis of rotation + * @param q - Quaternion to be decomposed + * @return Angle, in radians, of the rotation + */ + static getAxisAngle(out_axis, q) { + const rad = Math.acos(q[3]) * 2; + const s = Math.sin(rad / 2); + if (s > GLM_EPSILON) { + out_axis[0] = q[0] / s; + out_axis[1] = q[1] / s; + out_axis[2] = q[2] / s; + } else { + out_axis[0] = 1; + out_axis[1] = 0; + out_axis[2] = 0; + } + return rad; + } + /** + * Gets the angular distance between two unit quaternions + * @category Static + * + * @param {ReadonlyQuat} a Origin unit quaternion + * @param {ReadonlyQuat} b Destination unit quaternion + * @return {Number} Angle, in radians, between the two quaternions + */ + static getAngle(a, b) { + const dotproduct = _Quat.dot(a, b); + return Math.acos(2 * dotproduct * dotproduct - 1); + } + /** + * Multiplies two quaternions. + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out, a, b) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bx = b[0]; + const by = b[1]; + const bz = b[2]; + const bw = b[3]; + out[0] = ax * bw + aw * bx + ay * bz - az * by; + out[1] = ay * bw + aw * by + az * bx - ax * bz; + out[2] = az * bw + aw * bz + ax * by - ay * bx; + out[3] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + /** + * Rotates a quaternion by the given angle about the X axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out, a, rad) { + rad *= 0.5; + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bx = Math.sin(rad); + const bw = Math.cos(rad); + out[0] = ax * bw + aw * bx; + out[1] = ay * bw + az * bx; + out[2] = az * bw - ay * bx; + out[3] = aw * bw - ax * bx; + return out; + } + /** + * Rotates a quaternion by the given angle about the Y axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out, a, rad) { + rad *= 0.5; + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const by = Math.sin(rad); + const bw = Math.cos(rad); + out[0] = ax * bw - az * by; + out[1] = ay * bw + aw * by; + out[2] = az * bw + ax * by; + out[3] = aw * bw - ay * by; + return out; + } + /** + * Rotates a quaternion by the given angle about the Z axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out, a, rad) { + rad *= 0.5; + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bz = Math.sin(rad); + const bw = Math.cos(rad); + out[0] = ax * bw + ay * bz; + out[1] = ay * bw - ax * bz; + out[2] = az * bw + aw * bz; + out[3] = aw * bw - az * bz; + return out; + } + /** + * Calculates the W component of a quat from the X, Y, and Z components. + * Assumes that quaternion is 1 unit in length. + * Any existing W component will be ignored. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate W component of + * @returns `out` + */ + static calculateW(out, a) { + const x = a[0], y = a[1], z = a[2]; + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = Math.sqrt(Math.abs(1 - x * x - y * y - z * z)); + return out; + } + /** + * Calculate the exponential of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static exp(out, a) { + const x = a[0], y = a[1], z = a[2], w = a[3]; + const r = Math.sqrt(x * x + y * y + z * z); + const et = Math.exp(w); + const s = r > 0 ? et * Math.sin(r) / r : 0; + out[0] = x * s; + out[1] = y * s; + out[2] = z * s; + out[3] = et * Math.cos(r); + return out; + } + /** + * Calculate the natural logarithm of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static ln(out, a) { + const x = a[0], y = a[1], z = a[2], w = a[3]; + const r = Math.sqrt(x * x + y * y + z * z); + const t = r > 0 ? Math.atan2(r, w) / r : 0; + out[0] = x * t; + out[1] = y * t; + out[2] = z * t; + out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w); + return out; + } + /** + * Calculate the scalar power of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @param b - amount to scale the quaternion by + * @returns `out` + */ + static pow(out, a, b) { + _Quat.ln(out, a); + _Quat.scale(out, out, b); + _Quat.exp(out, out); + return out; + } + /** + * Performs a spherical linear interpolation between two quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out, a, b, t) { + const ax = a[0], ay = a[1], az = a[2], aw = a[3]; + let bx = b[0], by = b[1], bz = b[2], bw = b[3]; + let scale0; + let scale1; + let cosom = ax * bx + ay * by + az * bz + aw * bw; + if (cosom < 0) { + cosom = -cosom; + bx = -bx; + by = -by; + bz = -bz; + bw = -bw; + } + if (1 - cosom > GLM_EPSILON) { + const omega = Math.acos(cosom); + const sinom = Math.sin(omega); + scale0 = Math.sin((1 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; + } else { + scale0 = 1 - t; + scale1 = t; + } + out[0] = scale0 * ax + scale1 * bx; + out[1] = scale0 * ay + scale1 * by; + out[2] = scale0 * az + scale1 * bz; + out[3] = scale0 * aw + scale1 * bw; + return out; + } + /** + * Generates a random unit quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + /* static random(out: QuatLike): QuatLike { + // Implementation of http://planning.cs.uiuc.edu/node198.html + // TODO: Calling random 3 times is probably not the fastest solution + let u1 = glMatrix.RANDOM(); + let u2 = glMatrix.RANDOM(); + let u3 = glMatrix.RANDOM(); + + let sqrt1MinusU1 = Math.sqrt(1 - u1); + let sqrtU1 = Math.sqrt(u1); + + out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2); + out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2); + out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3); + out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3); + return out; + }*/ + /** + * Calculates the inverse of a quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate inverse of + * @returns `out` + */ + static invert(out, a) { + const a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; + const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; + const invDot = dot ? 1 / dot : 0; + out[0] = -a0 * invDot; + out[1] = -a1 * invDot; + out[2] = -a2 * invDot; + out[3] = a3 * invDot; + return out; + } + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate conjugate of + * @returns `out` + */ + static conjugate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + return out; + } + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to re-normalize the quaternion yourself where necessary. + * @category Static + * + * @param out - the receiving quaternion + * @param m - rotation matrix + * @returns `out` + */ + static fromMat3(out, m) { + const fTrace = m[0] + m[4] + m[8]; + let fRoot; + if (fTrace > 0) { + fRoot = Math.sqrt(fTrace + 1); + out[3] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[0] = (m[5] - m[7]) * fRoot; + out[1] = (m[6] - m[2]) * fRoot; + out[2] = (m[1] - m[3]) * fRoot; + } else { + let i = 0; + if (m[4] > m[0]) { + i = 1; + } + if (m[8] > m[i * 3 + i]) { + i = 2; + } + const j = (i + 1) % 3; + const k = (i + 2) % 3; + fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1); + out[i] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot; + out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; + out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + } + return out; + } + /** + * Creates a quaternion from the given euler angle x, y, z. + * @category Static + * + * @param out - the receiving quaternion + * @param x - Angle to rotate around X axis in degrees. + * @param y - Angle to rotate around Y axis in degrees. + * @param z - Angle to rotate around Z axis in degrees. + * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx. + * @returns `out` + */ + static fromEuler(out, x, y, z, order = _Quat.#DEFAULT_ANGLE_ORDER) { + const halfToRad = 0.5 * Math.PI / 180; + x *= halfToRad; + y *= halfToRad; + z *= halfToRad; + const sx = Math.sin(x); + const cx = Math.cos(x); + const sy = Math.sin(y); + const cy = Math.cos(y); + const sz = Math.sin(z); + const cz = Math.cos(z); + switch (order) { + case "xyz": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "xzy": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + case "yxz": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + case "yzx": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "zxy": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "zyx": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + default: + throw new Error(`Unknown angle order ${order}`); + } + return out; + } + /** + * Returns a string representation of a quatenion + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Quat(${a.join(", ")})`; + } + /** + * Creates a new quat initialized with values from an existing quaternion + * @category Static + * + * @param a - quaternion to clone + * @returns a new quaternion + */ + static clone(a) { + return new _Quat(a); + } + /** + * Creates a new quat initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new quaternion + */ + static fromValues(x, y, z, w) { + return new _Quat(x, y, z, w); + } + /** + * Copy the values from one quat to another + * @category Static + * + * @param out - the receiving quaternion + * @param a - the source quaternion + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Quat} to the given values + * @category Static + * + * @param out - the receiving quaternion + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static set(out, x, y, z, w) { + return out; + } + /** + * Adds two {@link Quat}'s + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static add(out, a, b) { + return out; + } + /** + * Alias for {@link Quat.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Scales a quat by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param b - amount to scale the vector by + * @returns `out` + */ + static scale(out, a, scale) { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + out[3] = a[3] * scale; + return out; + } + /** + * Calculates the dot product of two quat's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + /** + * Performs a linear interpolation between two quat's + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static lerp(out, a, b, t) { + return out; + } + /** + * Calculates the magnitude (length) of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate length of + * @returns length of `a` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static magnitude(a) { + return 0; + } + /** + * Alias for {@link Quat.magnitude} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mag(a) { + return 0; + } + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate squared length of + * @returns squared length of a + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static squaredLength(a) { + return 0; + } + /** + * Alias for {@link Quat.squaredLength} + * @category Static + */ + static sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Normalize a {@link Quat} + * @category Static + * + * @param out - the receiving quaternion + * @param a - quaternion to normalize + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static normalize(out, a) { + return out; + } + /** + * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first quaternion. + * @param b - The second quaternion. + * @returns True if the vectors are equal, false otherwise. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static exactEquals(a, b) { + return false; + } + /** + * Returns whether the quaternions have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static equals(a, b) { + return false; + } + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * @category Static + * + * @param out - the receiving quaternion. + * @param a - the initial vector + * @param b - the destination vector + * @returns `out` + */ + static rotationTo(out, a, b) { + const dot = Vec3.dot(a, b); + if (dot < -0.999999) { + Vec3.cross(_Quat.#TMP_VEC3, _Quat.#X_UNIT_VEC3, a); + if (Vec3.mag(_Quat.#TMP_VEC3) < 1e-6) { + Vec3.cross(_Quat.#TMP_VEC3, _Quat.#Y_UNIT_VEC3, a); + } + Vec3.normalize(_Quat.#TMP_VEC3, _Quat.#TMP_VEC3); + _Quat.setAxisAngle(out, _Quat.#TMP_VEC3, Math.PI); + return out; + } else if (dot > 0.999999) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } else { + Vec3.cross(_Quat.#TMP_VEC3, a, b); + out[0] = _Quat.#TMP_VEC3[0]; + out[1] = _Quat.#TMP_VEC3[1]; + out[2] = _Quat.#TMP_VEC3[2]; + out[3] = 1 + dot; + return _Quat.normalize(out, out); + } + } + /** + * Performs a spherical linear interpolation with two control points + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static sqlerp(out, a, b, c, d, t) { + _Quat.slerp(_Quat.#TMP_QUAT1, a, d, t); + _Quat.slerp(_Quat.#TMP_QUAT2, b, c, t); + _Quat.slerp(out, _Quat.#TMP_QUAT1, _Quat.#TMP_QUAT2, 2 * t * (1 - t)); + return out; + } + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * @category Static + * + * @param out - The receiving quaternion + * @param view - the vector representing the viewing direction + * @param right - the vector representing the local `right` direction + * @param up - the vector representing the local `up` direction + * @returns `out` + */ + static setAxes(out, view, right, up) { + _Quat.#TMP_MAT3[0] = right[0]; + _Quat.#TMP_MAT3[3] = right[1]; + _Quat.#TMP_MAT3[6] = right[2]; + _Quat.#TMP_MAT3[1] = up[0]; + _Quat.#TMP_MAT3[4] = up[1]; + _Quat.#TMP_MAT3[7] = up[2]; + _Quat.#TMP_MAT3[2] = -view[0]; + _Quat.#TMP_MAT3[5] = -view[1]; + _Quat.#TMP_MAT3[8] = -view[2]; + return _Quat.normalize(out, _Quat.fromMat3(out, _Quat.#TMP_MAT3)); + } +}; +Quat.set = Vec4.set; +Quat.add = Vec4.add; +Quat.lerp = Vec4.lerp; +Quat.normalize = Vec4.normalize; +Quat.squaredLength = Vec4.squaredLength; +Quat.sqrLen = Vec4.squaredLength; +Quat.exactEquals = Vec4.exactEquals; +Quat.equals = Vec4.equals; +Quat.magnitude = Vec4.magnitude; +Quat.prototype.mul = Quat.prototype.multiply; +Quat.mul = Quat.multiply; +Quat.mag = Quat.magnitude; +Quat.length = Quat.magnitude; +Quat.len = Quat.magnitude; + +// src/_lib/f32/Quat2.ts +var Quat2 = class _Quat2 extends Float32Array { + // Temporary variables to prevent repeated allocations in the algorithms within Quat2. + // These are declared as TypedArrays to aid in tree-shaking. + static #TMP_QUAT = new Float32Array(4); + static #TMP_VEC3 = new Float32Array(3); + /** + * Create a {@link Quat2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 8: + super(values); + break; + case 2: + super(values[0], values[1], 8); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v, v, v, v, v, v]); + } else { + super(v, 0, 8); + } + break; + } + default: + super(8); + this[3] = 1; + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Quat2.str(this);` + * + * @category Accessors + */ + get str() { + return _Quat2.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Quat2} into `this`. + * @category Methods + * + * @param a the source dual quaternion + * @returns `this` + */ + copy(a) { + super.set(a); + return this; + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat2}. + */ + static get BYTE_LENGTH() { + return 8 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new identity {@link Quat2} + * @category Static + * + * @returns a new dual quaternion [real -> rotation, dual -> translation] + */ + static create() { + return new _Quat2(); + } + /** + * Creates a {@link Quat2} quat initialized with values from an existing quaternion + * @category Static + * + * @param a - dual quaternion to clone + * @returns a new dual quaternion + */ + static clone(a) { + return new _Quat2(a); + } + /** + * Creates a new {@link Quat2} initialized with the given values + * @category Static + * + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns a new dual quaternion + */ + static fromValues(x1, y1, z1, w1, x2, y2, z2, w2) { + return new _Quat2(x1, y1, z1, w1, x2, y2, z2, w2); + } + /** + * Creates a new {@link Quat2} from the given values (quat and translation) + * @category Static + * + * @param x1 - X component (rotation) + * @param y1 - Y component (rotation) + * @param z1 - Z component (rotation) + * @param w1 - W component (rotation) + * @param x2 - X component (translation) + * @param y2 - Y component (translation) + * @param z2 - Z component (translation) + * @returns a new dual quaternion + */ + static fromRotationTranslationValues(x1, y1, z1, w1, x2, y2, z2) { + const ax = x2 * 0.5; + const ay = y2 * 0.5; + const az = z2 * 0.5; + return new _Quat2( + x1, + y1, + z1, + w1, + ax * w1 + ay * z1 - az * y1, + ay * w1 + az * x1 - ax * z1, + az * w1 + ax * y1 - ay * x1, + -ax * x1 - ay * y1 - az * z1 + ); + } + /** + * Sets a {@link Quat2} from a quaternion and a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @param t - translation vector + * @returns `out` + */ + static fromRotationTranslation(out, q, t) { + const ax = t[0] * 0.5; + const ay = t[1] * 0.5; + const az = t[2] * 0.5; + const bx = q[0]; + const by = q[1]; + const bz = q[2]; + const bw = q[3]; + out[0] = bx; + out[1] = by; + out[2] = bz; + out[3] = bw; + out[4] = ax * bw + ay * bz - az * by; + out[5] = ay * bw + az * bx - ax * bz; + out[6] = az * bw + ax * by - ay * bx; + out[7] = -ax * bx - ay * by - az * bz; + return out; + } + /** + * Sets a {@link Quat2} from a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param t - translation vector + * @returns `out` + */ + static fromTranslation(out, t) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = t[0] * 0.5; + out[5] = t[1] * 0.5; + out[6] = t[2] * 0.5; + out[7] = 0; + return out; + } + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @returns `out` + */ + static fromRotation(out, q) { + out[0] = q[0]; + out[1] = q[1]; + out[2] = q[2]; + out[3] = q[3]; + out[4] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + return out; + } + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param a - the matrix + * @returns `out` + */ + static fromMat4(out, a) { + Mat4.getRotation(_Quat2.#TMP_QUAT, a); + Mat4.getTranslation(_Quat2.#TMP_VEC3, a); + return _Quat2.fromRotationTranslation(out, _Quat2.#TMP_QUAT, _Quat2.#TMP_VEC3); + } + /** + * Copy the values from one {@link Quat2} to another + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the source dual quaternion + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + return out; + } + /** + * Set a {@link Quat2} to the identity dual quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @returns `out` + */ + static identity(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + return out; + } + /** + * Set the components of a {@link Quat2} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns `out` + */ + static set(out, x1, y1, z1, w1, x2, y2, z2, w2) { + out[0] = x1; + out[1] = y1; + out[2] = z1; + out[3] = w1; + out[4] = x2; + out[5] = y2; + out[6] = z2; + out[7] = w2; + return out; + } + /** + * Gets the real part of a dual quat + * @category Static + * + * @param out - real part + * @param a - Dual Quaternion + * @return `out` + */ + static getReal(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Gets the dual part of a dual quat + * @category Static + * + * @param out - dual part + * @param a - Dual Quaternion + * @return `out` + */ + static getDual(out, a) { + out[0] = a[4]; + out[1] = a[5]; + out[2] = a[6]; + out[3] = a[7]; + return out; + } + /** + * Set the real component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the real part + * @return `out` + */ + static setReal(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the dual component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the dual part + * @return `out` + */ + static setDual(out, a) { + out[4] = a[0]; + out[5] = a[1]; + out[6] = a[2]; + out[7] = a[3]; + return out; + } + /** + * Gets the translation of a normalized {@link Quat2} + * @category Static + * + * @param out - the receiving translation vector + * @param a - Dual Quaternion to be decomposed + * @return `out` + */ + static getTranslation(out, a) { + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const bx = -a[0]; + const by = -a[1]; + const bz = -a[2]; + const bw = a[3]; + out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; + out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; + out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + return out; + } + /** + * Translates a {@link Quat2} by the given vector + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const ax1 = a[0]; + const ay1 = a[1]; + const az1 = a[2]; + const aw1 = a[3]; + const bx1 = v[0] * 0.5; + const by1 = v[1] * 0.5; + const bz1 = v[2] * 0.5; + const ax2 = a[4]; + const ay2 = a[5]; + const az2 = a[6]; + const aw2 = a[7]; + out[0] = ax1; + out[1] = ay1; + out[2] = az1; + out[3] = aw1; + out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2; + out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2; + out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2; + out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2; + return out; + } + /** + * Rotates a {@link Quat2} around the X axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out, a, rad) { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateX(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} around the Y axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out, a, rad) { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateY(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} around the Z axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out, a, rad) { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateZ(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} by a given quaternion (a * q) + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param q - quaternion to rotate by + * @returns `out` + */ + static rotateByQuatAppend(out, a, q) { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + let ax = a[0]; + let ay = a[1]; + let az = a[2]; + let aw = a[3]; + out[0] = ax * qw + aw * qx + ay * qz - az * qy; + out[1] = ay * qw + aw * qy + az * qx - ax * qz; + out[2] = az * qw + aw * qz + ax * qy - ay * qx; + out[3] = aw * qw - ax * qx - ay * qy - az * qz; + ax = a[4]; + ay = a[5]; + az = a[6]; + aw = a[7]; + out[4] = ax * qw + aw * qx + ay * qz - az * qy; + out[5] = ay * qw + aw * qy + az * qx - ax * qz; + out[6] = az * qw + aw * qz + ax * qy - ay * qx; + out[7] = aw * qw - ax * qx - ay * qy - az * qz; + return out; + } + /** + * Rotates a {@link Quat2} by a given quaternion (q * a) + * @category Static + * + * @param out - the receiving dual quaternion + * @param q - quaternion to rotate by + * @param a - the dual quaternion to rotate + * @returns `out` + */ + static rotateByQuatPrepend(out, q, a) { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + let bx = a[0]; + let by = a[1]; + let bz = a[2]; + let bw = a[3]; + out[0] = qx * bw + qw * bx + qy * bz - qz * by; + out[1] = qy * bw + qw * by + qz * bx - qx * bz; + out[2] = qz * bw + qw * bz + qx * by - qy * bx; + out[3] = qw * bw - qx * bx - qy * by - qz * bz; + bx = a[4]; + by = a[5]; + bz = a[6]; + bw = a[7]; + out[4] = qx * bw + qw * bx + qy * bz - qz * by; + out[5] = qy * bw + qw * by + qz * bx - qx * bz; + out[6] = qz * bw + qw * bz + qx * by - qy * bx; + out[7] = qw * bw - qx * bx - qy * by - qz * bz; + return out; + } + /** + * Rotates a {@link Quat2} around a given axis. Does the normalization automatically + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param axis - the axis to rotate around + * @param rad - how far the rotation should be + * @returns `out` + */ + static rotateAroundAxis(out, a, axis, rad) { + if (Math.abs(rad) < GLM_EPSILON) { + return _Quat2.copy(out, a); + } + const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]); + rad *= 0.5; + const s = Math.sin(rad); + const bx = s * axis[0] / axisLength; + const by = s * axis[1] / axisLength; + const bz = s * axis[2] / axisLength; + const bw = Math.cos(rad); + const ax1 = a[0]; + const ay1 = a[1]; + const az1 = a[2]; + const aw1 = a[3]; + out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + out[4] = ax * bw + aw * bx + ay * bz - az * by; + out[5] = ay * bw + aw * by + az * bx - ax * bz; + out[6] = az * bw + aw * bz + ax * by - ay * bx; + out[7] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + /** + * Adds two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + return out; + } + /** + * Multiplies two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns {quat2} out + */ + static multiply(out, a, b) { + const ax0 = a[0]; + const ay0 = a[1]; + const az0 = a[2]; + const aw0 = a[3]; + const bx1 = b[4]; + const by1 = b[5]; + const bz1 = b[6]; + const bw1 = b[7]; + const ax1 = a[4]; + const ay1 = a[5]; + const az1 = a[6]; + const aw1 = a[7]; + const bx0 = b[0]; + const by0 = b[1]; + const bz0 = b[2]; + const bw0 = b[3]; + out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0; + out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0; + out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0; + out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0; + out[4] = ax0 * bw1 + aw0 * bx1 + ay0 * bz1 - az0 * by1 + ax1 * bw0 + aw1 * bx0 + ay1 * bz0 - az1 * by0; + out[5] = ay0 * bw1 + aw0 * by1 + az0 * bx1 - ax0 * bz1 + ay1 * bw0 + aw1 * by0 + az1 * bx0 - ax1 * bz0; + out[6] = az0 * bw1 + aw0 * bz1 + ax0 * by1 - ay0 * bx1 + az1 * bw0 + aw1 * bz0 + ax1 * by0 - ay1 * bx0; + out[7] = aw0 * bw1 - ax0 * bx1 - ay0 * by1 - az0 * bz1 + aw1 * bw0 - ax1 * bx0 - ay1 * by0 - az1 * bz0; + return out; + } + /** + * Alias for {@link Quat2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Scales a {@link Quat2} by a scalar value + * @category Static + * + * @param out - the receiving dual quaterion + * @param a - the dual quaternion to scale + * @param b - scalar value to scale the dual quaterion by + * @returns `out` + */ + static scale(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + return out; + } + /** + * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts) + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dot(a, b) { + return 0; + } + /** + * Performs a linear interpolation between two {@link Quat2}s + * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`) + * @category Static + * + * @param out - the receiving dual quat + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const mt = 1 - t; + if (_Quat2.dot(a, b) < 0) { + t = -t; + } + out[0] = a[0] * mt + b[0] * t; + out[1] = a[1] * mt + b[1] * t; + out[2] = a[2] * mt + b[2] * t; + out[3] = a[3] * mt + b[3] * t; + out[4] = a[4] * mt + b[4] * t; + out[5] = a[5] * mt + b[5] * t; + out[6] = a[6] * mt + b[6] * t; + out[7] = a[7] * mt + b[7] * t; + return out; + } + /** + * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quat to calculate inverse of + * @returns `out` + */ + static invert(out, a) { + const sqlen = _Quat2.squaredLength(a); + out[0] = -a[0] / sqlen; + out[1] = -a[1] / sqlen; + out[2] = -a[2] / sqlen; + out[3] = a[3] / sqlen; + out[4] = -a[4] / sqlen; + out[5] = -a[5] / sqlen; + out[6] = -a[6] / sqlen; + out[7] = a[7] / sqlen; + return out; + } + /** + * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than + * {@link Quat2.invert} and produces the same result. + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to calculate conjugate of + * @returns `out` + */ + static conjugate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + out[4] = -a[4]; + out[5] = -a[5]; + out[6] = -a[6]; + out[7] = a[7]; + return out; + } + /** + * Calculates the magnitude (length) of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate length of + * @returns length of `a` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static magnitude(a) { + return 0; + } + /** + * Alias for {@link Quat2.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate squared length of + * @returns squared length of a + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static squaredLength(a) { + return 0; + } + /** + * Alias for {@link Quat2.squaredLength} + * @category Static + */ + static sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Normalize a {@link Quat2} + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to normalize + * @returns `out` + */ + static normalize(out, a) { + let magnitude = _Quat2.squaredLength(a); + if (magnitude > 0) { + magnitude = Math.sqrt(magnitude); + const a0 = a[0] / magnitude; + const a1 = a[1] / magnitude; + const a2 = a[2] / magnitude; + const a3 = a[3] / magnitude; + const b0 = a[4]; + const b1 = a[5]; + const b2 = a[6]; + const b3 = a[7]; + const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3; + out[0] = a0; + out[1] = a1; + out[2] = a2; + out[3] = a3; + out[4] = (b0 - a0 * a_dot_b) / magnitude; + out[5] = (b1 - a1 * a_dot_b) / magnitude; + out[6] = (b2 - a2 * a_dot_b) / magnitude; + out[7] = (b3 - a3 * a_dot_b) / magnitude; + } + return out; + } + /** + * Returns a string representation of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Quat2(${a.join(", ")})`; + } + /** + * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7]; + } + /** + * Returns whether the {@link Quat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)); + } +}; +Quat2.dot = Quat.dot; +Quat2.squaredLength = Quat.squaredLength; +Quat2.sqrLen = Quat.squaredLength; +Quat2.mag = Quat.magnitude; +Quat2.length = Quat.magnitude; +Quat2.len = Quat.magnitude; +Quat2.mul = Quat2.multiply; + +// src/_lib/f32/Vec2.ts +var Vec2 = class _Vec2 extends Float32Array { + /** + * Create a {@link Vec2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 2: { + const v = values[0]; + if (typeof v === "number") { + super([v, values[1]]); + } else { + super(v, values[1], 2); + } + break; + } + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v]); + } else { + super(v, 0, 2); + } + break; + } + default: + super(2); + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r() { + return this[0]; + } + set r(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g() { + return this[1]; + } + set g(value) { + this[1] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec2.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + return Math.hypot(this[0], this[1]); + } + /** + * Alias for {@link Vec2.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec2.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude() { + const x = this[0]; + const y = this[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag() { + return this.squaredMagnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec2.str(this);` + * + * @category Accessors + */ + get str() { + return _Vec2.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec2} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + // Instead of zero(), use a.fill(0) for instances; + /** + * Adds a {@link Vec2} to `this`. + * Equivalent to `Vec2.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b) { + this[0] += b[0]; + this[1] += b[1]; + return this; + } + /** + * Subtracts a {@link Vec2} from `this`. + * Equivalent to `Vec2.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + return this; + } + /** + * Alias for {@link Vec2.subtract} + * @category Methods + */ + sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec2}. + * Equivalent to `Vec2.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + return this; + } + /** + * Alias for {@link Vec2.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec2}. + * Equivalent to `Vec2.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + return this; + } + /** + * Alias for {@link Vec2.divide} + * @category Methods + */ + div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec2.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b) { + this[0] *= b; + this[1] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b) { + return _Vec2.distance(this, b); + } + /** + * Alias for {@link Vec2.distance} + * @category Methods + */ + dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b) { + return _Vec2.squaredDistance(this, b); + } + /** + * Alias for {@link Vec2.squaredDistance} + * @category Methods + */ + sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec2.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate() { + this[0] *= -1; + this[1] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec2.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + return this; + } + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec2.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec2}. + * Equivalent to `Vec2.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b) { + return this[0] * b[0] + this[1] * b[1]; + } + /** + * Normalize `this`. + * Equivalent to `Vec2.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize() { + return _Vec2.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec2}. + */ + static get BYTE_LENGTH() { + return 2 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty {@link Vec2} + * @category Static + * + * @returns A new 2D vector + */ + static create() { + return new _Vec2(); + } + /** + * Creates a new {@link Vec2} initialized with values from an existing vector + * @category Static + * + * @param a - Vector to clone + * @returns A new 2D vector + */ + static clone(a) { + return new _Vec2(a); + } + /** + * Creates a new {@link Vec2} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @returns A new 2D vector + */ + static fromValues(x, y) { + return new _Vec2(x, y); + } + /** + * Copy the values from one {@link Vec2} to another + * @category Static + * + * @param out - the receiving vector + * @param a - The source vector + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + return out; + } + /** + * Set the components of a {@link Vec2} to the given values + * @category Static + * + * @param out - The receiving vector + * @param x - X component + * @param y - Y component + * @returns `out` + */ + static set(out, x, y) { + out[0] = x; + out[1] = y; + return out; + } + /** + * Adds two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + return out; + } + /** + * Alias for {@link Vec2.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return [0, 0]; + } + /** + * Multiplies two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + return out; + } + /** + * Alias for {@link Vec2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return [0, 0]; + } + /** + * Divides two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + return out; + } + /** + * Alias for {@link Vec2.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out, a, b) { + return [0, 0]; + } + /** + * Math.ceil the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to ceil + * @returns `out` + */ + static ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + return out; + } + /** + * Math.floor the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to floor + * @returns `out` + */ + static floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + return out; + } + /** + * Returns the minimum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + return out; + } + /** + * Returns the maximum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + return out; + } + /** + * Math.round the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to round + * @returns `out` + */ + static round(out, a) { + out[0] = Math.round(a[0]); + out[1] = Math.round(a[1]); + return out; + } + /** + * Scales a {@link Vec2} by a scalar number + * @category Static + * + * @param out - The receiving vector + * @param a - The vector to scale + * @param b - Amount to scale the vector by + * @returns `out` + */ + static scale(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + return out; + } + /** + * Adds two Vec2's after scaling the second operand by a scalar value + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param scale - The amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns distance between `a` and `b` + */ + static distance(a, b) { + return Math.hypot(b[0] - a[0], b[1] - a[1]); + } + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Squared distance between `a` and `b` + */ + static squaredDistance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a, b) { + return 0; + } + /** + * Calculates the magnitude (length) of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a) { + const x = a[0]; + const y = a[1]; + return Math.sqrt(x * x + y * y); + } + /** + * Alias for {@link Vec2.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate squared length of + * @returns Squared length of a + */ + static squaredLength(a) { + const x = a[0]; + const y = a[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.squaredLength} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrLen(a, b) { + return 0; + } + /** + * Negates the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to negate + * @returns `out` + */ + static negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + return out; + } + /** + * Returns the inverse of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to invert + * @returns `out` + */ + static inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + return out; + } + /** + * Normalize a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to normalize + * @returns `out` + */ + static normalize(out, a) { + const x = a[0]; + const y = a[1]; + let len = x * x + y * y; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + return out; + } + /** + * Calculates the dot product of two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Dot product of `a` and `b` + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1]; + } + /** + * Computes the cross product of two {@link Vec2}s + * Note that the cross product must by definition produce a 3D vector. + * For this reason there is also not instance equivalent for this function. + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static cross(out, a, b) { + const z = a[0] * b[1] - a[1] * b[0]; + out[0] = out[1] = 0; + out[2] = z; + return out; + } + /** + * Performs a linear interpolation between two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param t - Interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const ax = a[0]; + const ay = a[1]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat2} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[2] * y; + out[1] = m[1] * x + m[3] * y; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat2d} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2d(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[2] * y + m[4]; + out[1] = m[1] * x + m[3] * y + m[5]; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat3} + * 3rd vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat3(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[3] * y + m[6]; + out[1] = m[1] * x + m[4] * y + m[7]; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat4} + * 3rd vector component is implicitly '0' + * 4th vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat4(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[4] * y + m[12]; + out[1] = m[1] * x + m[5] * y + m[13]; + return out; + } + /** + * Rotate a 2D vector + * @category Static + * + * @param out - The receiving {@link Vec2} + * @param a - The {@link Vec2} point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotate(out, a, b, rad) { + const p0 = a[0] - b[0]; + const p1 = a[1] - b[1]; + const sinC = Math.sin(rad); + const cosC = Math.cos(rad); + out[0] = p0 * cosC - p1 * sinC + b[0]; + out[1] = p0 * sinC + p1 * cosC + b[1]; + return out; + } + /** + * Get the angle between two 2D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static angle(a, b) { + const x1 = a[0]; + const y1 = a[1]; + const x2 = b[0]; + const y2 = b[1]; + const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2); + const cosine = mag && (x1 * x2 + y1 * y2) / mag; + return Math.acos(Math.min(Math.max(cosine, -1), 1)); + } + /** + * Set the components of a {@link Vec2} to zero + * @category Static + * + * @param out - The receiving vector + * @returns `out` + */ + static zero(out) { + out[0] = 0; + out[1] = 0; + return out; + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors components are ===, `false` otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors are approximately equal, `false` otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const b0 = b[0]; + const b1 = b[1]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)); + } + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - Vector to represent as a string + * @returns String representation of the vector + */ + static str(a) { + return `Vec2(${a.join(", ")})`; + } +}; +Vec2.prototype.sub = Vec2.prototype.subtract; +Vec2.prototype.mul = Vec2.prototype.multiply; +Vec2.prototype.div = Vec2.prototype.divide; +Vec2.prototype.dist = Vec2.prototype.distance; +Vec2.prototype.sqrDist = Vec2.prototype.squaredDistance; +Vec2.sub = Vec2.subtract; +Vec2.mul = Vec2.multiply; +Vec2.div = Vec2.divide; +Vec2.dist = Vec2.distance; +Vec2.sqrDist = Vec2.squaredDistance; +Vec2.sqrLen = Vec2.squaredLength; +Vec2.mag = Vec2.magnitude; +Vec2.length = Vec2.magnitude; +Vec2.len = Vec2.magnitude; + +// src/swizzle/index.ts +var GLM_SWIZZLES_ENABLED_F32 = false; +function EnableSwizzles() { + if (GLM_SWIZZLES_ENABLED_F32) { + return; + } + const VEC2_SWIZZLES = ["xx", "xy", "yx", "yy", "xxx", "xxy", "xyx", "xyy", "yxx", "yxy", "yyx", "yyy", "xxxx", "xxxy", "xxyx", "xxyy", "xyxx", "xyxy", "xyyx", "xyyy", "yxxx", "yxxy", "yxyx", "yxyy", "yyxx", "yyxy", "yyyx", "yyyy", "rr", "rg", "gr", "gg", "rrr", "rrg", "rgr", "rgg", "grr", "grg", "ggr", "ggg", "rrrr", "rrrg", "rrgr", "rrgg", "rgrr", "rgrg", "rggr", "rggg", "grrr", "grrg", "grgr", "grgg", "ggrr", "ggrg", "gggr", "gggg"]; + const VEC3_SWIZZLES = ["xz", "yz", "zx", "zy", "zz", "xxz", "xyz", "xzx", "xzy", "xzz", "yxz", "yyz", "yzx", "yzy", "yzz", "zxx", "zxy", "zxz", "zyx", "zyy", "zyz", "zzx", "zzy", "zzz", "xxxz", "xxyz", "xxzx", "xxzy", "xxzz", "xyxz", "xyyz", "xyzx", "xyzy", "xyzz", "xzxx", "xzxy", "xzxz", "xzyx", "xzyy", "xzyz", "xzzx", "xzzy", "xzzz", "yxxz", "yxyz", "yxzx", "yxzy", "yxzz", "yyxz", "yyyz", "yyzx", "yyzy", "yyzz", "yzxx", "yzxy", "yzxz", "yzyx", "yzyy", "yzyz", "yzzx", "yzzy", "yzzz", "zxxx", "zxxy", "zxxz", "zxyx", "zxyy", "zxyz", "zxzx", "zxzy", "zxzz", "zyxx", "zyxy", "zyxz", "zyyx", "zyyy", "zyyz", "zyzx", "zyzy", "zyzz", "zzxx", "zzxy", "zzxz", "zzyx", "zzyy", "zzyz", "zzzx", "zzzy", "zzzz", "rb", "gb", "br", "bg", "bb", "rrb", "rgb", "rbr", "rbg", "rbb", "grb", "ggb", "gbr", "gbg", "gbb", "brr", "brg", "brb", "bgr", "bgg", "bgb", "bbr", "bbg", "bbb", "rrrb", "rrgb", "rrbr", "rrbg", "rrbb", "rgrb", "rggb", "rgbr", "rgbg", "rgbb", "rbrr", "rbrg", "rbrb", "rbgr", "rbgg", "rbgb", "rbbr", "rbbg", "rbbb", "grrb", "grgb", "grbr", "grbg", "grbb", "ggrb", "gggb", "ggbr", "ggbg", "ggbb", "gbrr", "gbrg", "gbrb", "gbgr", "gbgg", "gbgb", "gbbr", "gbbg", "gbbb", "brrr", "brrg", "brrb", "brgr", "brgg", "brgb", "brbr", "brbg", "brbb", "bgrr", "bgrg", "bgrb", "bggr", "bggg", "bggb", "bgbr", "bgbg", "bgbb", "bbrr", "bbrg", "bbrb", "bbgr", "bbgg", "bbgb", "bbbr", "bbbg", "bbbb"]; + const VEC4_SWIZZLES = ["xw", "yw", "zw", "wx", "wy", "wz", "ww", "xxw", "xyw", "xzw", "xwx", "xwy", "xwz", "xww", "yxw", "yyw", "yzw", "ywx", "ywy", "ywz", "yww", "zxw", "zyw", "zzw", "zwx", "zwy", "zwz", "zww", "wxx", "wxy", "wxz", "wxw", "wyx", "wyy", "wyz", "wyw", "wzx", "wzy", "wzz", "wzw", "wwx", "wwy", "wwz", "www", "xxxw", "xxyw", "xxzw", "xxwx", "xxwy", "xxwz", "xxww", "xyxw", "xyyw", "xyzw", "xywx", "xywy", "xywz", "xyww", "xzxw", "xzyw", "xzzw", "xzwx", "xzwy", "xzwz", "xzww", "xwxx", "xwxy", "xwxz", "xwxw", "xwyx", "xwyy", "xwyz", "xwyw", "xwzx", "xwzy", "xwzz", "xwzw", "xwwx", "xwwy", "xwwz", "xwww", "yxxw", "yxyw", "yxzw", "yxwx", "yxwy", "yxwz", "yxww", "yyxw", "yyyw", "yyzw", "yywx", "yywy", "yywz", "yyww", "yzxw", "yzyw", "yzzw", "yzwx", "yzwy", "yzwz", "yzww", "ywxx", "ywxy", "ywxz", "ywxw", "ywyx", "ywyy", "ywyz", "ywyw", "ywzx", "ywzy", "ywzz", "ywzw", "ywwx", "ywwy", "ywwz", "ywww", "zxxw", "zxyw", "zxzw", "zxwx", "zxwy", "zxwz", "zxww", "zyxw", "zyyw", "zyzw", "zywx", "zywy", "zywz", "zyww", "zzxw", "zzyw", "zzzw", "zzwx", "zzwy", "zzwz", "zzww", "zwxx", "zwxy", "zwxz", "zwxw", "zwyx", "zwyy", "zwyz", "zwyw", "zwzx", "zwzy", "zwzz", "zwzw", "zwwx", "zwwy", "zwwz", "zwww", "wxxx", "wxxy", "wxxz", "wxxw", "wxyx", "wxyy", "wxyz", "wxyw", "wxzx", "wxzy", "wxzz", "wxzw", "wxwx", "wxwy", "wxwz", "wxww", "wyxx", "wyxy", "wyxz", "wyxw", "wyyx", "wyyy", "wyyz", "wyyw", "wyzx", "wyzy", "wyzz", "wyzw", "wywx", "wywy", "wywz", "wyww", "wzxx", "wzxy", "wzxz", "wzxw", "wzyx", "wzyy", "wzyz", "wzyw", "wzzx", "wzzy", "wzzz", "wzzw", "wzwx", "wzwy", "wzwz", "wzww", "wwxx", "wwxy", "wwxz", "wwxw", "wwyx", "wwyy", "wwyz", "wwyw", "wwzx", "wwzy", "wwzz", "wwzw", "wwwx", "wwwy", "wwwz", "wwww", "ra", "ga", "ba", "ar", "ag", "ab", "aa", "rra", "rga", "rba", "rar", "rag", "rab", "raa", "gra", "gga", "gba", "gar", "gag", "gab", "gaa", "bra", "bga", "bba", "bar", "bag", "bab", "baa", "arr", "arg", "arb", "ara", "agr", "agg", "agb", "aga", "abr", "abg", "abb", "aba", "aar", "aag", "aab", "aaa", "rrra", "rrga", "rrba", "rrar", "rrag", "rrab", "rraa", "rgra", "rgga", "rgba", "rgar", "rgag", "rgab", "rgaa", "rbra", "rbga", "rbba", "rbar", "rbag", "rbab", "rbaa", "rarr", "rarg", "rarb", "rara", "ragr", "ragg", "ragb", "raga", "rabr", "rabg", "rabb", "raba", "raar", "raag", "raab", "raaa", "grra", "grga", "grba", "grar", "grag", "grab", "graa", "ggra", "ggga", "ggba", "ggar", "ggag", "ggab", "ggaa", "gbra", "gbga", "gbba", "gbar", "gbag", "gbab", "gbaa", "garr", "garg", "garb", "gara", "gagr", "gagg", "gagb", "gaga", "gabr", "gabg", "gabb", "gaba", "gaar", "gaag", "gaab", "gaaa", "brra", "brga", "brba", "brar", "brag", "brab", "braa", "bgra", "bgga", "bgba", "bgar", "bgag", "bgab", "bgaa", "bbra", "bbga", "bbba", "bbar", "bbag", "bbab", "bbaa", "barr", "barg", "barb", "bara", "bagr", "bagg", "bagb", "baga", "babr", "babg", "babb", "baba", "baar", "baag", "baab", "baaa", "arrr", "arrg", "arrb", "arra", "argr", "argg", "argb", "arga", "arbr", "arbg", "arbb", "arba", "arar", "arag", "arab", "araa", "agrr", "agrg", "agrb", "agra", "aggr", "aggg", "aggb", "agga", "agbr", "agbg", "agbb", "agba", "agar", "agag", "agab", "agaa", "abrr", "abrg", "abrb", "abra", "abgr", "abgg", "abgb", "abga", "abbr", "abbg", "abbb", "abba", "abar", "abag", "abab", "abaa", "aarr", "aarg", "aarb", "aara", "aagr", "aagg", "aagb", "aaga", "aabr", "aabg", "aabb", "aaba", "aaar", "aaag", "aaab", "aaaa"]; + const SWIZZLE_INDEX = { + x: 0, + r: 0, + y: 1, + g: 1, + z: 2, + b: 2, + w: 3, + a: 3 + }; + function getSwizzleImpl(swizzle) { + switch (swizzle.length) { + case 2: + return function() { + return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]); + }; + case 3: + return function() { + return new Vec3( + this[SWIZZLE_INDEX[swizzle[0]]], + this[SWIZZLE_INDEX[swizzle[1]]], + this[SWIZZLE_INDEX[swizzle[2]]] + ); + }; + case 4: + return function() { + return new Vec4( + this[SWIZZLE_INDEX[swizzle[0]]], + this[SWIZZLE_INDEX[swizzle[1]]], + this[SWIZZLE_INDEX[swizzle[2]]], + this[SWIZZLE_INDEX[swizzle[3]]] + ); + }; + } + throw new Error("Illegal swizzle length"); + } + for (const swizzle of VEC2_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec2.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec3.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + for (const swizzle of VEC3_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec3.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + for (const swizzle of VEC4_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + GLM_SWIZZLES_ENABLED_F32 = true; +} + +// src/util/angleConversion.ts +var GLM_DEG_TO_RAD = Math.PI / 180; +var GLM_RAD_TO_DEG = 180 / Math.PI; +function toDegree(value) { + return value * GLM_RAD_TO_DEG; +} +function toRadian(value) { + return value * GLM_DEG_TO_RAD; +} +//# sourceMappingURL=gl-matrix-f32.cjs.map diff --git a/dist-cdn/cjs/2022/gl-matrix-f32.cjs.map b/dist-cdn/cjs/2022/gl-matrix-f32.cjs.map new file mode 100644 index 00000000..3f94a666 --- /dev/null +++ b/dist-cdn/cjs/2022/gl-matrix-f32.cjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../../../src/cdn/index.ts", "../../../src/common/index.ts", "../../../src/_lib/f32/Mat2.ts", "../../../src/_lib/f32/Mat2d.ts", "../../../src/_lib/f32/Mat3.ts", "../../../src/_lib/f32/Mat4.ts", "../../../src/_lib/f32/Vec3.ts", "../../../src/_lib/f32/Vec4.ts", "../../../src/_lib/f32/Quat.ts", "../../../src/_lib/f32/Quat2.ts", "../../../src/_lib/f32/Vec2.ts", "../../../src/swizzle/index.ts", "../../../src/util/angleConversion.ts"], + "sourcesContent": ["/**\r\n * Provides an all-inclusive ESM distribution of `gl-matrix` (32-bit). All library classes extends `Float32Array`.\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\n/* v8 ignore next 6 */\r\nexport * from '#gl-matrix';\r\nexport * from '#gl-matrix/classic';\r\nexport * from '#gl-matrix/swizzle';\r\nexport * from '#gl-matrix/types';\r\nexport * from '#gl-matrix/types/swizzle';\r\nexport * from '#gl-matrix/util';\r\n", "/**\r\n * Provides common resources and constants shared across `gl-matrix`.\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\n/**\r\n * A small constant used to determine the acceptable error margin in floating-point calculations.\r\n */\r\nexport const GLM_EPSILON = 0.000001;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x2 Matrix\r\n */\r\nexport class Mat2 extends Float32Array {\r\n static #IDENTITY_2X2 = new Float32Array([\r\n 1, 0,\r\n 0, 1\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n default:\r\n super(Mat2.#IDENTITY_2X2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2} into `this`.\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2.identity(this)\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n identity(): this {\r\n this.set(Mat2.#IDENTITY_2X2);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2} against another one\r\n * Equivalent to `Mat2.multiply(this, this, b);`\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat2}\r\n * Equivalent to `Mat2.transpose(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n transpose(): this {\r\n return Mat2.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat2}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n invert(): this {\r\n return Mat2.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2.scale(this, this, v);`\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2} by the given angle around the given axis\r\n * Equivalent to `Mat2.rotate(this, this, rad);`\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n rotate(rad: number): this {\r\n return Mat2.rotate(this, this, rad) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2}\r\n */\r\n static create(): Mat2 {\r\n return new Mat2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2}\r\n */\r\n static clone(a: Readonly): Mat2 {\r\n return new Mat2(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2Like, a: Readonly): Mat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2}\r\n */\r\n static fromValues(...values: number[]): Mat2 {\r\n return new Mat2(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2Like, ...values: number[]): Mat2Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2Like): Mat2Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat2Like, a: Readonly): Mat2Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache\r\n // some values\r\n if (out === a) {\r\n const a1 = a[1];\r\n out[1] = a[2];\r\n out[2] = a1;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[2];\r\n out[2] = a[1];\r\n out[3] = a[3];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2Like, a: Mat2Like): Mat2Like | null {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n // Calculate the determinant\r\n let det = a0 * a3 - a2 * a1;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = a3 * det;\r\n out[1] = -a1 * det;\r\n out[2] = -a2 * det;\r\n out[3] = a0 * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat2Like, a: Mat2Like): Mat2Like {\r\n // Caching this value is necessary if out == a\r\n const a0 = a[0];\r\n out[0] = a[3];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[2] * a[1];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n return out;\r\n }\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Rotates a {@link Mat2} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2Like, a: Readonly, rad: number): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2Like, a: Readonly, v: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2Like, rad: number): Mat2Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2Like, v: Readonly): Mat2Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2Like, a: Readonly, b: number): Mat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2Like, a: Readonly, b: Readonly, scale: number): Mat2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\r\n * @category Static\r\n *\r\n * @param L - the lower triangular matrix\r\n * @param D - the diagonal matrix\r\n * @param U - the upper triangular matrix\r\n * @param a - the input matrix to factorize\r\n */\r\n\r\n static LDU(L: Mat2Like, D: Readonly, U: Mat2Like, a: Readonly):\r\n [Mat2Like, Readonly, Mat2Like] {\r\n L[2] = a[2] / a[0];\r\n U[0] = a[0];\r\n U[1] = a[1];\r\n U[3] = a[3] - L[2] * U[1];\r\n return [L, D, U];\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat2.prototype.mul = Mat2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat2.mul = Mat2.multiply;\r\nMat2.sub = Mat2.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x3 Matrix\r\n */\r\nexport class Mat2d extends Float32Array {\r\n static #IDENTITY_2X3 = new Float32Array([\r\n 1, 0,\r\n 0, 1,\r\n 0, 0,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 6:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 6); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 6);\r\n }\r\n break;\r\n default:\r\n super(Mat2d.#IDENTITY_2X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2d.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2d.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2d} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2d.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat2d.#IDENTITY_2X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2d} against another one\r\n * Equivalent to `Mat2d.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2d.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Translate this {@link Mat2d} by the given vector\r\n * Equivalent to `Mat2d.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat2d.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2d} by the given angle around the given axis\r\n * Equivalent to `Mat2d.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat2d.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2d.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2d.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2d}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 6 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2d}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2d}\r\n */\r\n static create(): Mat2d {\r\n return new Mat2d();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2d} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2d}\r\n */\r\n static clone(a: Readonly): Mat2d {\r\n return new Mat2d(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2d} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2dLike, a: Readonly): Mat2dLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2d} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2d}\r\n */\r\n static fromValues(...values: number[]): Mat2d {\r\n return new Mat2d(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2d} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2dLike, ...values: number[]): Mat2dLike {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2d} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2dLike): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2dLike, a: Mat2dLike): Mat2dLike | null {\r\n const aa = a[0];\r\n const ab = a[1];\r\n const ac = a[2];\r\n const ad = a[3];\r\n const atx = a[4];\r\n const aty = a[5];\r\n\r\n let det = aa * ad - ab * ac;\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = ad * det;\r\n out[1] = -ab * det;\r\n out[2] = -ac * det;\r\n out[3] = aa * det;\r\n out[4] = (ac * aty - ad * atx) * det;\r\n out[5] = (ab * atx - aa * aty) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[1] * a[2];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2d}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n out[4] = a0 * b4 + a2 * b5 + a4;\r\n out[5] = a1 * b4 + a3 * b5 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat2d} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n out[4] = a0 * v0 + a2 * v1 + a4;\r\n out[5] = a1 * v0 + a3 * v1 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat2d} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2dLike, a: Readonly, rad: number): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n // TODO: Got to fromRotation\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = v[0];\r\n out[5] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2dLike, rad: number): Mat2dLike {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2d} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2dLike, a: Readonly, b: number): Mat2dLike {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2dLike, a: Readonly, b: Readonly, scale: number):\r\n Mat2dLike {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2d(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Static method alias assignments\r\nMat2d.mul = Mat2d.multiply;\r\nMat2d.sub = Mat2d.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Mat3Like, Mat4Like, Vec2Like, QuatLike } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 3x3 Matrix\r\n */\r\nexport class Mat3 extends Float32Array {\r\n static #IDENTITY_3X3 = new Float32Array([\r\n 1, 0, 0,\r\n 0, 1, 0,\r\n 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 9:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 9); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v,\r\n v, v, v,\r\n v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 9);\r\n }\r\n break;\r\n default:\r\n super(Mat3.#IDENTITY_3X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat3.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat3.#IDENTITY_3X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat3} against another one\r\n * Equivalent to `Mat3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat3.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat3}\r\n * Equivalent to `Mat3.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat3.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat3}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat3.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat3} by the given vector\r\n * Equivalent to `Mat3.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat3.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat3} by the given angle around the given axis\r\n * Equivalent to `Mat3.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat3.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat3.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat3.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 9 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat3}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat3}\r\n */\r\n static create(): Mat3 {\r\n return new Mat3();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat3} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat3}\r\n */\r\n static clone(a: Readonly): Mat3 {\r\n return new Mat3(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat3} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat3} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat3}\r\n */\r\n static fromValues(...values: number[]): Mat3 {\r\n return new Mat3(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat3} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat3Like, ...values: number[]): Mat3Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat3} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat3Like): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat3Like, a: Readonly): Mat3Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a12 = a[5];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a01;\r\n out[5] = a[7];\r\n out[6] = a02;\r\n out[7] = a12;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a[1];\r\n out[4] = a[4];\r\n out[5] = a[7];\r\n out[6] = a[2];\r\n out[7] = a[5];\r\n out[8] = a[8];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat3Like, a: Mat3Like): Mat3Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2];\r\n const a10 = a[3],\r\n a11 = a[4],\r\n a12 = a[5];\r\n const a20 = a[6],\r\n a21 = a[7],\r\n a22 = a[8];\r\n\r\n const b01 = a22 * a11 - a12 * a21;\r\n const b11 = -a22 * a10 + a12 * a20;\r\n const b21 = a21 * a10 - a11 * a20;\r\n\r\n // Calculate the determinant\r\n let det = a00 * b01 + a01 * b11 + a02 * b21;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = b01 * det;\r\n out[1] = (-a22 * a01 + a02 * a21) * det;\r\n out[2] = (a12 * a01 - a02 * a11) * det;\r\n out[3] = b11 * det;\r\n out[4] = (a22 * a00 - a02 * a20) * det;\r\n out[5] = (-a12 * a00 + a02 * a10) * det;\r\n out[6] = b21 * det;\r\n out[7] = (-a21 * a00 + a01 * a20) * det;\r\n out[8] = (a11 * a00 - a01 * a10) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat3Like, a: Mat3Like): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n out[0] = a11 * a22 - a12 * a21;\r\n out[1] = a02 * a21 - a01 * a22;\r\n out[2] = a01 * a12 - a02 * a11;\r\n out[3] = a12 * a20 - a10 * a22;\r\n out[4] = a00 * a22 - a02 * a20;\r\n out[5] = a02 * a10 - a00 * a12;\r\n out[6] = a10 * a21 - a11 * a20;\r\n out[7] = a01 * a20 - a00 * a21;\r\n out[8] = a00 * a11 - a01 * a10;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n return (\r\n a00 * (a22 * a11 - a12 * a21) +\r\n a01 * (-a22 * a10 + a12 * a20) +\r\n a02 * (a21 * a10 - a11 * a20)\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[3];\r\n b1 = b[4];\r\n b2 = b[5];\r\n out[3] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[4] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[5] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[6];\r\n b1 = b[7];\r\n b2 = b[8];\r\n out[6] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[7] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[8] = b0 * a02 + b1 * a12 + b2 * a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat3} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n\r\n out[3] = a10;\r\n out[4] = a11;\r\n out[5] = a12;\r\n\r\n out[6] = x * a00 + y * a10 + a20;\r\n out[7] = x * a01 + y * a11 + a21;\r\n out[8] = x * a02 + y * a12 + a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat3} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat3Like, a: Readonly, rad: number): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c * a00 + s * a10;\r\n out[1] = c * a01 + s * a11;\r\n out[2] = c * a02 + s * a12;\r\n\r\n out[3] = c * a10 - s * a00;\r\n out[4] = c * a11 - s * a01;\r\n out[5] = c * a12 - s * a02;\r\n\r\n out[6] = a20;\r\n out[7] = a21;\r\n out[8] = a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat3} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = x * a[0];\r\n out[1] = x * a[1];\r\n out[2] = x * a[2];\r\n\r\n out[3] = y * a[3];\r\n out[4] = y * a[4];\r\n out[5] = y * a[5];\r\n\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = v[0];\r\n out[7] = v[1];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.rotate(dest, dest, rad);\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat3Like, rad: number): Mat3Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n\r\n out[3] = -s;\r\n out[4] = c;\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n\r\n out[3] = 0;\r\n out[4] = v[1];\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat2d} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 2x3 matrix\r\n * @returns `out`\r\n */\r\n static fromMat2d(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = 0;\r\n\r\n out[3] = a[2];\r\n out[4] = a[3];\r\n out[5] = 0;\r\n\r\n out[6] = a[4];\r\n out[7] = a[5];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param q - {@link Quat} to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat3Like, q: Readonly): Mat3Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[3] = yx - wz;\r\n out[6] = zx + wy;\r\n\r\n out[1] = yx + wz;\r\n out[4] = 1 - xx - zz;\r\n out[7] = zy - wx;\r\n\r\n out[2] = zx - wy;\r\n out[5] = zy + wx;\r\n out[8] = 1 - xx - yy;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat4} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 4x4 matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[4];\r\n out[4] = a[5];\r\n out[5] = a[6];\r\n out[6] = a[8];\r\n out[7] = a[9];\r\n out[8] = a[10];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\r\n * @category Static\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat3Like, a: Readonly): Mat3Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n\r\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n\r\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat3Like, a: Readonly): Mat3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n\r\n out[3] = cy * az - cz * ay;\r\n out[4] = cz * ax - cx * az;\r\n out[5] = cx * ay - cy * ax;\r\n\r\n out[6] = ay * bz - az * by;\r\n out[7] = az * bx - ax * bz;\r\n out[8] = ax * by - ay * bx;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a 2D projection matrix with the given bounds\r\n * @category Static\r\n *\r\n * @param out mat3 frustum matrix will be written into\r\n * @param width Width of your gl context\r\n * @param height Height of gl context\r\n * @returns `out`\r\n */\r\n static projection(out: Mat3Like, width: number, height: number): Mat3Like {\r\n out[0] = 2 / width;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -2 / height;\r\n out[5] = 0;\r\n out[6] = -1;\r\n out[7] = 1;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8]\r\n );\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat3} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat3Like, a: Readonly, b: number): Mat3Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat3Like, a: Readonly, b: Readonly, scale: number): Mat3Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat3(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat3.prototype.mul = Mat3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat3.mul = Mat3.multiply;\r\nMat3.sub = Mat3.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 4x4 Matrix\r\n */\r\nexport class Mat4 extends Float32Array {\r\n static #IDENTITY_4X4 = new Float32Array([\r\n 1, 0, 0, 0,\r\n 0, 1, 0, 0,\r\n 0, 0, 1, 0,\r\n 0, 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Temporary variable to prevent repeated allocations in the algorithms within Mat4.\r\n * These are declared as TypedArrays to aid in tree-shaking.\r\n */\r\n static #TMP_VEC3 = new Float32Array(3);\r\n\r\n /**\r\n * Create a {@link Mat4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 16:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 16); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 16);\r\n }\r\n break;\r\n default:\r\n super(Mat4.#IDENTITY_4X4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat4.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat4.#IDENTITY_4X4);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat4} against another one\r\n * Equivalent to `Mat4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat4.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat4}\r\n * Equivalent to `Mat4.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat4.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat4}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat4.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat4} by the given vector\r\n * Equivalent to `Mat4.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat4.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the given axis\r\n * Equivalent to `Mat4.rotate(this, this, rad, axis);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `this`\r\n */\r\n rotate(rad: number, axis: Readonly): this {\r\n return Mat4.rotate(this, this, rad, axis) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat4.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat4.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the X axis\r\n * Equivalent to `Mat4.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Mat4.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Y axis\r\n * Equivalent to `Mat4.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Mat4.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Z axis\r\n * Equivalent to `Mat4.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Mat4.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveNO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveNO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveZO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveZO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoNO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoNO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoZO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoZO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 16 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat4}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat4}\r\n */\r\n static create(): Mat4 {\r\n return new Mat4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat4} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat4}\r\n */\r\n static clone(a: Readonly): Mat4 {\r\n return new Mat4(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat4} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat4Like, a: Readonly): Mat4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new mat4 with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat4}\r\n */\r\n static fromValues(...values: number[]): Mat4 {\r\n return new Mat4(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a mat4 to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat4Like, ...values: number[]): Mat4Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n out[9] = values[9];\r\n out[10] = values[10];\r\n out[11] = values[11];\r\n out[12] = values[12];\r\n out[13] = values[13];\r\n out[14] = values[14];\r\n out[15] = values[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat4} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat4Like): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat4Like, a: Readonly): Mat4Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a12 = a[6],\r\n a13 = a[7];\r\n const a23 = a[11];\r\n\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a01;\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a02;\r\n out[9] = a12;\r\n out[11] = a[14];\r\n out[12] = a03;\r\n out[13] = a13;\r\n out[14] = a23;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a[1];\r\n out[5] = a[5];\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a[2];\r\n out[9] = a[6];\r\n out[10] = a[10];\r\n out[11] = a[14];\r\n out[12] = a[3];\r\n out[13] = a[7];\r\n out[14] = a[11];\r\n out[15] = a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat4Like, a: Mat4Like): Mat4Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\r\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\r\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\r\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\r\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\r\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\r\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat4Like, a: Mat4Like): Mat4Like {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n out[0] = a11 * b11 - a12 * b10 + a13 * b09;\r\n out[1] = a02 * b10 - a01 * b11 - a03 * b09;\r\n out[2] = a31 * b05 - a32 * b04 + a33 * b03;\r\n out[3] = a22 * b04 - a21 * b05 - a23 * b03;\r\n out[4] = a12 * b08 - a10 * b11 - a13 * b07;\r\n out[5] = a00 * b11 - a02 * b08 + a03 * b07;\r\n out[6] = a32 * b02 - a30 * b05 - a33 * b01;\r\n out[7] = a20 * b05 - a22 * b02 + a23 * b01;\r\n out[8] = a10 * b10 - a11 * b08 + a13 * b06;\r\n out[9] = a01 * b08 - a00 * b10 - a03 * b06;\r\n out[10] = a30 * b04 - a31 * b02 + a33 * b00;\r\n out[11] = a21 * b02 - a20 * b04 - a23 * b00;\r\n out[12] = a11 * b07 - a10 * b09 - a12 * b06;\r\n out[13] = a00 * b09 - a01 * b07 + a02 * b06;\r\n out[14] = a31 * b01 - a30 * b03 - a32 * b00;\r\n out[15] = a20 * b03 - a21 * b01 + a22 * b00;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b0 = a00 * a11 - a01 * a10;\r\n const b1 = a00 * a12 - a02 * a10;\r\n const b2 = a01 * a12 - a02 * a11;\r\n const b3 = a20 * a31 - a21 * a30;\r\n const b4 = a20 * a32 - a22 * a30;\r\n const b5 = a21 * a32 - a22 * a31;\r\n const b6 = a00 * b5 - a01 * b4 + a02 * b3;\r\n const b7 = a10 * b5 - a11 * b4 + a12 * b3;\r\n const b8 = a20 * b2 - a21 * b1 + a22 * b0;\r\n const b9 = a30 * b2 - a31 * b1 + a32 * b0;\r\n\r\n // Calculate the determinant\r\n return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Mat4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n // Cache only the current line of the second matrix\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n let b3 = b[3];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[4];\r\n b1 = b[5];\r\n b2 = b[6];\r\n b3 = b[7];\r\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[8];\r\n b1 = b[9];\r\n b2 = b[10];\r\n b3 = b[11];\r\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[12];\r\n b1 = b[13];\r\n b2 = b[14];\r\n b3 = b[15];\r\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat4} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n if (a === out) {\r\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\r\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\r\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\r\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\r\n } else {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n out[3] = a03;\r\n out[4] = a10;\r\n out[5] = a11;\r\n out[6] = a12;\r\n out[7] = a13;\r\n out[8] = a20;\r\n out[9] = a21;\r\n out[10] = a22;\r\n out[11] = a23;\r\n\r\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\r\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\r\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\r\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec3} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n out[0] = a[0] * x;\r\n out[1] = a[1] * x;\r\n out[2] = a[2] * x;\r\n out[3] = a[3] * x;\r\n out[4] = a[4] * y;\r\n out[5] = a[5] * y;\r\n out[6] = a[6] * y;\r\n out[7] = a[7] * y;\r\n out[8] = a[8] * z;\r\n out[9] = a[9] * z;\r\n out[10] = a[10] * z;\r\n out[11] = a[11] * z;\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat4} by the given angle around the given axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if axis has a length of 0\r\n */\r\n static rotate(out: Mat4Like, a: Readonly, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n // Construct the elements of the rotation matrix\r\n const b00 = x * x * t + c;\r\n const b01 = y * x * t + z * s;\r\n const b02 = z * x * t - y * s;\r\n const b10 = x * y * t - z * s;\r\n const b11 = y * y * t + c;\r\n const b12 = z * y * t + x * s;\r\n const b20 = x * z * t + y * s;\r\n const b21 = y * z * t - x * s;\r\n const b22 = z * z * t + c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\r\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\r\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\r\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\r\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\r\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\r\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\r\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\r\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\r\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\r\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\r\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateX(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[4] = a10 * c + a20 * s;\r\n out[5] = a11 * c + a21 * s;\r\n out[6] = a12 * c + a22 * s;\r\n out[7] = a13 * c + a23 * s;\r\n out[8] = a20 * c - a10 * s;\r\n out[9] = a21 * c - a11 * s;\r\n out[10] = a22 * c - a12 * s;\r\n out[11] = a23 * c - a13 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateY(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c - a20 * s;\r\n out[1] = a01 * c - a21 * s;\r\n out[2] = a02 * c - a22 * s;\r\n out[3] = a03 * c - a23 * s;\r\n out[8] = a00 * s + a20 * c;\r\n out[9] = a01 * s + a21 * c;\r\n out[10] = a02 * s + a22 * c;\r\n out[11] = a03 * s + a23 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c + a10 * s;\r\n out[1] = a01 * c + a11 * s;\r\n out[2] = a02 * c + a12 * s;\r\n out[3] = a03 * c + a13 * s;\r\n out[4] = a10 * c - a00 * s;\r\n out[5] = a11 * c - a01 * s;\r\n out[6] = a12 * c - a02 * s;\r\n out[7] = a13 * c - a03 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = v[1];\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = v[2];\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotate(dest, dest, rad, axis);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if `axis` has a length of 0\r\n */\r\n static fromRotation(out: Mat4Like, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = x * x * t + c;\r\n out[1] = y * x * t + z * s;\r\n out[2] = z * x * t - y * s;\r\n out[3] = 0;\r\n out[4] = x * y * t - z * s;\r\n out[5] = y * y * t + c;\r\n out[6] = z * y * t + x * s;\r\n out[7] = 0;\r\n out[8] = x * z * t + y * s;\r\n out[9] = y * z * t - x * s;\r\n out[10] = z * z * t + c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the X axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateX(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromXRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = c;\r\n out[6] = s;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = -s;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Y axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateY(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromYRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = 0;\r\n out[2] = -s;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = s;\r\n out[9] = 0;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Z axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateZ(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromZRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -s;\r\n out[5] = c;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation and vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Mat4Like, q: Readonly, v: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - (yy + zz);\r\n out[1] = xy + wz;\r\n out[2] = xz - wy;\r\n out[3] = 0;\r\n out[4] = xy - wz;\r\n out[5] = 1 - (xx + zz);\r\n out[6] = yz + wx;\r\n out[7] = 0;\r\n out[8] = xz + wy;\r\n out[9] = yz - wx;\r\n out[10] = 1 - (xx + yy);\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Mat4} from a {@link Quat2}.\r\n * @category Static\r\n *\r\n * @param out - Matrix\r\n * @param a - Dual Quaternion\r\n * @returns `out`\r\n */\r\n static fromQuat2(out: Mat4Like, a: Quat2Like): Mat4Like {\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n\r\n const magnitude = bx * bx + by * by + bz * bz + bw * bw;\r\n\r\n // Only scale if it makes sense\r\n if (magnitude > 0) {\r\n Mat4.#TMP_VEC3[0] = ((ax * bw + aw * bx + ay * bz - az * by) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[1] = ((ay * bw + aw * by + az * bx - ax * bz) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[2] = ((az * bw + aw * bz + ax * by - ay * bx) * 2) / magnitude;\r\n } else {\r\n Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n }\r\n Mat4.fromRotationTranslation(out, a as QuatLike, Mat4.#TMP_VEC3);\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat4Like, a: Readonly): Mat4Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[3] = 0;\r\n\r\n out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[7] = 0;\r\n\r\n out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat4Like, a: Readonly): Mat4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n out[3] = 0;\r\n\r\n out[4] = cy * az - cz * ay;\r\n out[5] = cz * ax - cx * az;\r\n out[6] = cx * ay - cy * ax;\r\n out[7] = 0;\r\n\r\n out[8] = ay * bz - az * by;\r\n out[9] = az * bx - ax * bz;\r\n out[10] = ax * by - ay * bx;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the translation vector component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslation,\r\n * the returned vector will be the same as the translation vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive translation component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getTranslation(out: Vec3Like, mat: Readonly): Vec3Like {\r\n out[0] = mat[12];\r\n out[1] = mat[13];\r\n out[2] = mat[14];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the scaling factor component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslationScale\r\n * with a normalized Quaternion parameter, the returned vector will be\r\n * the same as the scaling vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive scaling factor component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getScaling(out: Vec3Like, mat: Readonly): Vec3Like {\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a quaternion representing the rotational component\r\n * of a transformation matrix. If a matrix is built with\r\n * fromRotationTranslation, the returned quaternion will be the\r\n * same as the quaternion originally supplied.\r\n * @category Static\r\n *\r\n * @param out - Quaternion to receive the rotation component\r\n * @param mat - Matrix to be decomposed (input)\r\n * @return `out`\r\n */\r\n static getRotation(out: QuatLike, mat: Readonly): QuatLike {\r\n Mat4.getScaling(Mat4.#TMP_VEC3, mat);\r\n\r\n const is1 = 1 / Mat4.#TMP_VEC3[0];\r\n const is2 = 1 / Mat4.#TMP_VEC3[1];\r\n const is3 = 1 / Mat4.#TMP_VEC3[2];\r\n\r\n const sm11 = mat[0] * is1;\r\n const sm12 = mat[1] * is2;\r\n const sm13 = mat[2] * is3;\r\n const sm21 = mat[4] * is1;\r\n const sm22 = mat[5] * is2;\r\n const sm23 = mat[6] * is3;\r\n const sm31 = mat[8] * is1;\r\n const sm32 = mat[9] * is2;\r\n const sm33 = mat[10] * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out[3] = 0.25 * S;\r\n out[0] = (sm23 - sm32) / S;\r\n out[1] = (sm31 - sm13) / S;\r\n out[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out[3] = (sm23 - sm32) / S;\r\n out[0] = 0.25 * S;\r\n out[1] = (sm12 + sm21) / S;\r\n out[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out[3] = (sm31 - sm13) / S;\r\n out[0] = (sm12 + sm21) / S;\r\n out[1] = 0.25 * S;\r\n out[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out[3] = (sm12 - sm21) / S;\r\n out[0] = (sm31 + sm13) / S;\r\n out[1] = (sm23 + sm32) / S;\r\n out[2] = 0.25 * S;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Decomposes a transformation matrix into its rotation, translation\r\n * and scale components. Returns only the rotation component\r\n * @category Static\r\n *\r\n * @param out_r - Quaternion to receive the rotation component\r\n * @param out_t - Vector to receive the translation vector\r\n * @param out_s - Vector to receive the scaling factor\r\n * @param mat - Matrix to be decomposed (input)\r\n * @returns `out_r`\r\n */\r\n static decompose(out_r: QuatLike, out_t: Vec3Like, out_s: Vec3Like, mat: Readonly): QuatLike {\r\n out_t[0] = mat[12];\r\n out_t[1] = mat[13];\r\n out_t[2] = mat[14];\r\n\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n const is1 = 1 / out_s[0];\r\n const is2 = 1 / out_s[1];\r\n const is3 = 1 / out_s[2];\r\n\r\n const sm11 = m11 * is1;\r\n const sm12 = m12 * is2;\r\n const sm13 = m13 * is3;\r\n const sm21 = m21 * is1;\r\n const sm22 = m22 * is2;\r\n const sm23 = m23 * is3;\r\n const sm31 = m31 * is1;\r\n const sm32 = m32 * is2;\r\n const sm33 = m33 * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out_r[3] = 0.25 * S;\r\n out_r[0] = (sm23 - sm32) / S;\r\n out_r[1] = (sm31 - sm13) / S;\r\n out_r[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out_r[3] = (sm23 - sm32) / S;\r\n out_r[0] = 0.25 * S;\r\n out_r[1] = (sm12 + sm21) / S;\r\n out_r[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out_r[3] = (sm31 - sm13) / S;\r\n out_r[0] = (sm12 + sm21) / S;\r\n out_r[1] = 0.25 * S;\r\n out_r[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out_r[3] = (sm12 - sm21) / S;\r\n out_r[0] = (sm31 + sm13) / S;\r\n out_r[1] = (sm23 + sm32) / S;\r\n out_r[2] = 0.25 * S;\r\n }\r\n\r\n return out_r;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScale(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n out[0] = (1 - (yy + zz)) * sx;\r\n out[1] = (xy + wz) * sx;\r\n out[2] = (xz - wy) * sx;\r\n out[3] = 0;\r\n out[4] = (xy - wz) * sy;\r\n out[5] = (1 - (xx + zz)) * sy;\r\n out[6] = (yz + wx) * sy;\r\n out[7] = 0;\r\n out[8] = (xz + wy) * sz;\r\n out[9] = (yz - wx) * sz;\r\n out[10] = (1 - (xx + yy)) * sz;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the\r\n * given origin. This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * mat4.translate(dest, origin);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n * mat4.translate(dest, negativeOrigin);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @param o - The origin vector around which to scale and rotate\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScaleOrigin(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly, o: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n const ox = o[0];\r\n const oy = o[1];\r\n const oz = o[2];\r\n\r\n const out0 = (1 - (yy + zz)) * sx;\r\n const out1 = (xy + wz) * sx;\r\n const out2 = (xz - wy) * sx;\r\n const out4 = (xy - wz) * sy;\r\n const out5 = (1 - (xx + zz)) * sy;\r\n const out6 = (yz + wx) * sy;\r\n const out8 = (xz + wy) * sz;\r\n const out9 = (yz - wx) * sz;\r\n const out10 = (1 - (xx + yy)) * sz;\r\n\r\n out[0] = out0;\r\n out[1] = out1;\r\n out[2] = out2;\r\n out[3] = 0;\r\n out[4] = out4;\r\n out[5] = out5;\r\n out[6] = out6;\r\n out[7] = 0;\r\n out[8] = out8;\r\n out[9] = out9;\r\n out[10] = out10;\r\n out[11] = 0;\r\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\r\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\r\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 4x4 matrix from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Quaternion to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat4Like, q: Readonly): Mat4Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[1] = yx + wz;\r\n out[2] = zx - wy;\r\n out[3] = 0;\r\n\r\n out[4] = yx - wz;\r\n out[5] = 1 - xx - zz;\r\n out[6] = zy + wx;\r\n out[7] = 0;\r\n\r\n out[8] = zx + wy;\r\n out[9] = zy - wx;\r\n out[10] = 1 - xx - yy;\r\n out[11] = 0;\r\n\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.frustumNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly\r\n */\r\n static frustum(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like { return out; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveNO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.perspectiveNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static perspective(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveZO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating\r\n * projection matrices to be used with the still experimental WebVR API.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n * @deprecated\r\n */\r\n static perspectiveFromFieldOfView(out: Mat4Like,\r\n fov: { upDegrees: number, downDegrees: number, leftDegrees: number, rightDegrees: number }, near: number,\r\n far: number): Mat4Like {\r\n\r\n const upTan = Math.tan((fov.upDegrees * Math.PI) / 180.0);\r\n const downTan = Math.tan((fov.downDegrees * Math.PI) / 180.0);\r\n const leftTan = Math.tan((fov.leftDegrees * Math.PI) / 180.0);\r\n const rightTan = Math.tan((fov.rightDegrees * Math.PI) / 180.0);\r\n const xScale = 2.0 / (leftTan + rightTan);\r\n const yScale = 2.0 / (upTan + downTan);\r\n\r\n out[0] = xScale;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n out[4] = 0.0;\r\n out[5] = yScale;\r\n out[6] = 0.0;\r\n out[7] = 0.0;\r\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\r\n out[9] = (upTan - downTan) * yScale * 0.5;\r\n out[10] = far / (near - far);\r\n out[11] = -1.0;\r\n out[12] = 0.0;\r\n out[13] = 0.0;\r\n out[14] = (far * near) / (near - far);\r\n out[15] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 2 * nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = (far + near) * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.orthoNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static ortho(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, far: number):\r\n Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = near * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that\r\n * actually makes an object look at another object, you should use targetTo instead.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param center - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static lookAt(out: Mat4Like, eye: Readonly, center: Readonly, up: Readonly): Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n const centerx = center[0];\r\n const centery = center[1];\r\n const centerz = center[2];\r\n\r\n if (\r\n Math.abs(eyex - centerx) < GLM_EPSILON &&\r\n Math.abs(eyey - centery) < GLM_EPSILON &&\r\n Math.abs(eyez - centerz) < GLM_EPSILON\r\n ) {\r\n return Mat4.identity(out);\r\n }\r\n\r\n let z0 = eyex - centerx;\r\n let z1 = eyey - centery;\r\n let z2 = eyez - centerz;\r\n\r\n let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\r\n if (!len) {\r\n x0 = 0;\r\n x1 = 0;\r\n x2 = 0;\r\n } else {\r\n len = 1 / len;\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n let y0 = z1 * x2 - z2 * x1;\r\n let y1 = z2 * x0 - z0 * x2;\r\n let y2 = z0 * x1 - z1 * x0;\r\n\r\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\r\n if (!len) {\r\n y0 = 0;\r\n y1 = 0;\r\n y2 = 0;\r\n } else {\r\n len = 1 / len;\r\n y0 *= len;\r\n y1 *= len;\r\n y2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = y0;\r\n out[2] = z0;\r\n out[3] = 0;\r\n out[4] = x1;\r\n out[5] = y1;\r\n out[6] = z1;\r\n out[7] = 0;\r\n out[8] = x2;\r\n out[9] = y2;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\r\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\r\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a matrix that makes something look at something else.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param target - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static targetTo(out: Mat4Like, eye: Readonly, target: Readonly, up: Readonly):\r\n Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n\r\n let z0 = eyex - target[0];\r\n let z1 = eyey - target[1];\r\n let z2 = eyez - target[2];\r\n\r\n let len = z0 * z0 + z1 * z1 + z2 * z2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n }\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n\r\n len = x0 * x0 + x1 * x1 + x2 * x2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = x1;\r\n out[2] = x2;\r\n out[3] = 0;\r\n out[4] = z1 * x2 - z2 * x1;\r\n out[5] = z2 * x0 - z0 * x2;\r\n out[6] = z0 * x1 - z1 * x0;\r\n out[7] = 0;\r\n out[8] = z0;\r\n out[9] = z1;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = eyex;\r\n out[13] = eyey;\r\n out[14] = eyez;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8] +\r\n a[9] * a[9] +\r\n a[10] * a[10] +\r\n a[11] * a[11] +\r\n a[12] * a[12] +\r\n a[13] * a[13] +\r\n a[14] * a[14] +\r\n a[15] * a[15]\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n out[9] = a[9] + b[9];\r\n out[10] = a[10] + b[10];\r\n out[11] = a[11] + b[11];\r\n out[12] = a[12] + b[12];\r\n out[13] = a[13] + b[13];\r\n out[14] = a[14] + b[14];\r\n out[15] = a[15] + b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n out[9] = a[9] - b[9];\r\n out[10] = a[10] - b[10];\r\n out[11] = a[11] - b[11];\r\n out[12] = a[12] - b[12];\r\n out[13] = a[13] - b[13];\r\n out[14] = a[14] - b[14];\r\n out[15] = a[15] - b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Multiply each element of the matrix by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat4Like, a: Readonly, b: number): Mat4Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n out[9] = a[9] * b;\r\n out[10] = a[10] * b;\r\n out[11] = a[11] * b;\r\n out[12] = a[12] * b;\r\n out[13] = a[13] * b;\r\n out[14] = a[14] * b;\r\n out[15] = a[15] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat4Like, a: Readonly, b: Readonly, scale: number): Mat4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n out[9] = a[9] + b[9] * scale;\r\n out[10] = a[10] + b[10] * scale;\r\n out[11] = a[11] + b[11] * scale;\r\n out[12] = a[12] + b[12] * scale;\r\n out[13] = a[13] + b[13] * scale;\r\n out[14] = a[14] + b[14] * scale;\r\n out[15] = a[15] + b[15] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8] &&\r\n a[9] === b[9] &&\r\n a[10] === b[10] &&\r\n a[11] === b[11] &&\r\n a[12] === b[12] &&\r\n a[13] === b[13] &&\r\n a[14] === b[14] &&\r\n a[15] === b[15]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n const a9 = a[9];\r\n const a10 = a[10];\r\n const a11 = a[11];\r\n const a12 = a[12];\r\n const a13 = a[13];\r\n const a14 = a[14];\r\n const a15 = a[15];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n const b9 = b[9];\r\n const b10 = b[10];\r\n const b11 = b[11];\r\n const b12 = b[12];\r\n const b13 = b[13];\r\n const b14 = b[14];\r\n const b15 = b[15];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) &&\r\n Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) &&\r\n Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) &&\r\n Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) &&\r\n Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) &&\r\n Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) &&\r\n Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) &&\r\n Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat4(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat4.prototype.mul = Mat4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat4.sub = Mat4.subtract;\r\nMat4.mul = Mat4.multiply;\r\nMat4.frustum = Mat4.frustumNO;\r\nMat4.perspective = Mat4.perspectiveNO;\r\nMat4.ortho = Mat4.orthoNO;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, Mat4Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 3 Dimensional Vector\r\n */\r\nexport class Vec3 extends Float32Array {\r\n /**\r\n * Create a {@link Vec3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 3:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 3); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 3);\r\n }\r\n break;\r\n }\r\n default:\r\n super(3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec3.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec3.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec3} to `this`.\r\n * Equivalent to `Vec3.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec3} from `this`.\r\n * Equivalent to `Vec3.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec3.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec3.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec3.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec3.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec3.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to its absolute value.\r\n * Equivalent to `Vec3.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec3}.\r\n * Equivalent to `Vec3.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec3.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec3.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 3 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty vec3\r\n * @category Static\r\n *\r\n * @returns a new 3D vector\r\n */\r\n static create(): Vec3 {\r\n return new Vec3();\r\n }\r\n\r\n /**\r\n * Creates a new vec3 initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 3D vector\r\n */\r\n static clone(a: Readonly): Vec3 {\r\n return new Vec3(a);\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Creates a new vec3 initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns a new 3D vector\r\n */\r\n static fromValues(x: number, y: number, z: number): Vec3 {\r\n return new Vec3(x, y, z);\r\n }\r\n\r\n /**\r\n * Copy the values from one vec3 to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns `out`\r\n */\r\n static set(out: Vec3Like, x: number, y: number, z: number): Vec3Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Multiplies two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; }\r\n\r\n /**\r\n * Divides two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Math.ceil the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * symmetric round the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n /*\r\n static round(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = glMatrix.round(a[0]);\r\n out[1] = glMatrix.round(a[1]);\r\n out[2] = glMatrix.round(a[2]);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Scales a vec3 by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec3Like, a: Readonly, scale: number): Vec3Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two vec3's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec3Like, a: Readonly, b: Readonly, scale: number) {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared length of a vec3\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec3Like, a: Readonly): Vec3Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n let len = x * x + y * y + z * z;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n out[2] = a[2] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2];\r\n const bx = b[0],\r\n by = b[1],\r\n bz = b[2];\r\n\r\n out[0] = ay * bz - az * by;\r\n out[1] = az * bx - ax * bz;\r\n out[2] = ax * by - ay * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const angle = Math.acos(Math.min(Math.max(Vec3.dot(a, b), -1), 1));\r\n const sinTotal = Math.sin(angle);\r\n\r\n const ratioA = Math.sin((1 - t) * angle) / sinTotal;\r\n const ratioB = Math.sin(t * angle) / sinTotal;\r\n out[0] = ratioA * a[0] + ratioB * b[0];\r\n out[1] = ratioA * a[1] + ratioB * b[1];\r\n out[2] = ratioA * a[2] + ratioB * b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a hermite interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static hermite(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const factorTimes2 = t * t;\r\n const factor1 = factorTimes2 * (2 * t - 3) + 1;\r\n const factor2 = factorTimes2 * (t - 2) + t;\r\n const factor3 = factorTimes2 * (t - 1);\r\n const factor4 = factorTimes2 * (3 - 2 * t);\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a bezier interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static bezier(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const inverseFactor = 1 - t;\r\n const inverseFactorTimesTwo = inverseFactor * inverseFactor;\r\n const factorTimes2 = t * t;\r\n const factor1 = inverseFactorTimesTwo * inverseFactor;\r\n const factor2 = 3 * t * inverseFactorTimesTwo;\r\n const factor3 = 3 * factorTimes2 * inverseFactor;\r\n const factor4 = factorTimes2 * t;\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec3Like, scale) {\r\n scale = scale === undefined ? 1.0 : scale;\r\n\r\n let r = glMatrix.RANDOM() * 2.0 * Math.PI;\r\n let z = glMatrix.RANDOM() * 2.0 - 1.0;\r\n let zScale = Math.sqrt(1.0 - z * z) * scale;\r\n\r\n out[0] = Math.cos(r) * zScale;\r\n out[1] = Math.sin(r) * zScale;\r\n out[2] = z * scale;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the vec3 with a mat4.\r\n * 4th vector component is implicitly '1'\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec3Like, a: Readonly, m: Readonly): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1.0;\r\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\r\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\r\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a mat3.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - the 3x3 matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat3(out: Vec3Like, a: Vec3Like, m: Mat3Like): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n out[0] = x * m[0] + y * m[3] + z * m[6];\r\n out[1] = x * m[1] + y * m[4] + z * m[7];\r\n out[2] = x * m[2] + y * m[5] + z * m[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a quat\r\n * Can also be used for dual quaternions. (Multiply it with the real part)\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec3Like, a: Readonly, q: Readonly): Vec3Like {\r\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const w2 = q[3] * 2;\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n // var qvec = [qx, qy, qz];\r\n // var uv = vec3.cross([], qvec, a);\r\n const uvx = (qy * z - qz * y);\r\n const uvy = (qz * x - qx * z);\r\n const uvz = (qx * y - qy * x);\r\n // var uuv = vec3.cross([], qvec, uv);\r\n // vec3.scale(uuv, uuv, 2);\r\n const uuvx = (qy * uvz - qz * uvy) * 2;\r\n const uuvy = (qz * uvx - qx * uvz) * 2;\r\n const uuvz = (qx * uvy - qy * uvx) * 2;\r\n // vec3.scale(uv, uv, 2 * w);\r\n // return vec3.add(out, a, vec3.add(out, uv, uuv));\r\n out[0] = x + (uvx * w2) + uuvx;\r\n out[1] = y + (uvy * w2) + uuvy;\r\n out[2] = z + (uvz * w2) + uuvz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the x-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateX(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const by = b[1];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const py = a[1] - by;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = a[0];\r\n out[1] = (py * Math.cos(rad) - pz * Math.sin(rad)) + by;\r\n out[2] = (py * Math.sin(rad) + pz * Math.cos(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the y-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateY(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (pz * Math.sin(rad) + px * Math.cos(rad)) + bx;\r\n out[1] = a[1];\r\n out[2] = (pz * Math.cos(rad) - px * Math.sin(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the z-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const by = b[1];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const py = a[1] - by;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (px * Math.cos(rad) - py * Math.sin(rad)) + bx;\r\n out[1] = (px * Math.sin(rad) + py * Math.cos(rad)) + by;\r\n out[2] = b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 3D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly) {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz));\r\n const cosine = mag && Vec3.dot(a, b) / mag;\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec3Like): Vec3Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec3(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec3.prototype.sub = Vec3.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.mul = Vec3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.div = Vec3.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.dist = Vec3.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.sqrDist = Vec3.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec3.sub = Vec3.subtract;\r\nVec3.mul = Vec3.multiply;\r\nVec3.div = Vec3.divide;\r\nVec3.dist = Vec3.distance;\r\nVec3.sqrDist = Vec3.squaredDistance;\r\nVec3.sqrLen = Vec3.squaredLength;\r\nVec3.mag = Vec3.magnitude;\r\nVec3.length = Vec3.magnitude;\r\nVec3.len = Vec3.magnitude;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Vec4Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 4 Dimensional Vector\r\n */\r\nexport class Vec4 extends Float32Array {\r\n /**\r\n * Create a {@link Vec4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the vector. Equivalent to `this[3];`\r\n * @category Vector Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The a component of the vector. Equivalent to `this[3];`\r\n * @category Color Components\r\n */\r\n get a(): number { return this[3]; }\r\n set a(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec4.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec4} to `this`.\r\n * Equivalent to `Vec4.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n this[3] += b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec4} from `this`.\r\n * Equivalent to `Vec4.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n this[3] -= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n this[3] *= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n this[3] /= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec4.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n this[3] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n this[3] += b[3] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec4.distance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec4.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec4.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n this[3] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec4.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n this[3] = 1.0 / this[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec4.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n this[3] = Math.abs(this[3]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec4}.\r\n * Equivalent to `Vec4.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec4.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec4.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec4}\r\n * @category Static\r\n *\r\n * @returns a new 4D vector\r\n */\r\n static create(): Vec4 {\r\n return new Vec4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 4D vector\r\n */\r\n static clone(a: Vec4Like): Vec4 {\r\n return new Vec4(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new 4D vector\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Vec4 {\r\n return new Vec4(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec4} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n static set(out: Vec4Like, x: number, y: number, z: number, w: number): Vec4Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n out[3] = a[3] * b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Divides two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n out[3] = a[3] / b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n out[3] = Math.ceil(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n out[3] = Math.floor(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n out[3] = Math.min(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n out[3] = Math.max(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n out[2] = Math.round(a[2]);\r\n out[3] = Math.round(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec4} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec4Like, a: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}'s after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec4Like, a: Readonly, b: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return Math.hypot(x, y, z, w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of `a`\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = -a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n out[3] = 1.0 / a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n out[3] = Math.abs(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec4Like, a: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n let len = x * x + y * y + z * z + w * w;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = x * len;\r\n out[1] = y * len;\r\n out[2] = z * len;\r\n out[3] = w * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Returns the cross-product of three vectors in a 4-dimensional space\r\n * @category Static\r\n *\r\n * @param out the receiving vector\r\n * @param u - the first vector\r\n * @param v - the second vector\r\n * @param w - the third vector\r\n * @returns result\r\n */\r\n static cross(out: Vec4Like, u: Readonly, v: Readonly, w: Readonly): Vec4Like {\r\n const a = v[0] * w[1] - v[1] * w[0];\r\n const b = v[0] * w[2] - v[2] * w[0];\r\n const c = v[0] * w[3] - v[3] * w[0];\r\n const d = v[1] * w[2] - v[2] * w[1];\r\n const e = v[1] * w[3] - v[3] * w[1];\r\n const f = v[2] * w[3] - v[3] * w[2];\r\n const g = u[0];\r\n const h = u[1];\r\n const i = u[2];\r\n const j = u[3];\r\n\r\n out[0] = h * f - i * e + j * d;\r\n out[1] = -(g * f) + i * c - j * b;\r\n out[2] = g * e - h * c + j * a;\r\n out[3] = -(g * d) + h * b - i * a;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec4Like, a: Readonly, b: Readonly, t: number): Vec4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n out[3] = aw + t * (b[3] - aw);\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec4Like, scale): Vec4Like {\r\n scale = scale || 1.0;\r\n\r\n // Marsaglia, George. Choosing a Point from the Surface of a\r\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\r\n // http://projecteuclid.org/euclid.aoms/1177692644;\r\n var v1, v2, v3, v4;\r\n var s1, s2;\r\n do {\r\n v1 = glMatrix.RANDOM() * 2 - 1;\r\n v2 = glMatrix.RANDOM() * 2 - 1;\r\n s1 = v1 * v1 + v2 * v2;\r\n } while (s1 >= 1);\r\n do {\r\n v3 = glMatrix.RANDOM() * 2 - 1;\r\n v4 = glMatrix.RANDOM() * 2 - 1;\r\n s2 = v3 * v3 + v4 * v4;\r\n } while (s2 >= 1);\r\n\r\n var d = Math.sqrt((1 - s1) / s2);\r\n out[0] = scale * v1;\r\n out[1] = scale * v2;\r\n out[2] = scale * v3 * d;\r\n out[3] = scale * v4 * d;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Mat4}.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec4Like, a: Readonly, m: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\r\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\r\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\r\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec4Like, a: Readonly, q: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n\r\n // calculate quat * vec\r\n const ix = qw * x + qy * z - qz * y;\r\n const iy = qw * y + qz * x - qx * z;\r\n const iz = qw * z + qx * y - qy * x;\r\n const iw = -qx * x - qy * y - qz * z;\r\n\r\n // calculate result * inverse quat\r\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\r\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\r\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec4Like): Vec4Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec4(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec4.prototype.sub = Vec4.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.mul = Vec4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.div = Vec4.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.dist = Vec4.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.sqrDist = Vec4.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec4.sub = Vec4.subtract;\r\nVec4.mul = Vec4.multiply;\r\nVec4.div = Vec4.divide;\r\nVec4.dist = Vec4.distance;\r\nVec4.sqrDist = Vec4.squaredDistance;\r\nVec4.sqrLen = Vec4.squaredLength;\r\nVec4.mag = Vec4.magnitude;\r\nVec4.length = Vec4.magnitude;\r\nVec4.len = Vec4.magnitude;\r\n", "import { Vec3 } from './Vec3.js';\r\nimport { Vec4 } from './Vec4.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Quaternion\r\n */\r\nexport class Quat extends Float32Array {\r\n static #DEFAULT_ANGLE_ORDER = 'zyx';\r\n\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT1 = new Float32Array(4);\r\n static #TMP_QUAT2 = new Float32Array(4);\r\n static #TMP_MAT3 = new Float32Array(9);\r\n\r\n static #TMP_VEC3 = new Float32Array(3);\r\n static #X_UNIT_VEC3 = new Float32Array([1, 0, 0]);\r\n static #Y_UNIT_VEC3 = new Float32Array([0, 1, 0]);\r\n\r\n /**\r\n * Create a {@link Quat}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the quaternion. Equivalent to `this[0];`\r\n * @category Quaternion Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the quaternion. Equivalent to `this[1];`\r\n * @category Quaternion Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the quaternion. Equivalent to `this[2];`\r\n * @category Quaternion Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the quaternion. Equivalent to `this[3];`\r\n * @category Quaternion Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Quat.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity quaternion\r\n * Equivalent to Quat.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this[0] = 0;\r\n this[1] = 0;\r\n this[2] = 0;\r\n this[3] = 1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies `this` by a {@link Quat}.\r\n * Equivalent to `Quat.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Quat.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Rotates `this` by the given angle about the X axis\r\n * Equivalent to `Quat.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Quat.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Y axis\r\n * Equivalent to `Quat.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Quat.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Z axis\r\n * Equivalent to `Quat.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Quat.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Inverts `this`\r\n * Equivalent to `Quat.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Quat.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales `this` by a scalar number\r\n * Equivalent to `Quat.scale(this, this, scale);`\r\n * @category Methods\r\n *\r\n * @param scale - amount to scale the vector by\r\n * @returns `this`\r\n */\r\n scale(scale: number): QuatLike {\r\n this[0] *= scale;\r\n this[1] *= scale;\r\n this[2] *= scale;\r\n this[3] *= scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of `this` and another {@link Quat}\r\n * Equivalent to `Quat.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - the second operand\r\n * @returns dot product of `this` and b\r\n */\r\n dot(b: Readonly): number {\r\n return Quat.dot(this, b);\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity quat\r\n * @category Static\r\n *\r\n * @returns a new quaternion\r\n */\r\n static create(): Quat {\r\n return new Quat();\r\n }\r\n\r\n /**\r\n * Set a quat to the identity quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a quat from the given angle and rotation axis,\r\n * then returns it.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param axis - the axis around which to rotate\r\n * @param rad - the angle in radians\r\n * @returns `out`\r\n **/\r\n static setAxisAngle(out: QuatLike, axis: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n out[0] = s * axis[0];\r\n out[1] = s * axis[1];\r\n out[2] = s * axis[2];\r\n out[3] = Math.cos(rad);\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the rotation axis and angle for a given\r\n * quaternion. If a quaternion is created with\r\n * setAxisAngle, this method will return the same\r\n * values as provided in the original parameter list\r\n * OR functionally equivalent values.\r\n * Example: The quaternion formed by axis [0, 0, 1] and\r\n * angle -90 is the same as the quaternion formed by\r\n * [0, 0, 1] and 270. This method favors the latter.\r\n * @category Static\r\n *\r\n * @param out_axis - Vector receiving the axis of rotation\r\n * @param q - Quaternion to be decomposed\r\n * @return Angle, in radians, of the rotation\r\n */\r\n static getAxisAngle(out_axis: Vec3Like, q: Readonly): number {\r\n const rad = Math.acos(q[3]) * 2.0;\r\n const s = Math.sin(rad / 2.0);\r\n if (s > GLM_EPSILON) {\r\n out_axis[0] = q[0] / s;\r\n out_axis[1] = q[1] / s;\r\n out_axis[2] = q[2] / s;\r\n } else {\r\n // If s is zero, return any axis (no rotation - axis does not matter)\r\n out_axis[0] = 1;\r\n out_axis[1] = 0;\r\n out_axis[2] = 0;\r\n }\r\n return rad;\r\n }\r\n\r\n /**\r\n * Gets the angular distance between two unit quaternions\r\n * @category Static\r\n *\r\n * @param {ReadonlyQuat} a Origin unit quaternion\r\n * @param {ReadonlyQuat} b Destination unit quaternion\r\n * @return {Number} Angle, in radians, between the two quaternions\r\n */\r\n static getAngle(a: Readonly, b: Readonly): number {\r\n const dotproduct = Quat.dot(a, b);\r\n\r\n return Math.acos(2 * dotproduct * dotproduct - 1);\r\n }\r\n\r\n /**\r\n * Multiplies two quaternions.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const bw = b[3];\r\n\r\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the X axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + aw * bx;\r\n out[1] = ay * bw + az * bx;\r\n out[2] = az * bw - ay * bx;\r\n out[3] = aw * bw - ax * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Y axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const by = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw - az * by;\r\n out[1] = ay * bw + aw * by;\r\n out[2] = az * bw + ax * by;\r\n out[3] = aw * bw - ay * by;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Z axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bz = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + ay * bz;\r\n out[1] = ay * bw - ax * bz;\r\n out[2] = az * bw + aw * bz;\r\n out[3] = aw * bw - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the W component of a quat from the X, Y, and Z components.\r\n * Assumes that quaternion is 1 unit in length.\r\n * Any existing W component will be ignored.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate W component of\r\n * @returns `out`\r\n */\r\n static calculateW(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the exponential of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static exp(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const et = Math.exp(w);\r\n const s = r > 0 ? (et * Math.sin(r)) / r : 0;\r\n\r\n out[0] = x * s;\r\n out[1] = y * s;\r\n out[2] = z * s;\r\n out[3] = et * Math.cos(r);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the natural logarithm of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static ln(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const t = r > 0 ? Math.atan2(r, w) / r : 0;\r\n\r\n out[0] = x * t;\r\n out[1] = y * t;\r\n out[2] = z * t;\r\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the scalar power of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @param b - amount to scale the quaternion by\r\n * @returns `out`\r\n */\r\n static pow(out: QuatLike, a: Readonly, b: number): QuatLike {\r\n Quat.ln(out, a);\r\n Quat.scale(out, out, b);\r\n Quat.exp(out, out);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike {\r\n // benchmarks:\r\n // http://jsperf.com/quaternion-slerp-implementations\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2],\r\n aw = a[3];\r\n let bx = b[0],\r\n by = b[1],\r\n bz = b[2],\r\n bw = b[3];\r\n\r\n let scale0: number;\r\n let scale1: number;\r\n\r\n // calc cosine\r\n let cosom = ax * bx + ay * by + az * bz + aw * bw;\r\n // adjust signs (if necessary)\r\n if (cosom < 0.0) {\r\n cosom = -cosom;\r\n bx = -bx;\r\n by = -by;\r\n bz = -bz;\r\n bw = -bw;\r\n }\r\n // calculate coefficients\r\n if (1.0 - cosom > GLM_EPSILON) {\r\n // standard case (slerp)\r\n const omega = Math.acos(cosom);\r\n const sinom = Math.sin(omega);\r\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\r\n scale1 = Math.sin(t * omega) / sinom;\r\n } else {\r\n // \"from\" and \"to\" quaternions are very close\r\n // ... so we can do a linear interpolation\r\n scale0 = 1.0 - t;\r\n scale1 = t;\r\n }\r\n // calculate final values\r\n out[0] = scale0 * ax + scale1 * bx;\r\n out[1] = scale0 * ay + scale1 * by;\r\n out[2] = scale0 * az + scale1 * bz;\r\n out[3] = scale0 * aw + scale1 * bw;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random unit quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n /* static random(out: QuatLike): QuatLike {\r\n // Implementation of http://planning.cs.uiuc.edu/node198.html\r\n // TODO: Calling random 3 times is probably not the fastest solution\r\n let u1 = glMatrix.RANDOM();\r\n let u2 = glMatrix.RANDOM();\r\n let u3 = glMatrix.RANDOM();\r\n\r\n let sqrt1MinusU1 = Math.sqrt(1 - u1);\r\n let sqrtU1 = Math.sqrt(u1);\r\n\r\n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\r\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\r\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\r\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Calculates the inverse of a quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: QuatLike, a: Readonly): QuatLike {\r\n const a0 = a[0],\r\n a1 = a[1],\r\n a2 = a[2],\r\n a3 = a[3];\r\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\r\n const invDot = dot ? 1.0 / dot : 0;\r\n\r\n // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\r\n\r\n out[0] = -a0 * invDot;\r\n out[1] = -a1 * invDot;\r\n out[2] = -a2 * invDot;\r\n out[3] = a3 * invDot;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a quat\r\n * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given 3x3 rotation matrix.\r\n *\r\n * NOTE: The resultant quaternion is not normalized, so you should be sure\r\n * to re-normalize the quaternion yourself where necessary.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param m - rotation matrix\r\n * @returns `out`\r\n */\r\n static fromMat3(out: QuatLike, m: Readonly): QuatLike {\r\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\r\n // article \"Quaternion Calculus and Fast Animation\".\r\n const fTrace = m[0] + m[4] + m[8];\r\n let fRoot: number;\r\n\r\n if (fTrace > 0.0) {\r\n // |w| > 1/2, may as well choose w > 1/2\r\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\r\n out[3] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot; // 1/(4w)\r\n out[0] = (m[5] - m[7]) * fRoot;\r\n out[1] = (m[6] - m[2]) * fRoot;\r\n out[2] = (m[1] - m[3]) * fRoot;\r\n } else {\r\n // |w| <= 1/2\r\n let i = 0;\r\n if (m[4] > m[0]) { i = 1; }\r\n if (m[8] > m[i * 3 + i]) { i = 2; }\r\n const j = (i + 1) % 3;\r\n const k = (i + 2) % 3;\r\n\r\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\r\n out[i] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot;\r\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\r\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\r\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given euler angle x, y, z.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - Angle to rotate around X axis in degrees.\r\n * @param y - Angle to rotate around Y axis in degrees.\r\n * @param z - Angle to rotate around Z axis in degrees.\r\n * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx.\r\n * @returns `out`\r\n */\r\n static fromEuler(out: QuatLike, x: number, y: number, z: number, order = Quat.#DEFAULT_ANGLE_ORDER): QuatLike {\r\n const halfToRad = (0.5 * Math.PI) / 180.0;\r\n x *= halfToRad;\r\n y *= halfToRad;\r\n z *= halfToRad;\r\n\r\n const sx = Math.sin(x);\r\n const cx = Math.cos(x);\r\n const sy = Math.sin(y);\r\n const cy = Math.cos(y);\r\n const sz = Math.sin(z);\r\n const cz = Math.cos(z);\r\n\r\n switch (order) {\r\n case 'xyz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'xzy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yxz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yzx':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zxy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zyx':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n default:\r\n throw new Error(`Unknown angle order ${order}`);\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a quatenion\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - quaternion to clone\r\n * @returns a new quaternion\r\n */\r\n static clone(a: Readonly): Quat {\r\n return new Quat(a);\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new quaternion\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Quat {\r\n return new Quat(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one quat to another\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the source quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static set(out: QuatLike, x: number, y: number, z: number, w: number): QuatLike { return out; }\r\n\r\n /**\r\n * Adds two {@link Quat}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static add(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Scales a quat by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param b - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: QuatLike, a: Readonly, scale: number): QuatLike {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two quat's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two quat's\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static lerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike { return out; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mag(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quaternion to normalize\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static normalize(out: QuatLike, a: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first quaternion.\r\n * @param b - The second quaternion.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static exactEquals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Returns whether the quaternions have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static equals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Sets a quaternion to represent the shortest rotation from one\r\n * vector to another.\r\n *\r\n * Both vectors are assumed to be unit length.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion.\r\n * @param a - the initial vector\r\n * @param b - the destination vector\r\n * @returns `out`\r\n */\r\n static rotationTo(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const dot = Vec3.dot(a, b);\r\n\r\n if (dot < -0.999999) {\r\n Vec3.cross(Quat.#TMP_VEC3, Quat.#X_UNIT_VEC3, a);\r\n if (Vec3.mag(Quat.#TMP_VEC3) < 0.000001) { Vec3.cross(Quat.#TMP_VEC3, Quat.#Y_UNIT_VEC3, a); }\r\n Vec3.normalize(Quat.#TMP_VEC3, Quat.#TMP_VEC3);\r\n Quat.setAxisAngle(out, Quat.#TMP_VEC3, Math.PI);\r\n return out;\r\n } else if (dot > 0.999999) {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n } else {\r\n Vec3.cross(Quat.#TMP_VEC3, a, b);\r\n out[0] = Quat.#TMP_VEC3[0];\r\n out[1] = Quat.#TMP_VEC3[1];\r\n out[2] = Quat.#TMP_VEC3[2];\r\n out[3] = 1 + dot;\r\n return Quat.normalize(out, out);\r\n }\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static sqlerp(out: QuatLike, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): QuatLike {\r\n Quat.slerp(Quat.#TMP_QUAT1, a, d, t);\r\n Quat.slerp(Quat.#TMP_QUAT2, b, c, t);\r\n Quat.slerp(out, Quat.#TMP_QUAT1, Quat.#TMP_QUAT2, 2 * t * (1 - t));\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets the specified quaternion with values corresponding to the given\r\n * axes. Each axis is a vec3 and is expected to be unit length and\r\n * perpendicular to all other specified axes.\r\n * @category Static\r\n *\r\n * @param out - The receiving quaternion\r\n * @param view - the vector representing the viewing direction\r\n * @param right - the vector representing the local `right` direction\r\n * @param up - the vector representing the local `up` direction\r\n * @returns `out`\r\n */\r\n static setAxes(out: QuatLike, view: Readonly, right: Readonly, up: Readonly): QuatLike {\r\n Quat.#TMP_MAT3[0] = right[0];\r\n Quat.#TMP_MAT3[3] = right[1];\r\n Quat.#TMP_MAT3[6] = right[2];\r\n\r\n Quat.#TMP_MAT3[1] = up[0];\r\n Quat.#TMP_MAT3[4] = up[1];\r\n Quat.#TMP_MAT3[7] = up[2];\r\n\r\n Quat.#TMP_MAT3[2] = -view[0];\r\n Quat.#TMP_MAT3[5] = -view[1];\r\n Quat.#TMP_MAT3[8] = -view[2];\r\n\r\n return Quat.normalize(out, Quat.fromMat3(out, Quat.#TMP_MAT3));\r\n }\r\n}\r\n\r\n// Methods which re-use the Vec4 implementation\r\nQuat.set = Vec4.set;\r\nQuat.add = Vec4.add;\r\nQuat.lerp = Vec4.lerp;\r\nQuat.normalize = Vec4.normalize;\r\nQuat.squaredLength = Vec4.squaredLength;\r\nQuat.sqrLen = Vec4.squaredLength;\r\nQuat.exactEquals = Vec4.exactEquals;\r\nQuat.equals = Vec4.equals;\r\nQuat.magnitude = Vec4.magnitude;\r\n\r\n// Instance method alias assignments\r\nQuat.prototype.mul = Quat.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nQuat.mul = Quat.multiply;\r\nQuat.mag = Quat.magnitude;\r\nQuat.length = Quat.magnitude;\r\nQuat.len = Quat.magnitude;\r\n", "import { Mat4 } from './Mat4.js';\r\nimport { Quat } from './Quat.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Dual Quaternion\r\n */\r\nexport class Quat2 extends Float32Array {\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat2.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT = new Float32Array(4);\r\n static #TMP_VEC3 = new Float32Array(3);\r\n\r\n /**\r\n * Create a {@link Quat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 8:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 8); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v, v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 8);\r\n }\r\n break;\r\n }\r\n default:\r\n super(8);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source dual quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 8 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity {@link Quat2}\r\n * @category Static\r\n *\r\n * @returns a new dual quaternion [real -> rotation, dual -> translation]\r\n */\r\n static create(): Quat2 {\r\n return new Quat2();\r\n }\r\n\r\n /**\r\n * Creates a {@link Quat2} quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to clone\r\n * @returns a new dual quaternion\r\n */\r\n static clone(a: Quat2Like): Quat2 {\r\n return new Quat2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns a new dual quaternion\r\n */\r\n static fromValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2 {\r\n return new Quat2(x1, y1, z1, w1, x2, y2, z2, w2);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} from the given values (quat and translation)\r\n * @category Static\r\n *\r\n * @param x1 - X component (rotation)\r\n * @param y1 - Y component (rotation)\r\n * @param z1 - Z component (rotation)\r\n * @param w1 - W component (rotation)\r\n * @param x2 - X component (translation)\r\n * @param y2 - Y component (translation)\r\n * @param z2 - Z component (translation)\r\n * @returns a new dual quaternion\r\n */\r\n static fromRotationTranslationValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number): Quat2 {\r\n const ax = x2 * 0.5;\r\n const ay = y2 * 0.5;\r\n const az = z2 * 0.5;\r\n\r\n return new Quat2(x1, y1, z1, w1,\r\n ax * w1 + ay * z1 - az * y1,\r\n ay * w1 + az * x1 - ax * z1,\r\n az * w1 + ax * y1 - ay * x1,\r\n -ax * x1 - ay * y1 - az * z1);\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion and a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Quat2Like, q: Readonly, t: Readonly): Quat2Like {\r\n const ax = t[0] * 0.5;\r\n const ay = t[1] * 0.5;\r\n const az = t[2] * 0.5;\r\n const bx = q[0];\r\n const by = q[1];\r\n const bz = q[2];\r\n const bw = q[3];\r\n out[0] = bx;\r\n out[1] = by;\r\n out[2] = bz;\r\n out[3] = bw;\r\n out[4] = ax * bw + ay * bz - az * by;\r\n out[5] = ay * bw + az * bx - ax * bz;\r\n out[6] = az * bw + ax * by - ay * bx;\r\n out[7] = -ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Quat2Like, t: Readonly): Quat2Like {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = t[0] * 0.5;\r\n out[5] = t[1] * 0.5;\r\n out[6] = t[2] * 0.5;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Quat2Like, q: Readonly): Quat2Like {\r\n out[0] = q[0];\r\n out[1] = q[1];\r\n out[2] = q[2];\r\n out[3] = q[3];\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param a - the matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Quat2Like, a: Readonly): Quat2Like {\r\n Mat4.getRotation(Quat2.#TMP_QUAT, a);\r\n Mat4.getTranslation(Quat2.#TMP_VEC3, a);\r\n return Quat2.fromRotationTranslation(out, Quat2.#TMP_QUAT, Quat2.#TMP_VEC3);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Quat2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the source dual quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Quat2} to the identity dual quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns `out`\r\n */\r\n static set(out: Quat2Like, x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2Like {\r\n out[0] = x1;\r\n out[1] = y1;\r\n out[2] = z1;\r\n out[3] = w1;\r\n out[4] = x2;\r\n out[5] = y2;\r\n out[6] = z2;\r\n out[7] = w2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the real part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - real part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getReal(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Gets the dual part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - dual part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getDual(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[4];\r\n out[1] = a[5];\r\n out[2] = a[6];\r\n out[3] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the real component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the real part\r\n * @return `out`\r\n */\r\n static setReal(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Set the dual component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the dual part\r\n * @return `out`\r\n */\r\n static setDual(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[4] = a[0];\r\n out[5] = a[1];\r\n out[6] = a[2];\r\n out[7] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the translation of a normalized {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving translation vector\r\n * @param a - Dual Quaternion to be decomposed\r\n * @return `out`\r\n */\r\n static getTranslation(out: Vec3Like, a: Readonly): Vec3Like {\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Translates a {@link Quat2} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Quat2Like, a: Readonly, v: Readonly): Quat2Like {\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n const bx1 = v[0] * 0.5;\r\n const by1 = v[1] * 0.5;\r\n const bz1 = v[2] * 0.5;\r\n const ax2 = a[4];\r\n const ay2 = a[5];\r\n const az2 = a[6];\r\n const aw2 = a[7];\r\n out[0] = ax1;\r\n out[1] = ay1;\r\n out[2] = az1;\r\n out[3] = aw1;\r\n out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2;\r\n out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2;\r\n out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2;\r\n out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateX(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateY(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateZ(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (a * q)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param q - quaternion to rotate by\r\n * @returns `out`\r\n */\r\n static rotateByQuatAppend(out: Quat2Like, a: Readonly, q: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let ax = a[0];\r\n let ay = a[1];\r\n let az = a[2];\r\n let aw = a[3];\r\n\r\n out[0] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[1] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[2] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[3] = aw * qw - ax * qx - ay * qy - az * qz;\r\n ax = a[4];\r\n ay = a[5];\r\n az = a[6];\r\n aw = a[7];\r\n out[4] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[5] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[6] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[7] = aw * qw - ax * qx - ay * qy - az * qz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (q * a)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param q - quaternion to rotate by\r\n * @param a - the dual quaternion to rotate\r\n * @returns `out`\r\n */\r\n static rotateByQuatPrepend(out: Quat2Like, q: Readonly, a: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let bx = a[0];\r\n let by = a[1];\r\n let bz = a[2];\r\n let bw = a[3];\r\n\r\n out[0] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[1] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[2] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[3] = qw * bw - qx * bx - qy * by - qz * bz;\r\n bx = a[4];\r\n by = a[5];\r\n bz = a[6];\r\n bw = a[7];\r\n out[4] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[5] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[6] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[7] = qw * bw - qx * bx - qy * by - qz * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around a given axis. Does the normalization automatically\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param axis - the axis to rotate around\r\n * @param rad - how far the rotation should be\r\n * @returns `out`\r\n */\r\n static rotateAroundAxis(out: Quat2Like, a: Readonly, axis: Readonly, rad: number): Quat2Like {\r\n // Special case for rad = 0\r\n if (Math.abs(rad) < GLM_EPSILON) {\r\n return Quat2.copy(out, a);\r\n }\r\n const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);\r\n\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n const bx = (s * axis[0]) / axisLength;\r\n const by = (s * axis[1]) / axisLength;\r\n const bz = (s * axis[2]) / axisLength;\r\n const bw = Math.cos(rad);\r\n\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n out[4] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[5] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[6] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[7] = aw * bw - ax * bx - ay * by - az * bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns {quat2} out\r\n */\r\n static multiply(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n const ax0 = a[0];\r\n const ay0 = a[1];\r\n const az0 = a[2];\r\n const aw0 = a[3];\r\n const bx1 = b[4];\r\n const by1 = b[5];\r\n const bz1 = b[6];\r\n const bw1 = b[7];\r\n const ax1 = a[4];\r\n const ay1 = a[5];\r\n const az1 = a[6];\r\n const aw1 = a[7];\r\n const bx0 = b[0];\r\n const by0 = b[1];\r\n const bz0 = b[2];\r\n const bw0 = b[3];\r\n out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0;\r\n out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0;\r\n out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0;\r\n out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0;\r\n out[4] =\r\n ax0 * bw1 +\r\n aw0 * bx1 +\r\n ay0 * bz1 -\r\n az0 * by1 +\r\n ax1 * bw0 +\r\n aw1 * bx0 +\r\n ay1 * bz0 -\r\n az1 * by0;\r\n out[5] =\r\n ay0 * bw1 +\r\n aw0 * by1 +\r\n az0 * bx1 -\r\n ax0 * bz1 +\r\n ay1 * bw0 +\r\n aw1 * by0 +\r\n az1 * bx0 -\r\n ax1 * bz0;\r\n out[6] =\r\n az0 * bw1 +\r\n aw0 * bz1 +\r\n ax0 * by1 -\r\n ay0 * bx1 +\r\n az1 * bw0 +\r\n aw1 * bz0 +\r\n ax1 * by0 -\r\n ay1 * bx0;\r\n out[7] =\r\n aw0 * bw1 -\r\n ax0 * bx1 -\r\n ay0 * by1 -\r\n az0 * bz1 +\r\n aw1 * bw0 -\r\n ax1 * bx0 -\r\n ay1 * by0 -\r\n az1 * bz0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like { return out; }\r\n\r\n /**\r\n * Scales a {@link Quat2} by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaterion\r\n * @param a - the dual quaternion to scale\r\n * @param b - scalar value to scale the dual quaterion by\r\n * @returns `out`\r\n */\r\n static scale(out: Quat2Like, a: Readonly, b: number): Quat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts)\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dot(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Quat2}s\r\n * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quat\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Quat2Like, a: Readonly, b: Readonly, t: number): Quat2Like {\r\n const mt = 1 - t;\r\n if (Quat2.dot(a, b) < 0) { t = -t; }\r\n\r\n out[0] = a[0] * mt + b[0] * t;\r\n out[1] = a[1] * mt + b[1] * t;\r\n out[2] = a[2] * mt + b[2] * t;\r\n out[3] = a[3] * mt + b[3] * t;\r\n out[4] = a[4] * mt + b[4] * t;\r\n out[5] = a[5] * mt + b[5] * t;\r\n out[6] = a[6] * mt + b[6] * t;\r\n out[7] = a[7] * mt + b[7] * t;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: Quat2Like, a: Readonly): Quat2Like {\r\n const sqlen = Quat2.squaredLength(a);\r\n out[0] = -a[0] / sqlen;\r\n out[1] = -a[1] / sqlen;\r\n out[2] = -a[2] / sqlen;\r\n out[3] = a[3] / sqlen;\r\n out[4] = -a[4] / sqlen;\r\n out[5] = -a[5] / sqlen;\r\n out[6] = -a[6] / sqlen;\r\n out[7] = a[7] / sqlen;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than\r\n * {@link Quat2.invert} and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n out[4] = -a[4];\r\n out[5] = -a[5];\r\n out[6] = -a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Quat2Like, a: Readonly): Quat2Like {\r\n let magnitude = Quat2.squaredLength(a);\r\n if (magnitude > 0) {\r\n magnitude = Math.sqrt(magnitude);\r\n\r\n const a0 = a[0] / magnitude;\r\n const a1 = a[1] / magnitude;\r\n const a2 = a[2] / magnitude;\r\n const a3 = a[3] / magnitude;\r\n\r\n const b0 = a[4];\r\n const b1 = a[5];\r\n const b2 = a[6];\r\n const b3 = a[7];\r\n\r\n const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3;\r\n\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n\r\n out[4] = (b0 - a0 * a_dot_b) / magnitude;\r\n out[5] = (b1 - a1 * a_dot_b) / magnitude;\r\n out[6] = (b2 - a2 * a_dot_b) / magnitude;\r\n out[7] = (b3 - a3 * a_dot_b) / magnitude;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat2(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7))\r\n );\r\n }\r\n}\r\n\r\n// Methods which re-use the Quat implementation\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.dot = Quat.dot;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.squaredLength = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.sqrLen = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.mag = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.length = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.len = Quat.magnitude;\r\n\r\n// Static method alias assignments\r\nQuat2.mul = Quat2.multiply;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Mat2dLike, Mat3Like, Mat4Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 2 Dimensional Vector\r\n */\r\nexport class Vec2 extends Float32Array {\r\n /**\r\n * Create a {@link Vec2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 2:{\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, values[1]!]);\r\n } else {\r\n super(v as ArrayBufferLike, values[1], 2);\r\n }\r\n break;\r\n }\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 2);\r\n }\r\n break;\r\n }\r\n default:\r\n super(2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec2.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n return Math.hypot(this[0], this[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec2.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n // Instead of zero(), use a.fill(0) for instances;\r\n\r\n /**\r\n * Adds a {@link Vec2} to `this`.\r\n * Equivalent to `Vec2.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec2} from `this`.\r\n * Equivalent to `Vec2.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec2.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec2.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec2.squaredDistance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec2.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec2.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec2.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec2}.\r\n * Equivalent to `Vec2.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec2.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec2.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 2 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec2}\r\n * @category Static\r\n *\r\n * @returns A new 2D vector\r\n */\r\n static create(): Vec2 {\r\n return new Vec2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - Vector to clone\r\n * @returns A new 2D vector\r\n */\r\n static clone(a: Readonly): Vec2 {\r\n return new Vec2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns A new 2D vector\r\n */\r\n static fromValues(x: number, y: number): Vec2 {\r\n return new Vec2(x, y);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - The source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns `out`\r\n */\r\n static set(out: Vec2Like, x: number, y: number): Vec2Like {\r\n out[0] = x;\r\n out[1] = y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Multiplies two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Divides two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec2} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to scale\r\n * @param b - Amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec2Like, a: Readonly, b: number): Vec2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two Vec2's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param scale - The amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec2Like, a: Readonly, b: Readonly, scale: number): Vec2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns distance between `a` and `b`\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n return Math.hypot(b[0] - a[0], b[1] - a[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Squared distance between `a` and `b`\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return Math.sqrt(x * x + y * y);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate squared length of\r\n * @returns Squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec2Like, a: Readonly) {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec2Like, a: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n let len = x * x + y * y;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Dot product of `a` and `b`\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two {@link Vec2}s\r\n * Note that the cross product must by definition produce a 3D vector.\r\n * For this reason there is also not instance equivalent for this function.\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n const z = a[0] * b[1] - a[1] * b[0];\r\n out[0] = out[1] = 0;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param t - Interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec2Like, a: Readonly, b: Readonly, t: number): Vec2Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y;\r\n out[1] = m[1] * x + m[3] * y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2d}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2d(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y + m[4];\r\n out[1] = m[1] * x + m[3] * y + m[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat3}\r\n * 3rd vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat3(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[3] * y + m[6];\r\n out[1] = m[1] * x + m[4] * y + m[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat4}\r\n * 3rd vector component is implicitly '0'\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat4(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[4] * y + m[12];\r\n out[1] = m[1] * x + m[5] * y + m[13];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 2D vector\r\n * @category Static\r\n *\r\n * @param out - The receiving {@link Vec2}\r\n * @param a - The {@link Vec2} point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotate(out: Vec2Like, a: Readonly, b: Readonly, rad: number): Vec2Like {\r\n // Translate point to the origin\r\n const p0 = a[0] - b[0];\r\n const p1 = a[1] - b[1];\r\n const sinC = Math.sin(rad);\r\n const cosC = Math.cos(rad);\r\n\r\n // perform rotation and translate to correct position\r\n out[0] = p0 * cosC - p1 * sinC + b[0];\r\n out[1] = p0 * sinC + p1 * cosC + b[1];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 2D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly): number {\r\n const x1 = a[0];\r\n const y1 = a[1];\r\n const x2 = b[0];\r\n const y2 = b[1];\r\n // mag is the product of the magnitudes of a and b\r\n const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2);\r\n // mag &&.. short circuits if mag == 0\r\n const cosine = mag && (x1 * x2 + y1 * y2) / mag;\r\n // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to zero\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec2Like): Vec2Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors components are ===, `false` otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors are approximately equal, `false` otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - Vector to represent as a string\r\n * @returns String representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec2.prototype.sub = Vec2.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.mul = Vec2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.div = Vec2.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.dist = Vec2.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.sqrDist = Vec2.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec2.sub = Vec2.subtract;\r\nVec2.mul = Vec2.multiply;\r\nVec2.div = Vec2.divide;\r\nVec2.dist = Vec2.distance;\r\nVec2.sqrDist = Vec2.squaredDistance;\r\nVec2.sqrLen = Vec2.squaredLength;\r\nVec2.mag = Vec2.magnitude;\r\nVec2.length = Vec2.magnitude;\r\nVec2.len = Vec2.magnitude;\r\n", "/**\r\n * To enable additional swizzle accessors for vector classes (32-bit) invoke the {@link EnableSwizzles} function from\r\n * the `gl-matrix/swizzle` sub-path export. To enable ambient module declarations for IDE / Typescript support please\r\n * see {@link gl-matrix/types/swizzle}.\r\n *\r\n * To enable swizzling for the 64-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle/f64}.\r\n *\r\n * @example\r\n * ```ts\r\n * import { Vec3 } from 'gl-matrix';\r\n * import { EnableSwizzles } from 'gl-matrix/swizzle';\r\n *\r\n * EnableSwizzles();\r\n *\r\n * const vec = new Vec3(0, 1, 2);\r\n * const vecSwizzled = vec.zyx; // Returns a new Vec3(2, 1, 0).\r\n * ```\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\nimport { Vec2, Vec3, Vec4 } from '#gl-matrix';\r\n\r\n/**\r\n * Internal `gl-matrix` variable tracking if swizzling is enabled (32-bit).\r\n */\r\nlet GLM_SWIZZLES_ENABLED_F32 = false;\r\n\r\n/**\r\n * Enables Swizzle operations on {@link gl-matrix.Vec2 | Vec2} / {@link gl-matrix.Vec3 | Vec3} /\r\n * {@link gl-matrix.Vec4 | Vec4} types from {@link gl-matrix | gl-matrix} (32-bit).\r\n *\r\n * Swizzle operations are performed by using the `.` operator in conjunction with any combination\r\n * of between two and four component names, either from the set `xyzw` or `rgbw` (though not intermixed).\r\n * They return a new vector with the same number of components as specified in the swizzle attribute.\r\n *\r\n * @example\r\n * ```js\r\n * import { Vec3, EnableSwizzles } from 'gl-matrix';\r\n *\r\n * EnableSwizzles();\r\n *\r\n * let v = new Vec3(0, 1, 2);\r\n *\r\n * v.yx; // returns new Vec2(1, 0)\r\n * v.xzy; // returns new Vec3(0, 2, 1)\r\n * v.zyxz; // returns new Vec4(2, 1, 0, 2)\r\n *\r\n * v.rgb; // returns new Vec3(0, 1, 2)\r\n * v.rbg; // returns new Vec3(0, 2, 1)\r\n * v.gg; // returns new Vec2(1, 1)\r\n * ```\r\n */\r\nexport function EnableSwizzles(): void {\r\n /* v8 ignore next 1 */\r\n if (GLM_SWIZZLES_ENABLED_F32) { return; }\r\n\r\n /* eslint-disable comma-spacing, max-len */\r\n\r\n // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should\r\n // not be modified by hand.\r\n // [Swizzle Autogen]\r\n\r\n const VEC2_SWIZZLES = ['xx','xy','yx','yy','xxx','xxy','xyx','xyy','yxx','yxy','yyx','yyy','xxxx','xxxy','xxyx','xxyy','xyxx','xyxy','xyyx','xyyy','yxxx','yxxy','yxyx','yxyy','yyxx','yyxy','yyyx','yyyy','rr','rg','gr','gg','rrr','rrg','rgr','rgg','grr','grg','ggr','ggg','rrrr','rrrg','rrgr','rrgg','rgrr','rgrg','rggr','rggg','grrr','grrg','grgr','grgg','ggrr','ggrg','gggr','gggg'];\r\n const VEC3_SWIZZLES = ['xz','yz','zx','zy','zz','xxz','xyz','xzx','xzy','xzz','yxz','yyz','yzx','yzy','yzz','zxx','zxy','zxz','zyx','zyy','zyz','zzx','zzy','zzz','xxxz','xxyz','xxzx','xxzy','xxzz','xyxz','xyyz','xyzx','xyzy','xyzz','xzxx','xzxy','xzxz','xzyx','xzyy','xzyz','xzzx','xzzy','xzzz','yxxz','yxyz','yxzx','yxzy','yxzz','yyxz','yyyz','yyzx','yyzy','yyzz','yzxx','yzxy','yzxz','yzyx','yzyy','yzyz','yzzx','yzzy','yzzz','zxxx','zxxy','zxxz','zxyx','zxyy','zxyz','zxzx','zxzy','zxzz','zyxx','zyxy','zyxz','zyyx','zyyy','zyyz','zyzx','zyzy','zyzz','zzxx','zzxy','zzxz','zzyx','zzyy','zzyz','zzzx','zzzy','zzzz','rb','gb','br','bg','bb','rrb','rgb','rbr','rbg','rbb','grb','ggb','gbr','gbg','gbb','brr','brg','brb','bgr','bgg','bgb','bbr','bbg','bbb','rrrb','rrgb','rrbr','rrbg','rrbb','rgrb','rggb','rgbr','rgbg','rgbb','rbrr','rbrg','rbrb','rbgr','rbgg','rbgb','rbbr','rbbg','rbbb','grrb','grgb','grbr','grbg','grbb','ggrb','gggb','ggbr','ggbg','ggbb','gbrr','gbrg','gbrb','gbgr','gbgg','gbgb','gbbr','gbbg','gbbb','brrr','brrg','brrb','brgr','brgg','brgb','brbr','brbg','brbb','bgrr','bgrg','bgrb','bggr','bggg','bggb','bgbr','bgbg','bgbb','bbrr','bbrg','bbrb','bbgr','bbgg','bbgb','bbbr','bbbg','bbbb'];\r\n const VEC4_SWIZZLES = ['xw','yw','zw','wx','wy','wz','ww','xxw','xyw','xzw','xwx','xwy','xwz','xww','yxw','yyw','yzw','ywx','ywy','ywz','yww','zxw','zyw','zzw','zwx','zwy','zwz','zww','wxx','wxy','wxz','wxw','wyx','wyy','wyz','wyw','wzx','wzy','wzz','wzw','wwx','wwy','wwz','www','xxxw','xxyw','xxzw','xxwx','xxwy','xxwz','xxww','xyxw','xyyw','xyzw','xywx','xywy','xywz','xyww','xzxw','xzyw','xzzw','xzwx','xzwy','xzwz','xzww','xwxx','xwxy','xwxz','xwxw','xwyx','xwyy','xwyz','xwyw','xwzx','xwzy','xwzz','xwzw','xwwx','xwwy','xwwz','xwww','yxxw','yxyw','yxzw','yxwx','yxwy','yxwz','yxww','yyxw','yyyw','yyzw','yywx','yywy','yywz','yyww','yzxw','yzyw','yzzw','yzwx','yzwy','yzwz','yzww','ywxx','ywxy','ywxz','ywxw','ywyx','ywyy','ywyz','ywyw','ywzx','ywzy','ywzz','ywzw','ywwx','ywwy','ywwz','ywww','zxxw','zxyw','zxzw','zxwx','zxwy','zxwz','zxww','zyxw','zyyw','zyzw','zywx','zywy','zywz','zyww','zzxw','zzyw','zzzw','zzwx','zzwy','zzwz','zzww','zwxx','zwxy','zwxz','zwxw','zwyx','zwyy','zwyz','zwyw','zwzx','zwzy','zwzz','zwzw','zwwx','zwwy','zwwz','zwww','wxxx','wxxy','wxxz','wxxw','wxyx','wxyy','wxyz','wxyw','wxzx','wxzy','wxzz','wxzw','wxwx','wxwy','wxwz','wxww','wyxx','wyxy','wyxz','wyxw','wyyx','wyyy','wyyz','wyyw','wyzx','wyzy','wyzz','wyzw','wywx','wywy','wywz','wyww','wzxx','wzxy','wzxz','wzxw','wzyx','wzyy','wzyz','wzyw','wzzx','wzzy','wzzz','wzzw','wzwx','wzwy','wzwz','wzww','wwxx','wwxy','wwxz','wwxw','wwyx','wwyy','wwyz','wwyw','wwzx','wwzy','wwzz','wwzw','wwwx','wwwy','wwwz','wwww','ra','ga','ba','ar','ag','ab','aa','rra','rga','rba','rar','rag','rab','raa','gra','gga','gba','gar','gag','gab','gaa','bra','bga','bba','bar','bag','bab','baa','arr','arg','arb','ara','agr','agg','agb','aga','abr','abg','abb','aba','aar','aag','aab','aaa','rrra','rrga','rrba','rrar','rrag','rrab','rraa','rgra','rgga','rgba','rgar','rgag','rgab','rgaa','rbra','rbga','rbba','rbar','rbag','rbab','rbaa','rarr','rarg','rarb','rara','ragr','ragg','ragb','raga','rabr','rabg','rabb','raba','raar','raag','raab','raaa','grra','grga','grba','grar','grag','grab','graa','ggra','ggga','ggba','ggar','ggag','ggab','ggaa','gbra','gbga','gbba','gbar','gbag','gbab','gbaa','garr','garg','garb','gara','gagr','gagg','gagb','gaga','gabr','gabg','gabb','gaba','gaar','gaag','gaab','gaaa','brra','brga','brba','brar','brag','brab','braa','bgra','bgga','bgba','bgar','bgag','bgab','bgaa','bbra','bbga','bbba','bbar','bbag','bbab','bbaa','barr','barg','barb','bara','bagr','bagg','bagb','baga','babr','babg','babb','baba','baar','baag','baab','baaa','arrr','arrg','arrb','arra','argr','argg','argb','arga','arbr','arbg','arbb','arba','arar','arag','arab','araa','agrr','agrg','agrb','agra','aggr','aggg','aggb','agga','agbr','agbg','agbb','agba','agar','agag','agab','agaa','abrr','abrg','abrb','abra','abgr','abgg','abgb','abga','abbr','abbg','abbb','abba','abar','abag','abab','abaa','aarr','aarg','aarb','aara','aagr','aagg','aagb','aaga','aabr','aabg','aabb','aaba','aaar','aaag','aaab','aaaa'];\r\n\r\n // [/Swizzle Autogen]\r\n\r\n /* eslint-enable comma-spacing, max-len */\r\n\r\n /**\r\n * Internal swizzle index table for `gl-matrix`.\r\n */\r\n const SWIZZLE_INDEX: Record = {\r\n x: 0, r: 0,\r\n y: 1, g: 1,\r\n z: 2, b: 2,\r\n w: 3, a: 3,\r\n };\r\n\r\n /**\r\n * Internal helper function to convert and return a `gl-matrix` vector by swizzle format.\r\n *\r\n * @param swizzle - Swizzle format to apply.\r\n * @returns {Vec2 | Vec3 | Vec4} New swizzled vector instance.\r\n */\r\n function getSwizzleImpl(swizzle: string): () => Vec2 | Vec3 | Vec4 {\r\n switch (swizzle.length) {\r\n case 2:\r\n return function(this: Float32Array) {\r\n return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]);\r\n };\r\n case 3:\r\n return function(this: Float32Array) {\r\n return new Vec3(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]]);\r\n };\r\n case 4:\r\n return function(this: Float32Array) {\r\n return new Vec4(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]], this[SWIZZLE_INDEX[swizzle[3]]]);\r\n };\r\n }\r\n\r\n throw new Error('Illegal swizzle length');\r\n }\r\n\r\n for (const swizzle of VEC2_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec2.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC3_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC4_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n GLM_SWIZZLES_ENABLED_F32 = true;\r\n}\r\n", "/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_DEG_TO_RAD: number = Math.PI / 180;\r\n\r\n/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_RAD_TO_DEG: number = 180 / Math.PI;\r\n\r\n/**\r\n * Convert `radians` to `degrees`.\r\n *\r\n * @param value - Angle in `radians`.\r\n * @returns Angle in `degrees`.\r\n */\r\nexport function toDegree(value: number): number {\r\n return value * GLM_RAD_TO_DEG;\r\n}\r\n\r\n/**\r\n * Convert `degrees` to `radians`.\r\n *\r\n * @param value - Angle in `degrees`.\r\n * @returns Angle in `radians`.\r\n */\r\nexport function toRadian(value: number): number {\r\n return value * GLM_DEG_TO_RAD;\r\n}\r\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSO,IAAM,cAAc;;;ACFpB,IAAM,OAAN,MAAM,cAAa,aAAa;AAAA,EACrC,OAAO,gBAAgB,IAAI,aAAa;AAAA,IACtC;AAAA,IAAG;AAAA,IACH;AAAA,IAAG;AAAA,EACL,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOD,eAAe,QAAoE;AACjF,YA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AAK,WAAW,SAAS;AAAA,MAC7C,KAAK;AAAA,IACP,CAAC;AACD,WAAO,eAAe,KAAK,WAAW,SAAS;AAAA,MAC7C,KAAK;AAAA,IACP,CAAC;AACD,WAAO,eAAe,KAAK,WAAW,SAAS;AAAA,MAC7C,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAEA,aAAW,WAAW,eAAe;AACnC,UAAM,OAAO,eAAe,OAAO;AACnC,WAAO,eAAe,KAAK,WAAW,SAAS;AAAA,MAC7C,KAAK;AAAA,IACP,CAAC;AACD,WAAO,eAAe,KAAK,WAAW,SAAS;AAAA,MAC7C,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAEA,aAAW,WAAW,eAAe;AACnC,UAAM,OAAO,eAAe,OAAO;AACnC,WAAO,eAAe,KAAK,WAAW,SAAS;AAAA,MAC7C,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAEA,6BAA2B;AAC7B;;;ACxIA,IAAM,iBAAyB,KAAK,KAAK;AAKzC,IAAM,iBAAyB,MAAM,KAAK;AAQnC,SAAS,SAAS,OAAuB;AAC9C,SAAO,QAAQ;AACjB;AAQO,SAAS,SAAS,OAAuB;AAC9C,SAAO,QAAQ;AACjB;", + "names": [] +} diff --git a/dist-cdn/cjs/2022/gl-matrix-f32.min.cjs b/dist-cdn/cjs/2022/gl-matrix-f32.min.cjs new file mode 100644 index 00000000..f08aff8e --- /dev/null +++ b/dist-cdn/cjs/2022/gl-matrix-f32.min.cjs @@ -0,0 +1,6 @@ +// gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library. +// @author Brandon Jones +// @author Colin MacKenzie IV +// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md) +var $=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var u=(h,e)=>{for(var t in e)$(h,t,{get:e[t],enumerable:!0})},_=(h,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of K(e))!v.call(h,s)&&s!==t&&$(h,s,{get:()=>e[s],enumerable:!(n=J(e,s))||n.enumerable});return h};var ee=h=>_($({},"__esModule",{value:!0}),h);var ie={};u(ie,{EnableSwizzles:()=>te,Mat2:()=>Y,Mat2d:()=>j,Mat3:()=>Z,Mat4:()=>P,Quat:()=>S,Quat2:()=>O,Vec2:()=>B,Vec3:()=>q,Vec4:()=>E,mat2:()=>Y,mat2d:()=>j,mat3:()=>Z,mat4:()=>P,quat:()=>S,quat2:()=>O,toDegree:()=>re,toRadian:()=>ae,vec2:()=>B,vec3:()=>q,vec4:()=>E});module.exports=ee(ie);var Y=class h extends Float32Array{static#t=new Float32Array([1,0,0,1]);constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t]):super(t,0,4);break;default:super(h.#t);break}}get str(){return h.str(this)}copy(e){return this.set(e),this}identity(){return this.set(h.#t),this}multiply(e){return h.multiply(this,this,e)}mul(e){return this}transpose(){return h.transpose(this,this)}invert(){return h.invert(this,this)}scale(e){return h.scale(this,this,e)}rotate(e){return h.rotate(this,this,e)}static get BYTE_LENGTH(){return 4*Float32Array.BYTES_PER_ELEMENT}static create(){return new h}static clone(e){return new h(e)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static fromValues(...e){return new h(...e)}static set(e,...t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}static transpose(e,t){if(e===t){let n=t[1];e[1]=t[2],e[2]=n}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*a-r*s;return i?(i=1/i,e[0]=a*i,e[1]=-s*i,e[2]=-r*i,e[3]=n*i,e):null}static adjoint(e,t){let n=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=n,e}static determinant(e){return e[0]*e[3]-e[2]*e[1]}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*c+a*y,e[1]=r*c+i*y,e[2]=s*L+a*k,e[3]=r*L+i*k,e}static mul(e,t,n){return e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+a*c,e[1]=r*y+i*c,e[2]=s*-c+a*y,e[3]=r*-c+i*y,e}static scale(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1];return e[0]=s*c,e[1]=r*c,e[2]=a*y,e[3]=i*y,e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=-n,e[3]=s,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3])}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e}static LDU(e,t,n,s){return e[2]=s[2]/s[0],n[0]=s[0],n[1]=s[1],n[3]=s[3]-e[2]*n[1],[e,t,n]}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=t[0],c=t[1],y=t[2],L=t[3];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(a-L)<=1e-6*Math.max(1,Math.abs(a),Math.abs(L))}static str(e){return`Mat2(${e.join(", ")})`}};Y.prototype.mul=Y.prototype.multiply;Y.mul=Y.multiply;Y.sub=Y.subtract;var j=class h extends Float32Array{static#t=new Float32Array([1,0,0,1,0,0]);constructor(...e){switch(e.length){case 6:super(e);break;case 2:super(e[0],e[1],6);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t,t,t]):super(t,0,6);break;default:super(h.#t);break}}get str(){return h.str(this)}copy(e){return this.set(e),this}identity(){return this.set(h.#t),this}multiply(e){return h.multiply(this,this,e)}mul(e){return this}translate(e){return h.translate(this,this,e)}rotate(e){return h.rotate(this,this,e)}scale(e){return h.scale(this,this,e)}static get BYTE_LENGTH(){return 6*Float32Array.BYTES_PER_ELEMENT}static create(){return new h}static clone(e){return new h(e)}static copy(e,t){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}static fromValues(...e){return new h(...e)}static set(e,...t){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}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=n*a-s*r;return y?(y=1/y,e[0]=a*y,e[1]=-s*y,e[2]=-r*y,e[3]=n*y,e[4]=(r*c-a*i)*y,e[5]=(s*i-n*c)*y,e):null}static determinant(e){return e[0]*e[3]-e[1]*e[2]}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1],l=n[2],b=n[3],M=n[4],d=n[5];return e[0]=s*L+a*k,e[1]=r*L+i*k,e[2]=s*l+a*b,e[3]=r*l+i*b,e[4]=s*M+a*d+c,e[5]=r*M+i*d+y,e}static mul(e,t,n){return e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=s*L+a*k+c,e[5]=r*L+i*k+y,e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=Math.sin(n),k=Math.cos(n);return e[0]=s*k+a*L,e[1]=r*k+i*L,e[2]=s*-L+a*k,e[3]=r*-L+i*k,e[4]=c,e[5]=y,e}static scale(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1];return e[0]=s*L,e[1]=r*L,e[2]=a*k,e[3]=i*k,e[4]=c,e[5]=y,e}static fromTranslation(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0],e[5]=t[1],e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=-n,e[3]=s,e[4]=0,e[5]=0,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e[4]=0,e[5]=0,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+1)}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=t[0],L=t[1],k=t[2],l=t[3],b=t[4],M=t[5];return Math.abs(n-y)<=1e-6*Math.max(1,Math.abs(n),Math.abs(y))&&Math.abs(s-L)<=1e-6*Math.max(1,Math.abs(s),Math.abs(L))&&Math.abs(r-k)<=1e-6*Math.max(1,Math.abs(r),Math.abs(k))&&Math.abs(a-l)<=1e-6*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(i-b)<=1e-6*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(c-M)<=1e-6*Math.max(1,Math.abs(c),Math.abs(M))}static str(e){return`Mat2d(${e.join(", ")})`}};j.mul=j.multiply;j.sub=j.subtract;var Z=class h extends Float32Array{static#t=new Float32Array([1,0,0,0,1,0,0,0,1]);constructor(...e){switch(e.length){case 9:super(e);break;case 2:super(e[0],e[1],9);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t,t,t,t,t,t]):super(t,0,9);break;default:super(h.#t);break}}get str(){return h.str(this)}copy(e){return this.set(e),this}identity(){return this.set(h.#t),this}multiply(e){return h.multiply(this,this,e)}mul(e){return this}transpose(){return h.transpose(this,this)}invert(){return h.invert(this,this)}translate(e){return h.translate(this,this,e)}rotate(e){return h.rotate(this,this,e)}scale(e){return h.scale(this,this,e)}static get BYTE_LENGTH(){return 9*Float32Array.BYTES_PER_ELEMENT}static create(){return new h}static clone(e){return new h(e)}static copy(e,t){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}static fromValues(...e){return new h(...e)}static set(e,...t){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}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static transpose(e,t){if(e===t){let n=t[1],s=t[2],r=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=s,e[7]=r}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=k*i-c*L,b=-k*a+c*y,M=L*a-i*y,d=n*l+s*b+r*M;return d?(d=1/d,e[0]=l*d,e[1]=(-k*s+r*L)*d,e[2]=(c*s-r*i)*d,e[3]=b*d,e[4]=(k*n-r*y)*d,e[5]=(-c*n+r*a)*d,e[6]=M*d,e[7]=(-L*n+s*y)*d,e[8]=(i*n-s*a)*d,e):null}static adjoint(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8];return e[0]=i*k-c*L,e[1]=r*L-s*k,e[2]=s*c-r*i,e[3]=c*y-a*k,e[4]=n*k-r*y,e[5]=r*a-n*c,e[6]=a*L-i*y,e[7]=s*y-n*L,e[8]=n*i-s*a,e}static determinant(e){let t=e[0],n=e[1],s=e[2],r=e[3],a=e[4],i=e[5],c=e[6],y=e[7],L=e[8];return t*(L*a-i*y)+n*(-L*r+i*c)+s*(y*r-a*c)}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],b=n[0],M=n[1],d=n[2];return e[0]=b*s+M*i+d*L,e[1]=b*r+M*c+d*k,e[2]=b*a+M*y+d*l,b=n[3],M=n[4],d=n[5],e[3]=b*s+M*i+d*L,e[4]=b*r+M*c+d*k,e[5]=b*a+M*y+d*l,b=n[6],M=n[7],d=n[8],e[6]=b*s+M*i+d*L,e[7]=b*r+M*c+d*k,e[8]=b*a+M*y+d*l,e}static mul(e,t,n){return e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],b=n[0],M=n[1];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=c,e[5]=y,e[6]=b*s+M*i+L,e[7]=b*r+M*c+k,e[8]=b*a+M*y+l,e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],b=Math.sin(n),M=Math.cos(n);return e[0]=M*s+b*i,e[1]=M*r+b*c,e[2]=M*a+b*y,e[3]=M*i-b*s,e[4]=M*c-b*r,e[5]=M*y-b*a,e[6]=L,e[7]=k,e[8]=l,e}static scale(e,t,n){let s=n[0],r=n[1];return e[0]=s*t[0],e[1]=s*t[1],e[2]=s*t[2],e[3]=r*t[3],e[4]=r*t[4],e[5]=r*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}static fromTranslation(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=0,e[3]=-n,e[4]=s,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static fromMat2d(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}static fromQuat(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n+n,c=s+s,y=r+r,L=n*i,k=s*i,l=s*c,b=r*i,M=r*c,d=r*y,m=a*i,o=a*c,x=a*y;return e[0]=1-l-d,e[3]=k-x,e[6]=b+o,e[1]=k+x,e[4]=1-L-d,e[7]=M-m,e[2]=b-o,e[5]=M+m,e[8]=1-L-l,e}static fromMat4(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}static normalFromMat4(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],b=t[10],M=t[11],d=t[12],m=t[13],o=t[14],x=t[15],z=n*c-s*i,R=n*y-r*i,g=n*L-a*i,w=s*y-r*c,V=s*L-a*c,T=r*L-a*y,A=k*m-l*d,D=k*o-b*d,f=k*x-M*d,I=l*o-b*m,F=l*x-M*m,N=b*x-M*o,Q=z*N-R*F+g*I+w*f-V*D+T*A;return Q?(Q=1/Q,e[0]=(c*N-y*F+L*I)*Q,e[1]=(y*f-i*N-L*D)*Q,e[2]=(i*F-c*f+L*A)*Q,e[3]=(r*F-s*N-a*I)*Q,e[4]=(n*N-r*f+a*D)*Q,e[5]=(s*f-n*F-a*A)*Q,e[6]=(m*T-o*V+x*w)*Q,e[7]=(o*g-d*T-x*R)*Q,e[8]=(d*V-m*g+x*z)*Q,e):null}static normalFromMat4Fast(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=i*k-k*L,e[1]=c*y-y*k,e[2]=a*L-L*y,e[3]=L*r-k*s,e[4]=k*n-y*r,e[5]=y*s-L*n,e[6]=s*c-r*i,e[7]=r*a-n*c,e[8]=n*i-s*a,e}static projection(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8])}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e[6]=t[6]+n[6]*s,e[7]=t[7]+n[7]*s,e[8]=t[8]+n[8]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=e[8],l=t[0],b=t[1],M=t[2],d=t[3],m=t[4],o=t[5],x=t[6],z=t[7],R=t[8];return Math.abs(n-l)<=1e-6*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(s-b)<=1e-6*Math.max(1,Math.abs(s),Math.abs(b))&&Math.abs(r-M)<=1e-6*Math.max(1,Math.abs(r),Math.abs(M))&&Math.abs(a-d)<=1e-6*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(i-m)<=1e-6*Math.max(1,Math.abs(i),Math.abs(m))&&Math.abs(c-o)<=1e-6*Math.max(1,Math.abs(c),Math.abs(o))&&Math.abs(y-x)<=1e-6*Math.max(1,Math.abs(y),Math.abs(x))&&Math.abs(L-z)<=1e-6*Math.max(1,Math.abs(L),Math.abs(z))&&Math.abs(k-R)<=1e-6*Math.max(1,Math.abs(k),Math.abs(R))}static str(e){return`Mat3(${e.join(", ")})`}};Z.prototype.mul=Z.prototype.multiply;Z.mul=Z.multiply;Z.sub=Z.subtract;var P=class h extends Float32Array{static#t=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);static#e=new Float32Array(3);constructor(...e){switch(e.length){case 16:super(e);break;case 2:super(e[0],e[1],16);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t]):super(t,0,16);break;default:super(h.#t);break}}get str(){return h.str(this)}copy(e){return this.set(e),this}identity(){return this.set(h.#t),this}multiply(e){return h.multiply(this,this,e)}mul(e){return this}transpose(){return h.transpose(this,this)}invert(){return h.invert(this,this)}translate(e){return h.translate(this,this,e)}rotate(e,t){return h.rotate(this,this,e,t)}scale(e){return h.scale(this,this,e)}rotateX(e){return h.rotateX(this,this,e)}rotateY(e){return h.rotateY(this,this,e)}rotateZ(e){return h.rotateZ(this,this,e)}perspectiveNO(e,t,n,s){return h.perspectiveNO(this,e,t,n,s)}perspectiveZO(e,t,n,s){return h.perspectiveZO(this,e,t,n,s)}orthoNO(e,t,n,s,r,a){return h.orthoNO(this,e,t,n,s,r,a)}orthoZO(e,t,n,s,r,a){return h.orthoZO(this,e,t,n,s,r,a)}static get BYTE_LENGTH(){return 16*Float32Array.BYTES_PER_ELEMENT}static create(){return new h}static clone(e){return new h(e)}static copy(e,t){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}static fromValues(...e){return new h(...e)}static set(e,...t){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}static identity(e){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}static transpose(e,t){if(e===t){let n=t[1],s=t[2],r=t[3],a=t[6],i=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=s,e[9]=a,e[11]=t[14],e[12]=r,e[13]=i,e[14]=c}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],b=t[10],M=t[11],d=t[12],m=t[13],o=t[14],x=t[15],z=n*c-s*i,R=n*y-r*i,g=n*L-a*i,w=s*y-r*c,V=s*L-a*c,T=r*L-a*y,A=k*m-l*d,D=k*o-b*d,f=k*x-M*d,I=l*o-b*m,F=l*x-M*m,N=b*x-M*o,Q=z*N-R*F+g*I+w*f-V*D+T*A;return Q?(Q=1/Q,e[0]=(c*N-y*F+L*I)*Q,e[1]=(r*F-s*N-a*I)*Q,e[2]=(m*T-o*V+x*w)*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*D-b*f}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],b=t[9],M=t[10],d=t[11],m=t[12],o=t[13],x=t[14],z=t[15],R=n[0],g=n[1],w=n[2],V=n[3];return e[0]=R*s+g*c+w*l+V*m,e[1]=R*r+g*y+w*b+V*o,e[2]=R*a+g*L+w*M+V*x,e[3]=R*i+g*k+w*d+V*z,R=n[4],g=n[5],w=n[6],V=n[7],e[4]=R*s+g*c+w*l+V*m,e[5]=R*r+g*y+w*b+V*o,e[6]=R*a+g*L+w*M+V*x,e[7]=R*i+g*k+w*d+V*z,R=n[8],g=n[9],w=n[10],V=n[11],e[8]=R*s+g*c+w*l+V*m,e[9]=R*r+g*y+w*b+V*o,e[10]=R*a+g*L+w*M+V*x,e[11]=R*i+g*k+w*d+V*z,R=n[12],g=n[13],w=n[14],V=n[15],e[12]=R*s+g*c+w*l+V*m,e[13]=R*r+g*y+w*b+V*o,e[14]=R*a+g*L+w*M+V*x,e[15]=R*i+g*k+w*d+V*z,e}static mul(e,t,n){return e}static translate(e,t,n){let s=n[0],r=n[1],a=n[2];if(t===e)e[12]=t[0]*s+t[4]*r+t[8]*a+t[12],e[13]=t[1]*s+t[5]*r+t[9]*a+t[13],e[14]=t[2]*s+t[6]*r+t[10]*a+t[14],e[15]=t[3]*s+t[7]*r+t[11]*a+t[15];else{let i=t[0],c=t[1],y=t[2],L=t[3],k=t[4],l=t[5],b=t[6],M=t[7],d=t[8],m=t[9],o=t[10],x=t[11];e[0]=i,e[1]=c,e[2]=y,e[3]=L,e[4]=k,e[5]=l,e[6]=b,e[7]=M,e[8]=d,e[9]=m,e[10]=o,e[11]=x,e[12]=i*s+k*r+d*a+t[12],e[13]=c*s+l*r+m*a+t[13],e[14]=y*s+b*r+o*a+t[14],e[15]=L*s+M*r+x*a+t[15]}return e}static scale(e,t,n){let s=n[0],r=n[1],a=n[2];return e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e[3]=t[3]*s,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}static rotate(e,t,n,s){let r=s[0],a=s[1],i=s[2],c=Math.sqrt(r*r+a*a+i*i);if(c<1e-6)return null;c=1/c,r*=c,a*=c,i*=c;let y=Math.sin(n),L=Math.cos(n),k=1-L,l=t[0],b=t[1],M=t[2],d=t[3],m=t[4],o=t[5],x=t[6],z=t[7],R=t[8],g=t[9],w=t[10],V=t[11],T=r*r*k+L,A=a*r*k+i*y,D=i*r*k-a*y,f=r*a*k-i*y,I=a*a*k+L,F=i*a*k+r*y,N=r*i*k+a*y,Q=a*i*k-r*y,G=i*i*k+L;return e[0]=l*T+m*A+R*D,e[1]=b*T+o*A+g*D,e[2]=M*T+x*A+w*D,e[3]=d*T+z*A+V*D,e[4]=l*f+m*I+R*F,e[5]=b*f+o*I+g*F,e[6]=M*f+x*I+w*F,e[7]=d*f+z*I+V*F,e[8]=l*N+m*Q+R*G,e[9]=b*N+o*Q+g*G,e[10]=M*N+x*Q+w*G,e[11]=d*N+z*Q+V*G,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e}static rotateX(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[4],i=t[5],c=t[6],y=t[7],L=t[8],k=t[9],l=t[10],b=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*r+L*s,e[5]=i*r+k*s,e[6]=c*r+l*s,e[7]=y*r+b*s,e[8]=L*r-a*s,e[9]=k*r-i*s,e[10]=l*r-c*s,e[11]=b*r-y*s,e}static rotateY(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[0],i=t[1],c=t[2],y=t[3],L=t[8],k=t[9],l=t[10],b=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*r-L*s,e[1]=i*r-k*s,e[2]=c*r-l*s,e[3]=y*r-b*s,e[8]=a*s+L*r,e[9]=i*s+k*r,e[10]=c*s+l*r,e[11]=y*s+b*r,e}static rotateZ(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[0],i=t[1],c=t[2],y=t[3],L=t[4],k=t[5],l=t[6],b=t[7];return t!==e&&(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[0]=a*r+L*s,e[1]=i*r+k*s,e[2]=c*r+l*s,e[3]=y*r+b*s,e[4]=L*r-a*s,e[5]=k*r-i*s,e[6]=l*r-c*s,e[7]=b*r-y*s,e}static fromTranslation(e,t){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]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromRotation(e,t,n){let s=n[0],r=n[1],a=n[2],i=Math.sqrt(s*s+r*r+a*a);if(i<1e-6)return null;i=1/i,s*=i,r*=i,a*=i;let c=Math.sin(t),y=Math.cos(t),L=1-y;return e[0]=s*s*L+y,e[1]=r*s*L+a*c,e[2]=a*s*L-r*c,e[3]=0,e[4]=s*r*L-a*c,e[5]=r*r*L+y,e[6]=a*r*L+s*c,e[7]=0,e[8]=s*a*L+r*c,e[9]=r*a*L-s*c,e[10]=a*a*L+y,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromXRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=n,e[7]=0,e[8]=0,e[9]=-n,e[10]=s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromYRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromZRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=0,e[3]=0,e[4]=-n,e[5]=s,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}static fromRotationTranslation(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=s+s,y=r+r,L=a+a,k=s*c,l=s*y,b=s*L,M=r*y,d=r*L,m=a*L,o=i*c,x=i*y,z=i*L;return e[0]=1-(M+m),e[1]=l+z,e[2]=b-x,e[3]=0,e[4]=l-z,e[5]=1-(k+m),e[6]=d+o,e[7]=0,e[8]=b+x,e[9]=d-o,e[10]=1-(k+M),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}static fromQuat2(e,t){let n=-t[0],s=-t[1],r=-t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=n*n+s*s+r*r+a*a;return k>0?(h.#e[0]=(i*a+L*n+c*r-y*s)*2/k,h.#e[1]=(c*a+L*s+y*n-i*r)*2/k,h.#e[2]=(y*a+L*r+i*s-c*n)*2/k):(h.#e[0]=(i*a+L*n+c*r-y*s)*2,h.#e[1]=(c*a+L*s+y*n-i*r)*2,h.#e[2]=(y*a+L*r+i*s-c*n)*2),h.fromRotationTranslation(e,t,h.#e),e}static normalFromMat4(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],b=t[10],M=t[11],d=t[12],m=t[13],o=t[14],x=t[15],z=n*c-s*i,R=n*y-r*i,g=n*L-a*i,w=s*y-r*c,V=s*L-a*c,T=r*L-a*y,A=k*m-l*d,D=k*o-b*d,f=k*x-M*d,I=l*o-b*m,F=l*x-M*m,N=b*x-M*o,Q=z*N-R*F+g*I+w*f-V*D+T*A;return Q?(Q=1/Q,e[0]=(c*N-y*F+L*I)*Q,e[1]=(y*f-i*N-L*D)*Q,e[2]=(i*F-c*f+L*A)*Q,e[3]=0,e[4]=(r*F-s*N-a*I)*Q,e[5]=(n*N-r*f+a*D)*Q,e[6]=(s*f-n*F-a*A)*Q,e[7]=0,e[8]=(m*T-o*V+x*w)*Q,e[9]=(o*g-d*T-x*R)*Q,e[10]=(d*V-m*g+x*z)*Q,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):null}static normalFromMat4Fast(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=i*k-k*L,e[1]=c*y-y*k,e[2]=a*L-L*y,e[3]=0,e[4]=L*r-k*s,e[5]=k*n-y*r,e[6]=y*s-L*n,e[7]=0,e[8]=s*c-r*i,e[9]=r*a-n*c,e[10]=n*i-s*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static getTranslation(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}static getScaling(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=Math.sqrt(n*n+s*s+r*r),e[1]=Math.sqrt(a*a+i*i+c*c),e[2]=Math.sqrt(y*y+L*L+k*k),e}static getRotation(e,t){h.getScaling(h.#e,t);let n=1/h.#e[0],s=1/h.#e[1],r=1/h.#e[2],a=t[0]*n,i=t[1]*s,c=t[2]*r,y=t[4]*n,L=t[5]*s,k=t[6]*r,l=t[8]*n,b=t[9]*s,M=t[10]*r,d=a+L+M,m=0;return d>0?(m=Math.sqrt(d+1)*2,e[3]=.25*m,e[0]=(k-b)/m,e[1]=(l-c)/m,e[2]=(i-y)/m):a>L&&a>M?(m=Math.sqrt(1+a-L-M)*2,e[3]=(k-b)/m,e[0]=.25*m,e[1]=(i+y)/m,e[2]=(l+c)/m):L>M?(m=Math.sqrt(1+L-a-M)*2,e[3]=(l-c)/m,e[0]=(i+y)/m,e[1]=.25*m,e[2]=(k+b)/m):(m=Math.sqrt(1+M-a-L)*2,e[3]=(i-y)/m,e[0]=(l+c)/m,e[1]=(k+b)/m,e[2]=.25*m),e}static decompose(e,t,n,s){t[0]=s[12],t[1]=s[13],t[2]=s[14];let r=s[0],a=s[1],i=s[2],c=s[4],y=s[5],L=s[6],k=s[8],l=s[9],b=s[10];n[0]=Math.sqrt(r*r+a*a+i*i),n[1]=Math.sqrt(c*c+y*y+L*L),n[2]=Math.sqrt(k*k+l*l+b*b);let M=1/n[0],d=1/n[1],m=1/n[2],o=r*M,x=a*d,z=i*m,R=c*M,g=y*d,w=L*m,V=k*M,T=l*d,A=b*m,D=o+g+A,f=0;return D>0?(f=Math.sqrt(D+1)*2,e[3]=.25*f,e[0]=(w-T)/f,e[1]=(V-z)/f,e[2]=(x-R)/f):o>g&&o>A?(f=Math.sqrt(1+o-g-A)*2,e[3]=(w-T)/f,e[0]=.25*f,e[1]=(x+R)/f,e[2]=(V+z)/f):g>A?(f=Math.sqrt(1+g-o-A)*2,e[3]=(V-z)/f,e[0]=(x+R)/f,e[1]=.25*f,e[2]=(w+T)/f):(f=Math.sqrt(1+A-o-g)*2,e[3]=(x-R)/f,e[0]=(V+z)/f,e[1]=(w+T)/f,e[2]=.25*f),e}static fromRotationTranslationScale(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3],y=r+r,L=a+a,k=i+i,l=r*y,b=r*L,M=r*k,d=a*L,m=a*k,o=i*k,x=c*y,z=c*L,R=c*k,g=s[0],w=s[1],V=s[2];return e[0]=(1-(d+o))*g,e[1]=(b+R)*g,e[2]=(M-z)*g,e[3]=0,e[4]=(b-R)*w,e[5]=(1-(l+o))*w,e[6]=(m+x)*w,e[7]=0,e[8]=(M+z)*V,e[9]=(m-x)*V,e[10]=(1-(l+d))*V,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}static fromRotationTranslationScaleOrigin(e,t,n,s,r){let a=t[0],i=t[1],c=t[2],y=t[3],L=a+a,k=i+i,l=c+c,b=a*L,M=a*k,d=a*l,m=i*k,o=i*l,x=c*l,z=y*L,R=y*k,g=y*l,w=s[0],V=s[1],T=s[2],A=r[0],D=r[1],f=r[2],I=(1-(m+x))*w,F=(M+g)*w,N=(d-R)*w,Q=(M-g)*V,G=(1-(b+x))*V,X=(o+z)*V,C=(d+R)*T,H=(o-z)*T,W=(1-(b+m))*T;return e[0]=I,e[1]=F,e[2]=N,e[3]=0,e[4]=Q,e[5]=G,e[6]=X,e[7]=0,e[8]=C,e[9]=H,e[10]=W,e[11]=0,e[12]=n[0]+A-(I*A+Q*D+C*f),e[13]=n[1]+D-(F*A+G*D+H*f),e[14]=n[2]+f-(N*A+X*D+W*f),e[15]=1,e}static fromQuat(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n+n,c=s+s,y=r+r,L=n*i,k=s*i,l=s*c,b=r*i,M=r*c,d=r*y,m=a*i,o=a*c,x=a*y;return e[0]=1-l-d,e[1]=k+x,e[2]=b-o,e[3]=0,e[4]=k-x,e[5]=1-L-d,e[6]=M+m,e[7]=0,e[8]=b+o,e[9]=M-m,e[10]=1-L-l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static frustumNO(e,t,n,s,r,a,i=1/0){let c=1/(n-t),y=1/(r-s);if(e[0]=a*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*y,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(r+s)*y,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let L=1/(a-i);e[10]=(i+a)*L,e[14]=2*i*a*L}else e[10]=-1,e[14]=-2*a;return e}static frustum(e,t,n,s,r,a,i=1/0){return e}static frustumZO(e,t,n,s,r,a,i=1/0){let c=1/(n-t),y=1/(r-s);if(e[0]=a*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*y,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(r+s)*y,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let L=1/(a-i);e[10]=i*L,e[14]=i*a*L}else e[10]=-1,e[14]=-a;return e}static perspectiveNO(e,t,n,s,r=1/0){let a=1/Math.tan(t/2);if(e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,r!=null&&r!==1/0){let i=1/(s-r);e[10]=(r+s)*i,e[14]=2*r*s*i}else e[10]=-1,e[14]=-2*s;return e}static perspective(e,t,n,s,r=1/0){return e}static perspectiveZO(e,t,n,s,r=1/0){let a=1/Math.tan(t/2);if(e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,r!=null&&r!==1/0){let i=1/(s-r);e[10]=r*i,e[14]=r*s*i}else e[10]=-1,e[14]=-s;return e}static perspectiveFromFieldOfView(e,t,n,s){let r=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),i=Math.tan(t.leftDegrees*Math.PI/180),c=Math.tan(t.rightDegrees*Math.PI/180),y=2/(i+c),L=2/(r+a);return e[0]=y,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=L,e[6]=0,e[7]=0,e[8]=-((i-c)*y*.5),e[9]=(r-a)*L*.5,e[10]=s/(n-s),e[11]=-1,e[12]=0,e[13]=0,e[14]=s*n/(n-s),e[15]=0,e}static orthoNO(e,t,n,s,r,a,i){let c=1/(t-n),y=1/(s-r),L=1/(a-i);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*L,e[11]=0,e[12]=(t+n)*c,e[13]=(r+s)*y,e[14]=(i+a)*L,e[15]=1,e}static ortho(e,t,n,s,r,a,i){return e}static orthoZO(e,t,n,s,r,a,i){let c=1/(t-n),y=1/(s-r),L=1/(a-i);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=L,e[11]=0,e[12]=(t+n)*c,e[13]=(r+s)*y,e[14]=a*L,e[15]=1,e}static lookAt(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=s[0],y=s[1],L=s[2],k=n[0],l=n[1],b=n[2];if(Math.abs(r-k)<1e-6&&Math.abs(a-l)<1e-6&&Math.abs(i-b)<1e-6)return h.identity(e);let M=r-k,d=a-l,m=i-b,o=1/Math.sqrt(M*M+d*d+m*m);M*=o,d*=o,m*=o;let x=y*m-L*d,z=L*M-c*m,R=c*d-y*M;o=Math.sqrt(x*x+z*z+R*R),o?(o=1/o,x*=o,z*=o,R*=o):(x=0,z=0,R=0);let g=d*R-m*z,w=m*x-M*R,V=M*z-d*x;return o=Math.sqrt(g*g+w*w+V*V),o?(o=1/o,g*=o,w*=o,V*=o):(g=0,w=0,V=0),e[0]=x,e[1]=g,e[2]=M,e[3]=0,e[4]=z,e[5]=w,e[6]=d,e[7]=0,e[8]=R,e[9]=V,e[10]=m,e[11]=0,e[12]=-(x*r+z*a+R*i),e[13]=-(g*r+w*a+V*i),e[14]=-(M*r+d*a+m*i),e[15]=1,e}static targetTo(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=s[0],y=s[1],L=s[2],k=r-n[0],l=a-n[1],b=i-n[2],M=k*k+l*l+b*b;M>0&&(M=1/Math.sqrt(M),k*=M,l*=M,b*=M);let d=y*b-L*l,m=L*k-c*b,o=c*l-y*k;return M=d*d+m*m+o*o,M>0&&(M=1/Math.sqrt(M),d*=M,m*=M,o*=M),e[0]=d,e[1]=m,e[2]=o,e[3]=0,e[4]=l*o-b*m,e[5]=b*d-k*o,e[6]=k*m-l*d,e[7]=0,e[8]=k,e[9]=l,e[10]=b,e[11]=0,e[12]=r,e[13]=a,e[14]=i,e[15]=1,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8]+e[9]*e[9]+e[10]*e[10]+e[11]*e[11]+e[12]*e[12]+e[13]*e[13]+e[14]*e[14]+e[15]*e[15])}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}static sub(e,t,n){return e}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e[6]=t[6]+n[6]*s,e[7]=t[7]+n[7]*s,e[8]=t[8]+n[8]*s,e[9]=t[9]+n[9]*s,e[10]=t[10]+n[10]*s,e[11]=t[11]+n[11]*s,e[12]=t[12]+n[12]*s,e[13]=t[13]+n[13]*s,e[14]=t[14]+n[14]*s,e[15]=t[15]+n[15]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=e[8],l=e[9],b=e[10],M=e[11],d=e[12],m=e[13],o=e[14],x=e[15],z=t[0],R=t[1],g=t[2],w=t[3],V=t[4],T=t[5],A=t[6],D=t[7],f=t[8],I=t[9],F=t[10],N=t[11],Q=t[12],G=t[13],X=t[14],C=t[15];return Math.abs(n-z)<=1e-6*Math.max(1,Math.abs(n),Math.abs(z))&&Math.abs(s-R)<=1e-6*Math.max(1,Math.abs(s),Math.abs(R))&&Math.abs(r-g)<=1e-6*Math.max(1,Math.abs(r),Math.abs(g))&&Math.abs(a-w)<=1e-6*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(i-V)<=1e-6*Math.max(1,Math.abs(i),Math.abs(V))&&Math.abs(c-T)<=1e-6*Math.max(1,Math.abs(c),Math.abs(T))&&Math.abs(y-A)<=1e-6*Math.max(1,Math.abs(y),Math.abs(A))&&Math.abs(L-D)<=1e-6*Math.max(1,Math.abs(L),Math.abs(D))&&Math.abs(k-f)<=1e-6*Math.max(1,Math.abs(k),Math.abs(f))&&Math.abs(l-I)<=1e-6*Math.max(1,Math.abs(l),Math.abs(I))&&Math.abs(b-F)<=1e-6*Math.max(1,Math.abs(b),Math.abs(F))&&Math.abs(M-N)<=1e-6*Math.max(1,Math.abs(M),Math.abs(N))&&Math.abs(d-Q)<=1e-6*Math.max(1,Math.abs(d),Math.abs(Q))&&Math.abs(m-G)<=1e-6*Math.max(1,Math.abs(m),Math.abs(G))&&Math.abs(o-X)<=1e-6*Math.max(1,Math.abs(o),Math.abs(X))&&Math.abs(x-C)<=1e-6*Math.max(1,Math.abs(x),Math.abs(C))}static str(e){return`Mat4(${e.join(", ")})`}};P.prototype.mul=P.prototype.multiply;P.sub=P.subtract;P.mul=P.multiply;P.frustum=P.frustumNO;P.perspective=P.perspectiveNO;P.ortho=P.orthoNO;var q=class h extends Float32Array{constructor(...e){switch(e.length){case 3:super(e);break;case 2:super(e[0],e[1],3);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t]):super(t,0,3);break}default:super(3);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get b(){return this[2]}set b(e){this[2]=e}get magnitude(){let e=this[0],t=this[1],n=this[2];return Math.sqrt(e*e+t*t+n*n)}get mag(){return this.magnitude}get squaredMagnitude(){let e=this[0],t=this[1],n=this[2];return e*e+t*t+n*n}get sqrMag(){return this.squaredMagnitude}get str(){return h.str(this)}copy(e){return this.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this[2]+=e[2],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this[2]-=e[2],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this[2]*=e[2],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this[2]/=e[2],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this[2]+=e[2]*t,this}distance(e){return h.distance(this,e)}dist(e){return 0}squaredDistance(e){return h.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this[2]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this[2]=1/this[2],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this[2]=Math.abs(this[2]),this}dot(e){return this[0]*e[0]+this[1]*e[1]+this[2]*e[2]}normalize(){return h.normalize(this,this)}static get BYTE_LENGTH(){return 3*Float32Array.BYTES_PER_ELEMENT}static create(){return new h}static clone(e){return new h(e)}static magnitude(e){let t=e[0],n=e[1],s=e[2];return Math.sqrt(t*t+n*n+s*s)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static fromValues(e,t,n){return new h(e,t,n)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}static set(e,t,n,s){return e[0]=t,e[1]=n,e[2]=s,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}static sub(e,t,n){return[0,0,0]}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}static mul(e,t,n){return[0,0,0]}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e}static div(e,t,n){return[0,0,0]}static ceil(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}static floor(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e}static distance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2];return Math.sqrt(n*n+s*s+r*r)}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2];return n*n+s*s+r*r}static sqrDist(e,t){return 0}static squaredLength(e){let t=e[0],n=e[1],s=e[2];return t*t+n*n+s*s}static sqrLen(e,t){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e}static normalize(e,t){let n=t[0],s=t[1],r=t[2],a=n*n+s*s+r*r;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}static cross(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[0],c=n[1],y=n[2];return e[0]=r*y-a*c,e[1]=a*i-s*y,e[2]=s*c-r*i,e}static lerp(e,t,n,s){let r=t[0],a=t[1],i=t[2];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e[2]=i+s*(n[2]-i),e}static slerp(e,t,n,s){let r=Math.acos(Math.min(Math.max(h.dot(t,n),-1),1)),a=Math.sin(r),i=Math.sin((1-s)*r)/a,c=Math.sin(s*r)/a;return e[0]=i*t[0]+c*n[0],e[1]=i*t[1]+c*n[1],e[2]=i*t[2]+c*n[2],e}static hermite(e,t,n,s,r,a){let i=a*a,c=i*(2*a-3)+1,y=i*(a-2)+a,L=i*(a-1),k=i*(3-2*a);return e[0]=t[0]*c+n[0]*y+s[0]*L+r[0]*k,e[1]=t[1]*c+n[1]*y+s[1]*L+r[1]*k,e[2]=t[2]*c+n[2]*y+s[2]*L+r[2]*k,e}static bezier(e,t,n,s,r,a){let i=1-a,c=i*i,y=a*a,L=c*i,k=3*a*c,l=3*y*i,b=y*a;return e[0]=t[0]*L+n[0]*k+s[0]*l+r[0]*b,e[1]=t[1]*L+n[1]*k+s[1]*l+r[1]*b,e[2]=t[2]*L+n[2]*k+s[2]*l+r[2]*b,e}static transformMat4(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[3]*s+n[7]*r+n[11]*a+n[15]||1;return e[0]=(n[0]*s+n[4]*r+n[8]*a+n[12])/i,e[1]=(n[1]*s+n[5]*r+n[9]*a+n[13])/i,e[2]=(n[2]*s+n[6]*r+n[10]*a+n[14])/i,e}static transformMat3(e,t,n){let s=t[0],r=t[1],a=t[2];return e[0]=s*n[0]+r*n[3]+a*n[6],e[1]=s*n[1]+r*n[4]+a*n[7],e[2]=s*n[2]+r*n[5]+a*n[8],e}static transformQuat(e,t,n){let s=n[0],r=n[1],a=n[2],i=n[3]*2,c=t[0],y=t[1],L=t[2],k=r*L-a*y,l=a*c-s*L,b=s*y-r*c,M=(r*b-a*l)*2,d=(a*k-s*b)*2,m=(s*l-r*k)*2;return e[0]=c+k*i+M,e[1]=y+l*i+d,e[2]=L+b*i+m,e}static rotateX(e,t,n,s){let r=n[1],a=n[2],i=t[1]-r,c=t[2]-a;return e[0]=t[0],e[1]=i*Math.cos(s)-c*Math.sin(s)+r,e[2]=i*Math.sin(s)+c*Math.cos(s)+a,e}static rotateY(e,t,n,s){let r=n[0],a=n[2],i=t[0]-r,c=t[2]-a;return e[0]=c*Math.sin(s)+i*Math.cos(s)+r,e[1]=t[1],e[2]=c*Math.cos(s)-i*Math.sin(s)+a,e}static rotateZ(e,t,n,s){let r=n[0],a=n[1],i=t[0]-r,c=t[1]-a;return e[0]=i*Math.cos(s)-c*Math.sin(s)+r,e[1]=i*Math.sin(s)+c*Math.cos(s)+a,e[2]=n[2],e}static angle(e,t){let n=e[0],s=e[1],r=e[2],a=t[0],i=t[1],c=t[2],y=Math.sqrt((n*n+s*s+r*r)*(a*a+i*i+c*c)),L=y&&h.dot(e,t)/y;return Math.acos(Math.min(Math.max(L,-1),1))}static zero(e){return e[0]=0,e[1]=0,e[2]=0,e}static str(e){return`Vec3(${e.join(", ")})`}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=t[0],i=t[1],c=t[2];return Math.abs(n-a)<=1e-6*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(s-i)<=1e-6*Math.max(1,Math.abs(s),Math.abs(i))&&Math.abs(r-c)<=1e-6*Math.max(1,Math.abs(r),Math.abs(c))}};q.prototype.sub=q.prototype.subtract;q.prototype.mul=q.prototype.multiply;q.prototype.div=q.prototype.divide;q.prototype.dist=q.prototype.distance;q.prototype.sqrDist=q.prototype.squaredDistance;q.sub=q.subtract;q.mul=q.multiply;q.div=q.divide;q.dist=q.distance;q.sqrDist=q.squaredDistance;q.sqrLen=q.squaredLength;q.mag=q.magnitude;q.length=q.magnitude;q.len=q.magnitude;var E=class h extends Float32Array{constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t,t]):super(t,0,4);break}default:super(4);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get w(){return this[3]}set w(e){this[3]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get b(){return this[2]}set b(e){this[2]=e}get a(){return this[3]}set a(e){this[3]=e}get magnitude(){let e=this[0],t=this[1],n=this[2],s=this[3];return Math.sqrt(e*e+t*t+n*n+s*s)}get mag(){return this.magnitude}get str(){return h.str(this)}copy(e){return super.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this[2]+=e[2],this[3]+=e[3],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this[2]-=e[2],this[3]-=e[3],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this[2]*=e[2],this[3]*=e[3],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this[2]/=e[2],this[3]/=e[3],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this[3]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this[2]+=e[2]*t,this[3]+=e[3]*t,this}distance(e){return h.distance(this,e)}dist(e){return 0}squaredDistance(e){return h.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this[2]*=-1,this[3]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this[2]=1/this[2],this[3]=1/this[3],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this[2]=Math.abs(this[2]),this[3]=Math.abs(this[3]),this}dot(e){return this[0]*e[0]+this[1]*e[1]+this[2]*e[2]+this[3]*e[3]}normalize(){return h.normalize(this,this)}static get BYTE_LENGTH(){return 4*Float32Array.BYTES_PER_ELEMENT}static create(){return new h}static clone(e){return new h(e)}static fromValues(e,t,n,s){return new h(e,t,n,s)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static set(e,t,n,s,r){return e[0]=t,e[1]=n,e[2]=s,e[3]=r,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}static sub(e,t,n){return e}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e[3]=t[3]*n[3],e}static mul(e,t,n){return e}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e[3]=t[3]/n[3],e}static div(e,t,n){return e}static ceil(e,t){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}static floor(e,t){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}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e[3]=Math.min(t[3],n[3]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e[3]=Math.max(t[3],n[3]),e}static round(e,t){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}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e}static distance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2],a=t[3]-e[3];return Math.hypot(n,s,r,a)}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2],a=t[3]-e[3];return n*n+s*s+r*r+a*a}static sqrDist(e,t){return 0}static magnitude(e){let t=e[0],n=e[1],s=e[2],r=e[3];return Math.sqrt(t*t+n*n+s*s+r*r)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){let t=e[0],n=e[1],s=e[2],r=e[3];return t*t+n*n+s*s+r*r}static sqrLen(e){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e}static normalize(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*n+s*s+r*r+a*a;return i>0&&(i=1/Math.sqrt(i)),e[0]=n*i,e[1]=s*i,e[2]=r*i,e[3]=a*i,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}static cross(e,t,n,s){let r=n[0]*s[1]-n[1]*s[0],a=n[0]*s[2]-n[2]*s[0],i=n[0]*s[3]-n[3]*s[0],c=n[1]*s[2]-n[2]*s[1],y=n[1]*s[3]-n[3]*s[1],L=n[2]*s[3]-n[3]*s[2],k=t[0],l=t[1],b=t[2],M=t[3];return e[0]=l*L-b*y+M*c,e[1]=-(k*L)+b*i-M*a,e[2]=k*y-l*i+M*r,e[3]=-(k*c)+l*a-b*r,e}static lerp(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e[2]=i+s*(n[2]-i),e[3]=c+s*(n[3]-c),e}static transformMat4(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3];return e[0]=n[0]*s+n[4]*r+n[8]*a+n[12]*i,e[1]=n[1]*s+n[5]*r+n[9]*a+n[13]*i,e[2]=n[2]*s+n[6]*r+n[10]*a+n[14]*i,e[3]=n[3]*s+n[7]*r+n[11]*a+n[15]*i,e}static transformQuat(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[0],c=n[1],y=n[2],L=n[3],k=L*s+c*a-y*r,l=L*r+y*s-i*a,b=L*a+i*r-c*s,M=-i*s-c*r-y*a;return e[0]=k*L+M*-i+l*-y-b*-c,e[1]=l*L+M*-c+b*-i-k*-y,e[2]=b*L+M*-y+k*-c-l*-i,e[3]=t[3],e}static zero(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}static str(e){return`Vec4(${e.join(", ")})`}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=t[0],c=t[1],y=t[2],L=t[3];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(a-L)<=1e-6*Math.max(1,Math.abs(a),Math.abs(L))}};E.prototype.sub=E.prototype.subtract;E.prototype.mul=E.prototype.multiply;E.prototype.div=E.prototype.divide;E.prototype.dist=E.prototype.distance;E.prototype.sqrDist=E.prototype.squaredDistance;E.sub=E.subtract;E.mul=E.multiply;E.div=E.divide;E.dist=E.distance;E.sqrDist=E.squaredDistance;E.sqrLen=E.squaredLength;E.mag=E.magnitude;E.length=E.magnitude;E.len=E.magnitude;var S=class h extends Float32Array{static#t="zyx";static#e=new Float32Array(4);static#r=new Float32Array(4);static#n=new Float32Array(9);static#s=new Float32Array(3);static#a=new Float32Array([1,0,0]);static#i=new Float32Array([0,1,0]);constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t,t]):super(t,0,4);break}default:super(4),this[3]=1;break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get w(){return this[3]}set w(e){this[3]=e}get magnitude(){let e=this[0],t=this[1],n=this[2],s=this[3];return Math.sqrt(e*e+t*t+n*n+s*s)}get mag(){return this.magnitude}get str(){return h.str(this)}copy(e){return super.set(e),this}identity(){return this[0]=0,this[1]=0,this[2]=0,this[3]=1,this}multiply(e){return h.multiply(this,this,e)}mul(e){return this}rotateX(e){return h.rotateX(this,this,e)}rotateY(e){return h.rotateY(this,this,e)}rotateZ(e){return h.rotateZ(this,this,e)}invert(){return h.invert(this,this)}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this[3]*=e,this}dot(e){return h.dot(this,e)}static get BYTE_LENGTH(){return 4*Float32Array.BYTES_PER_ELEMENT}static create(){return new h}static identity(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}static setAxisAngle(e,t,n){n*=.5;let s=Math.sin(n);return e[0]=s*t[0],e[1]=s*t[1],e[2]=s*t[2],e[3]=Math.cos(n),e}static getAxisAngle(e,t){let n=Math.acos(t[3])*2,s=Math.sin(n/2);return s>1e-6?(e[0]=t[0]/s,e[1]=t[1]/s,e[2]=t[2]/s):(e[0]=1,e[1]=0,e[2]=0),n}static getAngle(e,t){let n=h.dot(e,t);return Math.acos(2*n*n-1)}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*k+i*c+r*L-a*y,e[1]=r*k+i*y+a*c-s*L,e[2]=a*k+i*L+s*y-r*c,e[3]=i*k-s*c-r*y-a*L,e}static rotateX(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+i*c,e[1]=r*y+a*c,e[2]=a*y-r*c,e[3]=i*y-s*c,e}static rotateY(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y-a*c,e[1]=r*y+i*c,e[2]=a*y+s*c,e[3]=i*y-r*c,e}static rotateZ(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+r*c,e[1]=r*y-s*c,e[2]=a*y+i*c,e[3]=i*y-a*c,e}static calculateW(e,t){let n=t[0],s=t[1],r=t[2];return e[0]=n,e[1]=s,e[2]=r,e[3]=Math.sqrt(Math.abs(1-n*n-s*s-r*r)),e}static exp(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=Math.sqrt(n*n+s*s+r*r),c=Math.exp(a),y=i>0?c*Math.sin(i)/i:0;return e[0]=n*y,e[1]=s*y,e[2]=r*y,e[3]=c*Math.cos(i),e}static ln(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=Math.sqrt(n*n+s*s+r*r),c=i>0?Math.atan2(i,a)/i:0;return e[0]=n*c,e[1]=s*c,e[2]=r*c,e[3]=.5*Math.log(n*n+s*s+r*r+a*a),e}static pow(e,t,n){return h.ln(e,t),h.scale(e,e,n),h.exp(e,e),e}static slerp(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3],y=n[0],L=n[1],k=n[2],l=n[3],b,M,d=r*y+a*L+i*k+c*l;if(d<0&&(d=-d,y=-y,L=-L,k=-k,l=-l),1-d>1e-6){let m=Math.acos(d),o=Math.sin(m);b=Math.sin((1-s)*m)/o,M=Math.sin(s*m)/o}else b=1-s,M=s;return e[0]=b*r+M*y,e[1]=b*a+M*L,e[2]=b*i+M*k,e[3]=b*c+M*l,e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*n+s*s+r*r+a*a,c=i?1/i:0;return e[0]=-n*c,e[1]=-s*c,e[2]=-r*c,e[3]=a*c,e}static conjugate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}static fromMat3(e,t){let n=t[0]+t[4]+t[8],s;if(n>0)s=Math.sqrt(n+1),e[3]=.5*s,s=.5/s,e[0]=(t[5]-t[7])*s,e[1]=(t[6]-t[2])*s,e[2]=(t[1]-t[3])*s;else{let r=0;t[4]>t[0]&&(r=1),t[8]>t[r*3+r]&&(r=2);let a=(r+1)%3,i=(r+2)%3;s=Math.sqrt(t[r*3+r]-t[a*3+a]-t[i*3+i]+1),e[r]=.5*s,s=.5/s,e[3]=(t[a*3+i]-t[i*3+a])*s,e[a]=(t[a*3+r]+t[r*3+a])*s,e[i]=(t[i*3+r]+t[r*3+i])*s}return e}static fromEuler(e,t,n,s,r=h.#t){let a=.5*Math.PI/180;t*=a,n*=a,s*=a;let i=Math.sin(t),c=Math.cos(t),y=Math.sin(n),L=Math.cos(n),k=Math.sin(s),l=Math.cos(s);switch(r){case"xyz":e[0]=i*L*l+c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l-i*y*k;break;case"xzy":e[0]=i*L*l-c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l+i*y*k;break;case"yxz":e[0]=i*L*l+c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l+i*y*k;break;case"yzx":e[0]=i*L*l+c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l-i*y*k;break;case"zxy":e[0]=i*L*l-c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l-i*y*k;break;case"zyx":e[0]=i*L*l-c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l+i*y*k;break;default:throw new Error(`Unknown angle order ${r}`)}return e}static str(e){return`Quat(${e.join(", ")})`}static clone(e){return new h(e)}static fromValues(e,t,n,s){return new h(e,t,n,s)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static set(e,t,n,s,r){return e}static add(e,t,n){return e}static mul(e,t,n){return e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}static lerp(e,t,n,s){return e}static magnitude(e){return 0}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){return 0}static sqrLen(e){return 0}static normalize(e,t){return e}static exactEquals(e,t){return!1}static equals(e,t){return!1}static rotationTo(e,t,n){let s=q.dot(t,n);return s<-.999999?(q.cross(h.#s,h.#a,t),q.mag(h.#s)<1e-6&&q.cross(h.#s,h.#i,t),q.normalize(h.#s,h.#s),h.setAxisAngle(e,h.#s,Math.PI),e):s>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(q.cross(h.#s,t,n),e[0]=h.#s[0],e[1]=h.#s[1],e[2]=h.#s[2],e[3]=1+s,h.normalize(e,e))}static sqlerp(e,t,n,s,r,a){return h.slerp(h.#e,t,r,a),h.slerp(h.#r,n,s,a),h.slerp(e,h.#e,h.#r,2*a*(1-a)),e}static setAxes(e,t,n,s){return h.#n[0]=n[0],h.#n[3]=n[1],h.#n[6]=n[2],h.#n[1]=s[0],h.#n[4]=s[1],h.#n[7]=s[2],h.#n[2]=-t[0],h.#n[5]=-t[1],h.#n[8]=-t[2],h.normalize(e,h.fromMat3(e,h.#n))}};S.set=E.set;S.add=E.add;S.lerp=E.lerp;S.normalize=E.normalize;S.squaredLength=E.squaredLength;S.sqrLen=E.squaredLength;S.exactEquals=E.exactEquals;S.equals=E.equals;S.magnitude=E.magnitude;S.prototype.mul=S.prototype.multiply;S.mul=S.multiply;S.mag=S.magnitude;S.length=S.magnitude;S.len=S.magnitude;var O=class h extends Float32Array{static#t=new Float32Array(4);static#e=new Float32Array(3);constructor(...e){switch(e.length){case 8:super(e);break;case 2:super(e[0],e[1],8);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t,t,t,t,t,t]):super(t,0,8);break}default:super(8),this[3]=1;break}}get str(){return h.str(this)}copy(e){return super.set(e),this}static get BYTE_LENGTH(){return 8*Float32Array.BYTES_PER_ELEMENT}static create(){return new h}static clone(e){return new h(e)}static fromValues(e,t,n,s,r,a,i,c){return new h(e,t,n,s,r,a,i,c)}static fromRotationTranslationValues(e,t,n,s,r,a,i){let c=r*.5,y=a*.5,L=i*.5;return new h(e,t,n,s,c*s+y*n-L*t,y*s+L*e-c*n,L*s+c*t-y*e,-c*e-y*t-L*n)}static fromRotationTranslation(e,t,n){let s=n[0]*.5,r=n[1]*.5,a=n[2]*.5,i=t[0],c=t[1],y=t[2],L=t[3];return e[0]=i,e[1]=c,e[2]=y,e[3]=L,e[4]=s*L+r*y-a*c,e[5]=r*L+a*i-s*y,e[6]=a*L+s*c-r*i,e[7]=-s*i-r*c-a*y,e}static fromTranslation(e,t){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0]*.5,e[5]=t[1]*.5,e[6]=t[2]*.5,e[7]=0,e}static fromRotation(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=0,e[5]=0,e[6]=0,e[7]=0,e}static fromMat4(e,t){return P.getRotation(h.#t,t),P.getTranslation(h.#e,t),h.fromRotationTranslation(e,h.#t,h.#e)}static copy(e,t){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}static identity(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e}static set(e,t,n,s,r,a,i,c,y){return e[0]=t,e[1]=n,e[2]=s,e[3]=r,e[4]=a,e[5]=i,e[6]=c,e[7]=y,e}static getReal(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static getDual(e,t){return e[0]=t[4],e[1]=t[5],e[2]=t[6],e[3]=t[7],e}static setReal(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static setDual(e,t){return e[4]=t[0],e[5]=t[1],e[6]=t[2],e[7]=t[3],e}static getTranslation(e,t){let n=t[4],s=t[5],r=t[6],a=t[7],i=-t[0],c=-t[1],y=-t[2],L=t[3];return e[0]=(n*L+a*i+s*y-r*c)*2,e[1]=(s*L+a*c+r*i-n*y)*2,e[2]=(r*L+a*y+n*c-s*i)*2,e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0]*.5,y=n[1]*.5,L=n[2]*.5,k=t[4],l=t[5],b=t[6],M=t[7];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=i*c+r*L-a*y+k,e[5]=i*y+a*c-s*L+l,e[6]=i*L+s*y-r*c+b,e[7]=-s*c-r*y-a*L+M,e}static rotateX(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,b=y*i+k*r+L*s-c*a,M=L*i+k*a+c*r-y*s,d=k*i-c*s-y*r-L*a;return S.rotateX(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+d*s+b*a-M*r,e[5]=b*i+d*r+M*s-l*a,e[6]=M*i+d*a+l*r-b*s,e[7]=d*i-l*s-b*r-M*a,e}static rotateY(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,b=y*i+k*r+L*s-c*a,M=L*i+k*a+c*r-y*s,d=k*i-c*s-y*r-L*a;return S.rotateY(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+d*s+b*a-M*r,e[5]=b*i+d*r+M*s-l*a,e[6]=M*i+d*a+l*r-b*s,e[7]=d*i-l*s-b*r-M*a,e}static rotateZ(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,b=y*i+k*r+L*s-c*a,M=L*i+k*a+c*r-y*s,d=k*i-c*s-y*r-L*a;return S.rotateZ(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+d*s+b*a-M*r,e[5]=b*i+d*r+M*s-l*a,e[6]=M*i+d*a+l*r-b*s,e[7]=d*i-l*s-b*r-M*a,e}static rotateByQuatAppend(e,t,n){let s=n[0],r=n[1],a=n[2],i=n[3],c=t[0],y=t[1],L=t[2],k=t[3];return e[0]=c*i+k*s+y*a-L*r,e[1]=y*i+k*r+L*s-c*a,e[2]=L*i+k*a+c*r-y*s,e[3]=k*i-c*s-y*r-L*a,c=t[4],y=t[5],L=t[6],k=t[7],e[4]=c*i+k*s+y*a-L*r,e[5]=y*i+k*r+L*s-c*a,e[6]=L*i+k*a+c*r-y*s,e[7]=k*i-c*s-y*r-L*a,e}static rotateByQuatPrepend(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*k+i*c+r*L-a*y,e[1]=r*k+i*y+a*c-s*L,e[2]=a*k+i*L+s*y-r*c,e[3]=i*k-s*c-r*y-a*L,c=n[4],y=n[5],L=n[6],k=n[7],e[4]=s*k+i*c+r*L-a*y,e[5]=r*k+i*y+a*c-s*L,e[6]=a*k+i*L+s*y-r*c,e[7]=i*k-s*c-r*y-a*L,e}static rotateAroundAxis(e,t,n,s){if(Math.abs(s)<1e-6)return h.copy(e,t);let r=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);s*=.5;let a=Math.sin(s),i=a*n[0]/r,c=a*n[1]/r,y=a*n[2]/r,L=Math.cos(s),k=t[0],l=t[1],b=t[2],M=t[3];e[0]=k*L+M*i+l*y-b*c,e[1]=l*L+M*c+b*i-k*y,e[2]=b*L+M*y+k*c-l*i,e[3]=M*L-k*i-l*c-b*y;let d=t[4],m=t[5],o=t[6],x=t[7];return e[4]=d*L+x*i+m*y-o*c,e[5]=m*L+x*c+o*i-d*y,e[6]=o*L+x*y+d*c-m*i,e[7]=x*L-d*i-m*c-o*y,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[4],y=n[5],L=n[6],k=n[7],l=t[4],b=t[5],M=t[6],d=t[7],m=n[0],o=n[1],x=n[2],z=n[3];return e[0]=s*z+i*m+r*x-a*o,e[1]=r*z+i*o+a*m-s*x,e[2]=a*z+i*x+s*o-r*m,e[3]=i*z-s*m-r*o-a*x,e[4]=s*k+i*c+r*L-a*y+l*z+d*m+b*x-M*o,e[5]=r*k+i*y+a*c-s*L+b*z+d*o+M*m-l*x,e[6]=a*k+i*L+s*y-r*c+M*z+d*x+l*o-b*m,e[7]=i*k-s*c-r*y-a*L+d*z-l*m-b*o-M*x,e}static mul(e,t,n){return e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e}static dot(e,t){return 0}static lerp(e,t,n,s){let r=1-s;return h.dot(t,n)<0&&(s=-s),e[0]=t[0]*r+n[0]*s,e[1]=t[1]*r+n[1]*s,e[2]=t[2]*r+n[2]*s,e[3]=t[3]*r+n[3]*s,e[4]=t[4]*r+n[4]*s,e[5]=t[5]*r+n[5]*s,e[6]=t[6]*r+n[6]*s,e[7]=t[7]*r+n[7]*s,e}static invert(e,t){let n=h.squaredLength(t);return e[0]=-t[0]/n,e[1]=-t[1]/n,e[2]=-t[2]/n,e[3]=t[3]/n,e[4]=-t[4]/n,e[5]=-t[5]/n,e[6]=-t[6]/n,e[7]=t[7]/n,e}static conjugate(e,t){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}static magnitude(e){return 0}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){return 0}static sqrLen(e){return 0}static normalize(e,t){let n=h.squaredLength(t);if(n>0){n=Math.sqrt(n);let s=t[0]/n,r=t[1]/n,a=t[2]/n,i=t[3]/n,c=t[4],y=t[5],L=t[6],k=t[7],l=s*c+r*y+a*L+i*k;e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=(c-s*l)/n,e[5]=(y-r*l)/n,e[6]=(L-a*l)/n,e[7]=(k-i*l)/n}return e}static str(e){return`Quat2(${e.join(", ")})`}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=t[0],l=t[1],b=t[2],M=t[3],d=t[4],m=t[5],o=t[6],x=t[7];return Math.abs(n-k)<=1e-6*Math.max(1,Math.abs(n),Math.abs(k))&&Math.abs(s-l)<=1e-6*Math.max(1,Math.abs(s),Math.abs(l))&&Math.abs(r-b)<=1e-6*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(a-M)<=1e-6*Math.max(1,Math.abs(a),Math.abs(M))&&Math.abs(i-d)<=1e-6*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(c-m)<=1e-6*Math.max(1,Math.abs(c),Math.abs(m))&&Math.abs(y-o)<=1e-6*Math.max(1,Math.abs(y),Math.abs(o))&&Math.abs(L-x)<=1e-6*Math.max(1,Math.abs(L),Math.abs(x))}};O.dot=S.dot;O.squaredLength=S.squaredLength;O.sqrLen=S.squaredLength;O.mag=S.magnitude;O.length=S.magnitude;O.len=S.magnitude;O.mul=O.multiply;var B=class h extends Float32Array{constructor(...e){switch(e.length){case 2:{let t=e[0];typeof t=="number"?super([t,e[1]]):super(t,e[1],2);break}case 1:{let t=e[0];typeof t=="number"?super([t,t]):super(t,0,2);break}default:super(2);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get magnitude(){return Math.hypot(this[0],this[1])}get mag(){return this.magnitude}get squaredMagnitude(){let e=this[0],t=this[1];return e*e+t*t}get sqrMag(){return this.squaredMagnitude}get str(){return h.str(this)}copy(e){return this.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this}distance(e){return h.distance(this,e)}dist(e){return 0}squaredDistance(e){return h.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this}dot(e){return this[0]*e[0]+this[1]*e[1]}normalize(){return h.normalize(this,this)}static get BYTE_LENGTH(){return 2*Float32Array.BYTES_PER_ELEMENT}static create(){return new h}static clone(e){return new h(e)}static fromValues(e,t){return new h(e,t)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e}static set(e,t,n){return e[0]=t,e[1]=n,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}static sub(e,t,n){return[0,0]}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e}static mul(e,t,n){return[0,0]}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e}static div(e,t,n){return[0,0]}static ceil(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}static floor(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e}static round(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e}static distance(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1])}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1];return n*n+s*s}static sqrDist(e,t){return 0}static magnitude(e){let t=e[0],n=e[1];return Math.sqrt(t*t+n*n)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){let t=e[0],n=e[1];return t*t+n*n}static sqrLen(e,t){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e}static normalize(e,t){let n=t[0],s=t[1],r=n*n+s*s;return r>0&&(r=1/Math.sqrt(r)),e[0]=t[0]*r,e[1]=t[1]*r,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]}static cross(e,t,n){let s=t[0]*n[1]-t[1]*n[0];return e[0]=e[1]=0,e[2]=s,e}static lerp(e,t,n,s){let r=t[0],a=t[1];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e}static transformMat2(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[2]*r,e[1]=n[1]*s+n[3]*r,e}static transformMat2d(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[2]*r+n[4],e[1]=n[1]*s+n[3]*r+n[5],e}static transformMat3(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[3]*r+n[6],e[1]=n[1]*s+n[4]*r+n[7],e}static transformMat4(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[4]*r+n[12],e[1]=n[1]*s+n[5]*r+n[13],e}static rotate(e,t,n,s){let r=t[0]-n[0],a=t[1]-n[1],i=Math.sin(s),c=Math.cos(s);return e[0]=r*c-a*i+n[0],e[1]=r*i+a*c+n[1],e}static angle(e,t){let n=e[0],s=e[1],r=t[0],a=t[1],i=Math.sqrt(n*n+s*s)*Math.sqrt(r*r+a*a),c=i&&(n*r+s*a)/i;return Math.acos(Math.min(Math.max(c,-1),1))}static zero(e){return e[0]=0,e[1]=0,e}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]}static equals(e,t){let n=e[0],s=e[1],r=t[0],a=t[1];return Math.abs(n-r)<=1e-6*Math.max(1,Math.abs(n),Math.abs(r))&&Math.abs(s-a)<=1e-6*Math.max(1,Math.abs(s),Math.abs(a))}static str(e){return`Vec2(${e.join(", ")})`}};B.prototype.sub=B.prototype.subtract;B.prototype.mul=B.prototype.multiply;B.prototype.div=B.prototype.divide;B.prototype.dist=B.prototype.distance;B.prototype.sqrDist=B.prototype.squaredDistance;B.sub=B.subtract;B.mul=B.multiply;B.div=B.divide;B.dist=B.distance;B.sqrDist=B.squaredDistance;B.sqrLen=B.squaredLength;B.mag=B.magnitude;B.length=B.magnitude;B.len=B.magnitude;var U=!1;function te(){if(U)return;let h=["xx","xy","yx","yy","xxx","xxy","xyx","xyy","yxx","yxy","yyx","yyy","xxxx","xxxy","xxyx","xxyy","xyxx","xyxy","xyyx","xyyy","yxxx","yxxy","yxyx","yxyy","yyxx","yyxy","yyyx","yyyy","rr","rg","gr","gg","rrr","rrg","rgr","rgg","grr","grg","ggr","ggg","rrrr","rrrg","rrgr","rrgg","rgrr","rgrg","rggr","rggg","grrr","grrg","grgr","grgg","ggrr","ggrg","gggr","gggg"],e=["xz","yz","zx","zy","zz","xxz","xyz","xzx","xzy","xzz","yxz","yyz","yzx","yzy","yzz","zxx","zxy","zxz","zyx","zyy","zyz","zzx","zzy","zzz","xxxz","xxyz","xxzx","xxzy","xxzz","xyxz","xyyz","xyzx","xyzy","xyzz","xzxx","xzxy","xzxz","xzyx","xzyy","xzyz","xzzx","xzzy","xzzz","yxxz","yxyz","yxzx","yxzy","yxzz","yyxz","yyyz","yyzx","yyzy","yyzz","yzxx","yzxy","yzxz","yzyx","yzyy","yzyz","yzzx","yzzy","yzzz","zxxx","zxxy","zxxz","zxyx","zxyy","zxyz","zxzx","zxzy","zxzz","zyxx","zyxy","zyxz","zyyx","zyyy","zyyz","zyzx","zyzy","zyzz","zzxx","zzxy","zzxz","zzyx","zzyy","zzyz","zzzx","zzzy","zzzz","rb","gb","br","bg","bb","rrb","rgb","rbr","rbg","rbb","grb","ggb","gbr","gbg","gbb","brr","brg","brb","bgr","bgg","bgb","bbr","bbg","bbb","rrrb","rrgb","rrbr","rrbg","rrbb","rgrb","rggb","rgbr","rgbg","rgbb","rbrr","rbrg","rbrb","rbgr","rbgg","rbgb","rbbr","rbbg","rbbb","grrb","grgb","grbr","grbg","grbb","ggrb","gggb","ggbr","ggbg","ggbb","gbrr","gbrg","gbrb","gbgr","gbgg","gbgb","gbbr","gbbg","gbbb","brrr","brrg","brrb","brgr","brgg","brgb","brbr","brbg","brbb","bgrr","bgrg","bgrb","bggr","bggg","bggb","bgbr","bgbg","bgbb","bbrr","bbrg","bbrb","bbgr","bbgg","bbgb","bbbr","bbbg","bbbb"],t=["xw","yw","zw","wx","wy","wz","ww","xxw","xyw","xzw","xwx","xwy","xwz","xww","yxw","yyw","yzw","ywx","ywy","ywz","yww","zxw","zyw","zzw","zwx","zwy","zwz","zww","wxx","wxy","wxz","wxw","wyx","wyy","wyz","wyw","wzx","wzy","wzz","wzw","wwx","wwy","wwz","www","xxxw","xxyw","xxzw","xxwx","xxwy","xxwz","xxww","xyxw","xyyw","xyzw","xywx","xywy","xywz","xyww","xzxw","xzyw","xzzw","xzwx","xzwy","xzwz","xzww","xwxx","xwxy","xwxz","xwxw","xwyx","xwyy","xwyz","xwyw","xwzx","xwzy","xwzz","xwzw","xwwx","xwwy","xwwz","xwww","yxxw","yxyw","yxzw","yxwx","yxwy","yxwz","yxww","yyxw","yyyw","yyzw","yywx","yywy","yywz","yyww","yzxw","yzyw","yzzw","yzwx","yzwy","yzwz","yzww","ywxx","ywxy","ywxz","ywxw","ywyx","ywyy","ywyz","ywyw","ywzx","ywzy","ywzz","ywzw","ywwx","ywwy","ywwz","ywww","zxxw","zxyw","zxzw","zxwx","zxwy","zxwz","zxww","zyxw","zyyw","zyzw","zywx","zywy","zywz","zyww","zzxw","zzyw","zzzw","zzwx","zzwy","zzwz","zzww","zwxx","zwxy","zwxz","zwxw","zwyx","zwyy","zwyz","zwyw","zwzx","zwzy","zwzz","zwzw","zwwx","zwwy","zwwz","zwww","wxxx","wxxy","wxxz","wxxw","wxyx","wxyy","wxyz","wxyw","wxzx","wxzy","wxzz","wxzw","wxwx","wxwy","wxwz","wxww","wyxx","wyxy","wyxz","wyxw","wyyx","wyyy","wyyz","wyyw","wyzx","wyzy","wyzz","wyzw","wywx","wywy","wywz","wyww","wzxx","wzxy","wzxz","wzxw","wzyx","wzyy","wzyz","wzyw","wzzx","wzzy","wzzz","wzzw","wzwx","wzwy","wzwz","wzww","wwxx","wwxy","wwxz","wwxw","wwyx","wwyy","wwyz","wwyw","wwzx","wwzy","wwzz","wwzw","wwwx","wwwy","wwwz","wwww","ra","ga","ba","ar","ag","ab","aa","rra","rga","rba","rar","rag","rab","raa","gra","gga","gba","gar","gag","gab","gaa","bra","bga","bba","bar","bag","bab","baa","arr","arg","arb","ara","agr","agg","agb","aga","abr","abg","abb","aba","aar","aag","aab","aaa","rrra","rrga","rrba","rrar","rrag","rrab","rraa","rgra","rgga","rgba","rgar","rgag","rgab","rgaa","rbra","rbga","rbba","rbar","rbag","rbab","rbaa","rarr","rarg","rarb","rara","ragr","ragg","ragb","raga","rabr","rabg","rabb","raba","raar","raag","raab","raaa","grra","grga","grba","grar","grag","grab","graa","ggra","ggga","ggba","ggar","ggag","ggab","ggaa","gbra","gbga","gbba","gbar","gbag","gbab","gbaa","garr","garg","garb","gara","gagr","gagg","gagb","gaga","gabr","gabg","gabb","gaba","gaar","gaag","gaab","gaaa","brra","brga","brba","brar","brag","brab","braa","bgra","bgga","bgba","bgar","bgag","bgab","bgaa","bbra","bbga","bbba","bbar","bbag","bbab","bbaa","barr","barg","barb","bara","bagr","bagg","bagb","baga","babr","babg","babb","baba","baar","baag","baab","baaa","arrr","arrg","arrb","arra","argr","argg","argb","arga","arbr","arbg","arbb","arba","arar","arag","arab","araa","agrr","agrg","agrb","agra","aggr","aggg","aggb","agga","agbr","agbg","agbb","agba","agar","agag","agab","agaa","abrr","abrg","abrb","abra","abgr","abgg","abgb","abga","abbr","abbg","abbb","abba","abar","abag","abab","abaa","aarr","aarg","aarb","aara","aagr","aagg","aagb","aaga","aabr","aabg","aabb","aaba","aaar","aaag","aaab","aaaa"],n={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};function s(r){switch(r.length){case 2:return function(){return new B(this[n[r[0]]],this[n[r[1]]])};case 3:return function(){return new q(this[n[r[0]]],this[n[r[1]]],this[n[r[2]]])};case 4:return function(){return new E(this[n[r[0]]],this[n[r[1]]],this[n[r[2]]],this[n[r[3]]])}}throw new Error("Illegal swizzle length")}for(let r of h){let a=s(r);Object.defineProperty(B.prototype,r,{get:a}),Object.defineProperty(q.prototype,r,{get:a}),Object.defineProperty(E.prototype,r,{get:a})}for(let r of e){let a=s(r);Object.defineProperty(q.prototype,r,{get:a}),Object.defineProperty(E.prototype,r,{get:a})}for(let r of t){let a=s(r);Object.defineProperty(E.prototype,r,{get:a})}U=!0}var ne=Math.PI/180,se=180/Math.PI;function re(h){return h*se}function ae(h){return h*ne} +//# sourceMappingURL=gl-matrix-f32.min.cjs.map diff --git a/dist-cdn/cjs/2022/gl-matrix-f32.min.cjs.map b/dist-cdn/cjs/2022/gl-matrix-f32.min.cjs.map new file mode 100644 index 00000000..8b9a23e1 --- /dev/null +++ b/dist-cdn/cjs/2022/gl-matrix-f32.min.cjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../../../src/cdn/index.ts", "../../../src/_lib/f32/Mat2.ts", "../../../src/_lib/f32/Mat2d.ts", "../../../src/_lib/f32/Mat3.ts", "../../../src/_lib/f32/Mat4.ts", "../../../src/_lib/f32/Vec3.ts", "../../../src/_lib/f32/Vec4.ts", "../../../src/_lib/f32/Quat.ts", "../../../src/_lib/f32/Quat2.ts", "../../../src/_lib/f32/Vec2.ts", "../../../src/swizzle/index.ts", "../../../src/util/angleConversion.ts"], + "sourcesContent": ["/**\r\n * Provides an all-inclusive ESM distribution of `gl-matrix` (32-bit). All library classes extends `Float32Array`.\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\n/* v8 ignore next 6 */\r\nexport * from '#gl-matrix';\r\nexport * from '#gl-matrix/classic';\r\nexport * from '#gl-matrix/swizzle';\r\nexport * from '#gl-matrix/types';\r\nexport * from '#gl-matrix/types/swizzle';\r\nexport * from '#gl-matrix/util';\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x2 Matrix\r\n */\r\nexport class Mat2 extends Float32Array {\r\n static #IDENTITY_2X2 = new Float32Array([\r\n 1, 0,\r\n 0, 1\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n default:\r\n super(Mat2.#IDENTITY_2X2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2} into `this`.\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2.identity(this)\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n identity(): this {\r\n this.set(Mat2.#IDENTITY_2X2);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2} against another one\r\n * Equivalent to `Mat2.multiply(this, this, b);`\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat2}\r\n * Equivalent to `Mat2.transpose(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n transpose(): this {\r\n return Mat2.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat2}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n invert(): this {\r\n return Mat2.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2.scale(this, this, v);`\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2} by the given angle around the given axis\r\n * Equivalent to `Mat2.rotate(this, this, rad);`\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n rotate(rad: number): this {\r\n return Mat2.rotate(this, this, rad) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2}\r\n */\r\n static create(): Mat2 {\r\n return new Mat2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2}\r\n */\r\n static clone(a: Readonly): Mat2 {\r\n return new Mat2(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2Like, a: Readonly): Mat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2}\r\n */\r\n static fromValues(...values: number[]): Mat2 {\r\n return new Mat2(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2Like, ...values: number[]): Mat2Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2Like): Mat2Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat2Like, a: Readonly): Mat2Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache\r\n // some values\r\n if (out === a) {\r\n const a1 = a[1];\r\n out[1] = a[2];\r\n out[2] = a1;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[2];\r\n out[2] = a[1];\r\n out[3] = a[3];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2Like, a: Mat2Like): Mat2Like | null {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n // Calculate the determinant\r\n let det = a0 * a3 - a2 * a1;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = a3 * det;\r\n out[1] = -a1 * det;\r\n out[2] = -a2 * det;\r\n out[3] = a0 * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat2Like, a: Mat2Like): Mat2Like {\r\n // Caching this value is necessary if out == a\r\n const a0 = a[0];\r\n out[0] = a[3];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[2] * a[1];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n return out;\r\n }\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Rotates a {@link Mat2} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2Like, a: Readonly, rad: number): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2Like, a: Readonly, v: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2Like, rad: number): Mat2Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2Like, v: Readonly): Mat2Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2Like, a: Readonly, b: number): Mat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2Like, a: Readonly, b: Readonly, scale: number): Mat2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\r\n * @category Static\r\n *\r\n * @param L - the lower triangular matrix\r\n * @param D - the diagonal matrix\r\n * @param U - the upper triangular matrix\r\n * @param a - the input matrix to factorize\r\n */\r\n\r\n static LDU(L: Mat2Like, D: Readonly, U: Mat2Like, a: Readonly):\r\n [Mat2Like, Readonly, Mat2Like] {\r\n L[2] = a[2] / a[0];\r\n U[0] = a[0];\r\n U[1] = a[1];\r\n U[3] = a[3] - L[2] * U[1];\r\n return [L, D, U];\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat2.prototype.mul = Mat2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat2.mul = Mat2.multiply;\r\nMat2.sub = Mat2.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x3 Matrix\r\n */\r\nexport class Mat2d extends Float32Array {\r\n static #IDENTITY_2X3 = new Float32Array([\r\n 1, 0,\r\n 0, 1,\r\n 0, 0,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 6:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 6); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 6);\r\n }\r\n break;\r\n default:\r\n super(Mat2d.#IDENTITY_2X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2d.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2d.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2d} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2d.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat2d.#IDENTITY_2X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2d} against another one\r\n * Equivalent to `Mat2d.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2d.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Translate this {@link Mat2d} by the given vector\r\n * Equivalent to `Mat2d.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat2d.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2d} by the given angle around the given axis\r\n * Equivalent to `Mat2d.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat2d.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2d.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2d.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2d}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 6 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2d}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2d}\r\n */\r\n static create(): Mat2d {\r\n return new Mat2d();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2d} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2d}\r\n */\r\n static clone(a: Readonly): Mat2d {\r\n return new Mat2d(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2d} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2dLike, a: Readonly): Mat2dLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2d} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2d}\r\n */\r\n static fromValues(...values: number[]): Mat2d {\r\n return new Mat2d(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2d} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2dLike, ...values: number[]): Mat2dLike {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2d} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2dLike): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2dLike, a: Mat2dLike): Mat2dLike | null {\r\n const aa = a[0];\r\n const ab = a[1];\r\n const ac = a[2];\r\n const ad = a[3];\r\n const atx = a[4];\r\n const aty = a[5];\r\n\r\n let det = aa * ad - ab * ac;\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = ad * det;\r\n out[1] = -ab * det;\r\n out[2] = -ac * det;\r\n out[3] = aa * det;\r\n out[4] = (ac * aty - ad * atx) * det;\r\n out[5] = (ab * atx - aa * aty) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[1] * a[2];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2d}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n out[4] = a0 * b4 + a2 * b5 + a4;\r\n out[5] = a1 * b4 + a3 * b5 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat2d} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n out[4] = a0 * v0 + a2 * v1 + a4;\r\n out[5] = a1 * v0 + a3 * v1 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat2d} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2dLike, a: Readonly, rad: number): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n // TODO: Got to fromRotation\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = v[0];\r\n out[5] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2dLike, rad: number): Mat2dLike {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2d} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2dLike, a: Readonly, b: number): Mat2dLike {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2dLike, a: Readonly, b: Readonly, scale: number):\r\n Mat2dLike {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2d(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Static method alias assignments\r\nMat2d.mul = Mat2d.multiply;\r\nMat2d.sub = Mat2d.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Mat3Like, Mat4Like, Vec2Like, QuatLike } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 3x3 Matrix\r\n */\r\nexport class Mat3 extends Float32Array {\r\n static #IDENTITY_3X3 = new Float32Array([\r\n 1, 0, 0,\r\n 0, 1, 0,\r\n 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 9:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 9); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v,\r\n v, v, v,\r\n v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 9);\r\n }\r\n break;\r\n default:\r\n super(Mat3.#IDENTITY_3X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat3.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat3.#IDENTITY_3X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat3} against another one\r\n * Equivalent to `Mat3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat3.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat3}\r\n * Equivalent to `Mat3.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat3.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat3}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat3.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat3} by the given vector\r\n * Equivalent to `Mat3.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat3.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat3} by the given angle around the given axis\r\n * Equivalent to `Mat3.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat3.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat3.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat3.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 9 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat3}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat3}\r\n */\r\n static create(): Mat3 {\r\n return new Mat3();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat3} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat3}\r\n */\r\n static clone(a: Readonly): Mat3 {\r\n return new Mat3(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat3} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat3} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat3}\r\n */\r\n static fromValues(...values: number[]): Mat3 {\r\n return new Mat3(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat3} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat3Like, ...values: number[]): Mat3Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat3} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat3Like): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat3Like, a: Readonly): Mat3Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a12 = a[5];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a01;\r\n out[5] = a[7];\r\n out[6] = a02;\r\n out[7] = a12;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a[1];\r\n out[4] = a[4];\r\n out[5] = a[7];\r\n out[6] = a[2];\r\n out[7] = a[5];\r\n out[8] = a[8];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat3Like, a: Mat3Like): Mat3Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2];\r\n const a10 = a[3],\r\n a11 = a[4],\r\n a12 = a[5];\r\n const a20 = a[6],\r\n a21 = a[7],\r\n a22 = a[8];\r\n\r\n const b01 = a22 * a11 - a12 * a21;\r\n const b11 = -a22 * a10 + a12 * a20;\r\n const b21 = a21 * a10 - a11 * a20;\r\n\r\n // Calculate the determinant\r\n let det = a00 * b01 + a01 * b11 + a02 * b21;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = b01 * det;\r\n out[1] = (-a22 * a01 + a02 * a21) * det;\r\n out[2] = (a12 * a01 - a02 * a11) * det;\r\n out[3] = b11 * det;\r\n out[4] = (a22 * a00 - a02 * a20) * det;\r\n out[5] = (-a12 * a00 + a02 * a10) * det;\r\n out[6] = b21 * det;\r\n out[7] = (-a21 * a00 + a01 * a20) * det;\r\n out[8] = (a11 * a00 - a01 * a10) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat3Like, a: Mat3Like): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n out[0] = a11 * a22 - a12 * a21;\r\n out[1] = a02 * a21 - a01 * a22;\r\n out[2] = a01 * a12 - a02 * a11;\r\n out[3] = a12 * a20 - a10 * a22;\r\n out[4] = a00 * a22 - a02 * a20;\r\n out[5] = a02 * a10 - a00 * a12;\r\n out[6] = a10 * a21 - a11 * a20;\r\n out[7] = a01 * a20 - a00 * a21;\r\n out[8] = a00 * a11 - a01 * a10;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n return (\r\n a00 * (a22 * a11 - a12 * a21) +\r\n a01 * (-a22 * a10 + a12 * a20) +\r\n a02 * (a21 * a10 - a11 * a20)\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[3];\r\n b1 = b[4];\r\n b2 = b[5];\r\n out[3] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[4] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[5] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[6];\r\n b1 = b[7];\r\n b2 = b[8];\r\n out[6] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[7] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[8] = b0 * a02 + b1 * a12 + b2 * a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat3} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n\r\n out[3] = a10;\r\n out[4] = a11;\r\n out[5] = a12;\r\n\r\n out[6] = x * a00 + y * a10 + a20;\r\n out[7] = x * a01 + y * a11 + a21;\r\n out[8] = x * a02 + y * a12 + a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat3} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat3Like, a: Readonly, rad: number): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c * a00 + s * a10;\r\n out[1] = c * a01 + s * a11;\r\n out[2] = c * a02 + s * a12;\r\n\r\n out[3] = c * a10 - s * a00;\r\n out[4] = c * a11 - s * a01;\r\n out[5] = c * a12 - s * a02;\r\n\r\n out[6] = a20;\r\n out[7] = a21;\r\n out[8] = a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat3} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = x * a[0];\r\n out[1] = x * a[1];\r\n out[2] = x * a[2];\r\n\r\n out[3] = y * a[3];\r\n out[4] = y * a[4];\r\n out[5] = y * a[5];\r\n\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = v[0];\r\n out[7] = v[1];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.rotate(dest, dest, rad);\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat3Like, rad: number): Mat3Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n\r\n out[3] = -s;\r\n out[4] = c;\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n\r\n out[3] = 0;\r\n out[4] = v[1];\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat2d} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 2x3 matrix\r\n * @returns `out`\r\n */\r\n static fromMat2d(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = 0;\r\n\r\n out[3] = a[2];\r\n out[4] = a[3];\r\n out[5] = 0;\r\n\r\n out[6] = a[4];\r\n out[7] = a[5];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param q - {@link Quat} to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat3Like, q: Readonly): Mat3Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[3] = yx - wz;\r\n out[6] = zx + wy;\r\n\r\n out[1] = yx + wz;\r\n out[4] = 1 - xx - zz;\r\n out[7] = zy - wx;\r\n\r\n out[2] = zx - wy;\r\n out[5] = zy + wx;\r\n out[8] = 1 - xx - yy;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat4} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 4x4 matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[4];\r\n out[4] = a[5];\r\n out[5] = a[6];\r\n out[6] = a[8];\r\n out[7] = a[9];\r\n out[8] = a[10];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\r\n * @category Static\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat3Like, a: Readonly): Mat3Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n\r\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n\r\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat3Like, a: Readonly): Mat3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n\r\n out[3] = cy * az - cz * ay;\r\n out[4] = cz * ax - cx * az;\r\n out[5] = cx * ay - cy * ax;\r\n\r\n out[6] = ay * bz - az * by;\r\n out[7] = az * bx - ax * bz;\r\n out[8] = ax * by - ay * bx;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a 2D projection matrix with the given bounds\r\n * @category Static\r\n *\r\n * @param out mat3 frustum matrix will be written into\r\n * @param width Width of your gl context\r\n * @param height Height of gl context\r\n * @returns `out`\r\n */\r\n static projection(out: Mat3Like, width: number, height: number): Mat3Like {\r\n out[0] = 2 / width;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -2 / height;\r\n out[5] = 0;\r\n out[6] = -1;\r\n out[7] = 1;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8]\r\n );\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat3} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat3Like, a: Readonly, b: number): Mat3Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat3Like, a: Readonly, b: Readonly, scale: number): Mat3Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat3(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat3.prototype.mul = Mat3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat3.mul = Mat3.multiply;\r\nMat3.sub = Mat3.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 4x4 Matrix\r\n */\r\nexport class Mat4 extends Float32Array {\r\n static #IDENTITY_4X4 = new Float32Array([\r\n 1, 0, 0, 0,\r\n 0, 1, 0, 0,\r\n 0, 0, 1, 0,\r\n 0, 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Temporary variable to prevent repeated allocations in the algorithms within Mat4.\r\n * These are declared as TypedArrays to aid in tree-shaking.\r\n */\r\n static #TMP_VEC3 = new Float32Array(3);\r\n\r\n /**\r\n * Create a {@link Mat4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 16:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 16); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 16);\r\n }\r\n break;\r\n default:\r\n super(Mat4.#IDENTITY_4X4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat4.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat4.#IDENTITY_4X4);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat4} against another one\r\n * Equivalent to `Mat4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat4.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat4}\r\n * Equivalent to `Mat4.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat4.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat4}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat4.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat4} by the given vector\r\n * Equivalent to `Mat4.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat4.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the given axis\r\n * Equivalent to `Mat4.rotate(this, this, rad, axis);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `this`\r\n */\r\n rotate(rad: number, axis: Readonly): this {\r\n return Mat4.rotate(this, this, rad, axis) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat4.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat4.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the X axis\r\n * Equivalent to `Mat4.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Mat4.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Y axis\r\n * Equivalent to `Mat4.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Mat4.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Z axis\r\n * Equivalent to `Mat4.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Mat4.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveNO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveNO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveZO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveZO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoNO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoNO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoZO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoZO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 16 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat4}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat4}\r\n */\r\n static create(): Mat4 {\r\n return new Mat4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat4} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat4}\r\n */\r\n static clone(a: Readonly): Mat4 {\r\n return new Mat4(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat4} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat4Like, a: Readonly): Mat4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new mat4 with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat4}\r\n */\r\n static fromValues(...values: number[]): Mat4 {\r\n return new Mat4(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a mat4 to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat4Like, ...values: number[]): Mat4Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n out[9] = values[9];\r\n out[10] = values[10];\r\n out[11] = values[11];\r\n out[12] = values[12];\r\n out[13] = values[13];\r\n out[14] = values[14];\r\n out[15] = values[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat4} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat4Like): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat4Like, a: Readonly): Mat4Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a12 = a[6],\r\n a13 = a[7];\r\n const a23 = a[11];\r\n\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a01;\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a02;\r\n out[9] = a12;\r\n out[11] = a[14];\r\n out[12] = a03;\r\n out[13] = a13;\r\n out[14] = a23;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a[1];\r\n out[5] = a[5];\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a[2];\r\n out[9] = a[6];\r\n out[10] = a[10];\r\n out[11] = a[14];\r\n out[12] = a[3];\r\n out[13] = a[7];\r\n out[14] = a[11];\r\n out[15] = a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat4Like, a: Mat4Like): Mat4Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\r\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\r\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\r\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\r\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\r\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\r\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat4Like, a: Mat4Like): Mat4Like {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n out[0] = a11 * b11 - a12 * b10 + a13 * b09;\r\n out[1] = a02 * b10 - a01 * b11 - a03 * b09;\r\n out[2] = a31 * b05 - a32 * b04 + a33 * b03;\r\n out[3] = a22 * b04 - a21 * b05 - a23 * b03;\r\n out[4] = a12 * b08 - a10 * b11 - a13 * b07;\r\n out[5] = a00 * b11 - a02 * b08 + a03 * b07;\r\n out[6] = a32 * b02 - a30 * b05 - a33 * b01;\r\n out[7] = a20 * b05 - a22 * b02 + a23 * b01;\r\n out[8] = a10 * b10 - a11 * b08 + a13 * b06;\r\n out[9] = a01 * b08 - a00 * b10 - a03 * b06;\r\n out[10] = a30 * b04 - a31 * b02 + a33 * b00;\r\n out[11] = a21 * b02 - a20 * b04 - a23 * b00;\r\n out[12] = a11 * b07 - a10 * b09 - a12 * b06;\r\n out[13] = a00 * b09 - a01 * b07 + a02 * b06;\r\n out[14] = a31 * b01 - a30 * b03 - a32 * b00;\r\n out[15] = a20 * b03 - a21 * b01 + a22 * b00;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b0 = a00 * a11 - a01 * a10;\r\n const b1 = a00 * a12 - a02 * a10;\r\n const b2 = a01 * a12 - a02 * a11;\r\n const b3 = a20 * a31 - a21 * a30;\r\n const b4 = a20 * a32 - a22 * a30;\r\n const b5 = a21 * a32 - a22 * a31;\r\n const b6 = a00 * b5 - a01 * b4 + a02 * b3;\r\n const b7 = a10 * b5 - a11 * b4 + a12 * b3;\r\n const b8 = a20 * b2 - a21 * b1 + a22 * b0;\r\n const b9 = a30 * b2 - a31 * b1 + a32 * b0;\r\n\r\n // Calculate the determinant\r\n return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Mat4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n // Cache only the current line of the second matrix\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n let b3 = b[3];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[4];\r\n b1 = b[5];\r\n b2 = b[6];\r\n b3 = b[7];\r\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[8];\r\n b1 = b[9];\r\n b2 = b[10];\r\n b3 = b[11];\r\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[12];\r\n b1 = b[13];\r\n b2 = b[14];\r\n b3 = b[15];\r\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat4} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n if (a === out) {\r\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\r\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\r\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\r\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\r\n } else {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n out[3] = a03;\r\n out[4] = a10;\r\n out[5] = a11;\r\n out[6] = a12;\r\n out[7] = a13;\r\n out[8] = a20;\r\n out[9] = a21;\r\n out[10] = a22;\r\n out[11] = a23;\r\n\r\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\r\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\r\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\r\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec3} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n out[0] = a[0] * x;\r\n out[1] = a[1] * x;\r\n out[2] = a[2] * x;\r\n out[3] = a[3] * x;\r\n out[4] = a[4] * y;\r\n out[5] = a[5] * y;\r\n out[6] = a[6] * y;\r\n out[7] = a[7] * y;\r\n out[8] = a[8] * z;\r\n out[9] = a[9] * z;\r\n out[10] = a[10] * z;\r\n out[11] = a[11] * z;\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat4} by the given angle around the given axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if axis has a length of 0\r\n */\r\n static rotate(out: Mat4Like, a: Readonly, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n // Construct the elements of the rotation matrix\r\n const b00 = x * x * t + c;\r\n const b01 = y * x * t + z * s;\r\n const b02 = z * x * t - y * s;\r\n const b10 = x * y * t - z * s;\r\n const b11 = y * y * t + c;\r\n const b12 = z * y * t + x * s;\r\n const b20 = x * z * t + y * s;\r\n const b21 = y * z * t - x * s;\r\n const b22 = z * z * t + c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\r\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\r\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\r\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\r\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\r\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\r\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\r\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\r\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\r\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\r\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\r\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateX(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[4] = a10 * c + a20 * s;\r\n out[5] = a11 * c + a21 * s;\r\n out[6] = a12 * c + a22 * s;\r\n out[7] = a13 * c + a23 * s;\r\n out[8] = a20 * c - a10 * s;\r\n out[9] = a21 * c - a11 * s;\r\n out[10] = a22 * c - a12 * s;\r\n out[11] = a23 * c - a13 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateY(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c - a20 * s;\r\n out[1] = a01 * c - a21 * s;\r\n out[2] = a02 * c - a22 * s;\r\n out[3] = a03 * c - a23 * s;\r\n out[8] = a00 * s + a20 * c;\r\n out[9] = a01 * s + a21 * c;\r\n out[10] = a02 * s + a22 * c;\r\n out[11] = a03 * s + a23 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c + a10 * s;\r\n out[1] = a01 * c + a11 * s;\r\n out[2] = a02 * c + a12 * s;\r\n out[3] = a03 * c + a13 * s;\r\n out[4] = a10 * c - a00 * s;\r\n out[5] = a11 * c - a01 * s;\r\n out[6] = a12 * c - a02 * s;\r\n out[7] = a13 * c - a03 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = v[1];\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = v[2];\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotate(dest, dest, rad, axis);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if `axis` has a length of 0\r\n */\r\n static fromRotation(out: Mat4Like, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = x * x * t + c;\r\n out[1] = y * x * t + z * s;\r\n out[2] = z * x * t - y * s;\r\n out[3] = 0;\r\n out[4] = x * y * t - z * s;\r\n out[5] = y * y * t + c;\r\n out[6] = z * y * t + x * s;\r\n out[7] = 0;\r\n out[8] = x * z * t + y * s;\r\n out[9] = y * z * t - x * s;\r\n out[10] = z * z * t + c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the X axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateX(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromXRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = c;\r\n out[6] = s;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = -s;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Y axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateY(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromYRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = 0;\r\n out[2] = -s;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = s;\r\n out[9] = 0;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Z axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateZ(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromZRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -s;\r\n out[5] = c;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation and vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Mat4Like, q: Readonly, v: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - (yy + zz);\r\n out[1] = xy + wz;\r\n out[2] = xz - wy;\r\n out[3] = 0;\r\n out[4] = xy - wz;\r\n out[5] = 1 - (xx + zz);\r\n out[6] = yz + wx;\r\n out[7] = 0;\r\n out[8] = xz + wy;\r\n out[9] = yz - wx;\r\n out[10] = 1 - (xx + yy);\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Mat4} from a {@link Quat2}.\r\n * @category Static\r\n *\r\n * @param out - Matrix\r\n * @param a - Dual Quaternion\r\n * @returns `out`\r\n */\r\n static fromQuat2(out: Mat4Like, a: Quat2Like): Mat4Like {\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n\r\n const magnitude = bx * bx + by * by + bz * bz + bw * bw;\r\n\r\n // Only scale if it makes sense\r\n if (magnitude > 0) {\r\n Mat4.#TMP_VEC3[0] = ((ax * bw + aw * bx + ay * bz - az * by) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[1] = ((ay * bw + aw * by + az * bx - ax * bz) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[2] = ((az * bw + aw * bz + ax * by - ay * bx) * 2) / magnitude;\r\n } else {\r\n Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n }\r\n Mat4.fromRotationTranslation(out, a as QuatLike, Mat4.#TMP_VEC3);\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat4Like, a: Readonly): Mat4Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[3] = 0;\r\n\r\n out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[7] = 0;\r\n\r\n out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat4Like, a: Readonly): Mat4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n out[3] = 0;\r\n\r\n out[4] = cy * az - cz * ay;\r\n out[5] = cz * ax - cx * az;\r\n out[6] = cx * ay - cy * ax;\r\n out[7] = 0;\r\n\r\n out[8] = ay * bz - az * by;\r\n out[9] = az * bx - ax * bz;\r\n out[10] = ax * by - ay * bx;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the translation vector component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslation,\r\n * the returned vector will be the same as the translation vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive translation component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getTranslation(out: Vec3Like, mat: Readonly): Vec3Like {\r\n out[0] = mat[12];\r\n out[1] = mat[13];\r\n out[2] = mat[14];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the scaling factor component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslationScale\r\n * with a normalized Quaternion parameter, the returned vector will be\r\n * the same as the scaling vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive scaling factor component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getScaling(out: Vec3Like, mat: Readonly): Vec3Like {\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a quaternion representing the rotational component\r\n * of a transformation matrix. If a matrix is built with\r\n * fromRotationTranslation, the returned quaternion will be the\r\n * same as the quaternion originally supplied.\r\n * @category Static\r\n *\r\n * @param out - Quaternion to receive the rotation component\r\n * @param mat - Matrix to be decomposed (input)\r\n * @return `out`\r\n */\r\n static getRotation(out: QuatLike, mat: Readonly): QuatLike {\r\n Mat4.getScaling(Mat4.#TMP_VEC3, mat);\r\n\r\n const is1 = 1 / Mat4.#TMP_VEC3[0];\r\n const is2 = 1 / Mat4.#TMP_VEC3[1];\r\n const is3 = 1 / Mat4.#TMP_VEC3[2];\r\n\r\n const sm11 = mat[0] * is1;\r\n const sm12 = mat[1] * is2;\r\n const sm13 = mat[2] * is3;\r\n const sm21 = mat[4] * is1;\r\n const sm22 = mat[5] * is2;\r\n const sm23 = mat[6] * is3;\r\n const sm31 = mat[8] * is1;\r\n const sm32 = mat[9] * is2;\r\n const sm33 = mat[10] * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out[3] = 0.25 * S;\r\n out[0] = (sm23 - sm32) / S;\r\n out[1] = (sm31 - sm13) / S;\r\n out[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out[3] = (sm23 - sm32) / S;\r\n out[0] = 0.25 * S;\r\n out[1] = (sm12 + sm21) / S;\r\n out[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out[3] = (sm31 - sm13) / S;\r\n out[0] = (sm12 + sm21) / S;\r\n out[1] = 0.25 * S;\r\n out[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out[3] = (sm12 - sm21) / S;\r\n out[0] = (sm31 + sm13) / S;\r\n out[1] = (sm23 + sm32) / S;\r\n out[2] = 0.25 * S;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Decomposes a transformation matrix into its rotation, translation\r\n * and scale components. Returns only the rotation component\r\n * @category Static\r\n *\r\n * @param out_r - Quaternion to receive the rotation component\r\n * @param out_t - Vector to receive the translation vector\r\n * @param out_s - Vector to receive the scaling factor\r\n * @param mat - Matrix to be decomposed (input)\r\n * @returns `out_r`\r\n */\r\n static decompose(out_r: QuatLike, out_t: Vec3Like, out_s: Vec3Like, mat: Readonly): QuatLike {\r\n out_t[0] = mat[12];\r\n out_t[1] = mat[13];\r\n out_t[2] = mat[14];\r\n\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n const is1 = 1 / out_s[0];\r\n const is2 = 1 / out_s[1];\r\n const is3 = 1 / out_s[2];\r\n\r\n const sm11 = m11 * is1;\r\n const sm12 = m12 * is2;\r\n const sm13 = m13 * is3;\r\n const sm21 = m21 * is1;\r\n const sm22 = m22 * is2;\r\n const sm23 = m23 * is3;\r\n const sm31 = m31 * is1;\r\n const sm32 = m32 * is2;\r\n const sm33 = m33 * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out_r[3] = 0.25 * S;\r\n out_r[0] = (sm23 - sm32) / S;\r\n out_r[1] = (sm31 - sm13) / S;\r\n out_r[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out_r[3] = (sm23 - sm32) / S;\r\n out_r[0] = 0.25 * S;\r\n out_r[1] = (sm12 + sm21) / S;\r\n out_r[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out_r[3] = (sm31 - sm13) / S;\r\n out_r[0] = (sm12 + sm21) / S;\r\n out_r[1] = 0.25 * S;\r\n out_r[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out_r[3] = (sm12 - sm21) / S;\r\n out_r[0] = (sm31 + sm13) / S;\r\n out_r[1] = (sm23 + sm32) / S;\r\n out_r[2] = 0.25 * S;\r\n }\r\n\r\n return out_r;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScale(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n out[0] = (1 - (yy + zz)) * sx;\r\n out[1] = (xy + wz) * sx;\r\n out[2] = (xz - wy) * sx;\r\n out[3] = 0;\r\n out[4] = (xy - wz) * sy;\r\n out[5] = (1 - (xx + zz)) * sy;\r\n out[6] = (yz + wx) * sy;\r\n out[7] = 0;\r\n out[8] = (xz + wy) * sz;\r\n out[9] = (yz - wx) * sz;\r\n out[10] = (1 - (xx + yy)) * sz;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the\r\n * given origin. This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * mat4.translate(dest, origin);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n * mat4.translate(dest, negativeOrigin);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @param o - The origin vector around which to scale and rotate\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScaleOrigin(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly, o: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n const ox = o[0];\r\n const oy = o[1];\r\n const oz = o[2];\r\n\r\n const out0 = (1 - (yy + zz)) * sx;\r\n const out1 = (xy + wz) * sx;\r\n const out2 = (xz - wy) * sx;\r\n const out4 = (xy - wz) * sy;\r\n const out5 = (1 - (xx + zz)) * sy;\r\n const out6 = (yz + wx) * sy;\r\n const out8 = (xz + wy) * sz;\r\n const out9 = (yz - wx) * sz;\r\n const out10 = (1 - (xx + yy)) * sz;\r\n\r\n out[0] = out0;\r\n out[1] = out1;\r\n out[2] = out2;\r\n out[3] = 0;\r\n out[4] = out4;\r\n out[5] = out5;\r\n out[6] = out6;\r\n out[7] = 0;\r\n out[8] = out8;\r\n out[9] = out9;\r\n out[10] = out10;\r\n out[11] = 0;\r\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\r\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\r\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 4x4 matrix from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Quaternion to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat4Like, q: Readonly): Mat4Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[1] = yx + wz;\r\n out[2] = zx - wy;\r\n out[3] = 0;\r\n\r\n out[4] = yx - wz;\r\n out[5] = 1 - xx - zz;\r\n out[6] = zy + wx;\r\n out[7] = 0;\r\n\r\n out[8] = zx + wy;\r\n out[9] = zy - wx;\r\n out[10] = 1 - xx - yy;\r\n out[11] = 0;\r\n\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.frustumNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly\r\n */\r\n static frustum(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like { return out; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveNO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.perspectiveNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static perspective(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveZO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating\r\n * projection matrices to be used with the still experimental WebVR API.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n * @deprecated\r\n */\r\n static perspectiveFromFieldOfView(out: Mat4Like,\r\n fov: { upDegrees: number, downDegrees: number, leftDegrees: number, rightDegrees: number }, near: number,\r\n far: number): Mat4Like {\r\n\r\n const upTan = Math.tan((fov.upDegrees * Math.PI) / 180.0);\r\n const downTan = Math.tan((fov.downDegrees * Math.PI) / 180.0);\r\n const leftTan = Math.tan((fov.leftDegrees * Math.PI) / 180.0);\r\n const rightTan = Math.tan((fov.rightDegrees * Math.PI) / 180.0);\r\n const xScale = 2.0 / (leftTan + rightTan);\r\n const yScale = 2.0 / (upTan + downTan);\r\n\r\n out[0] = xScale;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n out[4] = 0.0;\r\n out[5] = yScale;\r\n out[6] = 0.0;\r\n out[7] = 0.0;\r\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\r\n out[9] = (upTan - downTan) * yScale * 0.5;\r\n out[10] = far / (near - far);\r\n out[11] = -1.0;\r\n out[12] = 0.0;\r\n out[13] = 0.0;\r\n out[14] = (far * near) / (near - far);\r\n out[15] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 2 * nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = (far + near) * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.orthoNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static ortho(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, far: number):\r\n Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = near * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that\r\n * actually makes an object look at another object, you should use targetTo instead.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param center - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static lookAt(out: Mat4Like, eye: Readonly, center: Readonly, up: Readonly): Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n const centerx = center[0];\r\n const centery = center[1];\r\n const centerz = center[2];\r\n\r\n if (\r\n Math.abs(eyex - centerx) < GLM_EPSILON &&\r\n Math.abs(eyey - centery) < GLM_EPSILON &&\r\n Math.abs(eyez - centerz) < GLM_EPSILON\r\n ) {\r\n return Mat4.identity(out);\r\n }\r\n\r\n let z0 = eyex - centerx;\r\n let z1 = eyey - centery;\r\n let z2 = eyez - centerz;\r\n\r\n let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\r\n if (!len) {\r\n x0 = 0;\r\n x1 = 0;\r\n x2 = 0;\r\n } else {\r\n len = 1 / len;\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n let y0 = z1 * x2 - z2 * x1;\r\n let y1 = z2 * x0 - z0 * x2;\r\n let y2 = z0 * x1 - z1 * x0;\r\n\r\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\r\n if (!len) {\r\n y0 = 0;\r\n y1 = 0;\r\n y2 = 0;\r\n } else {\r\n len = 1 / len;\r\n y0 *= len;\r\n y1 *= len;\r\n y2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = y0;\r\n out[2] = z0;\r\n out[3] = 0;\r\n out[4] = x1;\r\n out[5] = y1;\r\n out[6] = z1;\r\n out[7] = 0;\r\n out[8] = x2;\r\n out[9] = y2;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\r\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\r\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a matrix that makes something look at something else.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param target - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static targetTo(out: Mat4Like, eye: Readonly, target: Readonly, up: Readonly):\r\n Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n\r\n let z0 = eyex - target[0];\r\n let z1 = eyey - target[1];\r\n let z2 = eyez - target[2];\r\n\r\n let len = z0 * z0 + z1 * z1 + z2 * z2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n }\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n\r\n len = x0 * x0 + x1 * x1 + x2 * x2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = x1;\r\n out[2] = x2;\r\n out[3] = 0;\r\n out[4] = z1 * x2 - z2 * x1;\r\n out[5] = z2 * x0 - z0 * x2;\r\n out[6] = z0 * x1 - z1 * x0;\r\n out[7] = 0;\r\n out[8] = z0;\r\n out[9] = z1;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = eyex;\r\n out[13] = eyey;\r\n out[14] = eyez;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8] +\r\n a[9] * a[9] +\r\n a[10] * a[10] +\r\n a[11] * a[11] +\r\n a[12] * a[12] +\r\n a[13] * a[13] +\r\n a[14] * a[14] +\r\n a[15] * a[15]\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n out[9] = a[9] + b[9];\r\n out[10] = a[10] + b[10];\r\n out[11] = a[11] + b[11];\r\n out[12] = a[12] + b[12];\r\n out[13] = a[13] + b[13];\r\n out[14] = a[14] + b[14];\r\n out[15] = a[15] + b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n out[9] = a[9] - b[9];\r\n out[10] = a[10] - b[10];\r\n out[11] = a[11] - b[11];\r\n out[12] = a[12] - b[12];\r\n out[13] = a[13] - b[13];\r\n out[14] = a[14] - b[14];\r\n out[15] = a[15] - b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Multiply each element of the matrix by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat4Like, a: Readonly, b: number): Mat4Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n out[9] = a[9] * b;\r\n out[10] = a[10] * b;\r\n out[11] = a[11] * b;\r\n out[12] = a[12] * b;\r\n out[13] = a[13] * b;\r\n out[14] = a[14] * b;\r\n out[15] = a[15] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat4Like, a: Readonly, b: Readonly, scale: number): Mat4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n out[9] = a[9] + b[9] * scale;\r\n out[10] = a[10] + b[10] * scale;\r\n out[11] = a[11] + b[11] * scale;\r\n out[12] = a[12] + b[12] * scale;\r\n out[13] = a[13] + b[13] * scale;\r\n out[14] = a[14] + b[14] * scale;\r\n out[15] = a[15] + b[15] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8] &&\r\n a[9] === b[9] &&\r\n a[10] === b[10] &&\r\n a[11] === b[11] &&\r\n a[12] === b[12] &&\r\n a[13] === b[13] &&\r\n a[14] === b[14] &&\r\n a[15] === b[15]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n const a9 = a[9];\r\n const a10 = a[10];\r\n const a11 = a[11];\r\n const a12 = a[12];\r\n const a13 = a[13];\r\n const a14 = a[14];\r\n const a15 = a[15];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n const b9 = b[9];\r\n const b10 = b[10];\r\n const b11 = b[11];\r\n const b12 = b[12];\r\n const b13 = b[13];\r\n const b14 = b[14];\r\n const b15 = b[15];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) &&\r\n Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) &&\r\n Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) &&\r\n Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) &&\r\n Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) &&\r\n Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) &&\r\n Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) &&\r\n Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat4(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat4.prototype.mul = Mat4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat4.sub = Mat4.subtract;\r\nMat4.mul = Mat4.multiply;\r\nMat4.frustum = Mat4.frustumNO;\r\nMat4.perspective = Mat4.perspectiveNO;\r\nMat4.ortho = Mat4.orthoNO;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, Mat4Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 3 Dimensional Vector\r\n */\r\nexport class Vec3 extends Float32Array {\r\n /**\r\n * Create a {@link Vec3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 3:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 3); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 3);\r\n }\r\n break;\r\n }\r\n default:\r\n super(3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec3.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec3.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec3} to `this`.\r\n * Equivalent to `Vec3.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec3} from `this`.\r\n * Equivalent to `Vec3.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec3.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec3.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec3.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec3.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec3.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to its absolute value.\r\n * Equivalent to `Vec3.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec3}.\r\n * Equivalent to `Vec3.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec3.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec3.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 3 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty vec3\r\n * @category Static\r\n *\r\n * @returns a new 3D vector\r\n */\r\n static create(): Vec3 {\r\n return new Vec3();\r\n }\r\n\r\n /**\r\n * Creates a new vec3 initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 3D vector\r\n */\r\n static clone(a: Readonly): Vec3 {\r\n return new Vec3(a);\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Creates a new vec3 initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns a new 3D vector\r\n */\r\n static fromValues(x: number, y: number, z: number): Vec3 {\r\n return new Vec3(x, y, z);\r\n }\r\n\r\n /**\r\n * Copy the values from one vec3 to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns `out`\r\n */\r\n static set(out: Vec3Like, x: number, y: number, z: number): Vec3Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Multiplies two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; }\r\n\r\n /**\r\n * Divides two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Math.ceil the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * symmetric round the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n /*\r\n static round(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = glMatrix.round(a[0]);\r\n out[1] = glMatrix.round(a[1]);\r\n out[2] = glMatrix.round(a[2]);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Scales a vec3 by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec3Like, a: Readonly, scale: number): Vec3Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two vec3's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec3Like, a: Readonly, b: Readonly, scale: number) {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared length of a vec3\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec3Like, a: Readonly): Vec3Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n let len = x * x + y * y + z * z;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n out[2] = a[2] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2];\r\n const bx = b[0],\r\n by = b[1],\r\n bz = b[2];\r\n\r\n out[0] = ay * bz - az * by;\r\n out[1] = az * bx - ax * bz;\r\n out[2] = ax * by - ay * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const angle = Math.acos(Math.min(Math.max(Vec3.dot(a, b), -1), 1));\r\n const sinTotal = Math.sin(angle);\r\n\r\n const ratioA = Math.sin((1 - t) * angle) / sinTotal;\r\n const ratioB = Math.sin(t * angle) / sinTotal;\r\n out[0] = ratioA * a[0] + ratioB * b[0];\r\n out[1] = ratioA * a[1] + ratioB * b[1];\r\n out[2] = ratioA * a[2] + ratioB * b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a hermite interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static hermite(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const factorTimes2 = t * t;\r\n const factor1 = factorTimes2 * (2 * t - 3) + 1;\r\n const factor2 = factorTimes2 * (t - 2) + t;\r\n const factor3 = factorTimes2 * (t - 1);\r\n const factor4 = factorTimes2 * (3 - 2 * t);\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a bezier interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static bezier(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const inverseFactor = 1 - t;\r\n const inverseFactorTimesTwo = inverseFactor * inverseFactor;\r\n const factorTimes2 = t * t;\r\n const factor1 = inverseFactorTimesTwo * inverseFactor;\r\n const factor2 = 3 * t * inverseFactorTimesTwo;\r\n const factor3 = 3 * factorTimes2 * inverseFactor;\r\n const factor4 = factorTimes2 * t;\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec3Like, scale) {\r\n scale = scale === undefined ? 1.0 : scale;\r\n\r\n let r = glMatrix.RANDOM() * 2.0 * Math.PI;\r\n let z = glMatrix.RANDOM() * 2.0 - 1.0;\r\n let zScale = Math.sqrt(1.0 - z * z) * scale;\r\n\r\n out[0] = Math.cos(r) * zScale;\r\n out[1] = Math.sin(r) * zScale;\r\n out[2] = z * scale;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the vec3 with a mat4.\r\n * 4th vector component is implicitly '1'\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec3Like, a: Readonly, m: Readonly): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1.0;\r\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\r\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\r\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a mat3.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - the 3x3 matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat3(out: Vec3Like, a: Vec3Like, m: Mat3Like): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n out[0] = x * m[0] + y * m[3] + z * m[6];\r\n out[1] = x * m[1] + y * m[4] + z * m[7];\r\n out[2] = x * m[2] + y * m[5] + z * m[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a quat\r\n * Can also be used for dual quaternions. (Multiply it with the real part)\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec3Like, a: Readonly, q: Readonly): Vec3Like {\r\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const w2 = q[3] * 2;\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n // var qvec = [qx, qy, qz];\r\n // var uv = vec3.cross([], qvec, a);\r\n const uvx = (qy * z - qz * y);\r\n const uvy = (qz * x - qx * z);\r\n const uvz = (qx * y - qy * x);\r\n // var uuv = vec3.cross([], qvec, uv);\r\n // vec3.scale(uuv, uuv, 2);\r\n const uuvx = (qy * uvz - qz * uvy) * 2;\r\n const uuvy = (qz * uvx - qx * uvz) * 2;\r\n const uuvz = (qx * uvy - qy * uvx) * 2;\r\n // vec3.scale(uv, uv, 2 * w);\r\n // return vec3.add(out, a, vec3.add(out, uv, uuv));\r\n out[0] = x + (uvx * w2) + uuvx;\r\n out[1] = y + (uvy * w2) + uuvy;\r\n out[2] = z + (uvz * w2) + uuvz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the x-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateX(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const by = b[1];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const py = a[1] - by;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = a[0];\r\n out[1] = (py * Math.cos(rad) - pz * Math.sin(rad)) + by;\r\n out[2] = (py * Math.sin(rad) + pz * Math.cos(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the y-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateY(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (pz * Math.sin(rad) + px * Math.cos(rad)) + bx;\r\n out[1] = a[1];\r\n out[2] = (pz * Math.cos(rad) - px * Math.sin(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the z-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const by = b[1];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const py = a[1] - by;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (px * Math.cos(rad) - py * Math.sin(rad)) + bx;\r\n out[1] = (px * Math.sin(rad) + py * Math.cos(rad)) + by;\r\n out[2] = b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 3D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly) {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz));\r\n const cosine = mag && Vec3.dot(a, b) / mag;\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec3Like): Vec3Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec3(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec3.prototype.sub = Vec3.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.mul = Vec3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.div = Vec3.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.dist = Vec3.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.sqrDist = Vec3.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec3.sub = Vec3.subtract;\r\nVec3.mul = Vec3.multiply;\r\nVec3.div = Vec3.divide;\r\nVec3.dist = Vec3.distance;\r\nVec3.sqrDist = Vec3.squaredDistance;\r\nVec3.sqrLen = Vec3.squaredLength;\r\nVec3.mag = Vec3.magnitude;\r\nVec3.length = Vec3.magnitude;\r\nVec3.len = Vec3.magnitude;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Vec4Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 4 Dimensional Vector\r\n */\r\nexport class Vec4 extends Float32Array {\r\n /**\r\n * Create a {@link Vec4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the vector. Equivalent to `this[3];`\r\n * @category Vector Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The a component of the vector. Equivalent to `this[3];`\r\n * @category Color Components\r\n */\r\n get a(): number { return this[3]; }\r\n set a(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec4.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec4} to `this`.\r\n * Equivalent to `Vec4.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n this[3] += b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec4} from `this`.\r\n * Equivalent to `Vec4.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n this[3] -= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n this[3] *= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n this[3] /= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec4.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n this[3] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n this[3] += b[3] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec4.distance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec4.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec4.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n this[3] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec4.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n this[3] = 1.0 / this[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec4.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n this[3] = Math.abs(this[3]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec4}.\r\n * Equivalent to `Vec4.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec4.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec4.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec4}\r\n * @category Static\r\n *\r\n * @returns a new 4D vector\r\n */\r\n static create(): Vec4 {\r\n return new Vec4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 4D vector\r\n */\r\n static clone(a: Vec4Like): Vec4 {\r\n return new Vec4(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new 4D vector\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Vec4 {\r\n return new Vec4(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec4} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n static set(out: Vec4Like, x: number, y: number, z: number, w: number): Vec4Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n out[3] = a[3] * b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Divides two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n out[3] = a[3] / b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n out[3] = Math.ceil(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n out[3] = Math.floor(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n out[3] = Math.min(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n out[3] = Math.max(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n out[2] = Math.round(a[2]);\r\n out[3] = Math.round(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec4} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec4Like, a: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}'s after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec4Like, a: Readonly, b: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return Math.hypot(x, y, z, w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of `a`\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = -a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n out[3] = 1.0 / a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n out[3] = Math.abs(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec4Like, a: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n let len = x * x + y * y + z * z + w * w;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = x * len;\r\n out[1] = y * len;\r\n out[2] = z * len;\r\n out[3] = w * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Returns the cross-product of three vectors in a 4-dimensional space\r\n * @category Static\r\n *\r\n * @param out the receiving vector\r\n * @param u - the first vector\r\n * @param v - the second vector\r\n * @param w - the third vector\r\n * @returns result\r\n */\r\n static cross(out: Vec4Like, u: Readonly, v: Readonly, w: Readonly): Vec4Like {\r\n const a = v[0] * w[1] - v[1] * w[0];\r\n const b = v[0] * w[2] - v[2] * w[0];\r\n const c = v[0] * w[3] - v[3] * w[0];\r\n const d = v[1] * w[2] - v[2] * w[1];\r\n const e = v[1] * w[3] - v[3] * w[1];\r\n const f = v[2] * w[3] - v[3] * w[2];\r\n const g = u[0];\r\n const h = u[1];\r\n const i = u[2];\r\n const j = u[3];\r\n\r\n out[0] = h * f - i * e + j * d;\r\n out[1] = -(g * f) + i * c - j * b;\r\n out[2] = g * e - h * c + j * a;\r\n out[3] = -(g * d) + h * b - i * a;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec4Like, a: Readonly, b: Readonly, t: number): Vec4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n out[3] = aw + t * (b[3] - aw);\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec4Like, scale): Vec4Like {\r\n scale = scale || 1.0;\r\n\r\n // Marsaglia, George. Choosing a Point from the Surface of a\r\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\r\n // http://projecteuclid.org/euclid.aoms/1177692644;\r\n var v1, v2, v3, v4;\r\n var s1, s2;\r\n do {\r\n v1 = glMatrix.RANDOM() * 2 - 1;\r\n v2 = glMatrix.RANDOM() * 2 - 1;\r\n s1 = v1 * v1 + v2 * v2;\r\n } while (s1 >= 1);\r\n do {\r\n v3 = glMatrix.RANDOM() * 2 - 1;\r\n v4 = glMatrix.RANDOM() * 2 - 1;\r\n s2 = v3 * v3 + v4 * v4;\r\n } while (s2 >= 1);\r\n\r\n var d = Math.sqrt((1 - s1) / s2);\r\n out[0] = scale * v1;\r\n out[1] = scale * v2;\r\n out[2] = scale * v3 * d;\r\n out[3] = scale * v4 * d;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Mat4}.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec4Like, a: Readonly, m: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\r\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\r\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\r\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec4Like, a: Readonly, q: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n\r\n // calculate quat * vec\r\n const ix = qw * x + qy * z - qz * y;\r\n const iy = qw * y + qz * x - qx * z;\r\n const iz = qw * z + qx * y - qy * x;\r\n const iw = -qx * x - qy * y - qz * z;\r\n\r\n // calculate result * inverse quat\r\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\r\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\r\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec4Like): Vec4Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec4(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec4.prototype.sub = Vec4.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.mul = Vec4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.div = Vec4.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.dist = Vec4.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.sqrDist = Vec4.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec4.sub = Vec4.subtract;\r\nVec4.mul = Vec4.multiply;\r\nVec4.div = Vec4.divide;\r\nVec4.dist = Vec4.distance;\r\nVec4.sqrDist = Vec4.squaredDistance;\r\nVec4.sqrLen = Vec4.squaredLength;\r\nVec4.mag = Vec4.magnitude;\r\nVec4.length = Vec4.magnitude;\r\nVec4.len = Vec4.magnitude;\r\n", "import { Vec3 } from './Vec3.js';\r\nimport { Vec4 } from './Vec4.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Quaternion\r\n */\r\nexport class Quat extends Float32Array {\r\n static #DEFAULT_ANGLE_ORDER = 'zyx';\r\n\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT1 = new Float32Array(4);\r\n static #TMP_QUAT2 = new Float32Array(4);\r\n static #TMP_MAT3 = new Float32Array(9);\r\n\r\n static #TMP_VEC3 = new Float32Array(3);\r\n static #X_UNIT_VEC3 = new Float32Array([1, 0, 0]);\r\n static #Y_UNIT_VEC3 = new Float32Array([0, 1, 0]);\r\n\r\n /**\r\n * Create a {@link Quat}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the quaternion. Equivalent to `this[0];`\r\n * @category Quaternion Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the quaternion. Equivalent to `this[1];`\r\n * @category Quaternion Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the quaternion. Equivalent to `this[2];`\r\n * @category Quaternion Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the quaternion. Equivalent to `this[3];`\r\n * @category Quaternion Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Quat.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity quaternion\r\n * Equivalent to Quat.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this[0] = 0;\r\n this[1] = 0;\r\n this[2] = 0;\r\n this[3] = 1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies `this` by a {@link Quat}.\r\n * Equivalent to `Quat.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Quat.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Rotates `this` by the given angle about the X axis\r\n * Equivalent to `Quat.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Quat.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Y axis\r\n * Equivalent to `Quat.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Quat.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Z axis\r\n * Equivalent to `Quat.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Quat.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Inverts `this`\r\n * Equivalent to `Quat.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Quat.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales `this` by a scalar number\r\n * Equivalent to `Quat.scale(this, this, scale);`\r\n * @category Methods\r\n *\r\n * @param scale - amount to scale the vector by\r\n * @returns `this`\r\n */\r\n scale(scale: number): QuatLike {\r\n this[0] *= scale;\r\n this[1] *= scale;\r\n this[2] *= scale;\r\n this[3] *= scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of `this` and another {@link Quat}\r\n * Equivalent to `Quat.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - the second operand\r\n * @returns dot product of `this` and b\r\n */\r\n dot(b: Readonly): number {\r\n return Quat.dot(this, b);\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity quat\r\n * @category Static\r\n *\r\n * @returns a new quaternion\r\n */\r\n static create(): Quat {\r\n return new Quat();\r\n }\r\n\r\n /**\r\n * Set a quat to the identity quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a quat from the given angle and rotation axis,\r\n * then returns it.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param axis - the axis around which to rotate\r\n * @param rad - the angle in radians\r\n * @returns `out`\r\n **/\r\n static setAxisAngle(out: QuatLike, axis: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n out[0] = s * axis[0];\r\n out[1] = s * axis[1];\r\n out[2] = s * axis[2];\r\n out[3] = Math.cos(rad);\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the rotation axis and angle for a given\r\n * quaternion. If a quaternion is created with\r\n * setAxisAngle, this method will return the same\r\n * values as provided in the original parameter list\r\n * OR functionally equivalent values.\r\n * Example: The quaternion formed by axis [0, 0, 1] and\r\n * angle -90 is the same as the quaternion formed by\r\n * [0, 0, 1] and 270. This method favors the latter.\r\n * @category Static\r\n *\r\n * @param out_axis - Vector receiving the axis of rotation\r\n * @param q - Quaternion to be decomposed\r\n * @return Angle, in radians, of the rotation\r\n */\r\n static getAxisAngle(out_axis: Vec3Like, q: Readonly): number {\r\n const rad = Math.acos(q[3]) * 2.0;\r\n const s = Math.sin(rad / 2.0);\r\n if (s > GLM_EPSILON) {\r\n out_axis[0] = q[0] / s;\r\n out_axis[1] = q[1] / s;\r\n out_axis[2] = q[2] / s;\r\n } else {\r\n // If s is zero, return any axis (no rotation - axis does not matter)\r\n out_axis[0] = 1;\r\n out_axis[1] = 0;\r\n out_axis[2] = 0;\r\n }\r\n return rad;\r\n }\r\n\r\n /**\r\n * Gets the angular distance between two unit quaternions\r\n * @category Static\r\n *\r\n * @param {ReadonlyQuat} a Origin unit quaternion\r\n * @param {ReadonlyQuat} b Destination unit quaternion\r\n * @return {Number} Angle, in radians, between the two quaternions\r\n */\r\n static getAngle(a: Readonly, b: Readonly): number {\r\n const dotproduct = Quat.dot(a, b);\r\n\r\n return Math.acos(2 * dotproduct * dotproduct - 1);\r\n }\r\n\r\n /**\r\n * Multiplies two quaternions.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const bw = b[3];\r\n\r\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the X axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + aw * bx;\r\n out[1] = ay * bw + az * bx;\r\n out[2] = az * bw - ay * bx;\r\n out[3] = aw * bw - ax * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Y axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const by = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw - az * by;\r\n out[1] = ay * bw + aw * by;\r\n out[2] = az * bw + ax * by;\r\n out[3] = aw * bw - ay * by;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Z axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bz = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + ay * bz;\r\n out[1] = ay * bw - ax * bz;\r\n out[2] = az * bw + aw * bz;\r\n out[3] = aw * bw - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the W component of a quat from the X, Y, and Z components.\r\n * Assumes that quaternion is 1 unit in length.\r\n * Any existing W component will be ignored.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate W component of\r\n * @returns `out`\r\n */\r\n static calculateW(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the exponential of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static exp(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const et = Math.exp(w);\r\n const s = r > 0 ? (et * Math.sin(r)) / r : 0;\r\n\r\n out[0] = x * s;\r\n out[1] = y * s;\r\n out[2] = z * s;\r\n out[3] = et * Math.cos(r);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the natural logarithm of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static ln(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const t = r > 0 ? Math.atan2(r, w) / r : 0;\r\n\r\n out[0] = x * t;\r\n out[1] = y * t;\r\n out[2] = z * t;\r\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the scalar power of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @param b - amount to scale the quaternion by\r\n * @returns `out`\r\n */\r\n static pow(out: QuatLike, a: Readonly, b: number): QuatLike {\r\n Quat.ln(out, a);\r\n Quat.scale(out, out, b);\r\n Quat.exp(out, out);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike {\r\n // benchmarks:\r\n // http://jsperf.com/quaternion-slerp-implementations\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2],\r\n aw = a[3];\r\n let bx = b[0],\r\n by = b[1],\r\n bz = b[2],\r\n bw = b[3];\r\n\r\n let scale0: number;\r\n let scale1: number;\r\n\r\n // calc cosine\r\n let cosom = ax * bx + ay * by + az * bz + aw * bw;\r\n // adjust signs (if necessary)\r\n if (cosom < 0.0) {\r\n cosom = -cosom;\r\n bx = -bx;\r\n by = -by;\r\n bz = -bz;\r\n bw = -bw;\r\n }\r\n // calculate coefficients\r\n if (1.0 - cosom > GLM_EPSILON) {\r\n // standard case (slerp)\r\n const omega = Math.acos(cosom);\r\n const sinom = Math.sin(omega);\r\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\r\n scale1 = Math.sin(t * omega) / sinom;\r\n } else {\r\n // \"from\" and \"to\" quaternions are very close\r\n // ... so we can do a linear interpolation\r\n scale0 = 1.0 - t;\r\n scale1 = t;\r\n }\r\n // calculate final values\r\n out[0] = scale0 * ax + scale1 * bx;\r\n out[1] = scale0 * ay + scale1 * by;\r\n out[2] = scale0 * az + scale1 * bz;\r\n out[3] = scale0 * aw + scale1 * bw;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random unit quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n /* static random(out: QuatLike): QuatLike {\r\n // Implementation of http://planning.cs.uiuc.edu/node198.html\r\n // TODO: Calling random 3 times is probably not the fastest solution\r\n let u1 = glMatrix.RANDOM();\r\n let u2 = glMatrix.RANDOM();\r\n let u3 = glMatrix.RANDOM();\r\n\r\n let sqrt1MinusU1 = Math.sqrt(1 - u1);\r\n let sqrtU1 = Math.sqrt(u1);\r\n\r\n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\r\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\r\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\r\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Calculates the inverse of a quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: QuatLike, a: Readonly): QuatLike {\r\n const a0 = a[0],\r\n a1 = a[1],\r\n a2 = a[2],\r\n a3 = a[3];\r\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\r\n const invDot = dot ? 1.0 / dot : 0;\r\n\r\n // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\r\n\r\n out[0] = -a0 * invDot;\r\n out[1] = -a1 * invDot;\r\n out[2] = -a2 * invDot;\r\n out[3] = a3 * invDot;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a quat\r\n * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given 3x3 rotation matrix.\r\n *\r\n * NOTE: The resultant quaternion is not normalized, so you should be sure\r\n * to re-normalize the quaternion yourself where necessary.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param m - rotation matrix\r\n * @returns `out`\r\n */\r\n static fromMat3(out: QuatLike, m: Readonly): QuatLike {\r\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\r\n // article \"Quaternion Calculus and Fast Animation\".\r\n const fTrace = m[0] + m[4] + m[8];\r\n let fRoot: number;\r\n\r\n if (fTrace > 0.0) {\r\n // |w| > 1/2, may as well choose w > 1/2\r\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\r\n out[3] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot; // 1/(4w)\r\n out[0] = (m[5] - m[7]) * fRoot;\r\n out[1] = (m[6] - m[2]) * fRoot;\r\n out[2] = (m[1] - m[3]) * fRoot;\r\n } else {\r\n // |w| <= 1/2\r\n let i = 0;\r\n if (m[4] > m[0]) { i = 1; }\r\n if (m[8] > m[i * 3 + i]) { i = 2; }\r\n const j = (i + 1) % 3;\r\n const k = (i + 2) % 3;\r\n\r\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\r\n out[i] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot;\r\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\r\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\r\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given euler angle x, y, z.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - Angle to rotate around X axis in degrees.\r\n * @param y - Angle to rotate around Y axis in degrees.\r\n * @param z - Angle to rotate around Z axis in degrees.\r\n * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx.\r\n * @returns `out`\r\n */\r\n static fromEuler(out: QuatLike, x: number, y: number, z: number, order = Quat.#DEFAULT_ANGLE_ORDER): QuatLike {\r\n const halfToRad = (0.5 * Math.PI) / 180.0;\r\n x *= halfToRad;\r\n y *= halfToRad;\r\n z *= halfToRad;\r\n\r\n const sx = Math.sin(x);\r\n const cx = Math.cos(x);\r\n const sy = Math.sin(y);\r\n const cy = Math.cos(y);\r\n const sz = Math.sin(z);\r\n const cz = Math.cos(z);\r\n\r\n switch (order) {\r\n case 'xyz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'xzy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yxz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yzx':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zxy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zyx':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n default:\r\n throw new Error(`Unknown angle order ${order}`);\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a quatenion\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - quaternion to clone\r\n * @returns a new quaternion\r\n */\r\n static clone(a: Readonly): Quat {\r\n return new Quat(a);\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new quaternion\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Quat {\r\n return new Quat(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one quat to another\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the source quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static set(out: QuatLike, x: number, y: number, z: number, w: number): QuatLike { return out; }\r\n\r\n /**\r\n * Adds two {@link Quat}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static add(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Scales a quat by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param b - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: QuatLike, a: Readonly, scale: number): QuatLike {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two quat's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two quat's\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static lerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike { return out; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mag(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quaternion to normalize\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static normalize(out: QuatLike, a: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first quaternion.\r\n * @param b - The second quaternion.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static exactEquals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Returns whether the quaternions have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static equals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Sets a quaternion to represent the shortest rotation from one\r\n * vector to another.\r\n *\r\n * Both vectors are assumed to be unit length.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion.\r\n * @param a - the initial vector\r\n * @param b - the destination vector\r\n * @returns `out`\r\n */\r\n static rotationTo(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const dot = Vec3.dot(a, b);\r\n\r\n if (dot < -0.999999) {\r\n Vec3.cross(Quat.#TMP_VEC3, Quat.#X_UNIT_VEC3, a);\r\n if (Vec3.mag(Quat.#TMP_VEC3) < 0.000001) { Vec3.cross(Quat.#TMP_VEC3, Quat.#Y_UNIT_VEC3, a); }\r\n Vec3.normalize(Quat.#TMP_VEC3, Quat.#TMP_VEC3);\r\n Quat.setAxisAngle(out, Quat.#TMP_VEC3, Math.PI);\r\n return out;\r\n } else if (dot > 0.999999) {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n } else {\r\n Vec3.cross(Quat.#TMP_VEC3, a, b);\r\n out[0] = Quat.#TMP_VEC3[0];\r\n out[1] = Quat.#TMP_VEC3[1];\r\n out[2] = Quat.#TMP_VEC3[2];\r\n out[3] = 1 + dot;\r\n return Quat.normalize(out, out);\r\n }\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static sqlerp(out: QuatLike, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): QuatLike {\r\n Quat.slerp(Quat.#TMP_QUAT1, a, d, t);\r\n Quat.slerp(Quat.#TMP_QUAT2, b, c, t);\r\n Quat.slerp(out, Quat.#TMP_QUAT1, Quat.#TMP_QUAT2, 2 * t * (1 - t));\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets the specified quaternion with values corresponding to the given\r\n * axes. Each axis is a vec3 and is expected to be unit length and\r\n * perpendicular to all other specified axes.\r\n * @category Static\r\n *\r\n * @param out - The receiving quaternion\r\n * @param view - the vector representing the viewing direction\r\n * @param right - the vector representing the local `right` direction\r\n * @param up - the vector representing the local `up` direction\r\n * @returns `out`\r\n */\r\n static setAxes(out: QuatLike, view: Readonly, right: Readonly, up: Readonly): QuatLike {\r\n Quat.#TMP_MAT3[0] = right[0];\r\n Quat.#TMP_MAT3[3] = right[1];\r\n Quat.#TMP_MAT3[6] = right[2];\r\n\r\n Quat.#TMP_MAT3[1] = up[0];\r\n Quat.#TMP_MAT3[4] = up[1];\r\n Quat.#TMP_MAT3[7] = up[2];\r\n\r\n Quat.#TMP_MAT3[2] = -view[0];\r\n Quat.#TMP_MAT3[5] = -view[1];\r\n Quat.#TMP_MAT3[8] = -view[2];\r\n\r\n return Quat.normalize(out, Quat.fromMat3(out, Quat.#TMP_MAT3));\r\n }\r\n}\r\n\r\n// Methods which re-use the Vec4 implementation\r\nQuat.set = Vec4.set;\r\nQuat.add = Vec4.add;\r\nQuat.lerp = Vec4.lerp;\r\nQuat.normalize = Vec4.normalize;\r\nQuat.squaredLength = Vec4.squaredLength;\r\nQuat.sqrLen = Vec4.squaredLength;\r\nQuat.exactEquals = Vec4.exactEquals;\r\nQuat.equals = Vec4.equals;\r\nQuat.magnitude = Vec4.magnitude;\r\n\r\n// Instance method alias assignments\r\nQuat.prototype.mul = Quat.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nQuat.mul = Quat.multiply;\r\nQuat.mag = Quat.magnitude;\r\nQuat.length = Quat.magnitude;\r\nQuat.len = Quat.magnitude;\r\n", "import { Mat4 } from './Mat4.js';\r\nimport { Quat } from './Quat.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Dual Quaternion\r\n */\r\nexport class Quat2 extends Float32Array {\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat2.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT = new Float32Array(4);\r\n static #TMP_VEC3 = new Float32Array(3);\r\n\r\n /**\r\n * Create a {@link Quat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 8:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 8); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v, v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 8);\r\n }\r\n break;\r\n }\r\n default:\r\n super(8);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source dual quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 8 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity {@link Quat2}\r\n * @category Static\r\n *\r\n * @returns a new dual quaternion [real -> rotation, dual -> translation]\r\n */\r\n static create(): Quat2 {\r\n return new Quat2();\r\n }\r\n\r\n /**\r\n * Creates a {@link Quat2} quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to clone\r\n * @returns a new dual quaternion\r\n */\r\n static clone(a: Quat2Like): Quat2 {\r\n return new Quat2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns a new dual quaternion\r\n */\r\n static fromValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2 {\r\n return new Quat2(x1, y1, z1, w1, x2, y2, z2, w2);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} from the given values (quat and translation)\r\n * @category Static\r\n *\r\n * @param x1 - X component (rotation)\r\n * @param y1 - Y component (rotation)\r\n * @param z1 - Z component (rotation)\r\n * @param w1 - W component (rotation)\r\n * @param x2 - X component (translation)\r\n * @param y2 - Y component (translation)\r\n * @param z2 - Z component (translation)\r\n * @returns a new dual quaternion\r\n */\r\n static fromRotationTranslationValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number): Quat2 {\r\n const ax = x2 * 0.5;\r\n const ay = y2 * 0.5;\r\n const az = z2 * 0.5;\r\n\r\n return new Quat2(x1, y1, z1, w1,\r\n ax * w1 + ay * z1 - az * y1,\r\n ay * w1 + az * x1 - ax * z1,\r\n az * w1 + ax * y1 - ay * x1,\r\n -ax * x1 - ay * y1 - az * z1);\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion and a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Quat2Like, q: Readonly, t: Readonly): Quat2Like {\r\n const ax = t[0] * 0.5;\r\n const ay = t[1] * 0.5;\r\n const az = t[2] * 0.5;\r\n const bx = q[0];\r\n const by = q[1];\r\n const bz = q[2];\r\n const bw = q[3];\r\n out[0] = bx;\r\n out[1] = by;\r\n out[2] = bz;\r\n out[3] = bw;\r\n out[4] = ax * bw + ay * bz - az * by;\r\n out[5] = ay * bw + az * bx - ax * bz;\r\n out[6] = az * bw + ax * by - ay * bx;\r\n out[7] = -ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Quat2Like, t: Readonly): Quat2Like {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = t[0] * 0.5;\r\n out[5] = t[1] * 0.5;\r\n out[6] = t[2] * 0.5;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Quat2Like, q: Readonly): Quat2Like {\r\n out[0] = q[0];\r\n out[1] = q[1];\r\n out[2] = q[2];\r\n out[3] = q[3];\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param a - the matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Quat2Like, a: Readonly): Quat2Like {\r\n Mat4.getRotation(Quat2.#TMP_QUAT, a);\r\n Mat4.getTranslation(Quat2.#TMP_VEC3, a);\r\n return Quat2.fromRotationTranslation(out, Quat2.#TMP_QUAT, Quat2.#TMP_VEC3);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Quat2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the source dual quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Quat2} to the identity dual quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns `out`\r\n */\r\n static set(out: Quat2Like, x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2Like {\r\n out[0] = x1;\r\n out[1] = y1;\r\n out[2] = z1;\r\n out[3] = w1;\r\n out[4] = x2;\r\n out[5] = y2;\r\n out[6] = z2;\r\n out[7] = w2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the real part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - real part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getReal(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Gets the dual part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - dual part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getDual(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[4];\r\n out[1] = a[5];\r\n out[2] = a[6];\r\n out[3] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the real component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the real part\r\n * @return `out`\r\n */\r\n static setReal(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Set the dual component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the dual part\r\n * @return `out`\r\n */\r\n static setDual(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[4] = a[0];\r\n out[5] = a[1];\r\n out[6] = a[2];\r\n out[7] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the translation of a normalized {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving translation vector\r\n * @param a - Dual Quaternion to be decomposed\r\n * @return `out`\r\n */\r\n static getTranslation(out: Vec3Like, a: Readonly): Vec3Like {\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Translates a {@link Quat2} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Quat2Like, a: Readonly, v: Readonly): Quat2Like {\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n const bx1 = v[0] * 0.5;\r\n const by1 = v[1] * 0.5;\r\n const bz1 = v[2] * 0.5;\r\n const ax2 = a[4];\r\n const ay2 = a[5];\r\n const az2 = a[6];\r\n const aw2 = a[7];\r\n out[0] = ax1;\r\n out[1] = ay1;\r\n out[2] = az1;\r\n out[3] = aw1;\r\n out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2;\r\n out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2;\r\n out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2;\r\n out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateX(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateY(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateZ(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (a * q)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param q - quaternion to rotate by\r\n * @returns `out`\r\n */\r\n static rotateByQuatAppend(out: Quat2Like, a: Readonly, q: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let ax = a[0];\r\n let ay = a[1];\r\n let az = a[2];\r\n let aw = a[3];\r\n\r\n out[0] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[1] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[2] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[3] = aw * qw - ax * qx - ay * qy - az * qz;\r\n ax = a[4];\r\n ay = a[5];\r\n az = a[6];\r\n aw = a[7];\r\n out[4] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[5] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[6] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[7] = aw * qw - ax * qx - ay * qy - az * qz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (q * a)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param q - quaternion to rotate by\r\n * @param a - the dual quaternion to rotate\r\n * @returns `out`\r\n */\r\n static rotateByQuatPrepend(out: Quat2Like, q: Readonly, a: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let bx = a[0];\r\n let by = a[1];\r\n let bz = a[2];\r\n let bw = a[3];\r\n\r\n out[0] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[1] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[2] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[3] = qw * bw - qx * bx - qy * by - qz * bz;\r\n bx = a[4];\r\n by = a[5];\r\n bz = a[6];\r\n bw = a[7];\r\n out[4] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[5] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[6] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[7] = qw * bw - qx * bx - qy * by - qz * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around a given axis. Does the normalization automatically\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param axis - the axis to rotate around\r\n * @param rad - how far the rotation should be\r\n * @returns `out`\r\n */\r\n static rotateAroundAxis(out: Quat2Like, a: Readonly, axis: Readonly, rad: number): Quat2Like {\r\n // Special case for rad = 0\r\n if (Math.abs(rad) < GLM_EPSILON) {\r\n return Quat2.copy(out, a);\r\n }\r\n const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);\r\n\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n const bx = (s * axis[0]) / axisLength;\r\n const by = (s * axis[1]) / axisLength;\r\n const bz = (s * axis[2]) / axisLength;\r\n const bw = Math.cos(rad);\r\n\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n out[4] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[5] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[6] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[7] = aw * bw - ax * bx - ay * by - az * bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns {quat2} out\r\n */\r\n static multiply(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n const ax0 = a[0];\r\n const ay0 = a[1];\r\n const az0 = a[2];\r\n const aw0 = a[3];\r\n const bx1 = b[4];\r\n const by1 = b[5];\r\n const bz1 = b[6];\r\n const bw1 = b[7];\r\n const ax1 = a[4];\r\n const ay1 = a[5];\r\n const az1 = a[6];\r\n const aw1 = a[7];\r\n const bx0 = b[0];\r\n const by0 = b[1];\r\n const bz0 = b[2];\r\n const bw0 = b[3];\r\n out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0;\r\n out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0;\r\n out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0;\r\n out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0;\r\n out[4] =\r\n ax0 * bw1 +\r\n aw0 * bx1 +\r\n ay0 * bz1 -\r\n az0 * by1 +\r\n ax1 * bw0 +\r\n aw1 * bx0 +\r\n ay1 * bz0 -\r\n az1 * by0;\r\n out[5] =\r\n ay0 * bw1 +\r\n aw0 * by1 +\r\n az0 * bx1 -\r\n ax0 * bz1 +\r\n ay1 * bw0 +\r\n aw1 * by0 +\r\n az1 * bx0 -\r\n ax1 * bz0;\r\n out[6] =\r\n az0 * bw1 +\r\n aw0 * bz1 +\r\n ax0 * by1 -\r\n ay0 * bx1 +\r\n az1 * bw0 +\r\n aw1 * bz0 +\r\n ax1 * by0 -\r\n ay1 * bx0;\r\n out[7] =\r\n aw0 * bw1 -\r\n ax0 * bx1 -\r\n ay0 * by1 -\r\n az0 * bz1 +\r\n aw1 * bw0 -\r\n ax1 * bx0 -\r\n ay1 * by0 -\r\n az1 * bz0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like { return out; }\r\n\r\n /**\r\n * Scales a {@link Quat2} by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaterion\r\n * @param a - the dual quaternion to scale\r\n * @param b - scalar value to scale the dual quaterion by\r\n * @returns `out`\r\n */\r\n static scale(out: Quat2Like, a: Readonly, b: number): Quat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts)\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dot(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Quat2}s\r\n * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quat\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Quat2Like, a: Readonly, b: Readonly, t: number): Quat2Like {\r\n const mt = 1 - t;\r\n if (Quat2.dot(a, b) < 0) { t = -t; }\r\n\r\n out[0] = a[0] * mt + b[0] * t;\r\n out[1] = a[1] * mt + b[1] * t;\r\n out[2] = a[2] * mt + b[2] * t;\r\n out[3] = a[3] * mt + b[3] * t;\r\n out[4] = a[4] * mt + b[4] * t;\r\n out[5] = a[5] * mt + b[5] * t;\r\n out[6] = a[6] * mt + b[6] * t;\r\n out[7] = a[7] * mt + b[7] * t;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: Quat2Like, a: Readonly): Quat2Like {\r\n const sqlen = Quat2.squaredLength(a);\r\n out[0] = -a[0] / sqlen;\r\n out[1] = -a[1] / sqlen;\r\n out[2] = -a[2] / sqlen;\r\n out[3] = a[3] / sqlen;\r\n out[4] = -a[4] / sqlen;\r\n out[5] = -a[5] / sqlen;\r\n out[6] = -a[6] / sqlen;\r\n out[7] = a[7] / sqlen;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than\r\n * {@link Quat2.invert} and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n out[4] = -a[4];\r\n out[5] = -a[5];\r\n out[6] = -a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Quat2Like, a: Readonly): Quat2Like {\r\n let magnitude = Quat2.squaredLength(a);\r\n if (magnitude > 0) {\r\n magnitude = Math.sqrt(magnitude);\r\n\r\n const a0 = a[0] / magnitude;\r\n const a1 = a[1] / magnitude;\r\n const a2 = a[2] / magnitude;\r\n const a3 = a[3] / magnitude;\r\n\r\n const b0 = a[4];\r\n const b1 = a[5];\r\n const b2 = a[6];\r\n const b3 = a[7];\r\n\r\n const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3;\r\n\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n\r\n out[4] = (b0 - a0 * a_dot_b) / magnitude;\r\n out[5] = (b1 - a1 * a_dot_b) / magnitude;\r\n out[6] = (b2 - a2 * a_dot_b) / magnitude;\r\n out[7] = (b3 - a3 * a_dot_b) / magnitude;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat2(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7))\r\n );\r\n }\r\n}\r\n\r\n// Methods which re-use the Quat implementation\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.dot = Quat.dot;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.squaredLength = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.sqrLen = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.mag = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.length = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.len = Quat.magnitude;\r\n\r\n// Static method alias assignments\r\nQuat2.mul = Quat2.multiply;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Mat2dLike, Mat3Like, Mat4Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 2 Dimensional Vector\r\n */\r\nexport class Vec2 extends Float32Array {\r\n /**\r\n * Create a {@link Vec2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 2:{\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, values[1]!]);\r\n } else {\r\n super(v as ArrayBufferLike, values[1], 2);\r\n }\r\n break;\r\n }\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 2);\r\n }\r\n break;\r\n }\r\n default:\r\n super(2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec2.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n return Math.hypot(this[0], this[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec2.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n // Instead of zero(), use a.fill(0) for instances;\r\n\r\n /**\r\n * Adds a {@link Vec2} to `this`.\r\n * Equivalent to `Vec2.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec2} from `this`.\r\n * Equivalent to `Vec2.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec2.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec2.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec2.squaredDistance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec2.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec2.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec2.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec2}.\r\n * Equivalent to `Vec2.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec2.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec2.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 2 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec2}\r\n * @category Static\r\n *\r\n * @returns A new 2D vector\r\n */\r\n static create(): Vec2 {\r\n return new Vec2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - Vector to clone\r\n * @returns A new 2D vector\r\n */\r\n static clone(a: Readonly): Vec2 {\r\n return new Vec2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns A new 2D vector\r\n */\r\n static fromValues(x: number, y: number): Vec2 {\r\n return new Vec2(x, y);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - The source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns `out`\r\n */\r\n static set(out: Vec2Like, x: number, y: number): Vec2Like {\r\n out[0] = x;\r\n out[1] = y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Multiplies two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Divides two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec2} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to scale\r\n * @param b - Amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec2Like, a: Readonly, b: number): Vec2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two Vec2's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param scale - The amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec2Like, a: Readonly, b: Readonly, scale: number): Vec2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns distance between `a` and `b`\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n return Math.hypot(b[0] - a[0], b[1] - a[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Squared distance between `a` and `b`\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return Math.sqrt(x * x + y * y);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate squared length of\r\n * @returns Squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec2Like, a: Readonly) {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec2Like, a: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n let len = x * x + y * y;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Dot product of `a` and `b`\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two {@link Vec2}s\r\n * Note that the cross product must by definition produce a 3D vector.\r\n * For this reason there is also not instance equivalent for this function.\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n const z = a[0] * b[1] - a[1] * b[0];\r\n out[0] = out[1] = 0;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param t - Interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec2Like, a: Readonly, b: Readonly, t: number): Vec2Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y;\r\n out[1] = m[1] * x + m[3] * y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2d}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2d(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y + m[4];\r\n out[1] = m[1] * x + m[3] * y + m[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat3}\r\n * 3rd vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat3(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[3] * y + m[6];\r\n out[1] = m[1] * x + m[4] * y + m[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat4}\r\n * 3rd vector component is implicitly '0'\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat4(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[4] * y + m[12];\r\n out[1] = m[1] * x + m[5] * y + m[13];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 2D vector\r\n * @category Static\r\n *\r\n * @param out - The receiving {@link Vec2}\r\n * @param a - The {@link Vec2} point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotate(out: Vec2Like, a: Readonly, b: Readonly, rad: number): Vec2Like {\r\n // Translate point to the origin\r\n const p0 = a[0] - b[0];\r\n const p1 = a[1] - b[1];\r\n const sinC = Math.sin(rad);\r\n const cosC = Math.cos(rad);\r\n\r\n // perform rotation and translate to correct position\r\n out[0] = p0 * cosC - p1 * sinC + b[0];\r\n out[1] = p0 * sinC + p1 * cosC + b[1];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 2D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly): number {\r\n const x1 = a[0];\r\n const y1 = a[1];\r\n const x2 = b[0];\r\n const y2 = b[1];\r\n // mag is the product of the magnitudes of a and b\r\n const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2);\r\n // mag &&.. short circuits if mag == 0\r\n const cosine = mag && (x1 * x2 + y1 * y2) / mag;\r\n // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to zero\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec2Like): Vec2Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors components are ===, `false` otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors are approximately equal, `false` otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - Vector to represent as a string\r\n * @returns String representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec2.prototype.sub = Vec2.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.mul = Vec2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.div = Vec2.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.dist = Vec2.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.sqrDist = Vec2.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec2.sub = Vec2.subtract;\r\nVec2.mul = Vec2.multiply;\r\nVec2.div = Vec2.divide;\r\nVec2.dist = Vec2.distance;\r\nVec2.sqrDist = Vec2.squaredDistance;\r\nVec2.sqrLen = Vec2.squaredLength;\r\nVec2.mag = Vec2.magnitude;\r\nVec2.length = Vec2.magnitude;\r\nVec2.len = Vec2.magnitude;\r\n", "/**\r\n * To enable additional swizzle accessors for vector classes (32-bit) invoke the {@link EnableSwizzles} function from\r\n * the `gl-matrix/swizzle` sub-path export. To enable ambient module declarations for IDE / Typescript support please\r\n * see {@link gl-matrix/types/swizzle}.\r\n *\r\n * To enable swizzling for the 64-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle/f64}.\r\n *\r\n * @example\r\n * ```ts\r\n * import { Vec3 } from 'gl-matrix';\r\n * import { EnableSwizzles } from 'gl-matrix/swizzle';\r\n *\r\n * EnableSwizzles();\r\n *\r\n * const vec = new Vec3(0, 1, 2);\r\n * const vecSwizzled = vec.zyx; // Returns a new Vec3(2, 1, 0).\r\n * ```\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\nimport { Vec2, Vec3, Vec4 } from '#gl-matrix';\r\n\r\n/**\r\n * Internal `gl-matrix` variable tracking if swizzling is enabled (32-bit).\r\n */\r\nlet GLM_SWIZZLES_ENABLED_F32 = false;\r\n\r\n/**\r\n * Enables Swizzle operations on {@link gl-matrix.Vec2 | Vec2} / {@link gl-matrix.Vec3 | Vec3} /\r\n * {@link gl-matrix.Vec4 | Vec4} types from {@link gl-matrix | gl-matrix} (32-bit).\r\n *\r\n * Swizzle operations are performed by using the `.` operator in conjunction with any combination\r\n * of between two and four component names, either from the set `xyzw` or `rgbw` (though not intermixed).\r\n * They return a new vector with the same number of components as specified in the swizzle attribute.\r\n *\r\n * @example\r\n * ```js\r\n * import { Vec3, EnableSwizzles } from 'gl-matrix';\r\n *\r\n * EnableSwizzles();\r\n *\r\n * let v = new Vec3(0, 1, 2);\r\n *\r\n * v.yx; // returns new Vec2(1, 0)\r\n * v.xzy; // returns new Vec3(0, 2, 1)\r\n * v.zyxz; // returns new Vec4(2, 1, 0, 2)\r\n *\r\n * v.rgb; // returns new Vec3(0, 1, 2)\r\n * v.rbg; // returns new Vec3(0, 2, 1)\r\n * v.gg; // returns new Vec2(1, 1)\r\n * ```\r\n */\r\nexport function EnableSwizzles(): void {\r\n /* v8 ignore next 1 */\r\n if (GLM_SWIZZLES_ENABLED_F32) { return; }\r\n\r\n /* eslint-disable comma-spacing, max-len */\r\n\r\n // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should\r\n // not be modified by hand.\r\n // [Swizzle Autogen]\r\n\r\n const VEC2_SWIZZLES = ['xx','xy','yx','yy','xxx','xxy','xyx','xyy','yxx','yxy','yyx','yyy','xxxx','xxxy','xxyx','xxyy','xyxx','xyxy','xyyx','xyyy','yxxx','yxxy','yxyx','yxyy','yyxx','yyxy','yyyx','yyyy','rr','rg','gr','gg','rrr','rrg','rgr','rgg','grr','grg','ggr','ggg','rrrr','rrrg','rrgr','rrgg','rgrr','rgrg','rggr','rggg','grrr','grrg','grgr','grgg','ggrr','ggrg','gggr','gggg'];\r\n const VEC3_SWIZZLES = ['xz','yz','zx','zy','zz','xxz','xyz','xzx','xzy','xzz','yxz','yyz','yzx','yzy','yzz','zxx','zxy','zxz','zyx','zyy','zyz','zzx','zzy','zzz','xxxz','xxyz','xxzx','xxzy','xxzz','xyxz','xyyz','xyzx','xyzy','xyzz','xzxx','xzxy','xzxz','xzyx','xzyy','xzyz','xzzx','xzzy','xzzz','yxxz','yxyz','yxzx','yxzy','yxzz','yyxz','yyyz','yyzx','yyzy','yyzz','yzxx','yzxy','yzxz','yzyx','yzyy','yzyz','yzzx','yzzy','yzzz','zxxx','zxxy','zxxz','zxyx','zxyy','zxyz','zxzx','zxzy','zxzz','zyxx','zyxy','zyxz','zyyx','zyyy','zyyz','zyzx','zyzy','zyzz','zzxx','zzxy','zzxz','zzyx','zzyy','zzyz','zzzx','zzzy','zzzz','rb','gb','br','bg','bb','rrb','rgb','rbr','rbg','rbb','grb','ggb','gbr','gbg','gbb','brr','brg','brb','bgr','bgg','bgb','bbr','bbg','bbb','rrrb','rrgb','rrbr','rrbg','rrbb','rgrb','rggb','rgbr','rgbg','rgbb','rbrr','rbrg','rbrb','rbgr','rbgg','rbgb','rbbr','rbbg','rbbb','grrb','grgb','grbr','grbg','grbb','ggrb','gggb','ggbr','ggbg','ggbb','gbrr','gbrg','gbrb','gbgr','gbgg','gbgb','gbbr','gbbg','gbbb','brrr','brrg','brrb','brgr','brgg','brgb','brbr','brbg','brbb','bgrr','bgrg','bgrb','bggr','bggg','bggb','bgbr','bgbg','bgbb','bbrr','bbrg','bbrb','bbgr','bbgg','bbgb','bbbr','bbbg','bbbb'];\r\n const VEC4_SWIZZLES = ['xw','yw','zw','wx','wy','wz','ww','xxw','xyw','xzw','xwx','xwy','xwz','xww','yxw','yyw','yzw','ywx','ywy','ywz','yww','zxw','zyw','zzw','zwx','zwy','zwz','zww','wxx','wxy','wxz','wxw','wyx','wyy','wyz','wyw','wzx','wzy','wzz','wzw','wwx','wwy','wwz','www','xxxw','xxyw','xxzw','xxwx','xxwy','xxwz','xxww','xyxw','xyyw','xyzw','xywx','xywy','xywz','xyww','xzxw','xzyw','xzzw','xzwx','xzwy','xzwz','xzww','xwxx','xwxy','xwxz','xwxw','xwyx','xwyy','xwyz','xwyw','xwzx','xwzy','xwzz','xwzw','xwwx','xwwy','xwwz','xwww','yxxw','yxyw','yxzw','yxwx','yxwy','yxwz','yxww','yyxw','yyyw','yyzw','yywx','yywy','yywz','yyww','yzxw','yzyw','yzzw','yzwx','yzwy','yzwz','yzww','ywxx','ywxy','ywxz','ywxw','ywyx','ywyy','ywyz','ywyw','ywzx','ywzy','ywzz','ywzw','ywwx','ywwy','ywwz','ywww','zxxw','zxyw','zxzw','zxwx','zxwy','zxwz','zxww','zyxw','zyyw','zyzw','zywx','zywy','zywz','zyww','zzxw','zzyw','zzzw','zzwx','zzwy','zzwz','zzww','zwxx','zwxy','zwxz','zwxw','zwyx','zwyy','zwyz','zwyw','zwzx','zwzy','zwzz','zwzw','zwwx','zwwy','zwwz','zwww','wxxx','wxxy','wxxz','wxxw','wxyx','wxyy','wxyz','wxyw','wxzx','wxzy','wxzz','wxzw','wxwx','wxwy','wxwz','wxww','wyxx','wyxy','wyxz','wyxw','wyyx','wyyy','wyyz','wyyw','wyzx','wyzy','wyzz','wyzw','wywx','wywy','wywz','wyww','wzxx','wzxy','wzxz','wzxw','wzyx','wzyy','wzyz','wzyw','wzzx','wzzy','wzzz','wzzw','wzwx','wzwy','wzwz','wzww','wwxx','wwxy','wwxz','wwxw','wwyx','wwyy','wwyz','wwyw','wwzx','wwzy','wwzz','wwzw','wwwx','wwwy','wwwz','wwww','ra','ga','ba','ar','ag','ab','aa','rra','rga','rba','rar','rag','rab','raa','gra','gga','gba','gar','gag','gab','gaa','bra','bga','bba','bar','bag','bab','baa','arr','arg','arb','ara','agr','agg','agb','aga','abr','abg','abb','aba','aar','aag','aab','aaa','rrra','rrga','rrba','rrar','rrag','rrab','rraa','rgra','rgga','rgba','rgar','rgag','rgab','rgaa','rbra','rbga','rbba','rbar','rbag','rbab','rbaa','rarr','rarg','rarb','rara','ragr','ragg','ragb','raga','rabr','rabg','rabb','raba','raar','raag','raab','raaa','grra','grga','grba','grar','grag','grab','graa','ggra','ggga','ggba','ggar','ggag','ggab','ggaa','gbra','gbga','gbba','gbar','gbag','gbab','gbaa','garr','garg','garb','gara','gagr','gagg','gagb','gaga','gabr','gabg','gabb','gaba','gaar','gaag','gaab','gaaa','brra','brga','brba','brar','brag','brab','braa','bgra','bgga','bgba','bgar','bgag','bgab','bgaa','bbra','bbga','bbba','bbar','bbag','bbab','bbaa','barr','barg','barb','bara','bagr','bagg','bagb','baga','babr','babg','babb','baba','baar','baag','baab','baaa','arrr','arrg','arrb','arra','argr','argg','argb','arga','arbr','arbg','arbb','arba','arar','arag','arab','araa','agrr','agrg','agrb','agra','aggr','aggg','aggb','agga','agbr','agbg','agbb','agba','agar','agag','agab','agaa','abrr','abrg','abrb','abra','abgr','abgg','abgb','abga','abbr','abbg','abbb','abba','abar','abag','abab','abaa','aarr','aarg','aarb','aara','aagr','aagg','aagb','aaga','aabr','aabg','aabb','aaba','aaar','aaag','aaab','aaaa'];\r\n\r\n // [/Swizzle Autogen]\r\n\r\n /* eslint-enable comma-spacing, max-len */\r\n\r\n /**\r\n * Internal swizzle index table for `gl-matrix`.\r\n */\r\n const SWIZZLE_INDEX: Record = {\r\n x: 0, r: 0,\r\n y: 1, g: 1,\r\n z: 2, b: 2,\r\n w: 3, a: 3,\r\n };\r\n\r\n /**\r\n * Internal helper function to convert and return a `gl-matrix` vector by swizzle format.\r\n *\r\n * @param swizzle - Swizzle format to apply.\r\n * @returns {Vec2 | Vec3 | Vec4} New swizzled vector instance.\r\n */\r\n function getSwizzleImpl(swizzle: string): () => Vec2 | Vec3 | Vec4 {\r\n switch (swizzle.length) {\r\n case 2:\r\n return function(this: Float32Array) {\r\n return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]);\r\n };\r\n case 3:\r\n return function(this: Float32Array) {\r\n return new Vec3(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]]);\r\n };\r\n case 4:\r\n return function(this: Float32Array) {\r\n return new Vec4(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]], this[SWIZZLE_INDEX[swizzle[3]]]);\r\n };\r\n }\r\n\r\n throw new Error('Illegal swizzle length');\r\n }\r\n\r\n for (const swizzle of VEC2_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec2.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC3_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC4_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n GLM_SWIZZLES_ENABLED_F32 = true;\r\n}\r\n", "/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_DEG_TO_RAD: number = Math.PI / 180;\r\n\r\n/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_RAD_TO_DEG: number = 180 / Math.PI;\r\n\r\n/**\r\n * Convert `radians` to `degrees`.\r\n *\r\n * @param value - Angle in `radians`.\r\n * @returns Angle in `degrees`.\r\n */\r\nexport function toDegree(value: number): number {\r\n return value * GLM_RAD_TO_DEG;\r\n}\r\n\r\n/**\r\n * Convert `degrees` to `radians`.\r\n *\r\n * @param value - Angle in `degrees`.\r\n * @returns Angle in `radians`.\r\n */\r\nexport function toRadian(value: number): number {\r\n return value * GLM_DEG_TO_RAD;\r\n}\r\n"], + "mappings": ";;;;6ZAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,oBAAAE,GAAA,SAAAC,EAAA,UAAAC,EAAA,SAAAC,EAAA,SAAAC,EAAA,SAAAC,EAAA,UAAAC,EAAA,SAAAC,EAAA,SAAAC,EAAA,SAAAC,EAAA,SAAAR,EAAA,UAAAC,EAAA,SAAAC,EAAA,SAAAC,EAAA,SAAAC,EAAA,UAAAC,EAAA,aAAAI,GAAA,aAAAC,GAAA,SAAAJ,EAAA,SAAAC,EAAA,SAAAC,IAAA,eAAAG,GAAAd,ICOO,IAAMe,EAAN,MAAMC,UAAa,YAAa,CACrC,MAAOC,GAAgB,IAAI,aAAa,CACtC,EAAG,EACH,EAAG,CACL,CAAC,EAOD,eAAeC,EAAoE,CACjF,OAAQA,EAAO,OAAQ,CACrB,IAAK,GACH,MAAMA,CAAM,EAAG,MACjB,IAAK,GACH,MAAMA,EAAO,CAAC,EAAsBA,EAAO,CAAC,EAAG,CAAC,EAAG,MACrD,IAAK,GACH,IAAMC,EAAID,EAAO,CAAC,EACd,OAAOC,GAAM,SACf,MAAM,CACJA,EAAGA,EACHA,EAAGA,CAAC,CAAC,EAEP,MAAMA,EAAsB,EAAG,CAAC,EAElC,MACF,QACE,MAAMH,EAAKC,EAAa,EAAG,KAC/B,CACF,CAYA,IAAI,KAAc,CAChB,OAAOD,EAAK,IAAI,IAAI,CACtB,CAaA,KAAKI,EAA6B,CAChC,YAAK,IAAIA,CAAC,EACH,IACT,CASA,UAAiB,CACf,YAAK,IAAIJ,EAAKC,EAAa,EACpB,IACT,CAUA,SAASI,EAA6B,CACpC,OAAOL,EAAK,SAAS,KAAM,KAAMK,CAAC,CACpC,CAMA,IAAIA,EAA6B,CAAE,OAAO,IAAM,CAShD,WAAkB,CAChB,OAAOL,EAAK,UAAU,KAA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,CAAC,CAAC,CAAC,CACpE,CACJ,CAEA,MAAM,IAAI,MAAM,wBAAwB,CAC1C,CAEA,QAAWA,KAAWL,EAAe,CACnC,IAAMS,EAAOL,EAAeC,CAAO,EACnC,OAAO,eAAeC,EAAK,UAAWD,EAAS,CAC7C,IAAKI,CACP,CAAC,EACD,OAAO,eAAeF,EAAK,UAAWF,EAAS,CAC7C,IAAKI,CACP,CAAC,EACD,OAAO,eAAeD,EAAK,UAAWH,EAAS,CAC7C,IAAKI,CACP,CAAC,CACH,CAEA,QAAWJ,KAAWJ,EAAe,CACnC,IAAMQ,EAAOL,EAAeC,CAAO,EACnC,OAAO,eAAeE,EAAK,UAAWF,EAAS,CAC7C,IAAKI,CACP,CAAC,EACD,OAAO,eAAeD,EAAK,UAAWH,EAAS,CAC7C,IAAKI,CACP,CAAC,CACH,CAEA,QAAWJ,KAAWH,EAAe,CACnC,IAAMO,EAAOL,EAAeC,CAAO,EACnC,OAAO,eAAeG,EAAK,UAAWH,EAAS,CAC7C,IAAKI,CACP,CAAC,CACH,CAEAX,EAA2B,EAC7B,CCxIA,IAAMY,GAAyB,KAAK,GAAK,IAKnCC,GAAyB,IAAM,KAAK,GAQnC,SAASC,GAASC,EAAuB,CAC9C,OAAOA,EAAQF,EACjB,CAQO,SAASG,GAASD,EAAuB,CAC9C,OAAOA,EAAQH,EACjB", + "names": ["cdn_exports", "__export", "EnableSwizzles", "Mat2", "Mat2d", "Mat3", "Mat4", "Quat", "Quat2", "Vec2", "Vec3", "Vec4", "toDegree", "toRadian", "__toCommonJS", "Mat2", "_Mat2", "#IDENTITY_2X2", "values", "v", "a", "b", "rad", "out", "a1", "a0", "a2", "a3", "det", "b0", "b1", "b2", "b3", "s", "c", "v0", "v1", "scale", "L", "D", "U", "Mat2d", "_Mat2d", "#IDENTITY_2X3", "values", "v", "a", "b", "rad", "out", "aa", "ab", "ac", "ad", "atx", "aty", "det", "a0", "a1", "a2", "a3", "a4", "a5", "b0", "b1", "b2", "b3", "b4", "b5", "v0", "v1", "s", "c", "scale", "Mat3", "_Mat3", "#IDENTITY_3X3", "values", "v", "a", "b", "rad", "out", "a01", "a02", "a12", "a00", "a10", "a11", "a20", "a21", "a22", "b01", "b11", "b21", "det", "b0", "b1", "b2", "x", "y", "s", "c", "q", "z", "w", "x2", "y2", "z2", "xx", "yx", "yy", "zx", "zy", "zz", "wx", "wy", "wz", "a03", "a13", "a23", "a30", "a31", "a32", "a33", "b00", "b02", "b03", "b04", "b05", "b06", "b07", "b08", "b09", "b10", "ax", "ay", "az", "bx", "by", "bz", "cx", "cy", "cz", "width", "height", "scale", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "b3", "b4", "b5", "b6", "b7", "b8", "Mat4", "_Mat4", "#IDENTITY_4X4", "#TMP_VEC3", "values", "v", "a", "b", "rad", "axis", "fovy", "aspect", "near", "far", "left", "right", "bottom", "top", "out", "a01", "a02", "a03", "a12", "a13", "a23", "a00", "a10", "a11", "a20", "a21", "a22", "a30", "a31", "a32", "a33", "b00", "b01", "b02", "b03", "b04", "b05", "b06", "b07", "b08", "b09", "b10", "b11", "det", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "x", "y", "z", "len", "s", "c", "t", "b12", "b20", "b21", "b22", "q", "w", "x2", "y2", "z2", "xx", "xy", "xz", "yy", "yz", "zz", "wx", "wy", "wz", "bx", "by", "bz", "bw", "ax", "ay", "az", "aw", "magnitude", "cx", "cy", "cz", "mat", "m11", "m12", "m13", "m21", "m22", "m23", "m31", "m32", "m33", "is1", "is2", "is3", "sm11", "sm12", "sm13", "sm21", "sm22", "sm23", "sm31", "sm32", "sm33", "trace", "S", "out_r", "out_t", "out_s", "sx", "sy", "sz", "o", "ox", "oy", "oz", "out0", "out1", "out2", "out4", "out5", "out6", "out8", "out9", "out10", "yx", "zx", "zy", "rl", "tb", "nf", "f", "fov", "upTan", "downTan", "leftTan", "rightTan", "xScale", "yScale", "lr", "bt", "eye", "center", "up", "eyex", "eyey", "eyez", "upx", "upy", "upz", "centerx", "centery", "centerz", "z0", "z1", "x0", "x1", "y0", "y1", "target", "scale", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a14", "a15", "b13", "b14", "b15", "Vec3", "_Vec3", "values", "v", "value", "x", "y", "z", "a", "b", "scale", "out", "len", "ax", "ay", "az", "bx", "by", "bz", "t", "angle", "sinTotal", "ratioA", "ratioB", "c", "d", "factorTimes2", "factor1", "factor2", "factor3", "factor4", "inverseFactor", "inverseFactorTimesTwo", "m", "w", "q", "qx", "qy", "qz", "w2", "uvx", "uvy", "uvz", "uuvx", "uuvy", "uuvz", "rad", "py", "pz", "px", "mag", "cosine", "a0", "a1", "a2", "b0", "b1", "b2", "Vec4", "_Vec4", "values", "v", "value", "x", "y", "z", "w", "a", "b", "scale", "out", "len", "u", "c", "d", "e", "f", "g", "h", "i", "j", "t", "ax", "ay", "az", "aw", "m", "q", "qx", "qy", "qz", "qw", "ix", "iy", "iz", "iw", "a0", "a1", "a2", "a3", "b0", "b1", "b2", "b3", "Quat", "_Quat", "#DEFAULT_ANGLE_ORDER", "#TMP_QUAT1", "#TMP_QUAT2", "#TMP_MAT3", "#TMP_VEC3", "#X_UNIT_VEC3", "#Y_UNIT_VEC3", "values", "v", "value", "x", "y", "z", "w", "a", "b", "rad", "scale", "out", "axis", "out_axis", "q", "dotproduct", "ax", "ay", "az", "aw", "bx", "by", "bz", "bw", "r", "et", "s", "t", "scale0", "scale1", "cosom", "omega", "sinom", "a0", "a1", "a2", "a3", "dot", "invDot", "m", "fTrace", "fRoot", "i", "j", "k", "order", "halfToRad", "sx", "cx", "sy", "cy", "sz", "cz", "Vec3", "c", "d", "view", "right", "up", "Vec4", "Quat2", "_Quat2", "#TMP_QUAT", "#TMP_VEC3", "values", "v", "a", "x1", "y1", "z1", "w1", "x2", "y2", "z2", "w2", "ax", "ay", "az", "out", "q", "t", "bx", "by", "bz", "bw", "Mat4", "aw", "ax1", "ay1", "az1", "aw1", "bx1", "by1", "bz1", "ax2", "ay2", "az2", "aw2", "rad", "Quat", "qx", "qy", "qz", "qw", "axis", "axisLength", "s", "b", "ax0", "ay0", "az0", "aw0", "bw1", "bx0", "by0", "bz0", "bw0", "mt", "sqlen", "magnitude", "a0", "a1", "a2", "a3", "b0", "b1", "b2", "b3", "a_dot_b", "a4", "a5", "a6", "a7", "b4", "b5", "b6", "b7", "Vec2", "_Vec2", "values", "v", "value", "x", "y", "a", "b", "scale", "out", "len", "z", "t", "ax", "ay", "m", "rad", "p0", "p1", "sinC", "cosC", "x1", "y1", "x2", "y2", "mag", "cosine", "a0", "a1", "b0", "b1", "GLM_SWIZZLES_ENABLED_F32", "EnableSwizzles", "VEC2_SWIZZLES", "VEC3_SWIZZLES", "VEC4_SWIZZLES", "SWIZZLE_INDEX", "getSwizzleImpl", "swizzle", "Vec2", "Vec3", "Vec4", "impl", "GLM_DEG_TO_RAD", "GLM_RAD_TO_DEG", "toDegree", "value", "toRadian"] +} diff --git a/dist-cdn/cjs/2022/gl-matrix-f64.cjs b/dist-cdn/cjs/2022/gl-matrix-f64.cjs new file mode 100644 index 00000000..e3a1a258 --- /dev/null +++ b/dist-cdn/cjs/2022/gl-matrix-f64.cjs @@ -0,0 +1,9527 @@ +// gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library. +// @author Brandon Jones +// @author Colin MacKenzie IV +// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md) +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/cdn/f64/index.ts +var f64_exports = {}; +__export(f64_exports, { + EnableSwizzlesF64: () => EnableSwizzlesF64, + Mat2: () => Mat2, + Mat2d: () => Mat2d, + Mat3: () => Mat3, + Mat4: () => Mat4, + Quat: () => Quat, + Quat2: () => Quat2, + Vec2: () => Vec2, + Vec3: () => Vec3, + Vec4: () => Vec4, + toDegree: () => toDegree, + toRadian: () => toRadian +}); +module.exports = __toCommonJS(f64_exports); + +// src/common/index.ts +var GLM_EPSILON = 1e-6; + +// src/_lib/f64/Mat2.ts +var Mat2 = class _Mat2 extends Float64Array { + static #IDENTITY_2X2 = new Float64Array([ + 1, + 0, + 0, + 1 + ]); + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 4: + super(values); + break; + case 2: + super(values[0], values[1], 4); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v + ]); + } else { + super(v, 0, 4); + } + break; + default: + super(_Mat2.#IDENTITY_2X2); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat2.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat2.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat2} into `this`. + * + * @param a the source vector + * @returns `this` + * @category Methods + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat2.identity(this) + * + * @returns `this` + * @category Methods + */ + identity() { + this.set(_Mat2.#IDENTITY_2X2); + return this; + } + /** + * Multiplies this {@link Mat2} against another one + * Equivalent to `Mat2.multiply(this, this, b);` + * + * @param b - The second operand + * @returns `this` + * @category Methods + */ + multiply(b) { + return _Mat2.multiply(this, this, b); + } + /** + * Alias for {@link Mat2.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat2} + * Equivalent to `Mat2.transpose(this, this);` + * + * @returns `this` + * @category Methods + */ + transpose() { + return _Mat2.transpose(this, this); + } + /** + * Inverts this {@link Mat2} + * Equivalent to `Mat4.invert(this, this);` + * + * @returns `this` + * @category Methods + */ + invert() { + return _Mat2.invert(this, this); + } + /** + * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2.scale(this, this, v);` + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + * @category Methods + */ + scale(v) { + return _Mat2.scale(this, this, v); + } + /** + * Rotates this {@link Mat2} by the given angle around the given axis + * Equivalent to `Mat2.rotate(this, this, rad);` + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + * @category Methods + */ + rotate(rad) { + return _Mat2.rotate(this, this, rad); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2}. + */ + static get BYTE_LENGTH() { + return 4 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat2} + * @category Static + * + * @returns A new {@link Mat2} + */ + static create() { + return new _Mat2(); + } + /** + * Creates a new {@link Mat2} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2} + */ + static clone(a) { + return new _Mat2(a); + } + /** + * Copy the values from one {@link Mat2} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Create a new {@link Mat2} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2} + */ + static fromValues(...values) { + return new _Mat2(...values); + } + /** + * Set the components of a {@link Mat2} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + return out; + } + /** + * Set a {@link Mat2} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out, a) { + if (out === a) { + const a1 = a[1]; + out[1] = a[2]; + out[2] = a1; + } else { + out[0] = a[0]; + out[1] = a[2]; + out[2] = a[1]; + out[3] = a[3]; + } + return out; + } + /** + * Inverts a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + let det = a0 * a3 - a2 * a1; + if (!det) { + return null; + } + det = 1 / det; + out[0] = a3 * det; + out[1] = -a1 * det; + out[2] = -a2 * det; + out[3] = a0 * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out, a) { + const a0 = a[0]; + out[0] = a[3]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a0; + return out; + } + /** + * Calculates the determinant of a {@link Mat2} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + return a[0] * a[3] - a[2] * a[1]; + } + /** + * Adds two {@link Mat2}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + return out; + } + /** + * Alias for {@link Mat2.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat2}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + out[0] = a0 * b0 + a2 * b1; + out[1] = a1 * b0 + a3 * b1; + out[2] = a0 * b2 + a2 * b3; + out[3] = a1 * b2 + a3 * b3; + return out; + } + /** + * Alias for {@link Mat2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Rotates a {@link Mat2} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out, a, rad) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = a0 * c + a2 * s; + out[1] = a1 * c + a3 * s; + out[2] = a0 * -s + a2 * c; + out[3] = a1 * -s + a3 * c; + return out; + } + /** + * Scales the {@link Mat2} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0 * v0; + out[1] = a1 * v0; + out[2] = a2 * v1; + out[3] = a3 * v1; + return out; + } + /** + * Creates a {@link Mat2} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = -s; + out[3] = c; + return out; + } + /** + * Creates a {@link Mat2} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = v[1]; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat2} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]); + } + /** + * Multiply each element of a {@link Mat2} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + return out; + } + /** + * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + return out; + } + /** + * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix + * @category Static + * + * @param L - the lower triangular matrix + * @param D - the diagonal matrix + * @param U - the upper triangular matrix + * @param a - the input matrix to factorize + */ + static LDU(L, D, U, a) { + L[2] = a[2] / a[0]; + U[0] = a[0]; + U[1] = a[1]; + U[3] = a[3] - L[2] * U[1]; + return [L, D, U]; + } + /** + * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + /** + * Returns whether two {@link Mat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)); + } + /** + * Returns a string representation of a {@link Mat2} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat2(${a.join(", ")})`; + } +}; +Mat2.prototype.mul = Mat2.prototype.multiply; +Mat2.mul = Mat2.multiply; +Mat2.sub = Mat2.subtract; + +// src/_lib/f64/Mat2d.ts +var Mat2d = class _Mat2d extends Float64Array { + static #IDENTITY_2X3 = new Float64Array([ + 1, + 0, + 0, + 1, + 0, + 0 + ]); + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 6: + super(values); + break; + case 2: + super(values[0], values[1], 6); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v, + v, + v + ]); + } else { + super(v, 0, 6); + } + break; + default: + super(_Mat2d.#IDENTITY_2X3); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat2d.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat2d.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Mat2d} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat2d.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this.set(_Mat2d.#IDENTITY_2X3); + return this; + } + /** + * Multiplies this {@link Mat2d} against another one + * Equivalent to `Mat2d.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b) { + return _Mat2d.multiply(this, this, b); + } + /** + * Alias for {@link Mat2d.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Translate this {@link Mat2d} by the given vector + * Equivalent to `Mat2d.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v) { + return _Mat2d.translate(this, this, v); + } + /** + * Rotates this {@link Mat2d} by the given angle around the given axis + * Equivalent to `Mat2d.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad) { + return _Mat2d.rotate(this, this, rad); + } + /** + * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2d.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v) { + return _Mat2d.scale(this, this, v); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2d}. + */ + static get BYTE_LENGTH() { + return 6 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat2d} + * @category Static + * + * @returns A new {@link Mat2d} + */ + static create() { + return new _Mat2d(); + } + /** + * Creates a new {@link Mat2d} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2d} + */ + static clone(a) { + return new _Mat2d(a); + } + /** + * Copy the values from one {@link Mat2d} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + return out; + } + /** + * Create a new {@link Mat2d} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2d} + */ + static fromValues(...values) { + return new _Mat2d(...values); + } + /** + * Set the components of a {@link Mat2d} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + return out; + } + /** + * Set a {@link Mat2d} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Inverts a {@link Mat2d} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const aa = a[0]; + const ab = a[1]; + const ac = a[2]; + const ad = a[3]; + const atx = a[4]; + const aty = a[5]; + let det = aa * ad - ab * ac; + if (!det) { + return null; + } + det = 1 / det; + out[0] = ad * det; + out[1] = -ab * det; + out[2] = -ac * det; + out[3] = aa * det; + out[4] = (ac * aty - ad * atx) * det; + out[5] = (ab * atx - aa * aty) * det; + return out; + } + /** + * Calculates the determinant of a {@link Mat2d} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + return a[0] * a[3] - a[1] * a[2]; + } + /** + * Adds two {@link Mat2d}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + return out; + } + /** + * Alias for {@link Mat2d.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat2d}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + out[0] = a0 * b0 + a2 * b1; + out[1] = a1 * b0 + a3 * b1; + out[2] = a0 * b2 + a2 * b3; + out[3] = a1 * b2 + a3 * b3; + out[4] = a0 * b4 + a2 * b5 + a4; + out[5] = a1 * b4 + a3 * b5 + a5; + return out; + } + /** + * Alias for {@link Mat2d.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat2d} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0; + out[1] = a1; + out[2] = a2; + out[3] = a3; + out[4] = a0 * v0 + a2 * v1 + a4; + out[5] = a1 * v0 + a3 * v1 + a5; + return out; + } + /** + * Rotates a {@link Mat2d} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out, a, rad) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = a0 * c + a2 * s; + out[1] = a1 * c + a3 * s; + out[2] = a0 * -s + a2 * c; + out[3] = a1 * -s + a3 * c; + out[4] = a4; + out[5] = a5; + return out; + } + /** + * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0 * v0; + out[1] = a1 * v0; + out[2] = a2 * v1; + out[3] = a3 * v1; + out[4] = a4; + out[5] = a5; + return out; + } + // TODO: Got to fromRotation + /** + * Creates a {@link Mat2d} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = v[0]; + out[5] = v[1]; + return out; + } + /** + * Creates a {@link Mat2d} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = -s; + out[3] = c; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Creates a {@link Mat2d} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = v[1]; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat2d} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1); + } + /** + * Multiply each element of a {@link Mat2d} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + return out; + } + /** + * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + return out; + } + /** + * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5]; + } + /** + * Returns whether two {@link Mat2d}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)); + } + /** + * Returns a string representation of a {@link Mat2d} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat2d(${a.join(", ")})`; + } +}; +Mat2d.mul = Mat2d.multiply; +Mat2d.sub = Mat2d.subtract; + +// src/_lib/f64/Mat3.ts +var Mat3 = class _Mat3 extends Float64Array { + static #IDENTITY_3X3 = new Float64Array([ + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1 + ]); + /** + * Create a {@link Mat3}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 9: + super(values); + break; + case 2: + super(values[0], values[1], 9); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v, + v, + v, + v, + v, + v + ]); + } else { + super(v, 0, 9); + } + break; + default: + super(_Mat3.#IDENTITY_3X3); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat3.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat3.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat3.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this.set(_Mat3.#IDENTITY_3X3); + return this; + } + /** + * Multiplies this {@link Mat3} against another one + * Equivalent to `Mat3.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b) { + return _Mat3.multiply(this, this, b); + } + /** + * Alias for {@link Mat3.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat3} + * Equivalent to `Mat3.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose() { + return _Mat3.transpose(this, this); + } + /** + * Inverts this {@link Mat3} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + return _Mat3.invert(this, this); + } + /** + * Translate this {@link Mat3} by the given vector + * Equivalent to `Mat3.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v) { + return _Mat3.translate(this, this, v); + } + /** + * Rotates this {@link Mat3} by the given angle around the given axis + * Equivalent to `Mat3.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad) { + return _Mat3.rotate(this, this, rad); + } + /** + * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat3.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v) { + return _Mat3.scale(this, this, v); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat3}. + */ + static get BYTE_LENGTH() { + return 9 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat3} + * @category Static + * + * @returns A new {@link Mat3} + */ + static create() { + return new _Mat3(); + } + /** + * Creates a new {@link Mat3} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat3} + */ + static clone(a) { + return new _Mat3(a); + } + /** + * Copy the values from one {@link Mat3} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + return out; + } + /** + * Create a new {@link Mat3} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat3} + */ + static fromValues(...values) { + return new _Mat3(...values); + } + /** + * Set the components of a {@link Mat3} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + out[6] = values[6]; + out[7] = values[7]; + out[8] = values[8]; + return out; + } + /** + * Set a {@link Mat3} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out, a) { + if (out === a) { + const a01 = a[1], a02 = a[2], a12 = a[5]; + out[1] = a[3]; + out[2] = a[6]; + out[3] = a01; + out[5] = a[7]; + out[6] = a02; + out[7] = a12; + } else { + out[0] = a[0]; + out[1] = a[3]; + out[2] = a[6]; + out[3] = a[1]; + out[4] = a[4]; + out[5] = a[7]; + out[6] = a[2]; + out[7] = a[5]; + out[8] = a[8]; + } + return out; + } + /** + * Inverts a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const a00 = a[0], a01 = a[1], a02 = a[2]; + const a10 = a[3], a11 = a[4], a12 = a[5]; + const a20 = a[6], a21 = a[7], a22 = a[8]; + const b01 = a22 * a11 - a12 * a21; + const b11 = -a22 * a10 + a12 * a20; + const b21 = a21 * a10 - a11 * a20; + let det = a00 * b01 + a01 * b11 + a02 * b21; + if (!det) { + return null; + } + det = 1 / det; + out[0] = b01 * det; + out[1] = (-a22 * a01 + a02 * a21) * det; + out[2] = (a12 * a01 - a02 * a11) * det; + out[3] = b11 * det; + out[4] = (a22 * a00 - a02 * a20) * det; + out[5] = (-a12 * a00 + a02 * a10) * det; + out[6] = b21 * det; + out[7] = (-a21 * a00 + a01 * a20) * det; + out[8] = (a11 * a00 - a01 * a10) * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out, a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + out[0] = a11 * a22 - a12 * a21; + out[1] = a02 * a21 - a01 * a22; + out[2] = a01 * a12 - a02 * a11; + out[3] = a12 * a20 - a10 * a22; + out[4] = a00 * a22 - a02 * a20; + out[5] = a02 * a10 - a00 * a12; + out[6] = a10 * a21 - a11 * a20; + out[7] = a01 * a20 - a00 * a21; + out[8] = a00 * a11 - a01 * a10; + return out; + } + /** + * Calculates the determinant of a {@link Mat3} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20); + } + /** + * Adds two {@link Mat3}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + out[8] = a[8] + b[8]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + out[6] = a[6] - b[6]; + out[7] = a[7] - b[7]; + out[8] = a[8] - b[8]; + return out; + } + /** + * Alias for {@link Mat3.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat3}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + let b0 = b[0]; + let b1 = b[1]; + let b2 = b[2]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20; + out[1] = b0 * a01 + b1 * a11 + b2 * a21; + out[2] = b0 * a02 + b1 * a12 + b2 * a22; + b0 = b[3]; + b1 = b[4]; + b2 = b[5]; + out[3] = b0 * a00 + b1 * a10 + b2 * a20; + out[4] = b0 * a01 + b1 * a11 + b2 * a21; + out[5] = b0 * a02 + b1 * a12 + b2 * a22; + b0 = b[6]; + b1 = b[7]; + b2 = b[8]; + out[6] = b0 * a00 + b1 * a10 + b2 * a20; + out[7] = b0 * a01 + b1 * a11 + b2 * a21; + out[8] = b0 * a02 + b1 * a12 + b2 * a22; + return out; + } + /** + * Alias for {@link Mat3.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat3} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + const x = v[0]; + const y = v[1]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a10; + out[4] = a11; + out[5] = a12; + out[6] = x * a00 + y * a10 + a20; + out[7] = x * a01 + y * a11 + a21; + out[8] = x * a02 + y * a12 + a22; + return out; + } + /** + * Rotates a {@link Mat3} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out, a, rad) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c * a00 + s * a10; + out[1] = c * a01 + s * a11; + out[2] = c * a02 + s * a12; + out[3] = c * a10 - s * a00; + out[4] = c * a11 - s * a01; + out[5] = c * a12 - s * a02; + out[6] = a20; + out[7] = a21; + out[8] = a22; + return out; + } + /** + * Scales the {@link Mat3} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const x = v[0]; + const y = v[1]; + out[0] = x * a[0]; + out[1] = x * a[1]; + out[2] = x * a[2]; + out[3] = y * a[3]; + out[4] = y * a[4]; + out[5] = y * a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + return out; + } + /** + * Creates a {@link Mat3} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = v[0]; + out[7] = v[1]; + out[8] = 1; + return out; + } + /** + * Creates a {@link Mat3} from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat3.identity(dest); + * mat3.rotate(dest, dest, rad); + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = 0; + out[3] = -s; + out[4] = c; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Creates a {@link Mat3} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = v[1]; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Copies the upper-left 3x3 values of a {@link Mat2d} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 2x3 matrix + * @returns `out` + */ + static fromMat2d(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = 0; + out[3] = a[2]; + out[4] = a[3]; + out[5] = 0; + out[6] = a[4]; + out[7] = a[5]; + out[8] = 1; + return out; + } + /** + * Calculates a {@link Mat3} from the given quaternion + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param q - {@link Quat} to create matrix from + * @returns `out` + */ + static fromQuat(out, q) { + 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; + out[0] = 1 - yy - zz; + out[3] = yx - wz; + out[6] = zx + wy; + out[1] = yx + wz; + out[4] = 1 - xx - zz; + out[7] = zy - wx; + out[2] = zx - wy; + out[5] = zy + wx; + out[8] = 1 - xx - yy; + return out; + } + /** + * Copies the upper-left 3x3 values of a {@link Mat4} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 4x4 matrix + * @returns `out` + */ + static fromMat4(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[4]; + out[4] = a[5]; + out[5] = a[6]; + out[6] = a[8]; + out[7] = a[9]; + out[8] = a[10]; + return out; + } + /** + * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix + * @category Static + * + * @param {mat3} out mat3 receiving operation result + * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out, a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + return out; + } + /** + * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out, a) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const bx = a[4]; + const by = a[5]; + const bz = a[6]; + const cx = a[8]; + const cy = a[9]; + const cz = a[10]; + out[0] = by * cz - cz * cy; + out[1] = bz * cx - cx * cz; + out[2] = bx * cy - cy * cx; + out[3] = cy * az - cz * ay; + out[4] = cz * ax - cx * az; + out[5] = cx * ay - cy * ax; + out[6] = ay * bz - az * by; + out[7] = az * bx - ax * bz; + out[8] = ax * by - ay * bx; + return out; + } + /** + * Generates a 2D projection matrix with the given bounds + * @category Static + * + * @param out mat3 frustum matrix will be written into + * @param width Width of your gl context + * @param height Height of gl context + * @returns `out` + */ + static projection(out, width, height) { + out[0] = 2 / width; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = -2 / height; + out[5] = 0; + out[6] = -1; + out[7] = 1; + out[8] = 1; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat3} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt( + a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + ); + } + /** + * Multiply each element of a {@link Mat3} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + out[8] = a[8] * b; + return out; + } + /** + * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + out[6] = a[6] + b[6] * scale; + out[7] = a[7] + b[7] * scale; + out[8] = a[8] + b[8] * scale; + return out; + } + /** + * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8]; + } + /** + * Returns whether two {@link Mat3}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const a8 = a[8]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + const b8 = b[8]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)); + } + /** + * Returns a string representation of a {@link Mat3} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat3(${a.join(", ")})`; + } +}; +Mat3.prototype.mul = Mat3.prototype.multiply; +Mat3.mul = Mat3.multiply; +Mat3.sub = Mat3.subtract; + +// src/_lib/f64/Mat4.ts +var Mat4 = class _Mat4 extends Float64Array { + static #IDENTITY_4X4 = new Float64Array([ + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 + ]); + /** + * Temporary variable to prevent repeated allocations in the algorithms within Mat4. + * These are declared as TypedArrays to aid in tree-shaking. + */ + static #TMP_VEC3 = new Float64Array(3); + /** + * Create a {@link Mat4}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 16: + super(values); + break; + case 2: + super(values[0], values[1], 16); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v + ]); + } else { + super(v, 0, 16); + } + break; + default: + super(_Mat4.#IDENTITY_4X4); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat4.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat4.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat4.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this.set(_Mat4.#IDENTITY_4X4); + return this; + } + /** + * Multiplies this {@link Mat4} against another one + * Equivalent to `Mat4.multiply(this, this, b);` + * @category Methods + * + * @param b - The second operand + * @returns `this` + */ + multiply(b) { + return _Mat4.multiply(this, this, b); + } + /** + * Alias for {@link Mat4.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat4} + * Equivalent to `Mat4.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose() { + return _Mat4.transpose(this, this); + } + /** + * Inverts this {@link Mat4} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + return _Mat4.invert(this, this); + } + /** + * Translate this {@link Mat4} by the given vector + * Equivalent to `Mat4.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to translate by + * @returns `this` + */ + translate(v) { + return _Mat4.translate(this, this, v); + } + /** + * Rotates this {@link Mat4} by the given angle around the given axis + * Equivalent to `Mat4.rotate(this, this, rad, axis);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `this` + */ + rotate(rad, axis) { + return _Mat4.rotate(this, this, rad, axis); + } + /** + * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat4.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to scale the matrix by + * @returns `this` + */ + scale(v) { + return _Mat4.scale(this, this, v); + } + /** + * Rotates this {@link Mat4} by the given angle around the X axis + * Equivalent to `Mat4.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateX(rad) { + return _Mat4.rotateX(this, this, rad); + } + /** + * Rotates this {@link Mat4} by the given angle around the Y axis + * Equivalent to `Mat4.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateY(rad) { + return _Mat4.rotateY(this, this, rad); + } + /** + * Rotates this {@link Mat4} by the given angle around the Z axis + * Equivalent to `Mat4.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateZ(rad) { + return _Mat4.rotateZ(this, this, rad); + } + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveNO(fovy, aspect, near, far) { + return _Mat4.perspectiveNO(this, fovy, aspect, near, far); + } + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveZO(fovy, aspect, near, far) { + return _Mat4.perspectiveZO(this, fovy, aspect, near, far); + } + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoNO(left, right, bottom, top, near, far) { + return _Mat4.orthoNO(this, left, right, bottom, top, near, far); + } + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoZO(left, right, bottom, top, near, far) { + return _Mat4.orthoZO(this, left, right, bottom, top, near, far); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat4}. + */ + static get BYTE_LENGTH() { + return 16 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat4} + * @category Static + * + * @returns A new {@link Mat4} + */ + static create() { + return new _Mat4(); + } + /** + * Creates a new {@link Mat4} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat4} + */ + static clone(a) { + return new _Mat4(a); + } + /** + * Copy the values from one {@link Mat4} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + /** + * Create a new mat4 with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat4} + */ + static fromValues(...values) { + return new _Mat4(...values); + } + /** + * Set the components of a mat4 to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + out[6] = values[6]; + out[7] = values[7]; + out[8] = values[8]; + out[9] = values[9]; + out[10] = values[10]; + out[11] = values[11]; + out[12] = values[12]; + out[13] = values[13]; + out[14] = values[14]; + out[15] = values[15]; + return out; + } + /** + * Set a {@link Mat4} to the identity matrix + * @category Static + * + * @param out - The receiving Matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out, a) { + if (out === a) { + const a01 = a[1], a02 = a[2], a03 = a[3]; + const a12 = a[6], a13 = a[7]; + const a23 = a[11]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a01; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a02; + out[9] = a12; + out[11] = a[14]; + out[12] = a03; + out[13] = a13; + out[14] = a23; + } else { + out[0] = a[0]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a[1]; + out[5] = a[5]; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a[2]; + out[9] = a[6]; + out[10] = a[10]; + out[11] = a[14]; + out[12] = a[3]; + out[13] = a[7]; + out[14] = a[11]; + out[15] = a[15]; + } + return out; + } + /** + * Inverts a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out, a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + out[0] = a11 * b11 - a12 * b10 + a13 * b09; + out[1] = a02 * b10 - a01 * b11 - a03 * b09; + out[2] = a31 * b05 - a32 * b04 + a33 * b03; + out[3] = a22 * b04 - a21 * b05 - a23 * b03; + out[4] = a12 * b08 - a10 * b11 - a13 * b07; + out[5] = a00 * b11 - a02 * b08 + a03 * b07; + out[6] = a32 * b02 - a30 * b05 - a33 * b01; + out[7] = a20 * b05 - a22 * b02 + a23 * b01; + out[8] = a10 * b10 - a11 * b08 + a13 * b06; + out[9] = a01 * b08 - a00 * b10 - a03 * b06; + out[10] = a30 * b04 - a31 * b02 + a33 * b00; + out[11] = a21 * b02 - a20 * b04 - a23 * b00; + out[12] = a11 * b07 - a10 * b09 - a12 * b06; + out[13] = a00 * b09 - a01 * b07 + a02 * b06; + out[14] = a31 * b01 - a30 * b03 - a32 * b00; + out[15] = a20 * b03 - a21 * b01 + a22 * b00; + return out; + } + /** + * Calculates the determinant of a {@link Mat4} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b0 = a00 * a11 - a01 * a10; + const b1 = a00 * a12 - a02 * a10; + const b2 = a01 * a12 - a02 * a11; + const b3 = a20 * a31 - a21 * a30; + const b4 = a20 * a32 - a22 * a30; + const b5 = a21 * a32 - a22 * a31; + const b6 = a00 * b5 - a01 * b4 + a02 * b3; + const b7 = a10 * b5 - a11 * b4 + a12 * b3; + const b8 = a20 * b2 - a21 * b1 + a22 * b0; + const b9 = a30 * b2 - a31 * b1 + a32 * b0; + return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9; + } + /** + * Multiplies two {@link Mat4}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + let b0 = b[0]; + let b1 = b[1]; + let b2 = b[2]; + let b3 = b[3]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[4]; + b1 = b[5]; + b2 = b[6]; + b3 = b[7]; + out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[8]; + b1 = b[9]; + b2 = b[10]; + b3 = b[11]; + out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[12]; + b1 = b[13]; + b2 = b[14]; + b3 = b[15]; + out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + return out; + } + /** + * Alias for {@link Mat4.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat4} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const x = v[0]; + const y = v[1]; + const z = v[2]; + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a03; + out[4] = a10; + out[5] = a11; + out[6] = a12; + out[7] = a13; + out[8] = a20; + out[9] = a21; + out[10] = a22; + out[11] = a23; + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + return out; + } + /** + * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec3} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const x = v[0]; + const y = v[1]; + const z = v[2]; + out[0] = a[0] * x; + out[1] = a[1] * x; + out[2] = a[2] * x; + out[3] = a[3] * x; + out[4] = a[4] * y; + out[5] = a[5] * y; + out[6] = a[6] * y; + out[7] = a[7] * y; + out[8] = a[8] * z; + out[9] = a[9] * z; + out[10] = a[10] * z; + out[11] = a[11] * z; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + /** + * Rotates a {@link Mat4} by the given angle around the given axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if axis has a length of 0 + */ + static rotate(out, a, rad, axis) { + let x = axis[0]; + let y = axis[1]; + let z = axis[2]; + let len = Math.sqrt(x * x + y * y + z * z); + if (len < GLM_EPSILON) { + return null; + } + len = 1 / len; + x *= len; + y *= len; + z *= len; + const s = Math.sin(rad); + const c = Math.cos(rad); + const t = 1 - c; + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const b00 = x * x * t + c; + const b01 = y * x * t + z * s; + const b02 = z * x * t - y * s; + const b10 = x * y * t - z * s; + const b11 = y * y * t + c; + const b12 = z * y * t + x * s; + const b20 = x * z * t + y * s; + const b21 = y * z * t - x * s; + const b22 = z * z * t + c; + out[0] = a00 * b00 + a10 * b01 + a20 * b02; + out[1] = a01 * b00 + a11 * b01 + a21 * b02; + out[2] = a02 * b00 + a12 * b01 + a22 * b02; + out[3] = a03 * b00 + a13 * b01 + a23 * b02; + out[4] = a00 * b10 + a10 * b11 + a20 * b12; + out[5] = a01 * b10 + a11 * b11 + a21 * b12; + out[6] = a02 * b10 + a12 * b11 + a22 * b12; + out[7] = a03 * b10 + a13 * b11 + a23 * b12; + out[8] = a00 * b20 + a10 * b21 + a20 * b22; + out[9] = a01 * b20 + a11 * b21 + a21 * b22; + out[10] = a02 * b20 + a12 * b21 + a22 * b22; + out[11] = a03 * b20 + a13 * b21 + a23 * b22; + if (a !== out) { + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + return out; + } + /** + * Rotates a matrix by the given angle around the X axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateX(out, a, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + if (a !== out) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[4] = a10 * c + a20 * s; + out[5] = a11 * c + a21 * s; + out[6] = a12 * c + a22 * s; + out[7] = a13 * c + a23 * s; + out[8] = a20 * c - a10 * s; + out[9] = a21 * c - a11 * s; + out[10] = a22 * c - a12 * s; + out[11] = a23 * c - a13 * s; + return out; + } + /** + * Rotates a matrix by the given angle around the Y axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateY(out, a, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + if (a !== out) { + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[0] = a00 * c - a20 * s; + out[1] = a01 * c - a21 * s; + out[2] = a02 * c - a22 * s; + out[3] = a03 * c - a23 * s; + out[8] = a00 * s + a20 * c; + out[9] = a01 * s + a21 * c; + out[10] = a02 * s + a22 * c; + out[11] = a03 * s + a23 * c; + return out; + } + /** + * Rotates a matrix by the given angle around the Z axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateZ(out, a, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + if (a !== out) { + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[0] = a00 * c + a10 * s; + out[1] = a01 * c + a11 * s; + out[2] = a02 * c + a12 * s; + out[3] = a03 * c + a13 * s; + out[4] = a10 * c - a00 * s; + out[5] = a11 * c - a01 * s; + out[6] = a12 * c - a02 * s; + out[7] = a13 * c - a03 * s; + return out; + } + /** + * Creates a {@link Mat4} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Creates a {@link Mat4} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = v[1]; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = v[2]; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a {@link Mat4} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotate(dest, dest, rad, axis); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if `axis` has a length of 0 + */ + static fromRotation(out, rad, axis) { + let x = axis[0]; + let y = axis[1]; + let z = axis[2]; + let len = Math.sqrt(x * x + y * y + z * z); + if (len < GLM_EPSILON) { + return null; + } + len = 1 / len; + x *= len; + y *= len; + z *= len; + const s = Math.sin(rad); + const c = Math.cos(rad); + const t = 1 - c; + out[0] = x * x * t + c; + out[1] = y * x * t + z * s; + out[2] = z * x * t - y * s; + out[3] = 0; + out[4] = x * y * t - z * s; + out[5] = y * y * t + c; + out[6] = z * y * t + x * s; + out[7] = 0; + out[8] = x * z * t + y * s; + out[9] = y * z * t - x * s; + out[10] = z * z * t + c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateX(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromXRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = c; + out[6] = s; + out[7] = 0; + out[8] = 0; + out[9] = -s; + out[10] = c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateY(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromYRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = 0; + out[2] = -s; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = s; + out[9] = 0; + out[10] = c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateZ(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromZRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = 0; + out[3] = 0; + out[4] = -s; + out[5] = c; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @returns `out` + */ + static fromRotationTranslation(out, q, v) { + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Sets a {@link Mat4} from a {@link Quat2}. + * @category Static + * + * @param out - Matrix + * @param a - Dual Quaternion + * @returns `out` + */ + static fromQuat2(out, a) { + const bx = -a[0]; + const by = -a[1]; + const bz = -a[2]; + const bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const magnitude = bx * bx + by * by + bz * bz + bw * bw; + if (magnitude > 0) { + _Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude; + _Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude; + _Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude; + } else { + _Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; + _Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; + _Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + } + _Mat4.fromRotationTranslation(out, a, _Mat4.#TMP_VEC3); + return out; + } + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out, a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[3] = 0; + out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[7] = 0; + out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out, a) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const bx = a[4]; + const by = a[5]; + const bz = a[6]; + const cx = a[8]; + const cy = a[9]; + const cz = a[10]; + out[0] = by * cz - cz * cy; + out[1] = bz * cx - cx * cz; + out[2] = bx * cy - cy * cx; + out[3] = 0; + out[4] = cy * az - cz * ay; + out[5] = cz * ax - cx * az; + out[6] = cx * ay - cy * ax; + out[7] = 0; + out[8] = ay * bz - az * by; + out[9] = az * bx - ax * bz; + out[10] = ax * by - ay * bx; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Returns the translation vector component of a transformation + * matrix. If a matrix is built with fromRotationTranslation, + * the returned vector will be the same as the translation vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive translation component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getTranslation(out, mat) { + out[0] = mat[12]; + out[1] = mat[13]; + out[2] = mat[14]; + return out; + } + /** + * Returns the scaling factor component of a transformation + * matrix. If a matrix is built with fromRotationTranslationScale + * with a normalized Quaternion parameter, the returned vector will be + * the same as the scaling vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive scaling factor component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getScaling(out, mat) { + const m11 = mat[0]; + const m12 = mat[1]; + const m13 = mat[2]; + const m21 = mat[4]; + const m22 = mat[5]; + const m23 = mat[6]; + const m31 = mat[8]; + const m32 = mat[9]; + const m33 = mat[10]; + out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + return out; + } + /** + * Returns a quaternion representing the rotational component + * of a transformation matrix. If a matrix is built with + * fromRotationTranslation, the returned quaternion will be the + * same as the quaternion originally supplied. + * @category Static + * + * @param out - Quaternion to receive the rotation component + * @param mat - Matrix to be decomposed (input) + * @return `out` + */ + static getRotation(out, mat) { + _Mat4.getScaling(_Mat4.#TMP_VEC3, mat); + const is1 = 1 / _Mat4.#TMP_VEC3[0]; + const is2 = 1 / _Mat4.#TMP_VEC3[1]; + const is3 = 1 / _Mat4.#TMP_VEC3[2]; + const sm11 = mat[0] * is1; + const sm12 = mat[1] * is2; + const sm13 = mat[2] * is3; + const sm21 = mat[4] * is1; + const sm22 = mat[5] * is2; + const sm23 = mat[6] * is3; + const sm31 = mat[8] * is1; + const sm32 = mat[9] * is2; + const sm33 = mat[10] * is3; + const trace = sm11 + sm22 + sm33; + let S = 0; + if (trace > 0) { + S = Math.sqrt(trace + 1) * 2; + out[3] = 0.25 * S; + out[0] = (sm23 - sm32) / S; + out[1] = (sm31 - sm13) / S; + out[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2; + out[3] = (sm23 - sm32) / S; + out[0] = 0.25 * S; + out[1] = (sm12 + sm21) / S; + out[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2; + out[3] = (sm31 - sm13) / S; + out[0] = (sm12 + sm21) / S; + out[1] = 0.25 * S; + out[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2; + out[3] = (sm12 - sm21) / S; + out[0] = (sm31 + sm13) / S; + out[1] = (sm23 + sm32) / S; + out[2] = 0.25 * S; + } + return out; + } + /** + * Decomposes a transformation matrix into its rotation, translation + * and scale components. Returns only the rotation component + * @category Static + * + * @param out_r - Quaternion to receive the rotation component + * @param out_t - Vector to receive the translation vector + * @param out_s - Vector to receive the scaling factor + * @param mat - Matrix to be decomposed (input) + * @returns `out_r` + */ + static decompose(out_r, out_t, out_s, mat) { + out_t[0] = mat[12]; + out_t[1] = mat[13]; + out_t[2] = mat[14]; + const m11 = mat[0]; + const m12 = mat[1]; + const m13 = mat[2]; + const m21 = mat[4]; + const m22 = mat[5]; + const m23 = mat[6]; + const m31 = mat[8]; + const m32 = mat[9]; + const m33 = mat[10]; + out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + const is1 = 1 / out_s[0]; + const is2 = 1 / out_s[1]; + const is3 = 1 / out_s[2]; + const sm11 = m11 * is1; + const sm12 = m12 * is2; + const sm13 = m13 * is3; + const sm21 = m21 * is1; + const sm22 = m22 * is2; + const sm23 = m23 * is3; + const sm31 = m31 * is1; + const sm32 = m32 * is2; + const sm33 = m33 * is3; + const trace = sm11 + sm22 + sm33; + let S = 0; + if (trace > 0) { + S = Math.sqrt(trace + 1) * 2; + out_r[3] = 0.25 * S; + out_r[0] = (sm23 - sm32) / S; + out_r[1] = (sm31 - sm13) / S; + out_r[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2; + out_r[3] = (sm23 - sm32) / S; + out_r[0] = 0.25 * S; + out_r[1] = (sm12 + sm21) / S; + out_r[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2; + out_r[3] = (sm31 - sm13) / S; + out_r[0] = (sm12 + sm21) / S; + out_r[1] = 0.25 * S; + out_r[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2; + out_r[3] = (sm12 - sm21) / S; + out_r[0] = (sm31 + sm13) / S; + out_r[1] = (sm23 + sm32) / S; + out_r[2] = 0.25 * S; + } + return out_r; + } + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @returns `out` + */ + static fromRotationTranslationScale(out, q, v, s) { + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + const sx = s[0]; + const sy = s[1]; + const sz = s[2]; + out[0] = (1 - (yy + zz)) * sx; + out[1] = (xy + wz) * sx; + out[2] = (xz - wy) * sx; + out[3] = 0; + out[4] = (xy - wz) * sy; + out[5] = (1 - (xx + zz)) * sy; + out[6] = (yz + wx) * sy; + out[7] = 0; + out[8] = (xz + wy) * sz; + out[9] = (yz - wx) * sz; + out[10] = (1 - (xx + yy)) * sz; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the + * given origin. This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * mat4.translate(dest, origin); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * mat4.translate(dest, negativeOrigin); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @param o - The origin vector around which to scale and rotate + * @returns `out` + */ + static fromRotationTranslationScaleOrigin(out, q, v, s, o) { + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + const sx = s[0]; + const sy = s[1]; + const sz = s[2]; + const ox = o[0]; + const oy = o[1]; + const oz = o[2]; + const out0 = (1 - (yy + zz)) * sx; + const out1 = (xy + wz) * sx; + const out2 = (xz - wy) * sx; + const out4 = (xy - wz) * sy; + const out5 = (1 - (xx + zz)) * sy; + const out6 = (yz + wx) * sy; + const out8 = (xz + wy) * sz; + const out9 = (yz - wx) * sz; + const out10 = (1 - (xx + yy)) * sz; + out[0] = out0; + out[1] = out1; + out[2] = out2; + out[3] = 0; + out[4] = out4; + out[5] = out5; + out[6] = out6; + out[7] = 0; + out[8] = out8; + out[9] = out9; + out[10] = out10; + out[11] = 0; + out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz); + out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz); + out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); + out[15] = 1; + return out; + } + /** + * Calculates a 4x4 matrix from the given quaternion + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Quaternion to create matrix from + * @returns `out` + */ + static fromQuat(out, q) { + 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; + out[0] = 1 - yy - zz; + out[1] = yx + wz; + out[2] = zx - wy; + out[3] = 0; + out[4] = yx - wz; + out[5] = 1 - xx - zz; + out[6] = zy + wx; + out[7] = 0; + out[8] = zx + wy; + out[9] = zy - wx; + out[10] = 1 - xx - yy; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumNO(out, left, right, bottom, top, near, far = Infinity) { + const rl = 1 / (right - left); + const tb = 1 / (top - bottom); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + /** + * Alias for {@link Mat4.frustumNO} + * @category Static + * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly + */ + static frustum(out, left, right, bottom, top, near, far = Infinity) { + return out; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumZO(out, left, right, bottom, top, near, far = Infinity) { + const rl = 1 / (right - left); + const tb = 1 / (top - bottom); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = far * nf; + out[14] = far * near * nf; + } else { + out[10] = -1; + out[14] = -near; + } + return out; + } + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveNO(out, fovy, aspect, near, far = Infinity) { + const f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + /** + * Alias for {@link Mat4.perspectiveNO} + * @category Static + * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static perspective(out, fovy, aspect, near, far = Infinity) { + return out; + } + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveZO(out, fovy, aspect, near, far = Infinity) { + const f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = far * nf; + out[14] = far * near * nf; + } else { + out[10] = -1; + out[14] = -near; + } + return out; + } + /** + * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating + * projection matrices to be used with the still experimental WebVR API. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + * @deprecated + */ + static perspectiveFromFieldOfView(out, fov, near, far) { + const upTan = Math.tan(fov.upDegrees * Math.PI / 180); + const downTan = Math.tan(fov.downDegrees * Math.PI / 180); + const leftTan = Math.tan(fov.leftDegrees * Math.PI / 180); + const rightTan = Math.tan(fov.rightDegrees * Math.PI / 180); + const xScale = 2 / (leftTan + rightTan); + const yScale = 2 / (upTan + downTan); + out[0] = xScale; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = yScale; + out[6] = 0; + out[7] = 0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = (upTan - downTan) * yScale * 0.5; + out[10] = far / (near - far); + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = far * near / (near - far); + out[15] = 0; + return out; + } + /** + * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoNO(out, left, right, bottom, top, near, far) { + const lr = 1 / (left - right); + const bt = 1 / (bottom - top); + const nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; + } + /** + * Alias for {@link Mat4.orthoNO} + * @category Static + * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static ortho(out, left, right, bottom, top, near, far) { + return out; + } + /** + * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoZO(out, left, right, bottom, top, near, far) { + const lr = 1 / (left - right); + const bt = 1 / (bottom - top); + const nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = near * nf; + out[15] = 1; + return out; + } + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that + * actually makes an object look at another object, you should use targetTo instead. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param center - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static lookAt(out, eye, center, up) { + const eyex = eye[0]; + const eyey = eye[1]; + const eyez = eye[2]; + const upx = up[0]; + const upy = up[1]; + const upz = up[2]; + const centerx = center[0]; + const centery = center[1]; + const centerz = center[2]; + if (Math.abs(eyex - centerx) < GLM_EPSILON && Math.abs(eyey - centery) < GLM_EPSILON && Math.abs(eyez - centerz) < GLM_EPSILON) { + return _Mat4.identity(out); + } + let z0 = eyex - centerx; + let z1 = eyey - centery; + let z2 = eyez - centerz; + let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + z0 *= len; + z1 *= len; + z2 *= len; + let x0 = upy * z2 - upz * z1; + let x1 = upz * z0 - upx * z2; + let x2 = upx * z1 - upy * z0; + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + if (!len) { + x0 = 0; + x1 = 0; + x2 = 0; + } else { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + let y0 = z1 * x2 - z2 * x1; + let y1 = z2 * x0 - z0 * x2; + let y2 = z0 * x1 - z1 * x0; + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + if (!len) { + y0 = 0; + y1 = 0; + y2 = 0; + } else { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + out[0] = x0; + out[1] = y0; + out[2] = z0; + out[3] = 0; + out[4] = x1; + out[5] = y1; + out[6] = z1; + out[7] = 0; + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); + out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); + out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + return out; + } + /** + * Generates a matrix that makes something look at something else. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param target - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static targetTo(out, eye, target, up) { + const eyex = eye[0]; + const eyey = eye[1]; + const eyez = eye[2]; + const upx = up[0]; + const upy = up[1]; + const upz = up[2]; + let z0 = eyex - target[0]; + let z1 = eyey - target[1]; + let z2 = eyez - target[2]; + let len = z0 * z0 + z1 * z1 + z2 * z2; + if (len > 0) { + len = 1 / Math.sqrt(len); + z0 *= len; + z1 *= len; + z2 *= len; + } + let x0 = upy * z2 - upz * z1; + let x1 = upz * z0 - upx * z2; + let x2 = upx * z1 - upy * z0; + len = x0 * x0 + x1 * x1 + x2 * x2; + if (len > 0) { + len = 1 / Math.sqrt(len); + x0 *= len; + x1 *= len; + x2 *= len; + } + out[0] = x0; + out[1] = x1; + out[2] = x2; + out[3] = 0; + out[4] = z1 * x2 - z2 * x1; + out[5] = z2 * x0 - z0 * x2; + out[6] = z0 * x1 - z1 * x0; + out[7] = 0; + out[8] = z0; + out[9] = z1; + out[10] = z2; + out[11] = 0; + out[12] = eyex; + out[13] = eyey; + out[14] = eyez; + out[15] = 1; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat4} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt( + a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + a[9] * a[9] + a[10] * a[10] + a[11] * a[11] + a[12] * a[12] + a[13] * a[13] + a[14] * a[14] + a[15] * a[15] + ); + } + /** + * Adds two {@link Mat4}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + out[8] = a[8] + b[8]; + out[9] = a[9] + b[9]; + out[10] = a[10] + b[10]; + out[11] = a[11] + b[11]; + out[12] = a[12] + b[12]; + out[13] = a[13] + b[13]; + out[14] = a[14] + b[14]; + out[15] = a[15] + b[15]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + out[6] = a[6] - b[6]; + out[7] = a[7] - b[7]; + out[8] = a[8] - b[8]; + out[9] = a[9] - b[9]; + out[10] = a[10] - b[10]; + out[11] = a[11] - b[11]; + out[12] = a[12] - b[12]; + out[13] = a[13] - b[13]; + out[14] = a[14] - b[14]; + out[15] = a[15] - b[15]; + return out; + } + /** + * Alias for {@link Mat4.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiply each element of the matrix by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + out[8] = a[8] * b; + out[9] = a[9] * b; + out[10] = a[10] * b; + out[11] = a[11] * b; + out[12] = a[12] * b; + out[13] = a[13] * b; + out[14] = a[14] * b; + out[15] = a[15] * b; + return out; + } + /** + * Adds two mat4's after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + out[6] = a[6] + b[6] * scale; + out[7] = a[7] + b[7] * scale; + out[8] = a[8] + b[8] * scale; + out[9] = a[9] + b[9] * scale; + out[10] = a[10] + b[10] * scale; + out[11] = a[11] + b[11] * scale; + out[12] = a[12] + b[12] * scale; + out[13] = a[13] + b[13] * scale; + out[14] = a[14] + b[14] * scale; + out[15] = a[15] + b[15] * scale; + return out; + } + /** + * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15]; + } + /** + * Returns whether two {@link Mat4}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const a8 = a[8]; + const a9 = a[9]; + const a10 = a[10]; + const a11 = a[11]; + const a12 = a[12]; + const a13 = a[13]; + const a14 = a[14]; + const a15 = a[15]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + const b8 = b[8]; + const b9 = b[9]; + const b10 = b[10]; + const b11 = b[11]; + const b12 = b[12]; + const b13 = b[13]; + const b14 = b[14]; + const b15 = b[15]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15)); + } + /** + * Returns a string representation of a {@link Mat4} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat4(${a.join(", ")})`; + } +}; +Mat4.prototype.mul = Mat4.prototype.multiply; +Mat4.sub = Mat4.subtract; +Mat4.mul = Mat4.multiply; +Mat4.frustum = Mat4.frustumNO; +Mat4.perspective = Mat4.perspectiveNO; +Mat4.ortho = Mat4.orthoNO; + +// src/_lib/f64/Vec3.ts +var Vec3 = class _Vec3 extends Float64Array { + /** + * Create a {@link Vec3}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 3: + super(values); + break; + case 2: + super(values[0], values[1], 3); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v]); + } else { + super(v, 0, 3); + } + break; + } + default: + super(3); + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z() { + return this[2]; + } + set z(value) { + this[2] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r() { + return this[0]; + } + set r(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g() { + return this[1]; + } + set g(value) { + this[1] = value; + } + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b() { + return this[2]; + } + set b(value) { + this[2] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec3.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec3.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag() { + return this.squaredMagnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec3.str(this);` + * + * @category Accessors + */ + get str() { + return _Vec3.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Adds a {@link Vec3} to `this`. + * Equivalent to `Vec3.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b) { + this[0] += b[0]; + this[1] += b[1]; + this[2] += b[2]; + return this; + } + /** + * Subtracts a {@link Vec3} from `this`. + * Equivalent to `Vec3.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + this[2] -= b[2]; + return this; + } + /** + * Alias for {@link Vec3.subtract} + * @category Methods + */ + sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec3}. + * Equivalent to `Vec3.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + this[2] *= b[2]; + return this; + } + /** + * Alias for {@link Vec3.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec3}. + * Equivalent to `Vec3.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + this[2] /= b[2]; + return this; + } + /** + * Alias for {@link Vec3.divide} + * @category Methods + */ + div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec3.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b) { + this[0] *= b; + this[1] *= b; + this[2] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + this[2] += b[2] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b) { + return _Vec3.distance(this, b); + } + /** + * Alias for {@link Vec3.distance} + * @category Methods + */ + dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b) { + return _Vec3.squaredDistance(this, b); + } + /** + * Alias for {@link Vec3.squaredDistance} + * @category Methods + */ + sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec3.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate() { + this[0] *= -1; + this[1] *= -1; + this[2] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec3.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + this[2] = 1 / this[2]; + return this; + } + /** + * Sets each component of `this` to its absolute value. + * Equivalent to `Vec3.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + this[2] = Math.abs(this[2]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec3}. + * Equivalent to `Vec3.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b) { + return this[0] * b[0] + this[1] * b[1] + this[2] * b[2]; + } + /** + * Normalize `this`. + * Equivalent to `Vec3.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize() { + return _Vec3.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec3}. + */ + static get BYTE_LENGTH() { + return 3 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty vec3 + * @category Static + * + * @returns a new 3D vector + */ + static create() { + return new _Vec3(); + } + /** + * Creates a new vec3 initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 3D vector + */ + static clone(a) { + return new _Vec3(a); + } + /** + * Calculates the magnitude (length) of a {@link Vec3} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Creates a new vec3 initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns a new 3D vector + */ + static fromValues(x, y, z) { + return new _Vec3(x, y, z); + } + /** + * Copy the values from one vec3 to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + return out; + } + /** + * Set the components of a vec3 to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns `out` + */ + static set(out, x, y, z) { + out[0] = x; + out[1] = y; + out[2] = z; + return out; + } + /** + * Adds two {@link Vec3}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + return out; + } + /** + * Alias for {@link Vec3.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return [0, 0, 0]; + } + /** + * Multiplies two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + return out; + } + /** + * Alias for {@link Vec3.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return [0, 0, 0]; + } + /** + * Divides two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + out[2] = a[2] / b[2]; + return out; + } + /** + * Alias for {@link Vec3.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out, a, b) { + return [0, 0, 0]; + } + /** + * Math.ceil the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + out[2] = Math.ceil(a[2]); + return out; + } + /** + * Math.floor the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + out[2] = Math.floor(a[2]); + return out; + } + /** + * Returns the minimum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + return out; + } + /** + * Returns the maximum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + return out; + } + /** + * symmetric round the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + /* + static round(out: Vec3Like, a: Readonly): Vec3Like { + out[0] = glMatrix.round(a[0]); + out[1] = glMatrix.round(a[1]); + out[2] = glMatrix.round(a[2]); + return out; + }*/ + /** + * Scales a vec3 by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out, a, scale) { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + return out; + } + /** + * Adds two vec3's after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredDistance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a, b) { + return 0; + } + /** + * Calculates the squared length of a vec3 + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredLength} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrLen(a, b) { + return 0; + } + /** + * Negates the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + return out; + } + /** + * Returns the inverse of the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + out[2] = 1 / a[2]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec3} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + out[2] = Math.abs(a[2]); + return out; + } + /** + * Normalize a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out, a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + let len = x * x + y * y + z * z; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + out[2] = a[2] * len; + return out; + } + /** + * Calculates the dot product of two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; + } + /** + * Computes the cross product of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static cross(out, a, b) { + const ax = a[0], ay = a[1], az = a[2]; + const bx = b[0], by = b[1], bz = b[2]; + out[0] = ay * bz - az * by; + out[1] = az * bx - ax * bz; + out[2] = ax * by - ay * bx; + return out; + } + /** + * Performs a linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + return out; + } + /** + * Performs a spherical linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out, a, b, t) { + const angle = Math.acos(Math.min(Math.max(_Vec3.dot(a, b), -1), 1)); + const sinTotal = Math.sin(angle); + const ratioA = Math.sin((1 - t) * angle) / sinTotal; + const ratioB = Math.sin(t * angle) / sinTotal; + out[0] = ratioA * a[0] + ratioB * b[0]; + out[1] = ratioA * a[1] + ratioB * b[1]; + out[2] = ratioA * a[2] + ratioB * b[2]; + return out; + } + /** + * Performs a hermite interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static hermite(out, a, b, c, d, t) { + const factorTimes2 = t * t; + const factor1 = factorTimes2 * (2 * t - 3) + 1; + const factor2 = factorTimes2 * (t - 2) + t; + const factor3 = factorTimes2 * (t - 1); + const factor4 = factorTimes2 * (3 - 2 * t); + out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; + out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; + out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; + return out; + } + /** + * Performs a bezier interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static bezier(out, a, b, c, d, t) { + const inverseFactor = 1 - t; + const inverseFactorTimesTwo = inverseFactor * inverseFactor; + const factorTimes2 = t * t; + const factor1 = inverseFactorTimesTwo * inverseFactor; + const factor2 = 3 * t * inverseFactorTimesTwo; + const factor3 = 3 * factorTimes2 * inverseFactor; + const factor4 = factorTimes2 * t; + out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; + out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; + out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; + return out; + } + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned + * @returns `out` + */ + /* + static random(out: Vec3Like, scale) { + scale = scale === undefined ? 1.0 : scale; + + let r = glMatrix.RANDOM() * 2.0 * Math.PI; + let z = glMatrix.RANDOM() * 2.0 - 1.0; + let zScale = Math.sqrt(1.0 - z * z) * scale; + + out[0] = Math.cos(r) * zScale; + out[1] = Math.sin(r) * zScale; + out[2] = z * scale; + return out; + }*/ + /** + * Transforms the vec3 with a mat4. + * 4th vector component is implicitly '1' + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out, a, m) { + const x = a[0], y = a[1], z = a[2]; + const w = m[3] * x + m[7] * y + m[11] * z + m[15] || 1; + out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; + out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; + out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; + return out; + } + /** + * Transforms the vec3 with a mat3. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - the 3x3 matrix to transform with + * @returns `out` + */ + static transformMat3(out, a, m) { + const x = a[0], y = a[1], z = a[2]; + out[0] = x * m[0] + y * m[3] + z * m[6]; + out[1] = x * m[1] + y * m[4] + z * m[7]; + out[2] = x * m[2] + y * m[5] + z * m[8]; + return out; + } + /** + * Transforms the vec3 with a quat + * Can also be used for dual quaternions. (Multiply it with the real part) + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out, a, q) { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const w2 = q[3] * 2; + const x = a[0]; + const y = a[1]; + const z = a[2]; + const uvx = qy * z - qz * y; + const uvy = qz * x - qx * z; + const uvz = qx * y - qy * x; + const uuvx = (qy * uvz - qz * uvy) * 2; + const uuvy = (qz * uvx - qx * uvz) * 2; + const uuvz = (qx * uvy - qy * uvx) * 2; + out[0] = x + uvx * w2 + uuvx; + out[1] = y + uvy * w2 + uuvy; + out[2] = z + uvz * w2 + uuvz; + return out; + } + /** + * Rotate a 3D vector around the x-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateX(out, a, b, rad) { + const by = b[1]; + const bz = b[2]; + const py = a[1] - by; + const pz = a[2] - bz; + out[0] = a[0]; + out[1] = py * Math.cos(rad) - pz * Math.sin(rad) + by; + out[2] = py * Math.sin(rad) + pz * Math.cos(rad) + bz; + return out; + } + /** + * Rotate a 3D vector around the y-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateY(out, a, b, rad) { + const bx = b[0]; + const bz = b[2]; + const px = a[0] - bx; + const pz = a[2] - bz; + out[0] = pz * Math.sin(rad) + px * Math.cos(rad) + bx; + out[1] = a[1]; + out[2] = pz * Math.cos(rad) - px * Math.sin(rad) + bz; + return out; + } + /** + * Rotate a 3D vector around the z-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateZ(out, a, b, rad) { + const bx = b[0]; + const by = b[1]; + const px = a[0] - bx; + const py = a[1] - by; + out[0] = px * Math.cos(rad) - py * Math.sin(rad) + bx; + out[1] = px * Math.sin(rad) + py * Math.cos(rad) + by; + out[2] = b[2]; + return out; + } + /** + * Get the angle between two 3D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static 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 mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz)); + const cosine = mag && _Vec3.dot(a, b) / mag; + return Math.acos(Math.min(Math.max(cosine, -1), 1)); + } + /** + * Set the components of a vec3 to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + return out; + } + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Vec3(${a.join(", ")})`; + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)); + } +}; +Vec3.prototype.sub = Vec3.prototype.subtract; +Vec3.prototype.mul = Vec3.prototype.multiply; +Vec3.prototype.div = Vec3.prototype.divide; +Vec3.prototype.dist = Vec3.prototype.distance; +Vec3.prototype.sqrDist = Vec3.prototype.squaredDistance; +Vec3.sub = Vec3.subtract; +Vec3.mul = Vec3.multiply; +Vec3.div = Vec3.divide; +Vec3.dist = Vec3.distance; +Vec3.sqrDist = Vec3.squaredDistance; +Vec3.sqrLen = Vec3.squaredLength; +Vec3.mag = Vec3.magnitude; +Vec3.length = Vec3.magnitude; +Vec3.len = Vec3.magnitude; + +// src/_lib/f64/Vec4.ts +var Vec4 = class _Vec4 extends Float64Array { + /** + * Create a {@link Vec4}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 4: + super(values); + break; + case 2: + super(values[0], values[1], 4); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v, v]); + } else { + super(v, 0, 4); + } + break; + } + default: + super(4); + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z() { + return this[2]; + } + set z(value) { + this[2] = value; + } + /** + * The w component of the vector. Equivalent to `this[3];` + * @category Vector Components + */ + get w() { + return this[3]; + } + set w(value) { + this[3] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r() { + return this[0]; + } + set r(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g() { + return this[1]; + } + set g(value) { + this[1] = value; + } + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b() { + return this[2]; + } + set b(value) { + this[2] = value; + } + /** + * The a component of the vector. Equivalent to `this[3];` + * @category Color Components + */ + get a() { + return this[3]; + } + set a(value) { + this[3] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec4.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + const w = this[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Vec4.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec4.str(this);` + * + * @category Accessors + */ + get str() { + return _Vec4.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + super.set(a); + return this; + } + /** + * Adds a {@link Vec4} to `this`. + * Equivalent to `Vec4.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b) { + this[0] += b[0]; + this[1] += b[1]; + this[2] += b[2]; + this[3] += b[3]; + return this; + } + /** + * Subtracts a {@link Vec4} from `this`. + * Equivalent to `Vec4.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + this[2] -= b[2]; + this[3] -= b[3]; + return this; + } + /** + * Alias for {@link Vec4.subtract} + * @category Methods + */ + sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec4}. + * Equivalent to `Vec4.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + this[2] *= b[2]; + this[3] *= b[3]; + return this; + } + /** + * Alias for {@link Vec4.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec4}. + * Equivalent to `Vec4.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + this[2] /= b[2]; + this[3] /= b[3]; + return this; + } + /** + * Alias for {@link Vec4.divide} + * @category Methods + */ + div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec4.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b) { + this[0] *= b; + this[1] *= b; + this[2] *= b; + this[3] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + this[2] += b[2] * scale; + this[3] += b[3] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b) { + return _Vec4.distance(this, b); + } + /** + * Alias for {@link Vec4.distance} + * @category Methods + */ + dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b) { + return _Vec4.squaredDistance(this, b); + } + /** + * Alias for {@link Vec4.squaredDistance} + * @category Methods + */ + sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec4.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate() { + this[0] *= -1; + this[1] *= -1; + this[2] *= -1; + this[3] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec4.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + this[2] = 1 / this[2]; + this[3] = 1 / this[3]; + return this; + } + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec4.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + this[2] = Math.abs(this[2]); + this[3] = Math.abs(this[3]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec4}. + * Equivalent to `Vec4.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b) { + return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3]; + } + /** + * Normalize `this`. + * Equivalent to `Vec4.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize() { + return _Vec4.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec4}. + */ + static get BYTE_LENGTH() { + return 4 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty {@link Vec4} + * @category Static + * + * @returns a new 4D vector + */ + static create() { + return new _Vec4(); + } + /** + * Creates a new {@link Vec4} initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 4D vector + */ + static clone(a) { + return new _Vec4(a); + } + /** + * Creates a new {@link Vec4} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new 4D vector + */ + static fromValues(x, y, z, w) { + return new _Vec4(x, y, z, w); + } + /** + * Copy the values from one {@link Vec4} to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Vec4} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + static set(out, x, y, z, w) { + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = w; + return out; + } + /** + * Adds two {@link Vec4}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + return out; + } + /** + * Alias for {@link Vec4.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + out[3] = a[3] * b[3]; + return out; + } + /** + * Alias for {@link Vec4.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Divides two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + out[2] = a[2] / b[2]; + out[3] = a[3] / b[3]; + return out; + } + /** + * Alias for {@link Vec4.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out, a, b) { + return out; + } + /** + * Math.ceil the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + out[2] = Math.ceil(a[2]); + out[3] = Math.ceil(a[3]); + return out; + } + /** + * Math.floor the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + out[2] = Math.floor(a[2]); + out[3] = Math.floor(a[3]); + return out; + } + /** + * Returns the minimum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + out[3] = Math.min(a[3], b[3]); + return out; + } + /** + * Returns the maximum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + out[3] = Math.max(a[3], b[3]); + return out; + } + /** + * Math.round the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + static round(out, a) { + out[0] = Math.round(a[0]); + out[1] = Math.round(a[1]); + out[2] = Math.round(a[2]); + out[3] = Math.round(a[3]); + return out; + } + /** + * Scales a {@link Vec4} by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out, a, scale) { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + out[3] = a[3] * scale; + return out; + } + /** + * Adds two {@link Vec4}'s after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + const w = b[3] - a[3]; + return Math.hypot(x, y, z, w); + } + /** + * Alias for {@link Vec4.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + const w = b[3] - a[3]; + return x * x + y * y + z * z + w * w; + } + /** + * Alias for {@link Vec4.squaredDistance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a, b) { + return 0; + } + /** + * Calculates the magnitude (length) of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate length of + * @returns length of `a` + */ + static magnitude(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Vec4.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + return x * x + y * y + z * z + w * w; + } + /** + * Alias for {@link Vec4.squaredLength} + * @category Static + */ + static sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = -a[3]; + return out; + } + /** + * Returns the inverse of the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + out[2] = 1 / a[2]; + out[3] = 1 / a[3]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec4} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + out[2] = Math.abs(a[2]); + out[3] = Math.abs(a[3]); + return out; + } + /** + * Normalize a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out, a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + let len = x * x + y * y + z * z + w * w; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = x * len; + out[1] = y * len; + out[2] = z * len; + out[3] = w * len; + return out; + } + /** + * Calculates the dot product of two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + /** + * Returns the cross-product of three vectors in a 4-dimensional space + * @category Static + * + * @param out the receiving vector + * @param u - the first vector + * @param v - the second vector + * @param w - the third vector + * @returns result + */ + static cross(out, u, v, w) { + const a = v[0] * w[1] - v[1] * w[0]; + const b = v[0] * w[2] - v[2] * w[0]; + const c = v[0] * w[3] - v[3] * w[0]; + const d = v[1] * w[2] - v[2] * w[1]; + const e = v[1] * w[3] - v[3] * w[1]; + const f = v[2] * w[3] - v[3] * w[2]; + const g = u[0]; + const h = u[1]; + const i = u[2]; + const j = u[3]; + out[0] = h * f - i * e + j * d; + out[1] = -(g * f) + i * c - j * b; + out[2] = g * e - h * c + j * a; + out[3] = -(g * d) + h * b - i * a; + return out; + } + /** + * Performs a linear interpolation between two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + out[3] = aw + t * (b[3] - aw); + return out; + } + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns `out` + */ + /* + static random(out: Vec4Like, scale): Vec4Like { + scale = scale || 1.0; + + // Marsaglia, George. Choosing a Point from the Surface of a + // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646. + // http://projecteuclid.org/euclid.aoms/1177692644; + var v1, v2, v3, v4; + var s1, s2; + do { + v1 = glMatrix.RANDOM() * 2 - 1; + v2 = glMatrix.RANDOM() * 2 - 1; + s1 = v1 * v1 + v2 * v2; + } while (s1 >= 1); + do { + v3 = glMatrix.RANDOM() * 2 - 1; + v4 = glMatrix.RANDOM() * 2 - 1; + s2 = v3 * v3 + v4 * v4; + } while (s2 >= 1); + + var d = Math.sqrt((1 - s1) / s2); + out[0] = scale * v1; + out[1] = scale * v2; + out[2] = scale * v3 * d; + out[3] = scale * v4 * d; + return out; + }*/ + /** + * Transforms the {@link Vec4} with a {@link Mat4}. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out, a, m) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; + out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; + out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; + out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; + return out; + } + /** + * Transforms the {@link Vec4} with a {@link Quat} + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out, a, q) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + const ix = qw * x + qy * z - qz * y; + const iy = qw * y + qz * x - qx * z; + const iz = qw * z + qx * y - qy * x; + const iw = -qx * x - qy * y - qz * z; + out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy; + out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz; + out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Vec4} to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 0; + return out; + } + /** + * Returns a string representation of a {@link Vec4} + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Vec4(${a.join(", ")})`; + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)); + } +}; +Vec4.prototype.sub = Vec4.prototype.subtract; +Vec4.prototype.mul = Vec4.prototype.multiply; +Vec4.prototype.div = Vec4.prototype.divide; +Vec4.prototype.dist = Vec4.prototype.distance; +Vec4.prototype.sqrDist = Vec4.prototype.squaredDistance; +Vec4.sub = Vec4.subtract; +Vec4.mul = Vec4.multiply; +Vec4.div = Vec4.divide; +Vec4.dist = Vec4.distance; +Vec4.sqrDist = Vec4.squaredDistance; +Vec4.sqrLen = Vec4.squaredLength; +Vec4.mag = Vec4.magnitude; +Vec4.length = Vec4.magnitude; +Vec4.len = Vec4.magnitude; + +// src/_lib/f64/Quat.ts +var Quat = class _Quat extends Float64Array { + static #DEFAULT_ANGLE_ORDER = "zyx"; + // Temporary variables to prevent repeated allocations in the algorithms within Quat. + // These are declared as TypedArrays to aid in tree-shaking. + static #TMP_QUAT1 = new Float64Array(4); + static #TMP_QUAT2 = new Float64Array(4); + static #TMP_MAT3 = new Float64Array(9); + static #TMP_VEC3 = new Float64Array(3); + static #X_UNIT_VEC3 = new Float64Array([1, 0, 0]); + static #Y_UNIT_VEC3 = new Float64Array([0, 1, 0]); + /** + * Create a {@link Quat}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 4: + super(values); + break; + case 2: + super(values[0], values[1], 4); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v, v]); + } else { + super(v, 0, 4); + } + break; + } + default: + super(4); + this[3] = 1; + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the quaternion. Equivalent to `this[0];` + * @category Quaternion Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the quaternion. Equivalent to `this[1];` + * @category Quaternion Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + /** + * The z component of the quaternion. Equivalent to `this[2];` + * @category Quaternion Components + */ + get z() { + return this[2]; + } + set z(value) { + this[2] = value; + } + /** + * The w component of the quaternion. Equivalent to `this[3];` + * @category Quaternion Components + */ + get w() { + return this[3]; + } + set w(value) { + this[3] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Quat.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + const w = this[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Quat.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * A string representation of `this` + * Equivalent to `Quat.str(this);` + * + * @category Accessors + */ + get str() { + return _Quat.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Quat} into `this`. + * @category Methods + * + * @param a the source quaternion + * @returns `this` + */ + copy(a) { + super.set(a); + return this; + } + /** + * Set `this` to the identity quaternion + * Equivalent to Quat.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this[0] = 0; + this[1] = 0; + this[2] = 0; + this[3] = 1; + return this; + } + /** + * Multiplies `this` by a {@link Quat}. + * Equivalent to `Quat.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + return _Quat.multiply(this, this, b); + } + /** + * Alias for {@link Quat.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Rotates `this` by the given angle about the X axis + * Equivalent to `Quat.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateX(rad) { + return _Quat.rotateX(this, this, rad); + } + /** + * Rotates `this` by the given angle about the Y axis + * Equivalent to `Quat.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateY(rad) { + return _Quat.rotateY(this, this, rad); + } + /** + * Rotates `this` by the given angle about the Z axis + * Equivalent to `Quat.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateZ(rad) { + return _Quat.rotateZ(this, this, rad); + } + /** + * Inverts `this` + * Equivalent to `Quat.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + return _Quat.invert(this, this); + } + /** + * Scales `this` by a scalar number + * Equivalent to `Quat.scale(this, this, scale);` + * @category Methods + * + * @param scale - amount to scale the vector by + * @returns `this` + */ + scale(scale) { + this[0] *= scale; + this[1] *= scale; + this[2] *= scale; + this[3] *= scale; + return this; + } + /** + * Calculates the dot product of `this` and another {@link Quat} + * Equivalent to `Quat.dot(this, b);` + * @category Methods + * + * @param b - the second operand + * @returns dot product of `this` and b + */ + dot(b) { + return _Quat.dot(this, b); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat}. + */ + static get BYTE_LENGTH() { + return 4 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new identity quat + * @category Static + * + * @returns a new quaternion + */ + static create() { + return new _Quat(); + } + /** + * Set a quat to the identity quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + static identity(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * @category Static + * + * @param out - the receiving quaternion + * @param axis - the axis around which to rotate + * @param rad - the angle in radians + * @returns `out` + **/ + static setAxisAngle(out, axis, rad) { + rad *= 0.5; + const s = Math.sin(rad); + out[0] = s * axis[0]; + out[1] = s * axis[1]; + out[2] = s * axis[2]; + out[3] = Math.cos(rad); + return out; + } + /** + * Gets the rotation axis and angle for a given + * quaternion. If a quaternion is created with + * setAxisAngle, this method will return the same + * values as provided in the original parameter list + * OR functionally equivalent values. + * Example: The quaternion formed by axis [0, 0, 1] and + * angle -90 is the same as the quaternion formed by + * [0, 0, 1] and 270. This method favors the latter. + * @category Static + * + * @param out_axis - Vector receiving the axis of rotation + * @param q - Quaternion to be decomposed + * @return Angle, in radians, of the rotation + */ + static getAxisAngle(out_axis, q) { + const rad = Math.acos(q[3]) * 2; + const s = Math.sin(rad / 2); + if (s > GLM_EPSILON) { + out_axis[0] = q[0] / s; + out_axis[1] = q[1] / s; + out_axis[2] = q[2] / s; + } else { + out_axis[0] = 1; + out_axis[1] = 0; + out_axis[2] = 0; + } + return rad; + } + /** + * Gets the angular distance between two unit quaternions + * @category Static + * + * @param {ReadonlyQuat} a Origin unit quaternion + * @param {ReadonlyQuat} b Destination unit quaternion + * @return {Number} Angle, in radians, between the two quaternions + */ + static getAngle(a, b) { + const dotproduct = _Quat.dot(a, b); + return Math.acos(2 * dotproduct * dotproduct - 1); + } + /** + * Multiplies two quaternions. + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out, a, b) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bx = b[0]; + const by = b[1]; + const bz = b[2]; + const bw = b[3]; + out[0] = ax * bw + aw * bx + ay * bz - az * by; + out[1] = ay * bw + aw * by + az * bx - ax * bz; + out[2] = az * bw + aw * bz + ax * by - ay * bx; + out[3] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + /** + * Rotates a quaternion by the given angle about the X axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out, a, rad) { + rad *= 0.5; + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bx = Math.sin(rad); + const bw = Math.cos(rad); + out[0] = ax * bw + aw * bx; + out[1] = ay * bw + az * bx; + out[2] = az * bw - ay * bx; + out[3] = aw * bw - ax * bx; + return out; + } + /** + * Rotates a quaternion by the given angle about the Y axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out, a, rad) { + rad *= 0.5; + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const by = Math.sin(rad); + const bw = Math.cos(rad); + out[0] = ax * bw - az * by; + out[1] = ay * bw + aw * by; + out[2] = az * bw + ax * by; + out[3] = aw * bw - ay * by; + return out; + } + /** + * Rotates a quaternion by the given angle about the Z axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out, a, rad) { + rad *= 0.5; + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bz = Math.sin(rad); + const bw = Math.cos(rad); + out[0] = ax * bw + ay * bz; + out[1] = ay * bw - ax * bz; + out[2] = az * bw + aw * bz; + out[3] = aw * bw - az * bz; + return out; + } + /** + * Calculates the W component of a quat from the X, Y, and Z components. + * Assumes that quaternion is 1 unit in length. + * Any existing W component will be ignored. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate W component of + * @returns `out` + */ + static calculateW(out, a) { + const x = a[0], y = a[1], z = a[2]; + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = Math.sqrt(Math.abs(1 - x * x - y * y - z * z)); + return out; + } + /** + * Calculate the exponential of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static exp(out, a) { + const x = a[0], y = a[1], z = a[2], w = a[3]; + const r = Math.sqrt(x * x + y * y + z * z); + const et = Math.exp(w); + const s = r > 0 ? et * Math.sin(r) / r : 0; + out[0] = x * s; + out[1] = y * s; + out[2] = z * s; + out[3] = et * Math.cos(r); + return out; + } + /** + * Calculate the natural logarithm of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static ln(out, a) { + const x = a[0], y = a[1], z = a[2], w = a[3]; + const r = Math.sqrt(x * x + y * y + z * z); + const t = r > 0 ? Math.atan2(r, w) / r : 0; + out[0] = x * t; + out[1] = y * t; + out[2] = z * t; + out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w); + return out; + } + /** + * Calculate the scalar power of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @param b - amount to scale the quaternion by + * @returns `out` + */ + static pow(out, a, b) { + _Quat.ln(out, a); + _Quat.scale(out, out, b); + _Quat.exp(out, out); + return out; + } + /** + * Performs a spherical linear interpolation between two quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out, a, b, t) { + const ax = a[0], ay = a[1], az = a[2], aw = a[3]; + let bx = b[0], by = b[1], bz = b[2], bw = b[3]; + let scale0; + let scale1; + let cosom = ax * bx + ay * by + az * bz + aw * bw; + if (cosom < 0) { + cosom = -cosom; + bx = -bx; + by = -by; + bz = -bz; + bw = -bw; + } + if (1 - cosom > GLM_EPSILON) { + const omega = Math.acos(cosom); + const sinom = Math.sin(omega); + scale0 = Math.sin((1 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; + } else { + scale0 = 1 - t; + scale1 = t; + } + out[0] = scale0 * ax + scale1 * bx; + out[1] = scale0 * ay + scale1 * by; + out[2] = scale0 * az + scale1 * bz; + out[3] = scale0 * aw + scale1 * bw; + return out; + } + /** + * Generates a random unit quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + /* static random(out: QuatLike): QuatLike { + // Implementation of http://planning.cs.uiuc.edu/node198.html + // TODO: Calling random 3 times is probably not the fastest solution + let u1 = glMatrix.RANDOM(); + let u2 = glMatrix.RANDOM(); + let u3 = glMatrix.RANDOM(); + + let sqrt1MinusU1 = Math.sqrt(1 - u1); + let sqrtU1 = Math.sqrt(u1); + + out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2); + out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2); + out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3); + out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3); + return out; + }*/ + /** + * Calculates the inverse of a quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate inverse of + * @returns `out` + */ + static invert(out, a) { + const a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; + const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; + const invDot = dot ? 1 / dot : 0; + out[0] = -a0 * invDot; + out[1] = -a1 * invDot; + out[2] = -a2 * invDot; + out[3] = a3 * invDot; + return out; + } + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate conjugate of + * @returns `out` + */ + static conjugate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + return out; + } + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to re-normalize the quaternion yourself where necessary. + * @category Static + * + * @param out - the receiving quaternion + * @param m - rotation matrix + * @returns `out` + */ + static fromMat3(out, m) { + const fTrace = m[0] + m[4] + m[8]; + let fRoot; + if (fTrace > 0) { + fRoot = Math.sqrt(fTrace + 1); + out[3] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[0] = (m[5] - m[7]) * fRoot; + out[1] = (m[6] - m[2]) * fRoot; + out[2] = (m[1] - m[3]) * fRoot; + } else { + let i = 0; + if (m[4] > m[0]) { + i = 1; + } + if (m[8] > m[i * 3 + i]) { + i = 2; + } + const j = (i + 1) % 3; + const k = (i + 2) % 3; + fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1); + out[i] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot; + out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; + out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + } + return out; + } + /** + * Creates a quaternion from the given euler angle x, y, z. + * @category Static + * + * @param out - the receiving quaternion + * @param x - Angle to rotate around X axis in degrees. + * @param y - Angle to rotate around Y axis in degrees. + * @param z - Angle to rotate around Z axis in degrees. + * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx. + * @returns `out` + */ + static fromEuler(out, x, y, z, order = _Quat.#DEFAULT_ANGLE_ORDER) { + const halfToRad = 0.5 * Math.PI / 180; + x *= halfToRad; + y *= halfToRad; + z *= halfToRad; + const sx = Math.sin(x); + const cx = Math.cos(x); + const sy = Math.sin(y); + const cy = Math.cos(y); + const sz = Math.sin(z); + const cz = Math.cos(z); + switch (order) { + case "xyz": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "xzy": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + case "yxz": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + case "yzx": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "zxy": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "zyx": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + default: + throw new Error(`Unknown angle order ${order}`); + } + return out; + } + /** + * Returns a string representation of a quatenion + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Quat(${a.join(", ")})`; + } + /** + * Creates a new quat initialized with values from an existing quaternion + * @category Static + * + * @param a - quaternion to clone + * @returns a new quaternion + */ + static clone(a) { + return new _Quat(a); + } + /** + * Creates a new quat initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new quaternion + */ + static fromValues(x, y, z, w) { + return new _Quat(x, y, z, w); + } + /** + * Copy the values from one quat to another + * @category Static + * + * @param out - the receiving quaternion + * @param a - the source quaternion + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Quat} to the given values + * @category Static + * + * @param out - the receiving quaternion + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static set(out, x, y, z, w) { + return out; + } + /** + * Adds two {@link Quat}'s + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static add(out, a, b) { + return out; + } + /** + * Alias for {@link Quat.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Scales a quat by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param b - amount to scale the vector by + * @returns `out` + */ + static scale(out, a, scale) { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + out[3] = a[3] * scale; + return out; + } + /** + * Calculates the dot product of two quat's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + /** + * Performs a linear interpolation between two quat's + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static lerp(out, a, b, t) { + return out; + } + /** + * Calculates the magnitude (length) of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate length of + * @returns length of `a` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static magnitude(a) { + return 0; + } + /** + * Alias for {@link Quat.magnitude} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mag(a) { + return 0; + } + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate squared length of + * @returns squared length of a + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static squaredLength(a) { + return 0; + } + /** + * Alias for {@link Quat.squaredLength} + * @category Static + */ + static sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Normalize a {@link Quat} + * @category Static + * + * @param out - the receiving quaternion + * @param a - quaternion to normalize + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static normalize(out, a) { + return out; + } + /** + * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first quaternion. + * @param b - The second quaternion. + * @returns True if the vectors are equal, false otherwise. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static exactEquals(a, b) { + return false; + } + /** + * Returns whether the quaternions have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static equals(a, b) { + return false; + } + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * @category Static + * + * @param out - the receiving quaternion. + * @param a - the initial vector + * @param b - the destination vector + * @returns `out` + */ + static rotationTo(out, a, b) { + const dot = Vec3.dot(a, b); + if (dot < -0.999999) { + Vec3.cross(_Quat.#TMP_VEC3, _Quat.#X_UNIT_VEC3, a); + if (Vec3.mag(_Quat.#TMP_VEC3) < 1e-6) { + Vec3.cross(_Quat.#TMP_VEC3, _Quat.#Y_UNIT_VEC3, a); + } + Vec3.normalize(_Quat.#TMP_VEC3, _Quat.#TMP_VEC3); + _Quat.setAxisAngle(out, _Quat.#TMP_VEC3, Math.PI); + return out; + } else if (dot > 0.999999) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } else { + Vec3.cross(_Quat.#TMP_VEC3, a, b); + out[0] = _Quat.#TMP_VEC3[0]; + out[1] = _Quat.#TMP_VEC3[1]; + out[2] = _Quat.#TMP_VEC3[2]; + out[3] = 1 + dot; + return _Quat.normalize(out, out); + } + } + /** + * Performs a spherical linear interpolation with two control points + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static sqlerp(out, a, b, c, d, t) { + _Quat.slerp(_Quat.#TMP_QUAT1, a, d, t); + _Quat.slerp(_Quat.#TMP_QUAT2, b, c, t); + _Quat.slerp(out, _Quat.#TMP_QUAT1, _Quat.#TMP_QUAT2, 2 * t * (1 - t)); + return out; + } + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * @category Static + * + * @param out - The receiving quaternion + * @param view - the vector representing the viewing direction + * @param right - the vector representing the local `right` direction + * @param up - the vector representing the local `up` direction + * @returns `out` + */ + static setAxes(out, view, right, up) { + _Quat.#TMP_MAT3[0] = right[0]; + _Quat.#TMP_MAT3[3] = right[1]; + _Quat.#TMP_MAT3[6] = right[2]; + _Quat.#TMP_MAT3[1] = up[0]; + _Quat.#TMP_MAT3[4] = up[1]; + _Quat.#TMP_MAT3[7] = up[2]; + _Quat.#TMP_MAT3[2] = -view[0]; + _Quat.#TMP_MAT3[5] = -view[1]; + _Quat.#TMP_MAT3[8] = -view[2]; + return _Quat.normalize(out, _Quat.fromMat3(out, _Quat.#TMP_MAT3)); + } +}; +Quat.set = Vec4.set; +Quat.add = Vec4.add; +Quat.lerp = Vec4.lerp; +Quat.normalize = Vec4.normalize; +Quat.squaredLength = Vec4.squaredLength; +Quat.sqrLen = Vec4.squaredLength; +Quat.exactEquals = Vec4.exactEquals; +Quat.equals = Vec4.equals; +Quat.magnitude = Vec4.magnitude; +Quat.prototype.mul = Quat.prototype.multiply; +Quat.mul = Quat.multiply; +Quat.mag = Quat.magnitude; +Quat.length = Quat.magnitude; +Quat.len = Quat.magnitude; + +// src/_lib/f64/Quat2.ts +var Quat2 = class _Quat2 extends Float64Array { + // Temporary variables to prevent repeated allocations in the algorithms within Quat2. + // These are declared as TypedArrays to aid in tree-shaking. + static #TMP_QUAT = new Float64Array(4); + static #TMP_VEC3 = new Float64Array(3); + /** + * Create a {@link Quat2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 8: + super(values); + break; + case 2: + super(values[0], values[1], 8); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v, v, v, v, v, v]); + } else { + super(v, 0, 8); + } + break; + } + default: + super(8); + this[3] = 1; + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Quat2.str(this);` + * + * @category Accessors + */ + get str() { + return _Quat2.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Quat2} into `this`. + * @category Methods + * + * @param a the source dual quaternion + * @returns `this` + */ + copy(a) { + super.set(a); + return this; + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat2}. + */ + static get BYTE_LENGTH() { + return 8 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new identity {@link Quat2} + * @category Static + * + * @returns a new dual quaternion [real -> rotation, dual -> translation] + */ + static create() { + return new _Quat2(); + } + /** + * Creates a {@link Quat2} quat initialized with values from an existing quaternion + * @category Static + * + * @param a - dual quaternion to clone + * @returns a new dual quaternion + */ + static clone(a) { + return new _Quat2(a); + } + /** + * Creates a new {@link Quat2} initialized with the given values + * @category Static + * + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns a new dual quaternion + */ + static fromValues(x1, y1, z1, w1, x2, y2, z2, w2) { + return new _Quat2(x1, y1, z1, w1, x2, y2, z2, w2); + } + /** + * Creates a new {@link Quat2} from the given values (quat and translation) + * @category Static + * + * @param x1 - X component (rotation) + * @param y1 - Y component (rotation) + * @param z1 - Z component (rotation) + * @param w1 - W component (rotation) + * @param x2 - X component (translation) + * @param y2 - Y component (translation) + * @param z2 - Z component (translation) + * @returns a new dual quaternion + */ + static fromRotationTranslationValues(x1, y1, z1, w1, x2, y2, z2) { + const ax = x2 * 0.5; + const ay = y2 * 0.5; + const az = z2 * 0.5; + return new _Quat2( + x1, + y1, + z1, + w1, + ax * w1 + ay * z1 - az * y1, + ay * w1 + az * x1 - ax * z1, + az * w1 + ax * y1 - ay * x1, + -ax * x1 - ay * y1 - az * z1 + ); + } + /** + * Sets a {@link Quat2} from a quaternion and a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @param t - translation vector + * @returns `out` + */ + static fromRotationTranslation(out, q, t) { + const ax = t[0] * 0.5; + const ay = t[1] * 0.5; + const az = t[2] * 0.5; + const bx = q[0]; + const by = q[1]; + const bz = q[2]; + const bw = q[3]; + out[0] = bx; + out[1] = by; + out[2] = bz; + out[3] = bw; + out[4] = ax * bw + ay * bz - az * by; + out[5] = ay * bw + az * bx - ax * bz; + out[6] = az * bw + ax * by - ay * bx; + out[7] = -ax * bx - ay * by - az * bz; + return out; + } + /** + * Sets a {@link Quat2} from a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param t - translation vector + * @returns `out` + */ + static fromTranslation(out, t) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = t[0] * 0.5; + out[5] = t[1] * 0.5; + out[6] = t[2] * 0.5; + out[7] = 0; + return out; + } + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @returns `out` + */ + static fromRotation(out, q) { + out[0] = q[0]; + out[1] = q[1]; + out[2] = q[2]; + out[3] = q[3]; + out[4] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + return out; + } + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param a - the matrix + * @returns `out` + */ + static fromMat4(out, a) { + Mat4.getRotation(_Quat2.#TMP_QUAT, a); + Mat4.getTranslation(_Quat2.#TMP_VEC3, a); + return _Quat2.fromRotationTranslation(out, _Quat2.#TMP_QUAT, _Quat2.#TMP_VEC3); + } + /** + * Copy the values from one {@link Quat2} to another + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the source dual quaternion + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + return out; + } + /** + * Set a {@link Quat2} to the identity dual quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @returns `out` + */ + static identity(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + return out; + } + /** + * Set the components of a {@link Quat2} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns `out` + */ + static set(out, x1, y1, z1, w1, x2, y2, z2, w2) { + out[0] = x1; + out[1] = y1; + out[2] = z1; + out[3] = w1; + out[4] = x2; + out[5] = y2; + out[6] = z2; + out[7] = w2; + return out; + } + /** + * Gets the real part of a dual quat + * @category Static + * + * @param out - real part + * @param a - Dual Quaternion + * @return `out` + */ + static getReal(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Gets the dual part of a dual quat + * @category Static + * + * @param out - dual part + * @param a - Dual Quaternion + * @return `out` + */ + static getDual(out, a) { + out[0] = a[4]; + out[1] = a[5]; + out[2] = a[6]; + out[3] = a[7]; + return out; + } + /** + * Set the real component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the real part + * @return `out` + */ + static setReal(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the dual component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the dual part + * @return `out` + */ + static setDual(out, a) { + out[4] = a[0]; + out[5] = a[1]; + out[6] = a[2]; + out[7] = a[3]; + return out; + } + /** + * Gets the translation of a normalized {@link Quat2} + * @category Static + * + * @param out - the receiving translation vector + * @param a - Dual Quaternion to be decomposed + * @return `out` + */ + static getTranslation(out, a) { + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const bx = -a[0]; + const by = -a[1]; + const bz = -a[2]; + const bw = a[3]; + out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; + out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; + out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + return out; + } + /** + * Translates a {@link Quat2} by the given vector + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const ax1 = a[0]; + const ay1 = a[1]; + const az1 = a[2]; + const aw1 = a[3]; + const bx1 = v[0] * 0.5; + const by1 = v[1] * 0.5; + const bz1 = v[2] * 0.5; + const ax2 = a[4]; + const ay2 = a[5]; + const az2 = a[6]; + const aw2 = a[7]; + out[0] = ax1; + out[1] = ay1; + out[2] = az1; + out[3] = aw1; + out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2; + out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2; + out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2; + out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2; + return out; + } + /** + * Rotates a {@link Quat2} around the X axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out, a, rad) { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateX(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} around the Y axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out, a, rad) { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateY(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} around the Z axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out, a, rad) { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateZ(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} by a given quaternion (a * q) + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param q - quaternion to rotate by + * @returns `out` + */ + static rotateByQuatAppend(out, a, q) { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + let ax = a[0]; + let ay = a[1]; + let az = a[2]; + let aw = a[3]; + out[0] = ax * qw + aw * qx + ay * qz - az * qy; + out[1] = ay * qw + aw * qy + az * qx - ax * qz; + out[2] = az * qw + aw * qz + ax * qy - ay * qx; + out[3] = aw * qw - ax * qx - ay * qy - az * qz; + ax = a[4]; + ay = a[5]; + az = a[6]; + aw = a[7]; + out[4] = ax * qw + aw * qx + ay * qz - az * qy; + out[5] = ay * qw + aw * qy + az * qx - ax * qz; + out[6] = az * qw + aw * qz + ax * qy - ay * qx; + out[7] = aw * qw - ax * qx - ay * qy - az * qz; + return out; + } + /** + * Rotates a {@link Quat2} by a given quaternion (q * a) + * @category Static + * + * @param out - the receiving dual quaternion + * @param q - quaternion to rotate by + * @param a - the dual quaternion to rotate + * @returns `out` + */ + static rotateByQuatPrepend(out, q, a) { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + let bx = a[0]; + let by = a[1]; + let bz = a[2]; + let bw = a[3]; + out[0] = qx * bw + qw * bx + qy * bz - qz * by; + out[1] = qy * bw + qw * by + qz * bx - qx * bz; + out[2] = qz * bw + qw * bz + qx * by - qy * bx; + out[3] = qw * bw - qx * bx - qy * by - qz * bz; + bx = a[4]; + by = a[5]; + bz = a[6]; + bw = a[7]; + out[4] = qx * bw + qw * bx + qy * bz - qz * by; + out[5] = qy * bw + qw * by + qz * bx - qx * bz; + out[6] = qz * bw + qw * bz + qx * by - qy * bx; + out[7] = qw * bw - qx * bx - qy * by - qz * bz; + return out; + } + /** + * Rotates a {@link Quat2} around a given axis. Does the normalization automatically + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param axis - the axis to rotate around + * @param rad - how far the rotation should be + * @returns `out` + */ + static rotateAroundAxis(out, a, axis, rad) { + if (Math.abs(rad) < GLM_EPSILON) { + return _Quat2.copy(out, a); + } + const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]); + rad *= 0.5; + const s = Math.sin(rad); + const bx = s * axis[0] / axisLength; + const by = s * axis[1] / axisLength; + const bz = s * axis[2] / axisLength; + const bw = Math.cos(rad); + const ax1 = a[0]; + const ay1 = a[1]; + const az1 = a[2]; + const aw1 = a[3]; + out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + out[4] = ax * bw + aw * bx + ay * bz - az * by; + out[5] = ay * bw + aw * by + az * bx - ax * bz; + out[6] = az * bw + aw * bz + ax * by - ay * bx; + out[7] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + /** + * Adds two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + return out; + } + /** + * Multiplies two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns {quat2} out + */ + static multiply(out, a, b) { + const ax0 = a[0]; + const ay0 = a[1]; + const az0 = a[2]; + const aw0 = a[3]; + const bx1 = b[4]; + const by1 = b[5]; + const bz1 = b[6]; + const bw1 = b[7]; + const ax1 = a[4]; + const ay1 = a[5]; + const az1 = a[6]; + const aw1 = a[7]; + const bx0 = b[0]; + const by0 = b[1]; + const bz0 = b[2]; + const bw0 = b[3]; + out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0; + out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0; + out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0; + out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0; + out[4] = ax0 * bw1 + aw0 * bx1 + ay0 * bz1 - az0 * by1 + ax1 * bw0 + aw1 * bx0 + ay1 * bz0 - az1 * by0; + out[5] = ay0 * bw1 + aw0 * by1 + az0 * bx1 - ax0 * bz1 + ay1 * bw0 + aw1 * by0 + az1 * bx0 - ax1 * bz0; + out[6] = az0 * bw1 + aw0 * bz1 + ax0 * by1 - ay0 * bx1 + az1 * bw0 + aw1 * bz0 + ax1 * by0 - ay1 * bx0; + out[7] = aw0 * bw1 - ax0 * bx1 - ay0 * by1 - az0 * bz1 + aw1 * bw0 - ax1 * bx0 - ay1 * by0 - az1 * bz0; + return out; + } + /** + * Alias for {@link Quat2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Scales a {@link Quat2} by a scalar value + * @category Static + * + * @param out - the receiving dual quaterion + * @param a - the dual quaternion to scale + * @param b - scalar value to scale the dual quaterion by + * @returns `out` + */ + static scale(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + return out; + } + /** + * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts) + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dot(a, b) { + return 0; + } + /** + * Performs a linear interpolation between two {@link Quat2}s + * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`) + * @category Static + * + * @param out - the receiving dual quat + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const mt = 1 - t; + if (_Quat2.dot(a, b) < 0) { + t = -t; + } + out[0] = a[0] * mt + b[0] * t; + out[1] = a[1] * mt + b[1] * t; + out[2] = a[2] * mt + b[2] * t; + out[3] = a[3] * mt + b[3] * t; + out[4] = a[4] * mt + b[4] * t; + out[5] = a[5] * mt + b[5] * t; + out[6] = a[6] * mt + b[6] * t; + out[7] = a[7] * mt + b[7] * t; + return out; + } + /** + * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quat to calculate inverse of + * @returns `out` + */ + static invert(out, a) { + const sqlen = _Quat2.squaredLength(a); + out[0] = -a[0] / sqlen; + out[1] = -a[1] / sqlen; + out[2] = -a[2] / sqlen; + out[3] = a[3] / sqlen; + out[4] = -a[4] / sqlen; + out[5] = -a[5] / sqlen; + out[6] = -a[6] / sqlen; + out[7] = a[7] / sqlen; + return out; + } + /** + * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than + * {@link Quat2.invert} and produces the same result. + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to calculate conjugate of + * @returns `out` + */ + static conjugate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + out[4] = -a[4]; + out[5] = -a[5]; + out[6] = -a[6]; + out[7] = a[7]; + return out; + } + /** + * Calculates the magnitude (length) of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate length of + * @returns length of `a` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static magnitude(a) { + return 0; + } + /** + * Alias for {@link Quat2.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate squared length of + * @returns squared length of a + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static squaredLength(a) { + return 0; + } + /** + * Alias for {@link Quat2.squaredLength} + * @category Static + */ + static sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Normalize a {@link Quat2} + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to normalize + * @returns `out` + */ + static normalize(out, a) { + let magnitude = _Quat2.squaredLength(a); + if (magnitude > 0) { + magnitude = Math.sqrt(magnitude); + const a0 = a[0] / magnitude; + const a1 = a[1] / magnitude; + const a2 = a[2] / magnitude; + const a3 = a[3] / magnitude; + const b0 = a[4]; + const b1 = a[5]; + const b2 = a[6]; + const b3 = a[7]; + const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3; + out[0] = a0; + out[1] = a1; + out[2] = a2; + out[3] = a3; + out[4] = (b0 - a0 * a_dot_b) / magnitude; + out[5] = (b1 - a1 * a_dot_b) / magnitude; + out[6] = (b2 - a2 * a_dot_b) / magnitude; + out[7] = (b3 - a3 * a_dot_b) / magnitude; + } + return out; + } + /** + * Returns a string representation of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Quat2(${a.join(", ")})`; + } + /** + * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7]; + } + /** + * Returns whether the {@link Quat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)); + } +}; +Quat2.dot = Quat.dot; +Quat2.squaredLength = Quat.squaredLength; +Quat2.sqrLen = Quat.squaredLength; +Quat2.mag = Quat.magnitude; +Quat2.length = Quat.magnitude; +Quat2.len = Quat.magnitude; +Quat2.mul = Quat2.multiply; + +// src/_lib/f64/Vec2.ts +var Vec2 = class _Vec2 extends Float64Array { + /** + * Create a {@link Vec2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 2: { + const v = values[0]; + if (typeof v === "number") { + super([v, values[1]]); + } else { + super(v, values[1], 2); + } + break; + } + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v]); + } else { + super(v, 0, 2); + } + break; + } + default: + super(2); + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r() { + return this[0]; + } + set r(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g() { + return this[1]; + } + set g(value) { + this[1] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec2.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + return Math.hypot(this[0], this[1]); + } + /** + * Alias for {@link Vec2.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec2.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude() { + const x = this[0]; + const y = this[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag() { + return this.squaredMagnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec2.str(this);` + * + * @category Accessors + */ + get str() { + return _Vec2.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec2} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + // Instead of zero(), use a.fill(0) for instances; + /** + * Adds a {@link Vec2} to `this`. + * Equivalent to `Vec2.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b) { + this[0] += b[0]; + this[1] += b[1]; + return this; + } + /** + * Subtracts a {@link Vec2} from `this`. + * Equivalent to `Vec2.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + return this; + } + /** + * Alias for {@link Vec2.subtract} + * @category Methods + */ + sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec2}. + * Equivalent to `Vec2.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + return this; + } + /** + * Alias for {@link Vec2.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec2}. + * Equivalent to `Vec2.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + return this; + } + /** + * Alias for {@link Vec2.divide} + * @category Methods + */ + div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec2.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b) { + this[0] *= b; + this[1] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b) { + return _Vec2.distance(this, b); + } + /** + * Alias for {@link Vec2.distance} + * @category Methods + */ + dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b) { + return _Vec2.squaredDistance(this, b); + } + /** + * Alias for {@link Vec2.squaredDistance} + * @category Methods + */ + sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec2.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate() { + this[0] *= -1; + this[1] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec2.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + return this; + } + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec2.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec2}. + * Equivalent to `Vec2.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b) { + return this[0] * b[0] + this[1] * b[1]; + } + /** + * Normalize `this`. + * Equivalent to `Vec2.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize() { + return _Vec2.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec2}. + */ + static get BYTE_LENGTH() { + return 2 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty {@link Vec2} + * @category Static + * + * @returns A new 2D vector + */ + static create() { + return new _Vec2(); + } + /** + * Creates a new {@link Vec2} initialized with values from an existing vector + * @category Static + * + * @param a - Vector to clone + * @returns A new 2D vector + */ + static clone(a) { + return new _Vec2(a); + } + /** + * Creates a new {@link Vec2} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @returns A new 2D vector + */ + static fromValues(x, y) { + return new _Vec2(x, y); + } + /** + * Copy the values from one {@link Vec2} to another + * @category Static + * + * @param out - the receiving vector + * @param a - The source vector + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + return out; + } + /** + * Set the components of a {@link Vec2} to the given values + * @category Static + * + * @param out - The receiving vector + * @param x - X component + * @param y - Y component + * @returns `out` + */ + static set(out, x, y) { + out[0] = x; + out[1] = y; + return out; + } + /** + * Adds two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + return out; + } + /** + * Alias for {@link Vec2.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return [0, 0]; + } + /** + * Multiplies two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + return out; + } + /** + * Alias for {@link Vec2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return [0, 0]; + } + /** + * Divides two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + return out; + } + /** + * Alias for {@link Vec2.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out, a, b) { + return [0, 0]; + } + /** + * Math.ceil the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to ceil + * @returns `out` + */ + static ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + return out; + } + /** + * Math.floor the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to floor + * @returns `out` + */ + static floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + return out; + } + /** + * Returns the minimum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + return out; + } + /** + * Returns the maximum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + return out; + } + /** + * Math.round the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to round + * @returns `out` + */ + static round(out, a) { + out[0] = Math.round(a[0]); + out[1] = Math.round(a[1]); + return out; + } + /** + * Scales a {@link Vec2} by a scalar number + * @category Static + * + * @param out - The receiving vector + * @param a - The vector to scale + * @param b - Amount to scale the vector by + * @returns `out` + */ + static scale(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + return out; + } + /** + * Adds two Vec2's after scaling the second operand by a scalar value + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param scale - The amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns distance between `a` and `b` + */ + static distance(a, b) { + return Math.hypot(b[0] - a[0], b[1] - a[1]); + } + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Squared distance between `a` and `b` + */ + static squaredDistance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a, b) { + return 0; + } + /** + * Calculates the magnitude (length) of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a) { + const x = a[0]; + const y = a[1]; + return Math.sqrt(x * x + y * y); + } + /** + * Alias for {@link Vec2.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate squared length of + * @returns Squared length of a + */ + static squaredLength(a) { + const x = a[0]; + const y = a[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.squaredLength} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrLen(a, b) { + return 0; + } + /** + * Negates the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to negate + * @returns `out` + */ + static negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + return out; + } + /** + * Returns the inverse of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to invert + * @returns `out` + */ + static inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + return out; + } + /** + * Normalize a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to normalize + * @returns `out` + */ + static normalize(out, a) { + const x = a[0]; + const y = a[1]; + let len = x * x + y * y; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + return out; + } + /** + * Calculates the dot product of two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Dot product of `a` and `b` + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1]; + } + /** + * Computes the cross product of two {@link Vec2}s + * Note that the cross product must by definition produce a 3D vector. + * For this reason there is also not instance equivalent for this function. + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static cross(out, a, b) { + const z = a[0] * b[1] - a[1] * b[0]; + out[0] = out[1] = 0; + out[2] = z; + return out; + } + /** + * Performs a linear interpolation between two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param t - Interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const ax = a[0]; + const ay = a[1]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat2} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[2] * y; + out[1] = m[1] * x + m[3] * y; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat2d} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2d(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[2] * y + m[4]; + out[1] = m[1] * x + m[3] * y + m[5]; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat3} + * 3rd vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat3(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[3] * y + m[6]; + out[1] = m[1] * x + m[4] * y + m[7]; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat4} + * 3rd vector component is implicitly '0' + * 4th vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat4(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[4] * y + m[12]; + out[1] = m[1] * x + m[5] * y + m[13]; + return out; + } + /** + * Rotate a 2D vector + * @category Static + * + * @param out - The receiving {@link Vec2} + * @param a - The {@link Vec2} point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotate(out, a, b, rad) { + const p0 = a[0] - b[0]; + const p1 = a[1] - b[1]; + const sinC = Math.sin(rad); + const cosC = Math.cos(rad); + out[0] = p0 * cosC - p1 * sinC + b[0]; + out[1] = p0 * sinC + p1 * cosC + b[1]; + return out; + } + /** + * Get the angle between two 2D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static angle(a, b) { + const x1 = a[0]; + const y1 = a[1]; + const x2 = b[0]; + const y2 = b[1]; + const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2); + const cosine = mag && (x1 * x2 + y1 * y2) / mag; + return Math.acos(Math.min(Math.max(cosine, -1), 1)); + } + /** + * Set the components of a {@link Vec2} to zero + * @category Static + * + * @param out - The receiving vector + * @returns `out` + */ + static zero(out) { + out[0] = 0; + out[1] = 0; + return out; + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors components are ===, `false` otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors are approximately equal, `false` otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const b0 = b[0]; + const b1 = b[1]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)); + } + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - Vector to represent as a string + * @returns String representation of the vector + */ + static str(a) { + return `Vec2(${a.join(", ")})`; + } +}; +Vec2.prototype.sub = Vec2.prototype.subtract; +Vec2.prototype.mul = Vec2.prototype.multiply; +Vec2.prototype.div = Vec2.prototype.divide; +Vec2.prototype.dist = Vec2.prototype.distance; +Vec2.prototype.sqrDist = Vec2.prototype.squaredDistance; +Vec2.sub = Vec2.subtract; +Vec2.mul = Vec2.multiply; +Vec2.div = Vec2.divide; +Vec2.dist = Vec2.distance; +Vec2.sqrDist = Vec2.squaredDistance; +Vec2.sqrLen = Vec2.squaredLength; +Vec2.mag = Vec2.magnitude; +Vec2.length = Vec2.magnitude; +Vec2.len = Vec2.magnitude; + +// src/swizzle/f64/index.ts +var GLM_SWIZZLES_ENABLED_F64 = false; +function EnableSwizzlesF64() { + if (GLM_SWIZZLES_ENABLED_F64) { + return; + } + const VEC2_SWIZZLES = ["xx", "xy", "yx", "yy", "xxx", "xxy", "xyx", "xyy", "yxx", "yxy", "yyx", "yyy", "xxxx", "xxxy", "xxyx", "xxyy", "xyxx", "xyxy", "xyyx", "xyyy", "yxxx", "yxxy", "yxyx", "yxyy", "yyxx", "yyxy", "yyyx", "yyyy", "rr", "rg", "gr", "gg", "rrr", "rrg", "rgr", "rgg", "grr", "grg", "ggr", "ggg", "rrrr", "rrrg", "rrgr", "rrgg", "rgrr", "rgrg", "rggr", "rggg", "grrr", "grrg", "grgr", "grgg", "ggrr", "ggrg", "gggr", "gggg"]; + const VEC3_SWIZZLES = ["xz", "yz", "zx", "zy", "zz", "xxz", "xyz", "xzx", "xzy", "xzz", "yxz", "yyz", "yzx", "yzy", "yzz", "zxx", "zxy", "zxz", "zyx", "zyy", "zyz", "zzx", "zzy", "zzz", "xxxz", "xxyz", "xxzx", "xxzy", "xxzz", "xyxz", "xyyz", "xyzx", "xyzy", "xyzz", "xzxx", "xzxy", "xzxz", "xzyx", "xzyy", "xzyz", "xzzx", "xzzy", "xzzz", "yxxz", "yxyz", "yxzx", "yxzy", "yxzz", "yyxz", "yyyz", "yyzx", "yyzy", "yyzz", "yzxx", "yzxy", "yzxz", "yzyx", "yzyy", "yzyz", "yzzx", "yzzy", "yzzz", "zxxx", "zxxy", "zxxz", "zxyx", "zxyy", "zxyz", "zxzx", "zxzy", "zxzz", "zyxx", "zyxy", "zyxz", "zyyx", "zyyy", "zyyz", "zyzx", "zyzy", "zyzz", "zzxx", "zzxy", "zzxz", "zzyx", "zzyy", "zzyz", "zzzx", "zzzy", "zzzz", "rb", "gb", "br", "bg", "bb", "rrb", "rgb", "rbr", "rbg", "rbb", "grb", "ggb", "gbr", "gbg", "gbb", "brr", "brg", "brb", "bgr", "bgg", "bgb", "bbr", "bbg", "bbb", "rrrb", "rrgb", "rrbr", "rrbg", "rrbb", "rgrb", "rggb", "rgbr", "rgbg", "rgbb", "rbrr", "rbrg", "rbrb", "rbgr", "rbgg", "rbgb", "rbbr", "rbbg", "rbbb", "grrb", "grgb", "grbr", "grbg", "grbb", "ggrb", "gggb", "ggbr", "ggbg", "ggbb", "gbrr", "gbrg", "gbrb", "gbgr", "gbgg", "gbgb", "gbbr", "gbbg", "gbbb", "brrr", "brrg", "brrb", "brgr", "brgg", "brgb", "brbr", "brbg", "brbb", "bgrr", "bgrg", "bgrb", "bggr", "bggg", "bggb", "bgbr", "bgbg", "bgbb", "bbrr", "bbrg", "bbrb", "bbgr", "bbgg", "bbgb", "bbbr", "bbbg", "bbbb"]; + const VEC4_SWIZZLES = ["xw", "yw", "zw", "wx", "wy", "wz", "ww", "xxw", "xyw", "xzw", "xwx", "xwy", "xwz", "xww", "yxw", "yyw", "yzw", "ywx", "ywy", "ywz", "yww", "zxw", "zyw", "zzw", "zwx", "zwy", "zwz", "zww", "wxx", "wxy", "wxz", "wxw", "wyx", "wyy", "wyz", "wyw", "wzx", "wzy", "wzz", "wzw", "wwx", "wwy", "wwz", "www", "xxxw", "xxyw", "xxzw", "xxwx", "xxwy", "xxwz", "xxww", "xyxw", "xyyw", "xyzw", "xywx", "xywy", "xywz", "xyww", "xzxw", "xzyw", "xzzw", "xzwx", "xzwy", "xzwz", "xzww", "xwxx", "xwxy", "xwxz", "xwxw", "xwyx", "xwyy", "xwyz", "xwyw", "xwzx", "xwzy", "xwzz", "xwzw", "xwwx", "xwwy", "xwwz", "xwww", "yxxw", "yxyw", "yxzw", "yxwx", "yxwy", "yxwz", "yxww", "yyxw", "yyyw", "yyzw", "yywx", "yywy", "yywz", "yyww", "yzxw", "yzyw", "yzzw", "yzwx", "yzwy", "yzwz", "yzww", "ywxx", "ywxy", "ywxz", "ywxw", "ywyx", "ywyy", "ywyz", "ywyw", "ywzx", "ywzy", "ywzz", "ywzw", "ywwx", "ywwy", "ywwz", "ywww", "zxxw", "zxyw", "zxzw", "zxwx", "zxwy", "zxwz", "zxww", "zyxw", "zyyw", "zyzw", "zywx", "zywy", "zywz", "zyww", "zzxw", "zzyw", "zzzw", "zzwx", "zzwy", "zzwz", "zzww", "zwxx", "zwxy", "zwxz", "zwxw", "zwyx", "zwyy", "zwyz", "zwyw", "zwzx", "zwzy", "zwzz", "zwzw", "zwwx", "zwwy", "zwwz", "zwww", "wxxx", "wxxy", "wxxz", "wxxw", "wxyx", "wxyy", "wxyz", "wxyw", "wxzx", "wxzy", "wxzz", "wxzw", "wxwx", "wxwy", "wxwz", "wxww", "wyxx", "wyxy", "wyxz", "wyxw", "wyyx", "wyyy", "wyyz", "wyyw", "wyzx", "wyzy", "wyzz", "wyzw", "wywx", "wywy", "wywz", "wyww", "wzxx", "wzxy", "wzxz", "wzxw", "wzyx", "wzyy", "wzyz", "wzyw", "wzzx", "wzzy", "wzzz", "wzzw", "wzwx", "wzwy", "wzwz", "wzww", "wwxx", "wwxy", "wwxz", "wwxw", "wwyx", "wwyy", "wwyz", "wwyw", "wwzx", "wwzy", "wwzz", "wwzw", "wwwx", "wwwy", "wwwz", "wwww", "ra", "ga", "ba", "ar", "ag", "ab", "aa", "rra", "rga", "rba", "rar", "rag", "rab", "raa", "gra", "gga", "gba", "gar", "gag", "gab", "gaa", "bra", "bga", "bba", "bar", "bag", "bab", "baa", "arr", "arg", "arb", "ara", "agr", "agg", "agb", "aga", "abr", "abg", "abb", "aba", "aar", "aag", "aab", "aaa", "rrra", "rrga", "rrba", "rrar", "rrag", "rrab", "rraa", "rgra", "rgga", "rgba", "rgar", "rgag", "rgab", "rgaa", "rbra", "rbga", "rbba", "rbar", "rbag", "rbab", "rbaa", "rarr", "rarg", "rarb", "rara", "ragr", "ragg", "ragb", "raga", "rabr", "rabg", "rabb", "raba", "raar", "raag", "raab", "raaa", "grra", "grga", "grba", "grar", "grag", "grab", "graa", "ggra", "ggga", "ggba", "ggar", "ggag", "ggab", "ggaa", "gbra", "gbga", "gbba", "gbar", "gbag", "gbab", "gbaa", "garr", "garg", "garb", "gara", "gagr", "gagg", "gagb", "gaga", "gabr", "gabg", "gabb", "gaba", "gaar", "gaag", "gaab", "gaaa", "brra", "brga", "brba", "brar", "brag", "brab", "braa", "bgra", "bgga", "bgba", "bgar", "bgag", "bgab", "bgaa", "bbra", "bbga", "bbba", "bbar", "bbag", "bbab", "bbaa", "barr", "barg", "barb", "bara", "bagr", "bagg", "bagb", "baga", "babr", "babg", "babb", "baba", "baar", "baag", "baab", "baaa", "arrr", "arrg", "arrb", "arra", "argr", "argg", "argb", "arga", "arbr", "arbg", "arbb", "arba", "arar", "arag", "arab", "araa", "agrr", "agrg", "agrb", "agra", "aggr", "aggg", "aggb", "agga", "agbr", "agbg", "agbb", "agba", "agar", "agag", "agab", "agaa", "abrr", "abrg", "abrb", "abra", "abgr", "abgg", "abgb", "abga", "abbr", "abbg", "abbb", "abba", "abar", "abag", "abab", "abaa", "aarr", "aarg", "aarb", "aara", "aagr", "aagg", "aagb", "aaga", "aabr", "aabg", "aabb", "aaba", "aaar", "aaag", "aaab", "aaaa"]; + const SWIZZLE_INDEX = { + x: 0, + r: 0, + y: 1, + g: 1, + z: 2, + b: 2, + w: 3, + a: 3 + }; + function getSwizzleImpl(swizzle) { + switch (swizzle.length) { + case 2: + return function() { + return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]); + }; + case 3: + return function() { + return new Vec3( + this[SWIZZLE_INDEX[swizzle[0]]], + this[SWIZZLE_INDEX[swizzle[1]]], + this[SWIZZLE_INDEX[swizzle[2]]] + ); + }; + case 4: + return function() { + return new Vec4( + this[SWIZZLE_INDEX[swizzle[0]]], + this[SWIZZLE_INDEX[swizzle[1]]], + this[SWIZZLE_INDEX[swizzle[2]]], + this[SWIZZLE_INDEX[swizzle[3]]] + ); + }; + } + throw new Error("Illegal swizzle length"); + } + for (const swizzle of VEC2_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec2.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec3.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + for (const swizzle of VEC3_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec3.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + for (const swizzle of VEC4_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + GLM_SWIZZLES_ENABLED_F64 = true; +} + +// src/util/angleConversion.ts +var GLM_DEG_TO_RAD = Math.PI / 180; +var GLM_RAD_TO_DEG = 180 / Math.PI; +function toDegree(value) { + return value * GLM_RAD_TO_DEG; +} +function toRadian(value) { + return value * GLM_DEG_TO_RAD; +} +//# sourceMappingURL=gl-matrix-f64.cjs.map diff --git a/dist-cdn/cjs/2022/gl-matrix-f64.cjs.map b/dist-cdn/cjs/2022/gl-matrix-f64.cjs.map new file mode 100644 index 00000000..de74a322 --- /dev/null +++ b/dist-cdn/cjs/2022/gl-matrix-f64.cjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../../../src/cdn/f64/index.ts", "../../../src/common/index.ts", "../../../src/_lib/f64/Mat2.ts", "../../../src/_lib/f64/Mat2d.ts", "../../../src/_lib/f64/Mat3.ts", "../../../src/_lib/f64/Mat4.ts", "../../../src/_lib/f64/Vec3.ts", "../../../src/_lib/f64/Vec4.ts", "../../../src/_lib/f64/Quat.ts", "../../../src/_lib/f64/Quat2.ts", "../../../src/_lib/f64/Vec2.ts", "../../../src/swizzle/f64/index.ts", "../../../src/util/angleConversion.ts"], + "sourcesContent": ["/**\r\n * Provides an all-inclusive ESM distribution of `gl-matrix` (64-bit). All library classes extends `Float64Array`.\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\n/* v8 ignore next 5 */\r\nexport * from '#gl-matrix/f64';\r\nexport * from '#gl-matrix/swizzle/f64';\r\nexport * from '#gl-matrix/types';\r\nexport * from '#gl-matrix/types/swizzle/f64';\r\nexport * from '#gl-matrix/util';\r\n", "/**\r\n * Provides common resources and constants shared across `gl-matrix`.\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\n/**\r\n * A small constant used to determine the acceptable error margin in floating-point calculations.\r\n */\r\nexport const GLM_EPSILON = 0.000001;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x2 Matrix\r\n */\r\nexport class Mat2 extends Float64Array {\r\n static #IDENTITY_2X2 = new Float64Array([\r\n 1, 0,\r\n 0, 1\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n default:\r\n super(Mat2.#IDENTITY_2X2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2} into `this`.\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2.identity(this)\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n identity(): this {\r\n this.set(Mat2.#IDENTITY_2X2);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2} against another one\r\n * Equivalent to `Mat2.multiply(this, this, b);`\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat2}\r\n * Equivalent to `Mat2.transpose(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n transpose(): this {\r\n return Mat2.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat2}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n invert(): this {\r\n return Mat2.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2.scale(this, this, v);`\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2} by the given angle around the given axis\r\n * Equivalent to `Mat2.rotate(this, this, rad);`\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n rotate(rad: number): this {\r\n return Mat2.rotate(this, this, rad) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2}\r\n */\r\n static create(): Mat2 {\r\n return new Mat2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2}\r\n */\r\n static clone(a: Readonly): Mat2 {\r\n return new Mat2(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2Like, a: Readonly): Mat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2}\r\n */\r\n static fromValues(...values: number[]): Mat2 {\r\n return new Mat2(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2Like, ...values: number[]): Mat2Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2Like): Mat2Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat2Like, a: Readonly): Mat2Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache\r\n // some values\r\n if (out === a) {\r\n const a1 = a[1];\r\n out[1] = a[2];\r\n out[2] = a1;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[2];\r\n out[2] = a[1];\r\n out[3] = a[3];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2Like, a: Mat2Like): Mat2Like | null {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n // Calculate the determinant\r\n let det = a0 * a3 - a2 * a1;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = a3 * det;\r\n out[1] = -a1 * det;\r\n out[2] = -a2 * det;\r\n out[3] = a0 * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat2Like, a: Mat2Like): Mat2Like {\r\n // Caching this value is necessary if out == a\r\n const a0 = a[0];\r\n out[0] = a[3];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[2] * a[1];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n return out;\r\n }\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Rotates a {@link Mat2} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2Like, a: Readonly, rad: number): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2Like, a: Readonly, v: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2Like, rad: number): Mat2Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2Like, v: Readonly): Mat2Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2Like, a: Readonly, b: number): Mat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2Like, a: Readonly, b: Readonly, scale: number): Mat2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\r\n * @category Static\r\n *\r\n * @param L - the lower triangular matrix\r\n * @param D - the diagonal matrix\r\n * @param U - the upper triangular matrix\r\n * @param a - the input matrix to factorize\r\n */\r\n\r\n static LDU(L: Mat2Like, D: Readonly, U: Mat2Like, a: Readonly):\r\n [Mat2Like, Readonly, Mat2Like] {\r\n L[2] = a[2] / a[0];\r\n U[0] = a[0];\r\n U[1] = a[1];\r\n U[3] = a[3] - L[2] * U[1];\r\n return [L, D, U];\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat2.prototype.mul = Mat2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat2.mul = Mat2.multiply;\r\nMat2.sub = Mat2.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x3 Matrix\r\n */\r\nexport class Mat2d extends Float64Array {\r\n static #IDENTITY_2X3 = new Float64Array([\r\n 1, 0,\r\n 0, 1,\r\n 0, 0,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 6:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 6); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 6);\r\n }\r\n break;\r\n default:\r\n super(Mat2d.#IDENTITY_2X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2d.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2d.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2d} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2d.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat2d.#IDENTITY_2X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2d} against another one\r\n * Equivalent to `Mat2d.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2d.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Translate this {@link Mat2d} by the given vector\r\n * Equivalent to `Mat2d.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat2d.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2d} by the given angle around the given axis\r\n * Equivalent to `Mat2d.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat2d.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2d.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2d.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2d}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 6 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2d}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2d}\r\n */\r\n static create(): Mat2d {\r\n return new Mat2d();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2d} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2d}\r\n */\r\n static clone(a: Readonly): Mat2d {\r\n return new Mat2d(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2d} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2dLike, a: Readonly): Mat2dLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2d} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2d}\r\n */\r\n static fromValues(...values: number[]): Mat2d {\r\n return new Mat2d(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2d} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2dLike, ...values: number[]): Mat2dLike {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2d} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2dLike): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2dLike, a: Mat2dLike): Mat2dLike | null {\r\n const aa = a[0];\r\n const ab = a[1];\r\n const ac = a[2];\r\n const ad = a[3];\r\n const atx = a[4];\r\n const aty = a[5];\r\n\r\n let det = aa * ad - ab * ac;\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = ad * det;\r\n out[1] = -ab * det;\r\n out[2] = -ac * det;\r\n out[3] = aa * det;\r\n out[4] = (ac * aty - ad * atx) * det;\r\n out[5] = (ab * atx - aa * aty) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[1] * a[2];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2d}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n out[4] = a0 * b4 + a2 * b5 + a4;\r\n out[5] = a1 * b4 + a3 * b5 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat2d} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n out[4] = a0 * v0 + a2 * v1 + a4;\r\n out[5] = a1 * v0 + a3 * v1 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat2d} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2dLike, a: Readonly, rad: number): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n // TODO: Got to fromRotation\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = v[0];\r\n out[5] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2dLike, rad: number): Mat2dLike {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2d} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2dLike, a: Readonly, b: number): Mat2dLike {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2dLike, a: Readonly, b: Readonly, scale: number):\r\n Mat2dLike {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2d(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Static method alias assignments\r\nMat2d.mul = Mat2d.multiply;\r\nMat2d.sub = Mat2d.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Mat3Like, Mat4Like, Vec2Like, QuatLike } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 3x3 Matrix\r\n */\r\nexport class Mat3 extends Float64Array {\r\n static #IDENTITY_3X3 = new Float64Array([\r\n 1, 0, 0,\r\n 0, 1, 0,\r\n 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 9:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 9); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v,\r\n v, v, v,\r\n v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 9);\r\n }\r\n break;\r\n default:\r\n super(Mat3.#IDENTITY_3X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat3.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat3.#IDENTITY_3X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat3} against another one\r\n * Equivalent to `Mat3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat3.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat3}\r\n * Equivalent to `Mat3.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat3.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat3}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat3.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat3} by the given vector\r\n * Equivalent to `Mat3.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat3.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat3} by the given angle around the given axis\r\n * Equivalent to `Mat3.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat3.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat3.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat3.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 9 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat3}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat3}\r\n */\r\n static create(): Mat3 {\r\n return new Mat3();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat3} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat3}\r\n */\r\n static clone(a: Readonly): Mat3 {\r\n return new Mat3(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat3} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat3} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat3}\r\n */\r\n static fromValues(...values: number[]): Mat3 {\r\n return new Mat3(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat3} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat3Like, ...values: number[]): Mat3Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat3} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat3Like): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat3Like, a: Readonly): Mat3Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a12 = a[5];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a01;\r\n out[5] = a[7];\r\n out[6] = a02;\r\n out[7] = a12;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a[1];\r\n out[4] = a[4];\r\n out[5] = a[7];\r\n out[6] = a[2];\r\n out[7] = a[5];\r\n out[8] = a[8];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat3Like, a: Mat3Like): Mat3Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2];\r\n const a10 = a[3],\r\n a11 = a[4],\r\n a12 = a[5];\r\n const a20 = a[6],\r\n a21 = a[7],\r\n a22 = a[8];\r\n\r\n const b01 = a22 * a11 - a12 * a21;\r\n const b11 = -a22 * a10 + a12 * a20;\r\n const b21 = a21 * a10 - a11 * a20;\r\n\r\n // Calculate the determinant\r\n let det = a00 * b01 + a01 * b11 + a02 * b21;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = b01 * det;\r\n out[1] = (-a22 * a01 + a02 * a21) * det;\r\n out[2] = (a12 * a01 - a02 * a11) * det;\r\n out[3] = b11 * det;\r\n out[4] = (a22 * a00 - a02 * a20) * det;\r\n out[5] = (-a12 * a00 + a02 * a10) * det;\r\n out[6] = b21 * det;\r\n out[7] = (-a21 * a00 + a01 * a20) * det;\r\n out[8] = (a11 * a00 - a01 * a10) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat3Like, a: Mat3Like): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n out[0] = a11 * a22 - a12 * a21;\r\n out[1] = a02 * a21 - a01 * a22;\r\n out[2] = a01 * a12 - a02 * a11;\r\n out[3] = a12 * a20 - a10 * a22;\r\n out[4] = a00 * a22 - a02 * a20;\r\n out[5] = a02 * a10 - a00 * a12;\r\n out[6] = a10 * a21 - a11 * a20;\r\n out[7] = a01 * a20 - a00 * a21;\r\n out[8] = a00 * a11 - a01 * a10;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n return (\r\n a00 * (a22 * a11 - a12 * a21) +\r\n a01 * (-a22 * a10 + a12 * a20) +\r\n a02 * (a21 * a10 - a11 * a20)\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[3];\r\n b1 = b[4];\r\n b2 = b[5];\r\n out[3] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[4] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[5] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[6];\r\n b1 = b[7];\r\n b2 = b[8];\r\n out[6] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[7] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[8] = b0 * a02 + b1 * a12 + b2 * a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat3} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n\r\n out[3] = a10;\r\n out[4] = a11;\r\n out[5] = a12;\r\n\r\n out[6] = x * a00 + y * a10 + a20;\r\n out[7] = x * a01 + y * a11 + a21;\r\n out[8] = x * a02 + y * a12 + a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat3} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat3Like, a: Readonly, rad: number): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c * a00 + s * a10;\r\n out[1] = c * a01 + s * a11;\r\n out[2] = c * a02 + s * a12;\r\n\r\n out[3] = c * a10 - s * a00;\r\n out[4] = c * a11 - s * a01;\r\n out[5] = c * a12 - s * a02;\r\n\r\n out[6] = a20;\r\n out[7] = a21;\r\n out[8] = a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat3} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = x * a[0];\r\n out[1] = x * a[1];\r\n out[2] = x * a[2];\r\n\r\n out[3] = y * a[3];\r\n out[4] = y * a[4];\r\n out[5] = y * a[5];\r\n\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = v[0];\r\n out[7] = v[1];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.rotate(dest, dest, rad);\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat3Like, rad: number): Mat3Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n\r\n out[3] = -s;\r\n out[4] = c;\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n\r\n out[3] = 0;\r\n out[4] = v[1];\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat2d} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 2x3 matrix\r\n * @returns `out`\r\n */\r\n static fromMat2d(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = 0;\r\n\r\n out[3] = a[2];\r\n out[4] = a[3];\r\n out[5] = 0;\r\n\r\n out[6] = a[4];\r\n out[7] = a[5];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param q - {@link Quat} to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat3Like, q: Readonly): Mat3Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[3] = yx - wz;\r\n out[6] = zx + wy;\r\n\r\n out[1] = yx + wz;\r\n out[4] = 1 - xx - zz;\r\n out[7] = zy - wx;\r\n\r\n out[2] = zx - wy;\r\n out[5] = zy + wx;\r\n out[8] = 1 - xx - yy;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat4} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 4x4 matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[4];\r\n out[4] = a[5];\r\n out[5] = a[6];\r\n out[6] = a[8];\r\n out[7] = a[9];\r\n out[8] = a[10];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\r\n * @category Static\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat3Like, a: Readonly): Mat3Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n\r\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n\r\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat3Like, a: Readonly): Mat3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n\r\n out[3] = cy * az - cz * ay;\r\n out[4] = cz * ax - cx * az;\r\n out[5] = cx * ay - cy * ax;\r\n\r\n out[6] = ay * bz - az * by;\r\n out[7] = az * bx - ax * bz;\r\n out[8] = ax * by - ay * bx;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a 2D projection matrix with the given bounds\r\n * @category Static\r\n *\r\n * @param out mat3 frustum matrix will be written into\r\n * @param width Width of your gl context\r\n * @param height Height of gl context\r\n * @returns `out`\r\n */\r\n static projection(out: Mat3Like, width: number, height: number): Mat3Like {\r\n out[0] = 2 / width;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -2 / height;\r\n out[5] = 0;\r\n out[6] = -1;\r\n out[7] = 1;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8]\r\n );\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat3} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat3Like, a: Readonly, b: number): Mat3Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat3Like, a: Readonly, b: Readonly, scale: number): Mat3Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat3(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat3.prototype.mul = Mat3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat3.mul = Mat3.multiply;\r\nMat3.sub = Mat3.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 4x4 Matrix\r\n */\r\nexport class Mat4 extends Float64Array {\r\n static #IDENTITY_4X4 = new Float64Array([\r\n 1, 0, 0, 0,\r\n 0, 1, 0, 0,\r\n 0, 0, 1, 0,\r\n 0, 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Temporary variable to prevent repeated allocations in the algorithms within Mat4.\r\n * These are declared as TypedArrays to aid in tree-shaking.\r\n */\r\n static #TMP_VEC3 = new Float64Array(3);\r\n\r\n /**\r\n * Create a {@link Mat4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 16:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 16); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 16);\r\n }\r\n break;\r\n default:\r\n super(Mat4.#IDENTITY_4X4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat4.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat4.#IDENTITY_4X4);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat4} against another one\r\n * Equivalent to `Mat4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat4.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat4}\r\n * Equivalent to `Mat4.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat4.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat4}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat4.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat4} by the given vector\r\n * Equivalent to `Mat4.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat4.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the given axis\r\n * Equivalent to `Mat4.rotate(this, this, rad, axis);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `this`\r\n */\r\n rotate(rad: number, axis: Readonly): this {\r\n return Mat4.rotate(this, this, rad, axis) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat4.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat4.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the X axis\r\n * Equivalent to `Mat4.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Mat4.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Y axis\r\n * Equivalent to `Mat4.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Mat4.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Z axis\r\n * Equivalent to `Mat4.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Mat4.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveNO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveNO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveZO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveZO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoNO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoNO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoZO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoZO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 16 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat4}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat4}\r\n */\r\n static create(): Mat4 {\r\n return new Mat4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat4} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat4}\r\n */\r\n static clone(a: Readonly): Mat4 {\r\n return new Mat4(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat4} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat4Like, a: Readonly): Mat4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new mat4 with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat4}\r\n */\r\n static fromValues(...values: number[]): Mat4 {\r\n return new Mat4(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a mat4 to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat4Like, ...values: number[]): Mat4Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n out[9] = values[9];\r\n out[10] = values[10];\r\n out[11] = values[11];\r\n out[12] = values[12];\r\n out[13] = values[13];\r\n out[14] = values[14];\r\n out[15] = values[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat4} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat4Like): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat4Like, a: Readonly): Mat4Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a12 = a[6],\r\n a13 = a[7];\r\n const a23 = a[11];\r\n\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a01;\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a02;\r\n out[9] = a12;\r\n out[11] = a[14];\r\n out[12] = a03;\r\n out[13] = a13;\r\n out[14] = a23;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a[1];\r\n out[5] = a[5];\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a[2];\r\n out[9] = a[6];\r\n out[10] = a[10];\r\n out[11] = a[14];\r\n out[12] = a[3];\r\n out[13] = a[7];\r\n out[14] = a[11];\r\n out[15] = a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat4Like, a: Mat4Like): Mat4Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\r\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\r\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\r\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\r\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\r\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\r\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat4Like, a: Mat4Like): Mat4Like {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n out[0] = a11 * b11 - a12 * b10 + a13 * b09;\r\n out[1] = a02 * b10 - a01 * b11 - a03 * b09;\r\n out[2] = a31 * b05 - a32 * b04 + a33 * b03;\r\n out[3] = a22 * b04 - a21 * b05 - a23 * b03;\r\n out[4] = a12 * b08 - a10 * b11 - a13 * b07;\r\n out[5] = a00 * b11 - a02 * b08 + a03 * b07;\r\n out[6] = a32 * b02 - a30 * b05 - a33 * b01;\r\n out[7] = a20 * b05 - a22 * b02 + a23 * b01;\r\n out[8] = a10 * b10 - a11 * b08 + a13 * b06;\r\n out[9] = a01 * b08 - a00 * b10 - a03 * b06;\r\n out[10] = a30 * b04 - a31 * b02 + a33 * b00;\r\n out[11] = a21 * b02 - a20 * b04 - a23 * b00;\r\n out[12] = a11 * b07 - a10 * b09 - a12 * b06;\r\n out[13] = a00 * b09 - a01 * b07 + a02 * b06;\r\n out[14] = a31 * b01 - a30 * b03 - a32 * b00;\r\n out[15] = a20 * b03 - a21 * b01 + a22 * b00;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b0 = a00 * a11 - a01 * a10;\r\n const b1 = a00 * a12 - a02 * a10;\r\n const b2 = a01 * a12 - a02 * a11;\r\n const b3 = a20 * a31 - a21 * a30;\r\n const b4 = a20 * a32 - a22 * a30;\r\n const b5 = a21 * a32 - a22 * a31;\r\n const b6 = a00 * b5 - a01 * b4 + a02 * b3;\r\n const b7 = a10 * b5 - a11 * b4 + a12 * b3;\r\n const b8 = a20 * b2 - a21 * b1 + a22 * b0;\r\n const b9 = a30 * b2 - a31 * b1 + a32 * b0;\r\n\r\n // Calculate the determinant\r\n return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Mat4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n // Cache only the current line of the second matrix\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n let b3 = b[3];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[4];\r\n b1 = b[5];\r\n b2 = b[6];\r\n b3 = b[7];\r\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[8];\r\n b1 = b[9];\r\n b2 = b[10];\r\n b3 = b[11];\r\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[12];\r\n b1 = b[13];\r\n b2 = b[14];\r\n b3 = b[15];\r\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat4} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n if (a === out) {\r\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\r\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\r\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\r\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\r\n } else {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n out[3] = a03;\r\n out[4] = a10;\r\n out[5] = a11;\r\n out[6] = a12;\r\n out[7] = a13;\r\n out[8] = a20;\r\n out[9] = a21;\r\n out[10] = a22;\r\n out[11] = a23;\r\n\r\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\r\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\r\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\r\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec3} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n out[0] = a[0] * x;\r\n out[1] = a[1] * x;\r\n out[2] = a[2] * x;\r\n out[3] = a[3] * x;\r\n out[4] = a[4] * y;\r\n out[5] = a[5] * y;\r\n out[6] = a[6] * y;\r\n out[7] = a[7] * y;\r\n out[8] = a[8] * z;\r\n out[9] = a[9] * z;\r\n out[10] = a[10] * z;\r\n out[11] = a[11] * z;\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat4} by the given angle around the given axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if axis has a length of 0\r\n */\r\n static rotate(out: Mat4Like, a: Readonly, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n // Construct the elements of the rotation matrix\r\n const b00 = x * x * t + c;\r\n const b01 = y * x * t + z * s;\r\n const b02 = z * x * t - y * s;\r\n const b10 = x * y * t - z * s;\r\n const b11 = y * y * t + c;\r\n const b12 = z * y * t + x * s;\r\n const b20 = x * z * t + y * s;\r\n const b21 = y * z * t - x * s;\r\n const b22 = z * z * t + c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\r\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\r\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\r\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\r\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\r\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\r\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\r\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\r\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\r\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\r\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\r\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateX(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[4] = a10 * c + a20 * s;\r\n out[5] = a11 * c + a21 * s;\r\n out[6] = a12 * c + a22 * s;\r\n out[7] = a13 * c + a23 * s;\r\n out[8] = a20 * c - a10 * s;\r\n out[9] = a21 * c - a11 * s;\r\n out[10] = a22 * c - a12 * s;\r\n out[11] = a23 * c - a13 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateY(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c - a20 * s;\r\n out[1] = a01 * c - a21 * s;\r\n out[2] = a02 * c - a22 * s;\r\n out[3] = a03 * c - a23 * s;\r\n out[8] = a00 * s + a20 * c;\r\n out[9] = a01 * s + a21 * c;\r\n out[10] = a02 * s + a22 * c;\r\n out[11] = a03 * s + a23 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c + a10 * s;\r\n out[1] = a01 * c + a11 * s;\r\n out[2] = a02 * c + a12 * s;\r\n out[3] = a03 * c + a13 * s;\r\n out[4] = a10 * c - a00 * s;\r\n out[5] = a11 * c - a01 * s;\r\n out[6] = a12 * c - a02 * s;\r\n out[7] = a13 * c - a03 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = v[1];\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = v[2];\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotate(dest, dest, rad, axis);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if `axis` has a length of 0\r\n */\r\n static fromRotation(out: Mat4Like, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = x * x * t + c;\r\n out[1] = y * x * t + z * s;\r\n out[2] = z * x * t - y * s;\r\n out[3] = 0;\r\n out[4] = x * y * t - z * s;\r\n out[5] = y * y * t + c;\r\n out[6] = z * y * t + x * s;\r\n out[7] = 0;\r\n out[8] = x * z * t + y * s;\r\n out[9] = y * z * t - x * s;\r\n out[10] = z * z * t + c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the X axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateX(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromXRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = c;\r\n out[6] = s;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = -s;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Y axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateY(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromYRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = 0;\r\n out[2] = -s;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = s;\r\n out[9] = 0;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Z axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateZ(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromZRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -s;\r\n out[5] = c;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation and vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Mat4Like, q: Readonly, v: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - (yy + zz);\r\n out[1] = xy + wz;\r\n out[2] = xz - wy;\r\n out[3] = 0;\r\n out[4] = xy - wz;\r\n out[5] = 1 - (xx + zz);\r\n out[6] = yz + wx;\r\n out[7] = 0;\r\n out[8] = xz + wy;\r\n out[9] = yz - wx;\r\n out[10] = 1 - (xx + yy);\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Mat4} from a {@link Quat2}.\r\n * @category Static\r\n *\r\n * @param out - Matrix\r\n * @param a - Dual Quaternion\r\n * @returns `out`\r\n */\r\n static fromQuat2(out: Mat4Like, a: Quat2Like): Mat4Like {\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n\r\n const magnitude = bx * bx + by * by + bz * bz + bw * bw;\r\n\r\n // Only scale if it makes sense\r\n if (magnitude > 0) {\r\n Mat4.#TMP_VEC3[0] = ((ax * bw + aw * bx + ay * bz - az * by) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[1] = ((ay * bw + aw * by + az * bx - ax * bz) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[2] = ((az * bw + aw * bz + ax * by - ay * bx) * 2) / magnitude;\r\n } else {\r\n Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n }\r\n Mat4.fromRotationTranslation(out, a as QuatLike, Mat4.#TMP_VEC3);\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat4Like, a: Readonly): Mat4Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[3] = 0;\r\n\r\n out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[7] = 0;\r\n\r\n out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat4Like, a: Readonly): Mat4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n out[3] = 0;\r\n\r\n out[4] = cy * az - cz * ay;\r\n out[5] = cz * ax - cx * az;\r\n out[6] = cx * ay - cy * ax;\r\n out[7] = 0;\r\n\r\n out[8] = ay * bz - az * by;\r\n out[9] = az * bx - ax * bz;\r\n out[10] = ax * by - ay * bx;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the translation vector component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslation,\r\n * the returned vector will be the same as the translation vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive translation component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getTranslation(out: Vec3Like, mat: Readonly): Vec3Like {\r\n out[0] = mat[12];\r\n out[1] = mat[13];\r\n out[2] = mat[14];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the scaling factor component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslationScale\r\n * with a normalized Quaternion parameter, the returned vector will be\r\n * the same as the scaling vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive scaling factor component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getScaling(out: Vec3Like, mat: Readonly): Vec3Like {\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a quaternion representing the rotational component\r\n * of a transformation matrix. If a matrix is built with\r\n * fromRotationTranslation, the returned quaternion will be the\r\n * same as the quaternion originally supplied.\r\n * @category Static\r\n *\r\n * @param out - Quaternion to receive the rotation component\r\n * @param mat - Matrix to be decomposed (input)\r\n * @return `out`\r\n */\r\n static getRotation(out: QuatLike, mat: Readonly): QuatLike {\r\n Mat4.getScaling(Mat4.#TMP_VEC3, mat);\r\n\r\n const is1 = 1 / Mat4.#TMP_VEC3[0];\r\n const is2 = 1 / Mat4.#TMP_VEC3[1];\r\n const is3 = 1 / Mat4.#TMP_VEC3[2];\r\n\r\n const sm11 = mat[0] * is1;\r\n const sm12 = mat[1] * is2;\r\n const sm13 = mat[2] * is3;\r\n const sm21 = mat[4] * is1;\r\n const sm22 = mat[5] * is2;\r\n const sm23 = mat[6] * is3;\r\n const sm31 = mat[8] * is1;\r\n const sm32 = mat[9] * is2;\r\n const sm33 = mat[10] * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out[3] = 0.25 * S;\r\n out[0] = (sm23 - sm32) / S;\r\n out[1] = (sm31 - sm13) / S;\r\n out[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out[3] = (sm23 - sm32) / S;\r\n out[0] = 0.25 * S;\r\n out[1] = (sm12 + sm21) / S;\r\n out[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out[3] = (sm31 - sm13) / S;\r\n out[0] = (sm12 + sm21) / S;\r\n out[1] = 0.25 * S;\r\n out[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out[3] = (sm12 - sm21) / S;\r\n out[0] = (sm31 + sm13) / S;\r\n out[1] = (sm23 + sm32) / S;\r\n out[2] = 0.25 * S;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Decomposes a transformation matrix into its rotation, translation\r\n * and scale components. Returns only the rotation component\r\n * @category Static\r\n *\r\n * @param out_r - Quaternion to receive the rotation component\r\n * @param out_t - Vector to receive the translation vector\r\n * @param out_s - Vector to receive the scaling factor\r\n * @param mat - Matrix to be decomposed (input)\r\n * @returns `out_r`\r\n */\r\n static decompose(out_r: QuatLike, out_t: Vec3Like, out_s: Vec3Like, mat: Readonly): QuatLike {\r\n out_t[0] = mat[12];\r\n out_t[1] = mat[13];\r\n out_t[2] = mat[14];\r\n\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n const is1 = 1 / out_s[0];\r\n const is2 = 1 / out_s[1];\r\n const is3 = 1 / out_s[2];\r\n\r\n const sm11 = m11 * is1;\r\n const sm12 = m12 * is2;\r\n const sm13 = m13 * is3;\r\n const sm21 = m21 * is1;\r\n const sm22 = m22 * is2;\r\n const sm23 = m23 * is3;\r\n const sm31 = m31 * is1;\r\n const sm32 = m32 * is2;\r\n const sm33 = m33 * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out_r[3] = 0.25 * S;\r\n out_r[0] = (sm23 - sm32) / S;\r\n out_r[1] = (sm31 - sm13) / S;\r\n out_r[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out_r[3] = (sm23 - sm32) / S;\r\n out_r[0] = 0.25 * S;\r\n out_r[1] = (sm12 + sm21) / S;\r\n out_r[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out_r[3] = (sm31 - sm13) / S;\r\n out_r[0] = (sm12 + sm21) / S;\r\n out_r[1] = 0.25 * S;\r\n out_r[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out_r[3] = (sm12 - sm21) / S;\r\n out_r[0] = (sm31 + sm13) / S;\r\n out_r[1] = (sm23 + sm32) / S;\r\n out_r[2] = 0.25 * S;\r\n }\r\n\r\n return out_r;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScale(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n out[0] = (1 - (yy + zz)) * sx;\r\n out[1] = (xy + wz) * sx;\r\n out[2] = (xz - wy) * sx;\r\n out[3] = 0;\r\n out[4] = (xy - wz) * sy;\r\n out[5] = (1 - (xx + zz)) * sy;\r\n out[6] = (yz + wx) * sy;\r\n out[7] = 0;\r\n out[8] = (xz + wy) * sz;\r\n out[9] = (yz - wx) * sz;\r\n out[10] = (1 - (xx + yy)) * sz;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the\r\n * given origin. This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * mat4.translate(dest, origin);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n * mat4.translate(dest, negativeOrigin);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @param o - The origin vector around which to scale and rotate\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScaleOrigin(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly, o: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n const ox = o[0];\r\n const oy = o[1];\r\n const oz = o[2];\r\n\r\n const out0 = (1 - (yy + zz)) * sx;\r\n const out1 = (xy + wz) * sx;\r\n const out2 = (xz - wy) * sx;\r\n const out4 = (xy - wz) * sy;\r\n const out5 = (1 - (xx + zz)) * sy;\r\n const out6 = (yz + wx) * sy;\r\n const out8 = (xz + wy) * sz;\r\n const out9 = (yz - wx) * sz;\r\n const out10 = (1 - (xx + yy)) * sz;\r\n\r\n out[0] = out0;\r\n out[1] = out1;\r\n out[2] = out2;\r\n out[3] = 0;\r\n out[4] = out4;\r\n out[5] = out5;\r\n out[6] = out6;\r\n out[7] = 0;\r\n out[8] = out8;\r\n out[9] = out9;\r\n out[10] = out10;\r\n out[11] = 0;\r\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\r\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\r\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 4x4 matrix from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Quaternion to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat4Like, q: Readonly): Mat4Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[1] = yx + wz;\r\n out[2] = zx - wy;\r\n out[3] = 0;\r\n\r\n out[4] = yx - wz;\r\n out[5] = 1 - xx - zz;\r\n out[6] = zy + wx;\r\n out[7] = 0;\r\n\r\n out[8] = zx + wy;\r\n out[9] = zy - wx;\r\n out[10] = 1 - xx - yy;\r\n out[11] = 0;\r\n\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.frustumNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly\r\n */\r\n static frustum(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like { return out; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveNO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.perspectiveNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static perspective(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveZO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating\r\n * projection matrices to be used with the still experimental WebVR API.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n * @deprecated\r\n */\r\n static perspectiveFromFieldOfView(out: Mat4Like,\r\n fov: { upDegrees: number, downDegrees: number, leftDegrees: number, rightDegrees: number }, near: number,\r\n far: number): Mat4Like {\r\n\r\n const upTan = Math.tan((fov.upDegrees * Math.PI) / 180.0);\r\n const downTan = Math.tan((fov.downDegrees * Math.PI) / 180.0);\r\n const leftTan = Math.tan((fov.leftDegrees * Math.PI) / 180.0);\r\n const rightTan = Math.tan((fov.rightDegrees * Math.PI) / 180.0);\r\n const xScale = 2.0 / (leftTan + rightTan);\r\n const yScale = 2.0 / (upTan + downTan);\r\n\r\n out[0] = xScale;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n out[4] = 0.0;\r\n out[5] = yScale;\r\n out[6] = 0.0;\r\n out[7] = 0.0;\r\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\r\n out[9] = (upTan - downTan) * yScale * 0.5;\r\n out[10] = far / (near - far);\r\n out[11] = -1.0;\r\n out[12] = 0.0;\r\n out[13] = 0.0;\r\n out[14] = (far * near) / (near - far);\r\n out[15] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 2 * nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = (far + near) * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.orthoNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static ortho(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, far: number):\r\n Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = near * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that\r\n * actually makes an object look at another object, you should use targetTo instead.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param center - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static lookAt(out: Mat4Like, eye: Readonly, center: Readonly, up: Readonly): Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n const centerx = center[0];\r\n const centery = center[1];\r\n const centerz = center[2];\r\n\r\n if (\r\n Math.abs(eyex - centerx) < GLM_EPSILON &&\r\n Math.abs(eyey - centery) < GLM_EPSILON &&\r\n Math.abs(eyez - centerz) < GLM_EPSILON\r\n ) {\r\n return Mat4.identity(out);\r\n }\r\n\r\n let z0 = eyex - centerx;\r\n let z1 = eyey - centery;\r\n let z2 = eyez - centerz;\r\n\r\n let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\r\n if (!len) {\r\n x0 = 0;\r\n x1 = 0;\r\n x2 = 0;\r\n } else {\r\n len = 1 / len;\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n let y0 = z1 * x2 - z2 * x1;\r\n let y1 = z2 * x0 - z0 * x2;\r\n let y2 = z0 * x1 - z1 * x0;\r\n\r\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\r\n if (!len) {\r\n y0 = 0;\r\n y1 = 0;\r\n y2 = 0;\r\n } else {\r\n len = 1 / len;\r\n y0 *= len;\r\n y1 *= len;\r\n y2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = y0;\r\n out[2] = z0;\r\n out[3] = 0;\r\n out[4] = x1;\r\n out[5] = y1;\r\n out[6] = z1;\r\n out[7] = 0;\r\n out[8] = x2;\r\n out[9] = y2;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\r\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\r\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a matrix that makes something look at something else.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param target - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static targetTo(out: Mat4Like, eye: Readonly, target: Readonly, up: Readonly):\r\n Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n\r\n let z0 = eyex - target[0];\r\n let z1 = eyey - target[1];\r\n let z2 = eyez - target[2];\r\n\r\n let len = z0 * z0 + z1 * z1 + z2 * z2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n }\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n\r\n len = x0 * x0 + x1 * x1 + x2 * x2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = x1;\r\n out[2] = x2;\r\n out[3] = 0;\r\n out[4] = z1 * x2 - z2 * x1;\r\n out[5] = z2 * x0 - z0 * x2;\r\n out[6] = z0 * x1 - z1 * x0;\r\n out[7] = 0;\r\n out[8] = z0;\r\n out[9] = z1;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = eyex;\r\n out[13] = eyey;\r\n out[14] = eyez;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8] +\r\n a[9] * a[9] +\r\n a[10] * a[10] +\r\n a[11] * a[11] +\r\n a[12] * a[12] +\r\n a[13] * a[13] +\r\n a[14] * a[14] +\r\n a[15] * a[15]\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n out[9] = a[9] + b[9];\r\n out[10] = a[10] + b[10];\r\n out[11] = a[11] + b[11];\r\n out[12] = a[12] + b[12];\r\n out[13] = a[13] + b[13];\r\n out[14] = a[14] + b[14];\r\n out[15] = a[15] + b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n out[9] = a[9] - b[9];\r\n out[10] = a[10] - b[10];\r\n out[11] = a[11] - b[11];\r\n out[12] = a[12] - b[12];\r\n out[13] = a[13] - b[13];\r\n out[14] = a[14] - b[14];\r\n out[15] = a[15] - b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Multiply each element of the matrix by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat4Like, a: Readonly, b: number): Mat4Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n out[9] = a[9] * b;\r\n out[10] = a[10] * b;\r\n out[11] = a[11] * b;\r\n out[12] = a[12] * b;\r\n out[13] = a[13] * b;\r\n out[14] = a[14] * b;\r\n out[15] = a[15] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat4Like, a: Readonly, b: Readonly, scale: number): Mat4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n out[9] = a[9] + b[9] * scale;\r\n out[10] = a[10] + b[10] * scale;\r\n out[11] = a[11] + b[11] * scale;\r\n out[12] = a[12] + b[12] * scale;\r\n out[13] = a[13] + b[13] * scale;\r\n out[14] = a[14] + b[14] * scale;\r\n out[15] = a[15] + b[15] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8] &&\r\n a[9] === b[9] &&\r\n a[10] === b[10] &&\r\n a[11] === b[11] &&\r\n a[12] === b[12] &&\r\n a[13] === b[13] &&\r\n a[14] === b[14] &&\r\n a[15] === b[15]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n const a9 = a[9];\r\n const a10 = a[10];\r\n const a11 = a[11];\r\n const a12 = a[12];\r\n const a13 = a[13];\r\n const a14 = a[14];\r\n const a15 = a[15];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n const b9 = b[9];\r\n const b10 = b[10];\r\n const b11 = b[11];\r\n const b12 = b[12];\r\n const b13 = b[13];\r\n const b14 = b[14];\r\n const b15 = b[15];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) &&\r\n Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) &&\r\n Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) &&\r\n Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) &&\r\n Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) &&\r\n Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) &&\r\n Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) &&\r\n Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat4(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat4.prototype.mul = Mat4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat4.sub = Mat4.subtract;\r\nMat4.mul = Mat4.multiply;\r\nMat4.frustum = Mat4.frustumNO;\r\nMat4.perspective = Mat4.perspectiveNO;\r\nMat4.ortho = Mat4.orthoNO;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, Mat4Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 3 Dimensional Vector\r\n */\r\nexport class Vec3 extends Float64Array {\r\n /**\r\n * Create a {@link Vec3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 3:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 3); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 3);\r\n }\r\n break;\r\n }\r\n default:\r\n super(3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec3.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec3.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec3} to `this`.\r\n * Equivalent to `Vec3.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec3} from `this`.\r\n * Equivalent to `Vec3.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec3.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec3.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec3.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec3.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec3.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to its absolute value.\r\n * Equivalent to `Vec3.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec3}.\r\n * Equivalent to `Vec3.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec3.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec3.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 3 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty vec3\r\n * @category Static\r\n *\r\n * @returns a new 3D vector\r\n */\r\n static create(): Vec3 {\r\n return new Vec3();\r\n }\r\n\r\n /**\r\n * Creates a new vec3 initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 3D vector\r\n */\r\n static clone(a: Readonly): Vec3 {\r\n return new Vec3(a);\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Creates a new vec3 initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns a new 3D vector\r\n */\r\n static fromValues(x: number, y: number, z: number): Vec3 {\r\n return new Vec3(x, y, z);\r\n }\r\n\r\n /**\r\n * Copy the values from one vec3 to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns `out`\r\n */\r\n static set(out: Vec3Like, x: number, y: number, z: number): Vec3Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Multiplies two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; }\r\n\r\n /**\r\n * Divides two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Math.ceil the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * symmetric round the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n /*\r\n static round(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = glMatrix.round(a[0]);\r\n out[1] = glMatrix.round(a[1]);\r\n out[2] = glMatrix.round(a[2]);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Scales a vec3 by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec3Like, a: Readonly, scale: number): Vec3Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two vec3's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec3Like, a: Readonly, b: Readonly, scale: number) {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared length of a vec3\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec3Like, a: Readonly): Vec3Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n let len = x * x + y * y + z * z;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n out[2] = a[2] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2];\r\n const bx = b[0],\r\n by = b[1],\r\n bz = b[2];\r\n\r\n out[0] = ay * bz - az * by;\r\n out[1] = az * bx - ax * bz;\r\n out[2] = ax * by - ay * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const angle = Math.acos(Math.min(Math.max(Vec3.dot(a, b), -1), 1));\r\n const sinTotal = Math.sin(angle);\r\n\r\n const ratioA = Math.sin((1 - t) * angle) / sinTotal;\r\n const ratioB = Math.sin(t * angle) / sinTotal;\r\n out[0] = ratioA * a[0] + ratioB * b[0];\r\n out[1] = ratioA * a[1] + ratioB * b[1];\r\n out[2] = ratioA * a[2] + ratioB * b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a hermite interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static hermite(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const factorTimes2 = t * t;\r\n const factor1 = factorTimes2 * (2 * t - 3) + 1;\r\n const factor2 = factorTimes2 * (t - 2) + t;\r\n const factor3 = factorTimes2 * (t - 1);\r\n const factor4 = factorTimes2 * (3 - 2 * t);\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a bezier interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static bezier(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const inverseFactor = 1 - t;\r\n const inverseFactorTimesTwo = inverseFactor * inverseFactor;\r\n const factorTimes2 = t * t;\r\n const factor1 = inverseFactorTimesTwo * inverseFactor;\r\n const factor2 = 3 * t * inverseFactorTimesTwo;\r\n const factor3 = 3 * factorTimes2 * inverseFactor;\r\n const factor4 = factorTimes2 * t;\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec3Like, scale) {\r\n scale = scale === undefined ? 1.0 : scale;\r\n\r\n let r = glMatrix.RANDOM() * 2.0 * Math.PI;\r\n let z = glMatrix.RANDOM() * 2.0 - 1.0;\r\n let zScale = Math.sqrt(1.0 - z * z) * scale;\r\n\r\n out[0] = Math.cos(r) * zScale;\r\n out[1] = Math.sin(r) * zScale;\r\n out[2] = z * scale;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the vec3 with a mat4.\r\n * 4th vector component is implicitly '1'\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec3Like, a: Readonly, m: Readonly): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1.0;\r\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\r\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\r\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a mat3.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - the 3x3 matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat3(out: Vec3Like, a: Vec3Like, m: Mat3Like): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n out[0] = x * m[0] + y * m[3] + z * m[6];\r\n out[1] = x * m[1] + y * m[4] + z * m[7];\r\n out[2] = x * m[2] + y * m[5] + z * m[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a quat\r\n * Can also be used for dual quaternions. (Multiply it with the real part)\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec3Like, a: Readonly, q: Readonly): Vec3Like {\r\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const w2 = q[3] * 2;\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n // var qvec = [qx, qy, qz];\r\n // var uv = vec3.cross([], qvec, a);\r\n const uvx = (qy * z - qz * y);\r\n const uvy = (qz * x - qx * z);\r\n const uvz = (qx * y - qy * x);\r\n // var uuv = vec3.cross([], qvec, uv);\r\n // vec3.scale(uuv, uuv, 2);\r\n const uuvx = (qy * uvz - qz * uvy) * 2;\r\n const uuvy = (qz * uvx - qx * uvz) * 2;\r\n const uuvz = (qx * uvy - qy * uvx) * 2;\r\n // vec3.scale(uv, uv, 2 * w);\r\n // return vec3.add(out, a, vec3.add(out, uv, uuv));\r\n out[0] = x + (uvx * w2) + uuvx;\r\n out[1] = y + (uvy * w2) + uuvy;\r\n out[2] = z + (uvz * w2) + uuvz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the x-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateX(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const by = b[1];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const py = a[1] - by;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = a[0];\r\n out[1] = (py * Math.cos(rad) - pz * Math.sin(rad)) + by;\r\n out[2] = (py * Math.sin(rad) + pz * Math.cos(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the y-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateY(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (pz * Math.sin(rad) + px * Math.cos(rad)) + bx;\r\n out[1] = a[1];\r\n out[2] = (pz * Math.cos(rad) - px * Math.sin(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the z-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const by = b[1];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const py = a[1] - by;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (px * Math.cos(rad) - py * Math.sin(rad)) + bx;\r\n out[1] = (px * Math.sin(rad) + py * Math.cos(rad)) + by;\r\n out[2] = b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 3D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly) {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz));\r\n const cosine = mag && Vec3.dot(a, b) / mag;\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec3Like): Vec3Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec3(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec3.prototype.sub = Vec3.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.mul = Vec3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.div = Vec3.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.dist = Vec3.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.sqrDist = Vec3.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec3.sub = Vec3.subtract;\r\nVec3.mul = Vec3.multiply;\r\nVec3.div = Vec3.divide;\r\nVec3.dist = Vec3.distance;\r\nVec3.sqrDist = Vec3.squaredDistance;\r\nVec3.sqrLen = Vec3.squaredLength;\r\nVec3.mag = Vec3.magnitude;\r\nVec3.length = Vec3.magnitude;\r\nVec3.len = Vec3.magnitude;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Vec4Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 4 Dimensional Vector\r\n */\r\nexport class Vec4 extends Float64Array {\r\n /**\r\n * Create a {@link Vec4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the vector. Equivalent to `this[3];`\r\n * @category Vector Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The a component of the vector. Equivalent to `this[3];`\r\n * @category Color Components\r\n */\r\n get a(): number { return this[3]; }\r\n set a(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec4.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec4} to `this`.\r\n * Equivalent to `Vec4.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n this[3] += b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec4} from `this`.\r\n * Equivalent to `Vec4.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n this[3] -= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n this[3] *= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n this[3] /= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec4.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n this[3] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n this[3] += b[3] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec4.distance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec4.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec4.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n this[3] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec4.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n this[3] = 1.0 / this[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec4.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n this[3] = Math.abs(this[3]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec4}.\r\n * Equivalent to `Vec4.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec4.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec4.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec4}\r\n * @category Static\r\n *\r\n * @returns a new 4D vector\r\n */\r\n static create(): Vec4 {\r\n return new Vec4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 4D vector\r\n */\r\n static clone(a: Vec4Like): Vec4 {\r\n return new Vec4(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new 4D vector\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Vec4 {\r\n return new Vec4(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec4} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n static set(out: Vec4Like, x: number, y: number, z: number, w: number): Vec4Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n out[3] = a[3] * b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Divides two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n out[3] = a[3] / b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n out[3] = Math.ceil(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n out[3] = Math.floor(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n out[3] = Math.min(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n out[3] = Math.max(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n out[2] = Math.round(a[2]);\r\n out[3] = Math.round(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec4} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec4Like, a: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}'s after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec4Like, a: Readonly, b: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return Math.hypot(x, y, z, w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of `a`\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = -a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n out[3] = 1.0 / a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n out[3] = Math.abs(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec4Like, a: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n let len = x * x + y * y + z * z + w * w;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = x * len;\r\n out[1] = y * len;\r\n out[2] = z * len;\r\n out[3] = w * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Returns the cross-product of three vectors in a 4-dimensional space\r\n * @category Static\r\n *\r\n * @param out the receiving vector\r\n * @param u - the first vector\r\n * @param v - the second vector\r\n * @param w - the third vector\r\n * @returns result\r\n */\r\n static cross(out: Vec4Like, u: Readonly, v: Readonly, w: Readonly): Vec4Like {\r\n const a = v[0] * w[1] - v[1] * w[0];\r\n const b = v[0] * w[2] - v[2] * w[0];\r\n const c = v[0] * w[3] - v[3] * w[0];\r\n const d = v[1] * w[2] - v[2] * w[1];\r\n const e = v[1] * w[3] - v[3] * w[1];\r\n const f = v[2] * w[3] - v[3] * w[2];\r\n const g = u[0];\r\n const h = u[1];\r\n const i = u[2];\r\n const j = u[3];\r\n\r\n out[0] = h * f - i * e + j * d;\r\n out[1] = -(g * f) + i * c - j * b;\r\n out[2] = g * e - h * c + j * a;\r\n out[3] = -(g * d) + h * b - i * a;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec4Like, a: Readonly, b: Readonly, t: number): Vec4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n out[3] = aw + t * (b[3] - aw);\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec4Like, scale): Vec4Like {\r\n scale = scale || 1.0;\r\n\r\n // Marsaglia, George. Choosing a Point from the Surface of a\r\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\r\n // http://projecteuclid.org/euclid.aoms/1177692644;\r\n var v1, v2, v3, v4;\r\n var s1, s2;\r\n do {\r\n v1 = glMatrix.RANDOM() * 2 - 1;\r\n v2 = glMatrix.RANDOM() * 2 - 1;\r\n s1 = v1 * v1 + v2 * v2;\r\n } while (s1 >= 1);\r\n do {\r\n v3 = glMatrix.RANDOM() * 2 - 1;\r\n v4 = glMatrix.RANDOM() * 2 - 1;\r\n s2 = v3 * v3 + v4 * v4;\r\n } while (s2 >= 1);\r\n\r\n var d = Math.sqrt((1 - s1) / s2);\r\n out[0] = scale * v1;\r\n out[1] = scale * v2;\r\n out[2] = scale * v3 * d;\r\n out[3] = scale * v4 * d;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Mat4}.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec4Like, a: Readonly, m: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\r\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\r\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\r\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec4Like, a: Readonly, q: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n\r\n // calculate quat * vec\r\n const ix = qw * x + qy * z - qz * y;\r\n const iy = qw * y + qz * x - qx * z;\r\n const iz = qw * z + qx * y - qy * x;\r\n const iw = -qx * x - qy * y - qz * z;\r\n\r\n // calculate result * inverse quat\r\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\r\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\r\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec4Like): Vec4Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec4(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec4.prototype.sub = Vec4.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.mul = Vec4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.div = Vec4.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.dist = Vec4.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.sqrDist = Vec4.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec4.sub = Vec4.subtract;\r\nVec4.mul = Vec4.multiply;\r\nVec4.div = Vec4.divide;\r\nVec4.dist = Vec4.distance;\r\nVec4.sqrDist = Vec4.squaredDistance;\r\nVec4.sqrLen = Vec4.squaredLength;\r\nVec4.mag = Vec4.magnitude;\r\nVec4.length = Vec4.magnitude;\r\nVec4.len = Vec4.magnitude;\r\n", "import { Vec3 } from './Vec3.js';\r\nimport { Vec4 } from './Vec4.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Quaternion\r\n */\r\nexport class Quat extends Float64Array {\r\n static #DEFAULT_ANGLE_ORDER = 'zyx';\r\n\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT1 = new Float64Array(4);\r\n static #TMP_QUAT2 = new Float64Array(4);\r\n static #TMP_MAT3 = new Float64Array(9);\r\n\r\n static #TMP_VEC3 = new Float64Array(3);\r\n static #X_UNIT_VEC3 = new Float64Array([1, 0, 0]);\r\n static #Y_UNIT_VEC3 = new Float64Array([0, 1, 0]);\r\n\r\n /**\r\n * Create a {@link Quat}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the quaternion. Equivalent to `this[0];`\r\n * @category Quaternion Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the quaternion. Equivalent to `this[1];`\r\n * @category Quaternion Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the quaternion. Equivalent to `this[2];`\r\n * @category Quaternion Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the quaternion. Equivalent to `this[3];`\r\n * @category Quaternion Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Quat.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity quaternion\r\n * Equivalent to Quat.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this[0] = 0;\r\n this[1] = 0;\r\n this[2] = 0;\r\n this[3] = 1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies `this` by a {@link Quat}.\r\n * Equivalent to `Quat.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Quat.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Rotates `this` by the given angle about the X axis\r\n * Equivalent to `Quat.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Quat.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Y axis\r\n * Equivalent to `Quat.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Quat.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Z axis\r\n * Equivalent to `Quat.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Quat.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Inverts `this`\r\n * Equivalent to `Quat.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Quat.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales `this` by a scalar number\r\n * Equivalent to `Quat.scale(this, this, scale);`\r\n * @category Methods\r\n *\r\n * @param scale - amount to scale the vector by\r\n * @returns `this`\r\n */\r\n scale(scale: number): QuatLike {\r\n this[0] *= scale;\r\n this[1] *= scale;\r\n this[2] *= scale;\r\n this[3] *= scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of `this` and another {@link Quat}\r\n * Equivalent to `Quat.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - the second operand\r\n * @returns dot product of `this` and b\r\n */\r\n dot(b: Readonly): number {\r\n return Quat.dot(this, b);\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity quat\r\n * @category Static\r\n *\r\n * @returns a new quaternion\r\n */\r\n static create(): Quat {\r\n return new Quat();\r\n }\r\n\r\n /**\r\n * Set a quat to the identity quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a quat from the given angle and rotation axis,\r\n * then returns it.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param axis - the axis around which to rotate\r\n * @param rad - the angle in radians\r\n * @returns `out`\r\n **/\r\n static setAxisAngle(out: QuatLike, axis: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n out[0] = s * axis[0];\r\n out[1] = s * axis[1];\r\n out[2] = s * axis[2];\r\n out[3] = Math.cos(rad);\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the rotation axis and angle for a given\r\n * quaternion. If a quaternion is created with\r\n * setAxisAngle, this method will return the same\r\n * values as provided in the original parameter list\r\n * OR functionally equivalent values.\r\n * Example: The quaternion formed by axis [0, 0, 1] and\r\n * angle -90 is the same as the quaternion formed by\r\n * [0, 0, 1] and 270. This method favors the latter.\r\n * @category Static\r\n *\r\n * @param out_axis - Vector receiving the axis of rotation\r\n * @param q - Quaternion to be decomposed\r\n * @return Angle, in radians, of the rotation\r\n */\r\n static getAxisAngle(out_axis: Vec3Like, q: Readonly): number {\r\n const rad = Math.acos(q[3]) * 2.0;\r\n const s = Math.sin(rad / 2.0);\r\n if (s > GLM_EPSILON) {\r\n out_axis[0] = q[0] / s;\r\n out_axis[1] = q[1] / s;\r\n out_axis[2] = q[2] / s;\r\n } else {\r\n // If s is zero, return any axis (no rotation - axis does not matter)\r\n out_axis[0] = 1;\r\n out_axis[1] = 0;\r\n out_axis[2] = 0;\r\n }\r\n return rad;\r\n }\r\n\r\n /**\r\n * Gets the angular distance between two unit quaternions\r\n * @category Static\r\n *\r\n * @param {ReadonlyQuat} a Origin unit quaternion\r\n * @param {ReadonlyQuat} b Destination unit quaternion\r\n * @return {Number} Angle, in radians, between the two quaternions\r\n */\r\n static getAngle(a: Readonly, b: Readonly): number {\r\n const dotproduct = Quat.dot(a, b);\r\n\r\n return Math.acos(2 * dotproduct * dotproduct - 1);\r\n }\r\n\r\n /**\r\n * Multiplies two quaternions.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const bw = b[3];\r\n\r\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the X axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + aw * bx;\r\n out[1] = ay * bw + az * bx;\r\n out[2] = az * bw - ay * bx;\r\n out[3] = aw * bw - ax * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Y axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const by = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw - az * by;\r\n out[1] = ay * bw + aw * by;\r\n out[2] = az * bw + ax * by;\r\n out[3] = aw * bw - ay * by;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Z axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bz = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + ay * bz;\r\n out[1] = ay * bw - ax * bz;\r\n out[2] = az * bw + aw * bz;\r\n out[3] = aw * bw - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the W component of a quat from the X, Y, and Z components.\r\n * Assumes that quaternion is 1 unit in length.\r\n * Any existing W component will be ignored.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate W component of\r\n * @returns `out`\r\n */\r\n static calculateW(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the exponential of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static exp(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const et = Math.exp(w);\r\n const s = r > 0 ? (et * Math.sin(r)) / r : 0;\r\n\r\n out[0] = x * s;\r\n out[1] = y * s;\r\n out[2] = z * s;\r\n out[3] = et * Math.cos(r);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the natural logarithm of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static ln(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const t = r > 0 ? Math.atan2(r, w) / r : 0;\r\n\r\n out[0] = x * t;\r\n out[1] = y * t;\r\n out[2] = z * t;\r\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the scalar power of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @param b - amount to scale the quaternion by\r\n * @returns `out`\r\n */\r\n static pow(out: QuatLike, a: Readonly, b: number): QuatLike {\r\n Quat.ln(out, a);\r\n Quat.scale(out, out, b);\r\n Quat.exp(out, out);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike {\r\n // benchmarks:\r\n // http://jsperf.com/quaternion-slerp-implementations\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2],\r\n aw = a[3];\r\n let bx = b[0],\r\n by = b[1],\r\n bz = b[2],\r\n bw = b[3];\r\n\r\n let scale0: number;\r\n let scale1: number;\r\n\r\n // calc cosine\r\n let cosom = ax * bx + ay * by + az * bz + aw * bw;\r\n // adjust signs (if necessary)\r\n if (cosom < 0.0) {\r\n cosom = -cosom;\r\n bx = -bx;\r\n by = -by;\r\n bz = -bz;\r\n bw = -bw;\r\n }\r\n // calculate coefficients\r\n if (1.0 - cosom > GLM_EPSILON) {\r\n // standard case (slerp)\r\n const omega = Math.acos(cosom);\r\n const sinom = Math.sin(omega);\r\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\r\n scale1 = Math.sin(t * omega) / sinom;\r\n } else {\r\n // \"from\" and \"to\" quaternions are very close\r\n // ... so we can do a linear interpolation\r\n scale0 = 1.0 - t;\r\n scale1 = t;\r\n }\r\n // calculate final values\r\n out[0] = scale0 * ax + scale1 * bx;\r\n out[1] = scale0 * ay + scale1 * by;\r\n out[2] = scale0 * az + scale1 * bz;\r\n out[3] = scale0 * aw + scale1 * bw;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random unit quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n /* static random(out: QuatLike): QuatLike {\r\n // Implementation of http://planning.cs.uiuc.edu/node198.html\r\n // TODO: Calling random 3 times is probably not the fastest solution\r\n let u1 = glMatrix.RANDOM();\r\n let u2 = glMatrix.RANDOM();\r\n let u3 = glMatrix.RANDOM();\r\n\r\n let sqrt1MinusU1 = Math.sqrt(1 - u1);\r\n let sqrtU1 = Math.sqrt(u1);\r\n\r\n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\r\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\r\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\r\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Calculates the inverse of a quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: QuatLike, a: Readonly): QuatLike {\r\n const a0 = a[0],\r\n a1 = a[1],\r\n a2 = a[2],\r\n a3 = a[3];\r\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\r\n const invDot = dot ? 1.0 / dot : 0;\r\n\r\n // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\r\n\r\n out[0] = -a0 * invDot;\r\n out[1] = -a1 * invDot;\r\n out[2] = -a2 * invDot;\r\n out[3] = a3 * invDot;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a quat\r\n * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given 3x3 rotation matrix.\r\n *\r\n * NOTE: The resultant quaternion is not normalized, so you should be sure\r\n * to re-normalize the quaternion yourself where necessary.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param m - rotation matrix\r\n * @returns `out`\r\n */\r\n static fromMat3(out: QuatLike, m: Readonly): QuatLike {\r\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\r\n // article \"Quaternion Calculus and Fast Animation\".\r\n const fTrace = m[0] + m[4] + m[8];\r\n let fRoot: number;\r\n\r\n if (fTrace > 0.0) {\r\n // |w| > 1/2, may as well choose w > 1/2\r\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\r\n out[3] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot; // 1/(4w)\r\n out[0] = (m[5] - m[7]) * fRoot;\r\n out[1] = (m[6] - m[2]) * fRoot;\r\n out[2] = (m[1] - m[3]) * fRoot;\r\n } else {\r\n // |w| <= 1/2\r\n let i = 0;\r\n if (m[4] > m[0]) { i = 1; }\r\n if (m[8] > m[i * 3 + i]) { i = 2; }\r\n const j = (i + 1) % 3;\r\n const k = (i + 2) % 3;\r\n\r\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\r\n out[i] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot;\r\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\r\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\r\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given euler angle x, y, z.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - Angle to rotate around X axis in degrees.\r\n * @param y - Angle to rotate around Y axis in degrees.\r\n * @param z - Angle to rotate around Z axis in degrees.\r\n * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx.\r\n * @returns `out`\r\n */\r\n static fromEuler(out: QuatLike, x: number, y: number, z: number, order = Quat.#DEFAULT_ANGLE_ORDER): QuatLike {\r\n const halfToRad = (0.5 * Math.PI) / 180.0;\r\n x *= halfToRad;\r\n y *= halfToRad;\r\n z *= halfToRad;\r\n\r\n const sx = Math.sin(x);\r\n const cx = Math.cos(x);\r\n const sy = Math.sin(y);\r\n const cy = Math.cos(y);\r\n const sz = Math.sin(z);\r\n const cz = Math.cos(z);\r\n\r\n switch (order) {\r\n case 'xyz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'xzy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yxz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yzx':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zxy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zyx':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n default:\r\n throw new Error(`Unknown angle order ${order}`);\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a quatenion\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - quaternion to clone\r\n * @returns a new quaternion\r\n */\r\n static clone(a: Readonly): Quat {\r\n return new Quat(a);\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new quaternion\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Quat {\r\n return new Quat(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one quat to another\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the source quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static set(out: QuatLike, x: number, y: number, z: number, w: number): QuatLike { return out; }\r\n\r\n /**\r\n * Adds two {@link Quat}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static add(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Scales a quat by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param b - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: QuatLike, a: Readonly, scale: number): QuatLike {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two quat's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two quat's\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static lerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike { return out; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mag(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quaternion to normalize\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static normalize(out: QuatLike, a: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first quaternion.\r\n * @param b - The second quaternion.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static exactEquals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Returns whether the quaternions have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static equals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Sets a quaternion to represent the shortest rotation from one\r\n * vector to another.\r\n *\r\n * Both vectors are assumed to be unit length.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion.\r\n * @param a - the initial vector\r\n * @param b - the destination vector\r\n * @returns `out`\r\n */\r\n static rotationTo(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const dot = Vec3.dot(a, b);\r\n\r\n if (dot < -0.999999) {\r\n Vec3.cross(Quat.#TMP_VEC3, Quat.#X_UNIT_VEC3, a);\r\n if (Vec3.mag(Quat.#TMP_VEC3) < 0.000001) { Vec3.cross(Quat.#TMP_VEC3, Quat.#Y_UNIT_VEC3, a); }\r\n Vec3.normalize(Quat.#TMP_VEC3, Quat.#TMP_VEC3);\r\n Quat.setAxisAngle(out, Quat.#TMP_VEC3, Math.PI);\r\n return out;\r\n } else if (dot > 0.999999) {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n } else {\r\n Vec3.cross(Quat.#TMP_VEC3, a, b);\r\n out[0] = Quat.#TMP_VEC3[0];\r\n out[1] = Quat.#TMP_VEC3[1];\r\n out[2] = Quat.#TMP_VEC3[2];\r\n out[3] = 1 + dot;\r\n return Quat.normalize(out, out);\r\n }\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static sqlerp(out: QuatLike, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): QuatLike {\r\n Quat.slerp(Quat.#TMP_QUAT1, a, d, t);\r\n Quat.slerp(Quat.#TMP_QUAT2, b, c, t);\r\n Quat.slerp(out, Quat.#TMP_QUAT1, Quat.#TMP_QUAT2, 2 * t * (1 - t));\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets the specified quaternion with values corresponding to the given\r\n * axes. Each axis is a vec3 and is expected to be unit length and\r\n * perpendicular to all other specified axes.\r\n * @category Static\r\n *\r\n * @param out - The receiving quaternion\r\n * @param view - the vector representing the viewing direction\r\n * @param right - the vector representing the local `right` direction\r\n * @param up - the vector representing the local `up` direction\r\n * @returns `out`\r\n */\r\n static setAxes(out: QuatLike, view: Readonly, right: Readonly, up: Readonly): QuatLike {\r\n Quat.#TMP_MAT3[0] = right[0];\r\n Quat.#TMP_MAT3[3] = right[1];\r\n Quat.#TMP_MAT3[6] = right[2];\r\n\r\n Quat.#TMP_MAT3[1] = up[0];\r\n Quat.#TMP_MAT3[4] = up[1];\r\n Quat.#TMP_MAT3[7] = up[2];\r\n\r\n Quat.#TMP_MAT3[2] = -view[0];\r\n Quat.#TMP_MAT3[5] = -view[1];\r\n Quat.#TMP_MAT3[8] = -view[2];\r\n\r\n return Quat.normalize(out, Quat.fromMat3(out, Quat.#TMP_MAT3));\r\n }\r\n}\r\n\r\n// Methods which re-use the Vec4 implementation\r\nQuat.set = Vec4.set;\r\nQuat.add = Vec4.add;\r\nQuat.lerp = Vec4.lerp;\r\nQuat.normalize = Vec4.normalize;\r\nQuat.squaredLength = Vec4.squaredLength;\r\nQuat.sqrLen = Vec4.squaredLength;\r\nQuat.exactEquals = Vec4.exactEquals;\r\nQuat.equals = Vec4.equals;\r\nQuat.magnitude = Vec4.magnitude;\r\n\r\n// Instance method alias assignments\r\nQuat.prototype.mul = Quat.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nQuat.mul = Quat.multiply;\r\nQuat.mag = Quat.magnitude;\r\nQuat.length = Quat.magnitude;\r\nQuat.len = Quat.magnitude;\r\n", "import { Mat4 } from './Mat4.js';\r\nimport { Quat } from './Quat.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Dual Quaternion\r\n */\r\nexport class Quat2 extends Float64Array {\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat2.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT = new Float64Array(4);\r\n static #TMP_VEC3 = new Float64Array(3);\r\n\r\n /**\r\n * Create a {@link Quat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 8:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 8); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v, v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 8);\r\n }\r\n break;\r\n }\r\n default:\r\n super(8);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source dual quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 8 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity {@link Quat2}\r\n * @category Static\r\n *\r\n * @returns a new dual quaternion [real -> rotation, dual -> translation]\r\n */\r\n static create(): Quat2 {\r\n return new Quat2();\r\n }\r\n\r\n /**\r\n * Creates a {@link Quat2} quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to clone\r\n * @returns a new dual quaternion\r\n */\r\n static clone(a: Quat2Like): Quat2 {\r\n return new Quat2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns a new dual quaternion\r\n */\r\n static fromValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2 {\r\n return new Quat2(x1, y1, z1, w1, x2, y2, z2, w2);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} from the given values (quat and translation)\r\n * @category Static\r\n *\r\n * @param x1 - X component (rotation)\r\n * @param y1 - Y component (rotation)\r\n * @param z1 - Z component (rotation)\r\n * @param w1 - W component (rotation)\r\n * @param x2 - X component (translation)\r\n * @param y2 - Y component (translation)\r\n * @param z2 - Z component (translation)\r\n * @returns a new dual quaternion\r\n */\r\n static fromRotationTranslationValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number): Quat2 {\r\n const ax = x2 * 0.5;\r\n const ay = y2 * 0.5;\r\n const az = z2 * 0.5;\r\n\r\n return new Quat2(x1, y1, z1, w1,\r\n ax * w1 + ay * z1 - az * y1,\r\n ay * w1 + az * x1 - ax * z1,\r\n az * w1 + ax * y1 - ay * x1,\r\n -ax * x1 - ay * y1 - az * z1);\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion and a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Quat2Like, q: Readonly, t: Readonly): Quat2Like {\r\n const ax = t[0] * 0.5;\r\n const ay = t[1] * 0.5;\r\n const az = t[2] * 0.5;\r\n const bx = q[0];\r\n const by = q[1];\r\n const bz = q[2];\r\n const bw = q[3];\r\n out[0] = bx;\r\n out[1] = by;\r\n out[2] = bz;\r\n out[3] = bw;\r\n out[4] = ax * bw + ay * bz - az * by;\r\n out[5] = ay * bw + az * bx - ax * bz;\r\n out[6] = az * bw + ax * by - ay * bx;\r\n out[7] = -ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Quat2Like, t: Readonly): Quat2Like {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = t[0] * 0.5;\r\n out[5] = t[1] * 0.5;\r\n out[6] = t[2] * 0.5;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Quat2Like, q: Readonly): Quat2Like {\r\n out[0] = q[0];\r\n out[1] = q[1];\r\n out[2] = q[2];\r\n out[3] = q[3];\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param a - the matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Quat2Like, a: Readonly): Quat2Like {\r\n Mat4.getRotation(Quat2.#TMP_QUAT, a);\r\n Mat4.getTranslation(Quat2.#TMP_VEC3, a);\r\n return Quat2.fromRotationTranslation(out, Quat2.#TMP_QUAT, Quat2.#TMP_VEC3);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Quat2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the source dual quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Quat2} to the identity dual quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns `out`\r\n */\r\n static set(out: Quat2Like, x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2Like {\r\n out[0] = x1;\r\n out[1] = y1;\r\n out[2] = z1;\r\n out[3] = w1;\r\n out[4] = x2;\r\n out[5] = y2;\r\n out[6] = z2;\r\n out[7] = w2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the real part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - real part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getReal(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Gets the dual part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - dual part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getDual(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[4];\r\n out[1] = a[5];\r\n out[2] = a[6];\r\n out[3] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the real component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the real part\r\n * @return `out`\r\n */\r\n static setReal(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Set the dual component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the dual part\r\n * @return `out`\r\n */\r\n static setDual(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[4] = a[0];\r\n out[5] = a[1];\r\n out[6] = a[2];\r\n out[7] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the translation of a normalized {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving translation vector\r\n * @param a - Dual Quaternion to be decomposed\r\n * @return `out`\r\n */\r\n static getTranslation(out: Vec3Like, a: Readonly): Vec3Like {\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Translates a {@link Quat2} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Quat2Like, a: Readonly, v: Readonly): Quat2Like {\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n const bx1 = v[0] * 0.5;\r\n const by1 = v[1] * 0.5;\r\n const bz1 = v[2] * 0.5;\r\n const ax2 = a[4];\r\n const ay2 = a[5];\r\n const az2 = a[6];\r\n const aw2 = a[7];\r\n out[0] = ax1;\r\n out[1] = ay1;\r\n out[2] = az1;\r\n out[3] = aw1;\r\n out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2;\r\n out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2;\r\n out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2;\r\n out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateX(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateY(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateZ(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (a * q)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param q - quaternion to rotate by\r\n * @returns `out`\r\n */\r\n static rotateByQuatAppend(out: Quat2Like, a: Readonly, q: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let ax = a[0];\r\n let ay = a[1];\r\n let az = a[2];\r\n let aw = a[3];\r\n\r\n out[0] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[1] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[2] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[3] = aw * qw - ax * qx - ay * qy - az * qz;\r\n ax = a[4];\r\n ay = a[5];\r\n az = a[6];\r\n aw = a[7];\r\n out[4] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[5] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[6] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[7] = aw * qw - ax * qx - ay * qy - az * qz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (q * a)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param q - quaternion to rotate by\r\n * @param a - the dual quaternion to rotate\r\n * @returns `out`\r\n */\r\n static rotateByQuatPrepend(out: Quat2Like, q: Readonly, a: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let bx = a[0];\r\n let by = a[1];\r\n let bz = a[2];\r\n let bw = a[3];\r\n\r\n out[0] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[1] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[2] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[3] = qw * bw - qx * bx - qy * by - qz * bz;\r\n bx = a[4];\r\n by = a[5];\r\n bz = a[6];\r\n bw = a[7];\r\n out[4] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[5] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[6] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[7] = qw * bw - qx * bx - qy * by - qz * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around a given axis. Does the normalization automatically\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param axis - the axis to rotate around\r\n * @param rad - how far the rotation should be\r\n * @returns `out`\r\n */\r\n static rotateAroundAxis(out: Quat2Like, a: Readonly, axis: Readonly, rad: number): Quat2Like {\r\n // Special case for rad = 0\r\n if (Math.abs(rad) < GLM_EPSILON) {\r\n return Quat2.copy(out, a);\r\n }\r\n const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);\r\n\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n const bx = (s * axis[0]) / axisLength;\r\n const by = (s * axis[1]) / axisLength;\r\n const bz = (s * axis[2]) / axisLength;\r\n const bw = Math.cos(rad);\r\n\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n out[4] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[5] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[6] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[7] = aw * bw - ax * bx - ay * by - az * bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns {quat2} out\r\n */\r\n static multiply(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n const ax0 = a[0];\r\n const ay0 = a[1];\r\n const az0 = a[2];\r\n const aw0 = a[3];\r\n const bx1 = b[4];\r\n const by1 = b[5];\r\n const bz1 = b[6];\r\n const bw1 = b[7];\r\n const ax1 = a[4];\r\n const ay1 = a[5];\r\n const az1 = a[6];\r\n const aw1 = a[7];\r\n const bx0 = b[0];\r\n const by0 = b[1];\r\n const bz0 = b[2];\r\n const bw0 = b[3];\r\n out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0;\r\n out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0;\r\n out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0;\r\n out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0;\r\n out[4] =\r\n ax0 * bw1 +\r\n aw0 * bx1 +\r\n ay0 * bz1 -\r\n az0 * by1 +\r\n ax1 * bw0 +\r\n aw1 * bx0 +\r\n ay1 * bz0 -\r\n az1 * by0;\r\n out[5] =\r\n ay0 * bw1 +\r\n aw0 * by1 +\r\n az0 * bx1 -\r\n ax0 * bz1 +\r\n ay1 * bw0 +\r\n aw1 * by0 +\r\n az1 * bx0 -\r\n ax1 * bz0;\r\n out[6] =\r\n az0 * bw1 +\r\n aw0 * bz1 +\r\n ax0 * by1 -\r\n ay0 * bx1 +\r\n az1 * bw0 +\r\n aw1 * bz0 +\r\n ax1 * by0 -\r\n ay1 * bx0;\r\n out[7] =\r\n aw0 * bw1 -\r\n ax0 * bx1 -\r\n ay0 * by1 -\r\n az0 * bz1 +\r\n aw1 * bw0 -\r\n ax1 * bx0 -\r\n ay1 * by0 -\r\n az1 * bz0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like { return out; }\r\n\r\n /**\r\n * Scales a {@link Quat2} by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaterion\r\n * @param a - the dual quaternion to scale\r\n * @param b - scalar value to scale the dual quaterion by\r\n * @returns `out`\r\n */\r\n static scale(out: Quat2Like, a: Readonly, b: number): Quat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts)\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dot(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Quat2}s\r\n * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quat\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Quat2Like, a: Readonly, b: Readonly, t: number): Quat2Like {\r\n const mt = 1 - t;\r\n if (Quat2.dot(a, b) < 0) { t = -t; }\r\n\r\n out[0] = a[0] * mt + b[0] * t;\r\n out[1] = a[1] * mt + b[1] * t;\r\n out[2] = a[2] * mt + b[2] * t;\r\n out[3] = a[3] * mt + b[3] * t;\r\n out[4] = a[4] * mt + b[4] * t;\r\n out[5] = a[5] * mt + b[5] * t;\r\n out[6] = a[6] * mt + b[6] * t;\r\n out[7] = a[7] * mt + b[7] * t;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: Quat2Like, a: Readonly): Quat2Like {\r\n const sqlen = Quat2.squaredLength(a);\r\n out[0] = -a[0] / sqlen;\r\n out[1] = -a[1] / sqlen;\r\n out[2] = -a[2] / sqlen;\r\n out[3] = a[3] / sqlen;\r\n out[4] = -a[4] / sqlen;\r\n out[5] = -a[5] / sqlen;\r\n out[6] = -a[6] / sqlen;\r\n out[7] = a[7] / sqlen;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than\r\n * {@link Quat2.invert} and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n out[4] = -a[4];\r\n out[5] = -a[5];\r\n out[6] = -a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Quat2Like, a: Readonly): Quat2Like {\r\n let magnitude = Quat2.squaredLength(a);\r\n if (magnitude > 0) {\r\n magnitude = Math.sqrt(magnitude);\r\n\r\n const a0 = a[0] / magnitude;\r\n const a1 = a[1] / magnitude;\r\n const a2 = a[2] / magnitude;\r\n const a3 = a[3] / magnitude;\r\n\r\n const b0 = a[4];\r\n const b1 = a[5];\r\n const b2 = a[6];\r\n const b3 = a[7];\r\n\r\n const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3;\r\n\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n\r\n out[4] = (b0 - a0 * a_dot_b) / magnitude;\r\n out[5] = (b1 - a1 * a_dot_b) / magnitude;\r\n out[6] = (b2 - a2 * a_dot_b) / magnitude;\r\n out[7] = (b3 - a3 * a_dot_b) / magnitude;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat2(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7))\r\n );\r\n }\r\n}\r\n\r\n// Methods which re-use the Quat implementation\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.dot = Quat.dot;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.squaredLength = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.sqrLen = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.mag = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.length = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.len = Quat.magnitude;\r\n\r\n// Static method alias assignments\r\nQuat2.mul = Quat2.multiply;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Mat2dLike, Mat3Like, Mat4Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 2 Dimensional Vector\r\n */\r\nexport class Vec2 extends Float64Array {\r\n /**\r\n * Create a {@link Vec2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 2:{\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, values[1]!]);\r\n } else {\r\n super(v as ArrayBufferLike, values[1], 2);\r\n }\r\n break;\r\n }\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 2);\r\n }\r\n break;\r\n }\r\n default:\r\n super(2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec2.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n return Math.hypot(this[0], this[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec2.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n // Instead of zero(), use a.fill(0) for instances;\r\n\r\n /**\r\n * Adds a {@link Vec2} to `this`.\r\n * Equivalent to `Vec2.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec2} from `this`.\r\n * Equivalent to `Vec2.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec2.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec2.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec2.squaredDistance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec2.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec2.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec2.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec2}.\r\n * Equivalent to `Vec2.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec2.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec2.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 2 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec2}\r\n * @category Static\r\n *\r\n * @returns A new 2D vector\r\n */\r\n static create(): Vec2 {\r\n return new Vec2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - Vector to clone\r\n * @returns A new 2D vector\r\n */\r\n static clone(a: Readonly): Vec2 {\r\n return new Vec2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns A new 2D vector\r\n */\r\n static fromValues(x: number, y: number): Vec2 {\r\n return new Vec2(x, y);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - The source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns `out`\r\n */\r\n static set(out: Vec2Like, x: number, y: number): Vec2Like {\r\n out[0] = x;\r\n out[1] = y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Multiplies two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Divides two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec2} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to scale\r\n * @param b - Amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec2Like, a: Readonly, b: number): Vec2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two Vec2's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param scale - The amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec2Like, a: Readonly, b: Readonly, scale: number): Vec2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns distance between `a` and `b`\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n return Math.hypot(b[0] - a[0], b[1] - a[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Squared distance between `a` and `b`\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return Math.sqrt(x * x + y * y);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate squared length of\r\n * @returns Squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec2Like, a: Readonly) {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec2Like, a: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n let len = x * x + y * y;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Dot product of `a` and `b`\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two {@link Vec2}s\r\n * Note that the cross product must by definition produce a 3D vector.\r\n * For this reason there is also not instance equivalent for this function.\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n const z = a[0] * b[1] - a[1] * b[0];\r\n out[0] = out[1] = 0;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param t - Interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec2Like, a: Readonly, b: Readonly, t: number): Vec2Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y;\r\n out[1] = m[1] * x + m[3] * y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2d}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2d(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y + m[4];\r\n out[1] = m[1] * x + m[3] * y + m[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat3}\r\n * 3rd vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat3(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[3] * y + m[6];\r\n out[1] = m[1] * x + m[4] * y + m[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat4}\r\n * 3rd vector component is implicitly '0'\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat4(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[4] * y + m[12];\r\n out[1] = m[1] * x + m[5] * y + m[13];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 2D vector\r\n * @category Static\r\n *\r\n * @param out - The receiving {@link Vec2}\r\n * @param a - The {@link Vec2} point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotate(out: Vec2Like, a: Readonly, b: Readonly, rad: number): Vec2Like {\r\n // Translate point to the origin\r\n const p0 = a[0] - b[0];\r\n const p1 = a[1] - b[1];\r\n const sinC = Math.sin(rad);\r\n const cosC = Math.cos(rad);\r\n\r\n // perform rotation and translate to correct position\r\n out[0] = p0 * cosC - p1 * sinC + b[0];\r\n out[1] = p0 * sinC + p1 * cosC + b[1];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 2D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly): number {\r\n const x1 = a[0];\r\n const y1 = a[1];\r\n const x2 = b[0];\r\n const y2 = b[1];\r\n // mag is the product of the magnitudes of a and b\r\n const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2);\r\n // mag &&.. short circuits if mag == 0\r\n const cosine = mag && (x1 * x2 + y1 * y2) / mag;\r\n // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to zero\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec2Like): Vec2Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors components are ===, `false` otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors are approximately equal, `false` otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - Vector to represent as a string\r\n * @returns String representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec2.prototype.sub = Vec2.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.mul = Vec2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.div = Vec2.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.dist = Vec2.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.sqrDist = Vec2.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec2.sub = Vec2.subtract;\r\nVec2.mul = Vec2.multiply;\r\nVec2.div = Vec2.divide;\r\nVec2.dist = Vec2.distance;\r\nVec2.sqrDist = Vec2.squaredDistance;\r\nVec2.sqrLen = Vec2.squaredLength;\r\nVec2.mag = Vec2.magnitude;\r\nVec2.length = Vec2.magnitude;\r\nVec2.len = Vec2.magnitude;\r\n", "/**\r\n * To enable additional swizzle accessors for vector classes (64-bit) invoke the {@link EnableSwizzlesF64} function from\r\n * the `gl-matrix/swizzle/f64` sub-path export. To enable ambient module declarations for IDE / Typescript support\r\n * please see {@link gl-matrix/types/swizzle/f64}.\r\n *\r\n * To enable swizzling for the 32-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle}.\r\n *\r\n * @example\r\n * ```ts\r\n * import { Vec3 } from 'gl-matrix/f64';\r\n * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64';\r\n *\r\n * EnableSwizzlesF64();\r\n *\r\n * const vec = new Vec3(0, 1, 2);\r\n * const vecSwizzled = vec.zyx; // Returns a new Vec3(2, 1, 0).\r\n * ```\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\nimport { Vec2, Vec3, Vec4 } from '#gl-matrix/f64';\r\n\r\n/**\r\n * Internal `gl-matrix` variable tracking if swizzling is enabled (64-bit).\r\n */\r\nlet GLM_SWIZZLES_ENABLED_F64 = false;\r\n\r\n/**\r\n * Enables Swizzle operations on {@link gl-matrix/f64.Vec2 | Vec2} / {@link gl-matrix/f64.Vec3 | Vec3} /\r\n * {@link gl-matrix/f64.Vec4 | Vec4} types from {@link gl-matrix/f64} (64-bit).\r\n *\r\n * Swizzle operations are performed by using the `.` operator in conjunction with any combination\r\n * of between two and four component names, either from the set `xyzw` or `rgbw` (though not intermixed).\r\n * They return a new vector with the same number of components as specified in the swizzle attribute.\r\n *\r\n * @example\r\n * ```js\r\n * import { Vec3 } from 'gl-matrix/f64';\r\n * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64';\r\n *\r\n * EnableSwizzlesF64();\r\n *\r\n * let v = new Vec3(0, 1, 2);\r\n *\r\n * v.yx; // returns new Vec2(1, 0)\r\n * v.xzy; // returns new Vec3(0, 2, 1)\r\n * v.zyxz; // returns new Vec4(2, 1, 0, 2)\r\n *\r\n * v.rgb; // returns new Vec3(0, 1, 2)\r\n * v.rbg; // returns new Vec3(0, 2, 1)\r\n * v.gg; // returns new Vec2(1, 1)\r\n * ```\r\n */\r\nexport function EnableSwizzlesF64(): void {\r\n /* v8 ignore next 1 */\r\n if (GLM_SWIZZLES_ENABLED_F64) { return; }\r\n\r\n /* eslint-disable comma-spacing, max-len */\r\n\r\n // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should\r\n // not be modified by hand.\r\n // [Swizzle Autogen]\r\n\r\n const VEC2_SWIZZLES = ['xx','xy','yx','yy','xxx','xxy','xyx','xyy','yxx','yxy','yyx','yyy','xxxx','xxxy','xxyx','xxyy','xyxx','xyxy','xyyx','xyyy','yxxx','yxxy','yxyx','yxyy','yyxx','yyxy','yyyx','yyyy','rr','rg','gr','gg','rrr','rrg','rgr','rgg','grr','grg','ggr','ggg','rrrr','rrrg','rrgr','rrgg','rgrr','rgrg','rggr','rggg','grrr','grrg','grgr','grgg','ggrr','ggrg','gggr','gggg'];\r\n const VEC3_SWIZZLES = ['xz','yz','zx','zy','zz','xxz','xyz','xzx','xzy','xzz','yxz','yyz','yzx','yzy','yzz','zxx','zxy','zxz','zyx','zyy','zyz','zzx','zzy','zzz','xxxz','xxyz','xxzx','xxzy','xxzz','xyxz','xyyz','xyzx','xyzy','xyzz','xzxx','xzxy','xzxz','xzyx','xzyy','xzyz','xzzx','xzzy','xzzz','yxxz','yxyz','yxzx','yxzy','yxzz','yyxz','yyyz','yyzx','yyzy','yyzz','yzxx','yzxy','yzxz','yzyx','yzyy','yzyz','yzzx','yzzy','yzzz','zxxx','zxxy','zxxz','zxyx','zxyy','zxyz','zxzx','zxzy','zxzz','zyxx','zyxy','zyxz','zyyx','zyyy','zyyz','zyzx','zyzy','zyzz','zzxx','zzxy','zzxz','zzyx','zzyy','zzyz','zzzx','zzzy','zzzz','rb','gb','br','bg','bb','rrb','rgb','rbr','rbg','rbb','grb','ggb','gbr','gbg','gbb','brr','brg','brb','bgr','bgg','bgb','bbr','bbg','bbb','rrrb','rrgb','rrbr','rrbg','rrbb','rgrb','rggb','rgbr','rgbg','rgbb','rbrr','rbrg','rbrb','rbgr','rbgg','rbgb','rbbr','rbbg','rbbb','grrb','grgb','grbr','grbg','grbb','ggrb','gggb','ggbr','ggbg','ggbb','gbrr','gbrg','gbrb','gbgr','gbgg','gbgb','gbbr','gbbg','gbbb','brrr','brrg','brrb','brgr','brgg','brgb','brbr','brbg','brbb','bgrr','bgrg','bgrb','bggr','bggg','bggb','bgbr','bgbg','bgbb','bbrr','bbrg','bbrb','bbgr','bbgg','bbgb','bbbr','bbbg','bbbb'];\r\n const VEC4_SWIZZLES = ['xw','yw','zw','wx','wy','wz','ww','xxw','xyw','xzw','xwx','xwy','xwz','xww','yxw','yyw','yzw','ywx','ywy','ywz','yww','zxw','zyw','zzw','zwx','zwy','zwz','zww','wxx','wxy','wxz','wxw','wyx','wyy','wyz','wyw','wzx','wzy','wzz','wzw','wwx','wwy','wwz','www','xxxw','xxyw','xxzw','xxwx','xxwy','xxwz','xxww','xyxw','xyyw','xyzw','xywx','xywy','xywz','xyww','xzxw','xzyw','xzzw','xzwx','xzwy','xzwz','xzww','xwxx','xwxy','xwxz','xwxw','xwyx','xwyy','xwyz','xwyw','xwzx','xwzy','xwzz','xwzw','xwwx','xwwy','xwwz','xwww','yxxw','yxyw','yxzw','yxwx','yxwy','yxwz','yxww','yyxw','yyyw','yyzw','yywx','yywy','yywz','yyww','yzxw','yzyw','yzzw','yzwx','yzwy','yzwz','yzww','ywxx','ywxy','ywxz','ywxw','ywyx','ywyy','ywyz','ywyw','ywzx','ywzy','ywzz','ywzw','ywwx','ywwy','ywwz','ywww','zxxw','zxyw','zxzw','zxwx','zxwy','zxwz','zxww','zyxw','zyyw','zyzw','zywx','zywy','zywz','zyww','zzxw','zzyw','zzzw','zzwx','zzwy','zzwz','zzww','zwxx','zwxy','zwxz','zwxw','zwyx','zwyy','zwyz','zwyw','zwzx','zwzy','zwzz','zwzw','zwwx','zwwy','zwwz','zwww','wxxx','wxxy','wxxz','wxxw','wxyx','wxyy','wxyz','wxyw','wxzx','wxzy','wxzz','wxzw','wxwx','wxwy','wxwz','wxww','wyxx','wyxy','wyxz','wyxw','wyyx','wyyy','wyyz','wyyw','wyzx','wyzy','wyzz','wyzw','wywx','wywy','wywz','wyww','wzxx','wzxy','wzxz','wzxw','wzyx','wzyy','wzyz','wzyw','wzzx','wzzy','wzzz','wzzw','wzwx','wzwy','wzwz','wzww','wwxx','wwxy','wwxz','wwxw','wwyx','wwyy','wwyz','wwyw','wwzx','wwzy','wwzz','wwzw','wwwx','wwwy','wwwz','wwww','ra','ga','ba','ar','ag','ab','aa','rra','rga','rba','rar','rag','rab','raa','gra','gga','gba','gar','gag','gab','gaa','bra','bga','bba','bar','bag','bab','baa','arr','arg','arb','ara','agr','agg','agb','aga','abr','abg','abb','aba','aar','aag','aab','aaa','rrra','rrga','rrba','rrar','rrag','rrab','rraa','rgra','rgga','rgba','rgar','rgag','rgab','rgaa','rbra','rbga','rbba','rbar','rbag','rbab','rbaa','rarr','rarg','rarb','rara','ragr','ragg','ragb','raga','rabr','rabg','rabb','raba','raar','raag','raab','raaa','grra','grga','grba','grar','grag','grab','graa','ggra','ggga','ggba','ggar','ggag','ggab','ggaa','gbra','gbga','gbba','gbar','gbag','gbab','gbaa','garr','garg','garb','gara','gagr','gagg','gagb','gaga','gabr','gabg','gabb','gaba','gaar','gaag','gaab','gaaa','brra','brga','brba','brar','brag','brab','braa','bgra','bgga','bgba','bgar','bgag','bgab','bgaa','bbra','bbga','bbba','bbar','bbag','bbab','bbaa','barr','barg','barb','bara','bagr','bagg','bagb','baga','babr','babg','babb','baba','baar','baag','baab','baaa','arrr','arrg','arrb','arra','argr','argg','argb','arga','arbr','arbg','arbb','arba','arar','arag','arab','araa','agrr','agrg','agrb','agra','aggr','aggg','aggb','agga','agbr','agbg','agbb','agba','agar','agag','agab','agaa','abrr','abrg','abrb','abra','abgr','abgg','abgb','abga','abbr','abbg','abbb','abba','abar','abag','abab','abaa','aarr','aarg','aarb','aara','aagr','aagg','aagb','aaga','aabr','aabg','aabb','aaba','aaar','aaag','aaab','aaaa'];\r\n\r\n // [/Swizzle Autogen]\r\n\r\n /* eslint-enable comma-spacing, max-len */\r\n\r\n /**\r\n * Internal swizzle index table for `gl-matrix`.\r\n */\r\n const SWIZZLE_INDEX: Record = {\r\n x: 0, r: 0,\r\n y: 1, g: 1,\r\n z: 2, b: 2,\r\n w: 3, a: 3,\r\n };\r\n\r\n /**\r\n * Internal helper function to convert and return a `gl-matrix` vector by swizzle format.\r\n *\r\n * @param swizzle - Swizzle format to apply.\r\n * @returns {Vec2 | Vec3 | Vec4} New swizzled vector instance.\r\n */\r\n function getSwizzleImpl(swizzle: string): () => Vec2 | Vec3 | Vec4 {\r\n switch (swizzle.length) {\r\n case 2:\r\n return function(this: Float64Array) {\r\n return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]);\r\n };\r\n case 3:\r\n return function(this: Float64Array) {\r\n return new Vec3(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]]);\r\n };\r\n case 4:\r\n return function(this: Float64Array) {\r\n return new Vec4(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]], this[SWIZZLE_INDEX[swizzle[3]]]);\r\n };\r\n }\r\n\r\n throw new Error('Illegal swizzle length');\r\n }\r\n\r\n for (const swizzle of VEC2_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec2.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC3_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC4_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n GLM_SWIZZLES_ENABLED_F64 = true;\r\n}\r\n", "/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_DEG_TO_RAD: number = Math.PI / 180;\r\n\r\n/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_RAD_TO_DEG: number = 180 / Math.PI;\r\n\r\n/**\r\n * Convert `radians` to `degrees`.\r\n *\r\n * @param value - Angle in `radians`.\r\n * @returns Angle in `degrees`.\r\n */\r\nexport function toDegree(value: number): number {\r\n return value * GLM_RAD_TO_DEG;\r\n}\r\n\r\n/**\r\n * Convert `degrees` to `radians`.\r\n *\r\n * @param value - Angle in `degrees`.\r\n * @returns Angle in `radians`.\r\n */\r\nexport function toRadian(value: number): number {\r\n return value * GLM_DEG_TO_RAD;\r\n}\r\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSO,IAAM,cAAc;;;ACFpB,IAAM,OAAN,MAAM,cAAa,aAAa;AAAA,EACrC,OAAO,gBAAgB,IAAI,aAAa;AAAA,IACtC;AAAA,IAAG;AAAA,IACH;AAAA,IAAG;AAAA,EACL,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOD,eAAe,QAAoE;AACjF,YAAQ,OAAO,QAAQ;AAAA,M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C7C,KAAK;AAAA,IACP,CAAC;AACD,WAAO,eAAe,KAAK,WAAW,SAAS;AAAA,MAC7C,KAAK;AAAA,IACP,CAAC;AACD,WAAO,eAAe,KAAK,WAAW,SAAS;AAAA,MAC7C,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAEA,aAAW,WAAW,eAAe;AACnC,UAAM,OAAO,eAAe,OAAO;AACnC,WAAO,eAAe,KAAK,WAAW,SAAS;AAAA,MAC7C,KAAK;AAAA,IACP,CAAC;AACD,WAAO,eAAe,KAAK,WAAW,SAAS;AAAA,MAC7C,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAEA,aAAW,WAAW,eAAe;AACnC,UAAM,OAAO,eAAe,OAAO;AACnC,WAAO,eAAe,KAAK,WAAW,SAAS;AAAA,MAC7C,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAEA,6BAA2B;AAC7B;;;ACzIA,IAAM,iBAAyB,KAAK,KAAK;AAKzC,IAAM,iBAAyB,MAAM,KAAK;AAQnC,SAAS,SAAS,OAAuB;AAC9C,SAAO,QAAQ;AACjB;AAQO,SAAS,SAAS,OAAuB;AAC9C,SAAO,QAAQ;AACjB;", + "names": [] +} diff --git a/dist-cdn/cjs/2022/gl-matrix-f64.min.cjs b/dist-cdn/cjs/2022/gl-matrix-f64.min.cjs new file mode 100644 index 00000000..ef65a711 --- /dev/null +++ b/dist-cdn/cjs/2022/gl-matrix-f64.min.cjs @@ -0,0 +1,6 @@ +// gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library. +// @author Brandon Jones +// @author Colin MacKenzie IV +// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md) +var $=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var u=(h,e)=>{for(var t in e)$(h,t,{get:e[t],enumerable:!0})},_=(h,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of K(e))!v.call(h,s)&&s!==t&&$(h,s,{get:()=>e[s],enumerable:!(n=J(e,s))||n.enumerable});return h};var ee=h=>_($({},"__esModule",{value:!0}),h);var ie={};u(ie,{EnableSwizzlesF64:()=>te,Mat2:()=>Z,Mat2d:()=>j,Mat3:()=>G,Mat4:()=>P,Quat:()=>N,Quat2:()=>O,Vec2:()=>B,Vec3:()=>q,Vec4:()=>E,toDegree:()=>re,toRadian:()=>ae});module.exports=ee(ie);var Z=class h extends Float64Array{static#t=new Float64Array([1,0,0,1]);constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t]):super(t,0,4);break;default:super(h.#t);break}}get str(){return h.str(this)}copy(e){return this.set(e),this}identity(){return this.set(h.#t),this}multiply(e){return h.multiply(this,this,e)}mul(e){return this}transpose(){return h.transpose(this,this)}invert(){return h.invert(this,this)}scale(e){return h.scale(this,this,e)}rotate(e){return h.rotate(this,this,e)}static get BYTE_LENGTH(){return 4*Float64Array.BYTES_PER_ELEMENT}static create(){return new h}static clone(e){return new h(e)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static fromValues(...e){return new h(...e)}static set(e,...t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}static transpose(e,t){if(e===t){let n=t[1];e[1]=t[2],e[2]=n}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*a-r*s;return i?(i=1/i,e[0]=a*i,e[1]=-s*i,e[2]=-r*i,e[3]=n*i,e):null}static adjoint(e,t){let n=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=n,e}static determinant(e){return e[0]*e[3]-e[2]*e[1]}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*c+a*y,e[1]=r*c+i*y,e[2]=s*L+a*k,e[3]=r*L+i*k,e}static mul(e,t,n){return e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+a*c,e[1]=r*y+i*c,e[2]=s*-c+a*y,e[3]=r*-c+i*y,e}static scale(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1];return e[0]=s*c,e[1]=r*c,e[2]=a*y,e[3]=i*y,e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=-n,e[3]=s,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3])}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e}static LDU(e,t,n,s){return e[2]=s[2]/s[0],n[0]=s[0],n[1]=s[1],n[3]=s[3]-e[2]*n[1],[e,t,n]}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=t[0],c=t[1],y=t[2],L=t[3];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(a-L)<=1e-6*Math.max(1,Math.abs(a),Math.abs(L))}static str(e){return`Mat2(${e.join(", ")})`}};Z.prototype.mul=Z.prototype.multiply;Z.mul=Z.multiply;Z.sub=Z.subtract;var j=class h extends Float64Array{static#t=new Float64Array([1,0,0,1,0,0]);constructor(...e){switch(e.length){case 6:super(e);break;case 2:super(e[0],e[1],6);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t,t,t]):super(t,0,6);break;default:super(h.#t);break}}get str(){return h.str(this)}copy(e){return this.set(e),this}identity(){return this.set(h.#t),this}multiply(e){return h.multiply(this,this,e)}mul(e){return this}translate(e){return h.translate(this,this,e)}rotate(e){return h.rotate(this,this,e)}scale(e){return h.scale(this,this,e)}static get BYTE_LENGTH(){return 6*Float64Array.BYTES_PER_ELEMENT}static create(){return new h}static clone(e){return new h(e)}static copy(e,t){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}static fromValues(...e){return new h(...e)}static set(e,...t){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}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=n*a-s*r;return y?(y=1/y,e[0]=a*y,e[1]=-s*y,e[2]=-r*y,e[3]=n*y,e[4]=(r*c-a*i)*y,e[5]=(s*i-n*c)*y,e):null}static determinant(e){return e[0]*e[3]-e[1]*e[2]}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1],l=n[2],b=n[3],M=n[4],d=n[5];return e[0]=s*L+a*k,e[1]=r*L+i*k,e[2]=s*l+a*b,e[3]=r*l+i*b,e[4]=s*M+a*d+c,e[5]=r*M+i*d+y,e}static mul(e,t,n){return e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=s*L+a*k+c,e[5]=r*L+i*k+y,e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=Math.sin(n),k=Math.cos(n);return e[0]=s*k+a*L,e[1]=r*k+i*L,e[2]=s*-L+a*k,e[3]=r*-L+i*k,e[4]=c,e[5]=y,e}static scale(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1];return e[0]=s*L,e[1]=r*L,e[2]=a*k,e[3]=i*k,e[4]=c,e[5]=y,e}static fromTranslation(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0],e[5]=t[1],e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=-n,e[3]=s,e[4]=0,e[5]=0,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e[4]=0,e[5]=0,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+1)}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=t[0],L=t[1],k=t[2],l=t[3],b=t[4],M=t[5];return Math.abs(n-y)<=1e-6*Math.max(1,Math.abs(n),Math.abs(y))&&Math.abs(s-L)<=1e-6*Math.max(1,Math.abs(s),Math.abs(L))&&Math.abs(r-k)<=1e-6*Math.max(1,Math.abs(r),Math.abs(k))&&Math.abs(a-l)<=1e-6*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(i-b)<=1e-6*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(c-M)<=1e-6*Math.max(1,Math.abs(c),Math.abs(M))}static str(e){return`Mat2d(${e.join(", ")})`}};j.mul=j.multiply;j.sub=j.subtract;var G=class h extends Float64Array{static#t=new Float64Array([1,0,0,0,1,0,0,0,1]);constructor(...e){switch(e.length){case 9:super(e);break;case 2:super(e[0],e[1],9);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t,t,t,t,t,t]):super(t,0,9);break;default:super(h.#t);break}}get str(){return h.str(this)}copy(e){return this.set(e),this}identity(){return this.set(h.#t),this}multiply(e){return h.multiply(this,this,e)}mul(e){return this}transpose(){return h.transpose(this,this)}invert(){return h.invert(this,this)}translate(e){return h.translate(this,this,e)}rotate(e){return h.rotate(this,this,e)}scale(e){return h.scale(this,this,e)}static get BYTE_LENGTH(){return 9*Float64Array.BYTES_PER_ELEMENT}static create(){return new h}static clone(e){return new h(e)}static copy(e,t){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}static fromValues(...e){return new h(...e)}static set(e,...t){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}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static transpose(e,t){if(e===t){let n=t[1],s=t[2],r=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=s,e[7]=r}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=k*i-c*L,b=-k*a+c*y,M=L*a-i*y,d=n*l+s*b+r*M;return d?(d=1/d,e[0]=l*d,e[1]=(-k*s+r*L)*d,e[2]=(c*s-r*i)*d,e[3]=b*d,e[4]=(k*n-r*y)*d,e[5]=(-c*n+r*a)*d,e[6]=M*d,e[7]=(-L*n+s*y)*d,e[8]=(i*n-s*a)*d,e):null}static adjoint(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8];return e[0]=i*k-c*L,e[1]=r*L-s*k,e[2]=s*c-r*i,e[3]=c*y-a*k,e[4]=n*k-r*y,e[5]=r*a-n*c,e[6]=a*L-i*y,e[7]=s*y-n*L,e[8]=n*i-s*a,e}static determinant(e){let t=e[0],n=e[1],s=e[2],r=e[3],a=e[4],i=e[5],c=e[6],y=e[7],L=e[8];return t*(L*a-i*y)+n*(-L*r+i*c)+s*(y*r-a*c)}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],b=n[0],M=n[1],d=n[2];return e[0]=b*s+M*i+d*L,e[1]=b*r+M*c+d*k,e[2]=b*a+M*y+d*l,b=n[3],M=n[4],d=n[5],e[3]=b*s+M*i+d*L,e[4]=b*r+M*c+d*k,e[5]=b*a+M*y+d*l,b=n[6],M=n[7],d=n[8],e[6]=b*s+M*i+d*L,e[7]=b*r+M*c+d*k,e[8]=b*a+M*y+d*l,e}static mul(e,t,n){return e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],b=n[0],M=n[1];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=c,e[5]=y,e[6]=b*s+M*i+L,e[7]=b*r+M*c+k,e[8]=b*a+M*y+l,e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],b=Math.sin(n),M=Math.cos(n);return e[0]=M*s+b*i,e[1]=M*r+b*c,e[2]=M*a+b*y,e[3]=M*i-b*s,e[4]=M*c-b*r,e[5]=M*y-b*a,e[6]=L,e[7]=k,e[8]=l,e}static scale(e,t,n){let s=n[0],r=n[1];return e[0]=s*t[0],e[1]=s*t[1],e[2]=s*t[2],e[3]=r*t[3],e[4]=r*t[4],e[5]=r*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}static fromTranslation(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=0,e[3]=-n,e[4]=s,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static fromMat2d(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}static fromQuat(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n+n,c=s+s,y=r+r,L=n*i,k=s*i,l=s*c,b=r*i,M=r*c,d=r*y,m=a*i,o=a*c,x=a*y;return e[0]=1-l-d,e[3]=k-x,e[6]=b+o,e[1]=k+x,e[4]=1-L-d,e[7]=M-m,e[2]=b-o,e[5]=M+m,e[8]=1-L-l,e}static fromMat4(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}static normalFromMat4(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],b=t[10],M=t[11],d=t[12],m=t[13],o=t[14],x=t[15],z=n*c-s*i,R=n*y-r*i,g=n*L-a*i,w=s*y-r*c,V=s*L-a*c,T=r*L-a*y,A=k*m-l*d,D=k*o-b*d,f=k*x-M*d,I=l*o-b*m,S=l*x-M*m,F=b*x-M*o,Q=z*F-R*S+g*I+w*f-V*D+T*A;return Q?(Q=1/Q,e[0]=(c*F-y*S+L*I)*Q,e[1]=(y*f-i*F-L*D)*Q,e[2]=(i*S-c*f+L*A)*Q,e[3]=(r*S-s*F-a*I)*Q,e[4]=(n*F-r*f+a*D)*Q,e[5]=(s*f-n*S-a*A)*Q,e[6]=(m*T-o*V+x*w)*Q,e[7]=(o*g-d*T-x*R)*Q,e[8]=(d*V-m*g+x*z)*Q,e):null}static normalFromMat4Fast(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=i*k-k*L,e[1]=c*y-y*k,e[2]=a*L-L*y,e[3]=L*r-k*s,e[4]=k*n-y*r,e[5]=y*s-L*n,e[6]=s*c-r*i,e[7]=r*a-n*c,e[8]=n*i-s*a,e}static projection(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8])}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e[6]=t[6]+n[6]*s,e[7]=t[7]+n[7]*s,e[8]=t[8]+n[8]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=e[8],l=t[0],b=t[1],M=t[2],d=t[3],m=t[4],o=t[5],x=t[6],z=t[7],R=t[8];return Math.abs(n-l)<=1e-6*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(s-b)<=1e-6*Math.max(1,Math.abs(s),Math.abs(b))&&Math.abs(r-M)<=1e-6*Math.max(1,Math.abs(r),Math.abs(M))&&Math.abs(a-d)<=1e-6*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(i-m)<=1e-6*Math.max(1,Math.abs(i),Math.abs(m))&&Math.abs(c-o)<=1e-6*Math.max(1,Math.abs(c),Math.abs(o))&&Math.abs(y-x)<=1e-6*Math.max(1,Math.abs(y),Math.abs(x))&&Math.abs(L-z)<=1e-6*Math.max(1,Math.abs(L),Math.abs(z))&&Math.abs(k-R)<=1e-6*Math.max(1,Math.abs(k),Math.abs(R))}static str(e){return`Mat3(${e.join(", ")})`}};G.prototype.mul=G.prototype.multiply;G.mul=G.multiply;G.sub=G.subtract;var P=class h extends Float64Array{static#t=new Float64Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);static#e=new Float64Array(3);constructor(...e){switch(e.length){case 16:super(e);break;case 2:super(e[0],e[1],16);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t]):super(t,0,16);break;default:super(h.#t);break}}get str(){return h.str(this)}copy(e){return this.set(e),this}identity(){return this.set(h.#t),this}multiply(e){return h.multiply(this,this,e)}mul(e){return this}transpose(){return h.transpose(this,this)}invert(){return h.invert(this,this)}translate(e){return h.translate(this,this,e)}rotate(e,t){return h.rotate(this,this,e,t)}scale(e){return h.scale(this,this,e)}rotateX(e){return h.rotateX(this,this,e)}rotateY(e){return h.rotateY(this,this,e)}rotateZ(e){return h.rotateZ(this,this,e)}perspectiveNO(e,t,n,s){return h.perspectiveNO(this,e,t,n,s)}perspectiveZO(e,t,n,s){return h.perspectiveZO(this,e,t,n,s)}orthoNO(e,t,n,s,r,a){return h.orthoNO(this,e,t,n,s,r,a)}orthoZO(e,t,n,s,r,a){return h.orthoZO(this,e,t,n,s,r,a)}static get BYTE_LENGTH(){return 16*Float64Array.BYTES_PER_ELEMENT}static create(){return new h}static clone(e){return new h(e)}static copy(e,t){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}static fromValues(...e){return new h(...e)}static set(e,...t){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}static identity(e){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}static transpose(e,t){if(e===t){let n=t[1],s=t[2],r=t[3],a=t[6],i=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=s,e[9]=a,e[11]=t[14],e[12]=r,e[13]=i,e[14]=c}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],b=t[10],M=t[11],d=t[12],m=t[13],o=t[14],x=t[15],z=n*c-s*i,R=n*y-r*i,g=n*L-a*i,w=s*y-r*c,V=s*L-a*c,T=r*L-a*y,A=k*m-l*d,D=k*o-b*d,f=k*x-M*d,I=l*o-b*m,S=l*x-M*m,F=b*x-M*o,Q=z*F-R*S+g*I+w*f-V*D+T*A;return Q?(Q=1/Q,e[0]=(c*F-y*S+L*I)*Q,e[1]=(r*S-s*F-a*I)*Q,e[2]=(m*T-o*V+x*w)*Q,e[3]=(b*V-l*T-M*w)*Q,e[4]=(y*f-i*F-L*D)*Q,e[5]=(n*F-r*f+a*D)*Q,e[6]=(o*g-d*T-x*R)*Q,e[7]=(k*T-b*g+M*R)*Q,e[8]=(i*S-c*f+L*A)*Q,e[9]=(s*f-n*S-a*A)*Q,e[10]=(d*V-m*g+x*z)*Q,e[11]=(l*g-k*V-M*z)*Q,e[12]=(c*D-i*I-y*A)*Q,e[13]=(n*I-s*D+r*A)*Q,e[14]=(m*R-d*w-o*z)*Q,e[15]=(k*w-l*R+b*z)*Q,e):null}static adjoint(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],b=t[10],M=t[11],d=t[12],m=t[13],o=t[14],x=t[15],z=n*c-s*i,R=n*y-r*i,g=n*L-a*i,w=s*y-r*c,V=s*L-a*c,T=r*L-a*y,A=k*m-l*d,D=k*o-b*d,f=k*x-M*d,I=l*o-b*m,S=l*x-M*m,F=b*x-M*o;return e[0]=c*F-y*S+L*I,e[1]=r*S-s*F-a*I,e[2]=m*T-o*V+x*w,e[3]=b*V-l*T-M*w,e[4]=y*f-i*F-L*D,e[5]=n*F-r*f+a*D,e[6]=o*g-d*T-x*R,e[7]=k*T-b*g+M*R,e[8]=i*S-c*f+L*A,e[9]=s*f-n*S-a*A,e[10]=d*V-m*g+x*z,e[11]=l*g-k*V-M*z,e[12]=c*D-i*I-y*A,e[13]=n*I-s*D+r*A,e[14]=m*R-d*w-o*z,e[15]=k*w-l*R+b*z,e}static determinant(e){let t=e[0],n=e[1],s=e[2],r=e[3],a=e[4],i=e[5],c=e[6],y=e[7],L=e[8],k=e[9],l=e[10],b=e[11],M=e[12],d=e[13],m=e[14],o=e[15],x=t*i-n*a,z=t*c-s*a,R=n*c-s*i,g=L*d-k*M,w=L*m-l*M,V=k*m-l*d,T=t*V-n*w+s*g,A=a*V-i*w+c*g,D=L*R-k*z+l*x,f=M*R-d*z+m*x;return y*T-r*A+o*D-b*f}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],b=t[9],M=t[10],d=t[11],m=t[12],o=t[13],x=t[14],z=t[15],R=n[0],g=n[1],w=n[2],V=n[3];return e[0]=R*s+g*c+w*l+V*m,e[1]=R*r+g*y+w*b+V*o,e[2]=R*a+g*L+w*M+V*x,e[3]=R*i+g*k+w*d+V*z,R=n[4],g=n[5],w=n[6],V=n[7],e[4]=R*s+g*c+w*l+V*m,e[5]=R*r+g*y+w*b+V*o,e[6]=R*a+g*L+w*M+V*x,e[7]=R*i+g*k+w*d+V*z,R=n[8],g=n[9],w=n[10],V=n[11],e[8]=R*s+g*c+w*l+V*m,e[9]=R*r+g*y+w*b+V*o,e[10]=R*a+g*L+w*M+V*x,e[11]=R*i+g*k+w*d+V*z,R=n[12],g=n[13],w=n[14],V=n[15],e[12]=R*s+g*c+w*l+V*m,e[13]=R*r+g*y+w*b+V*o,e[14]=R*a+g*L+w*M+V*x,e[15]=R*i+g*k+w*d+V*z,e}static mul(e,t,n){return e}static translate(e,t,n){let s=n[0],r=n[1],a=n[2];if(t===e)e[12]=t[0]*s+t[4]*r+t[8]*a+t[12],e[13]=t[1]*s+t[5]*r+t[9]*a+t[13],e[14]=t[2]*s+t[6]*r+t[10]*a+t[14],e[15]=t[3]*s+t[7]*r+t[11]*a+t[15];else{let i=t[0],c=t[1],y=t[2],L=t[3],k=t[4],l=t[5],b=t[6],M=t[7],d=t[8],m=t[9],o=t[10],x=t[11];e[0]=i,e[1]=c,e[2]=y,e[3]=L,e[4]=k,e[5]=l,e[6]=b,e[7]=M,e[8]=d,e[9]=m,e[10]=o,e[11]=x,e[12]=i*s+k*r+d*a+t[12],e[13]=c*s+l*r+m*a+t[13],e[14]=y*s+b*r+o*a+t[14],e[15]=L*s+M*r+x*a+t[15]}return e}static scale(e,t,n){let s=n[0],r=n[1],a=n[2];return e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e[3]=t[3]*s,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}static rotate(e,t,n,s){let r=s[0],a=s[1],i=s[2],c=Math.sqrt(r*r+a*a+i*i);if(c<1e-6)return null;c=1/c,r*=c,a*=c,i*=c;let y=Math.sin(n),L=Math.cos(n),k=1-L,l=t[0],b=t[1],M=t[2],d=t[3],m=t[4],o=t[5],x=t[6],z=t[7],R=t[8],g=t[9],w=t[10],V=t[11],T=r*r*k+L,A=a*r*k+i*y,D=i*r*k-a*y,f=r*a*k-i*y,I=a*a*k+L,S=i*a*k+r*y,F=r*i*k+a*y,Q=a*i*k-r*y,Y=i*i*k+L;return e[0]=l*T+m*A+R*D,e[1]=b*T+o*A+g*D,e[2]=M*T+x*A+w*D,e[3]=d*T+z*A+V*D,e[4]=l*f+m*I+R*S,e[5]=b*f+o*I+g*S,e[6]=M*f+x*I+w*S,e[7]=d*f+z*I+V*S,e[8]=l*F+m*Q+R*Y,e[9]=b*F+o*Q+g*Y,e[10]=M*F+x*Q+w*Y,e[11]=d*F+z*Q+V*Y,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e}static rotateX(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[4],i=t[5],c=t[6],y=t[7],L=t[8],k=t[9],l=t[10],b=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*r+L*s,e[5]=i*r+k*s,e[6]=c*r+l*s,e[7]=y*r+b*s,e[8]=L*r-a*s,e[9]=k*r-i*s,e[10]=l*r-c*s,e[11]=b*r-y*s,e}static rotateY(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[0],i=t[1],c=t[2],y=t[3],L=t[8],k=t[9],l=t[10],b=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*r-L*s,e[1]=i*r-k*s,e[2]=c*r-l*s,e[3]=y*r-b*s,e[8]=a*s+L*r,e[9]=i*s+k*r,e[10]=c*s+l*r,e[11]=y*s+b*r,e}static rotateZ(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[0],i=t[1],c=t[2],y=t[3],L=t[4],k=t[5],l=t[6],b=t[7];return t!==e&&(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[0]=a*r+L*s,e[1]=i*r+k*s,e[2]=c*r+l*s,e[3]=y*r+b*s,e[4]=L*r-a*s,e[5]=k*r-i*s,e[6]=l*r-c*s,e[7]=b*r-y*s,e}static fromTranslation(e,t){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]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromRotation(e,t,n){let s=n[0],r=n[1],a=n[2],i=Math.sqrt(s*s+r*r+a*a);if(i<1e-6)return null;i=1/i,s*=i,r*=i,a*=i;let c=Math.sin(t),y=Math.cos(t),L=1-y;return e[0]=s*s*L+y,e[1]=r*s*L+a*c,e[2]=a*s*L-r*c,e[3]=0,e[4]=s*r*L-a*c,e[5]=r*r*L+y,e[6]=a*r*L+s*c,e[7]=0,e[8]=s*a*L+r*c,e[9]=r*a*L-s*c,e[10]=a*a*L+y,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromXRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=n,e[7]=0,e[8]=0,e[9]=-n,e[10]=s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromYRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromZRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=0,e[3]=0,e[4]=-n,e[5]=s,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}static fromRotationTranslation(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=s+s,y=r+r,L=a+a,k=s*c,l=s*y,b=s*L,M=r*y,d=r*L,m=a*L,o=i*c,x=i*y,z=i*L;return e[0]=1-(M+m),e[1]=l+z,e[2]=b-x,e[3]=0,e[4]=l-z,e[5]=1-(k+m),e[6]=d+o,e[7]=0,e[8]=b+x,e[9]=d-o,e[10]=1-(k+M),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}static fromQuat2(e,t){let n=-t[0],s=-t[1],r=-t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=n*n+s*s+r*r+a*a;return k>0?(h.#e[0]=(i*a+L*n+c*r-y*s)*2/k,h.#e[1]=(c*a+L*s+y*n-i*r)*2/k,h.#e[2]=(y*a+L*r+i*s-c*n)*2/k):(h.#e[0]=(i*a+L*n+c*r-y*s)*2,h.#e[1]=(c*a+L*s+y*n-i*r)*2,h.#e[2]=(y*a+L*r+i*s-c*n)*2),h.fromRotationTranslation(e,t,h.#e),e}static normalFromMat4(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],b=t[10],M=t[11],d=t[12],m=t[13],o=t[14],x=t[15],z=n*c-s*i,R=n*y-r*i,g=n*L-a*i,w=s*y-r*c,V=s*L-a*c,T=r*L-a*y,A=k*m-l*d,D=k*o-b*d,f=k*x-M*d,I=l*o-b*m,S=l*x-M*m,F=b*x-M*o,Q=z*F-R*S+g*I+w*f-V*D+T*A;return Q?(Q=1/Q,e[0]=(c*F-y*S+L*I)*Q,e[1]=(y*f-i*F-L*D)*Q,e[2]=(i*S-c*f+L*A)*Q,e[3]=0,e[4]=(r*S-s*F-a*I)*Q,e[5]=(n*F-r*f+a*D)*Q,e[6]=(s*f-n*S-a*A)*Q,e[7]=0,e[8]=(m*T-o*V+x*w)*Q,e[9]=(o*g-d*T-x*R)*Q,e[10]=(d*V-m*g+x*z)*Q,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):null}static normalFromMat4Fast(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=i*k-k*L,e[1]=c*y-y*k,e[2]=a*L-L*y,e[3]=0,e[4]=L*r-k*s,e[5]=k*n-y*r,e[6]=y*s-L*n,e[7]=0,e[8]=s*c-r*i,e[9]=r*a-n*c,e[10]=n*i-s*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static getTranslation(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}static getScaling(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=Math.sqrt(n*n+s*s+r*r),e[1]=Math.sqrt(a*a+i*i+c*c),e[2]=Math.sqrt(y*y+L*L+k*k),e}static getRotation(e,t){h.getScaling(h.#e,t);let n=1/h.#e[0],s=1/h.#e[1],r=1/h.#e[2],a=t[0]*n,i=t[1]*s,c=t[2]*r,y=t[4]*n,L=t[5]*s,k=t[6]*r,l=t[8]*n,b=t[9]*s,M=t[10]*r,d=a+L+M,m=0;return d>0?(m=Math.sqrt(d+1)*2,e[3]=.25*m,e[0]=(k-b)/m,e[1]=(l-c)/m,e[2]=(i-y)/m):a>L&&a>M?(m=Math.sqrt(1+a-L-M)*2,e[3]=(k-b)/m,e[0]=.25*m,e[1]=(i+y)/m,e[2]=(l+c)/m):L>M?(m=Math.sqrt(1+L-a-M)*2,e[3]=(l-c)/m,e[0]=(i+y)/m,e[1]=.25*m,e[2]=(k+b)/m):(m=Math.sqrt(1+M-a-L)*2,e[3]=(i-y)/m,e[0]=(l+c)/m,e[1]=(k+b)/m,e[2]=.25*m),e}static decompose(e,t,n,s){t[0]=s[12],t[1]=s[13],t[2]=s[14];let r=s[0],a=s[1],i=s[2],c=s[4],y=s[5],L=s[6],k=s[8],l=s[9],b=s[10];n[0]=Math.sqrt(r*r+a*a+i*i),n[1]=Math.sqrt(c*c+y*y+L*L),n[2]=Math.sqrt(k*k+l*l+b*b);let M=1/n[0],d=1/n[1],m=1/n[2],o=r*M,x=a*d,z=i*m,R=c*M,g=y*d,w=L*m,V=k*M,T=l*d,A=b*m,D=o+g+A,f=0;return D>0?(f=Math.sqrt(D+1)*2,e[3]=.25*f,e[0]=(w-T)/f,e[1]=(V-z)/f,e[2]=(x-R)/f):o>g&&o>A?(f=Math.sqrt(1+o-g-A)*2,e[3]=(w-T)/f,e[0]=.25*f,e[1]=(x+R)/f,e[2]=(V+z)/f):g>A?(f=Math.sqrt(1+g-o-A)*2,e[3]=(V-z)/f,e[0]=(x+R)/f,e[1]=.25*f,e[2]=(w+T)/f):(f=Math.sqrt(1+A-o-g)*2,e[3]=(x-R)/f,e[0]=(V+z)/f,e[1]=(w+T)/f,e[2]=.25*f),e}static fromRotationTranslationScale(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3],y=r+r,L=a+a,k=i+i,l=r*y,b=r*L,M=r*k,d=a*L,m=a*k,o=i*k,x=c*y,z=c*L,R=c*k,g=s[0],w=s[1],V=s[2];return e[0]=(1-(d+o))*g,e[1]=(b+R)*g,e[2]=(M-z)*g,e[3]=0,e[4]=(b-R)*w,e[5]=(1-(l+o))*w,e[6]=(m+x)*w,e[7]=0,e[8]=(M+z)*V,e[9]=(m-x)*V,e[10]=(1-(l+d))*V,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}static fromRotationTranslationScaleOrigin(e,t,n,s,r){let a=t[0],i=t[1],c=t[2],y=t[3],L=a+a,k=i+i,l=c+c,b=a*L,M=a*k,d=a*l,m=i*k,o=i*l,x=c*l,z=y*L,R=y*k,g=y*l,w=s[0],V=s[1],T=s[2],A=r[0],D=r[1],f=r[2],I=(1-(m+x))*w,S=(M+g)*w,F=(d-R)*w,Q=(M-g)*V,Y=(1-(b+x))*V,X=(o+z)*V,C=(d+R)*T,H=(o-z)*T,W=(1-(b+m))*T;return e[0]=I,e[1]=S,e[2]=F,e[3]=0,e[4]=Q,e[5]=Y,e[6]=X,e[7]=0,e[8]=C,e[9]=H,e[10]=W,e[11]=0,e[12]=n[0]+A-(I*A+Q*D+C*f),e[13]=n[1]+D-(S*A+Y*D+H*f),e[14]=n[2]+f-(F*A+X*D+W*f),e[15]=1,e}static fromQuat(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n+n,c=s+s,y=r+r,L=n*i,k=s*i,l=s*c,b=r*i,M=r*c,d=r*y,m=a*i,o=a*c,x=a*y;return e[0]=1-l-d,e[1]=k+x,e[2]=b-o,e[3]=0,e[4]=k-x,e[5]=1-L-d,e[6]=M+m,e[7]=0,e[8]=b+o,e[9]=M-m,e[10]=1-L-l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static frustumNO(e,t,n,s,r,a,i=1/0){let c=1/(n-t),y=1/(r-s);if(e[0]=a*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*y,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(r+s)*y,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let L=1/(a-i);e[10]=(i+a)*L,e[14]=2*i*a*L}else e[10]=-1,e[14]=-2*a;return e}static frustum(e,t,n,s,r,a,i=1/0){return e}static frustumZO(e,t,n,s,r,a,i=1/0){let c=1/(n-t),y=1/(r-s);if(e[0]=a*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*y,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(r+s)*y,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let L=1/(a-i);e[10]=i*L,e[14]=i*a*L}else e[10]=-1,e[14]=-a;return e}static perspectiveNO(e,t,n,s,r=1/0){let a=1/Math.tan(t/2);if(e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,r!=null&&r!==1/0){let i=1/(s-r);e[10]=(r+s)*i,e[14]=2*r*s*i}else e[10]=-1,e[14]=-2*s;return e}static perspective(e,t,n,s,r=1/0){return e}static perspectiveZO(e,t,n,s,r=1/0){let a=1/Math.tan(t/2);if(e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,r!=null&&r!==1/0){let i=1/(s-r);e[10]=r*i,e[14]=r*s*i}else e[10]=-1,e[14]=-s;return e}static perspectiveFromFieldOfView(e,t,n,s){let r=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),i=Math.tan(t.leftDegrees*Math.PI/180),c=Math.tan(t.rightDegrees*Math.PI/180),y=2/(i+c),L=2/(r+a);return e[0]=y,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=L,e[6]=0,e[7]=0,e[8]=-((i-c)*y*.5),e[9]=(r-a)*L*.5,e[10]=s/(n-s),e[11]=-1,e[12]=0,e[13]=0,e[14]=s*n/(n-s),e[15]=0,e}static orthoNO(e,t,n,s,r,a,i){let c=1/(t-n),y=1/(s-r),L=1/(a-i);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*L,e[11]=0,e[12]=(t+n)*c,e[13]=(r+s)*y,e[14]=(i+a)*L,e[15]=1,e}static ortho(e,t,n,s,r,a,i){return e}static orthoZO(e,t,n,s,r,a,i){let c=1/(t-n),y=1/(s-r),L=1/(a-i);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=L,e[11]=0,e[12]=(t+n)*c,e[13]=(r+s)*y,e[14]=a*L,e[15]=1,e}static lookAt(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=s[0],y=s[1],L=s[2],k=n[0],l=n[1],b=n[2];if(Math.abs(r-k)<1e-6&&Math.abs(a-l)<1e-6&&Math.abs(i-b)<1e-6)return h.identity(e);let M=r-k,d=a-l,m=i-b,o=1/Math.sqrt(M*M+d*d+m*m);M*=o,d*=o,m*=o;let x=y*m-L*d,z=L*M-c*m,R=c*d-y*M;o=Math.sqrt(x*x+z*z+R*R),o?(o=1/o,x*=o,z*=o,R*=o):(x=0,z=0,R=0);let g=d*R-m*z,w=m*x-M*R,V=M*z-d*x;return o=Math.sqrt(g*g+w*w+V*V),o?(o=1/o,g*=o,w*=o,V*=o):(g=0,w=0,V=0),e[0]=x,e[1]=g,e[2]=M,e[3]=0,e[4]=z,e[5]=w,e[6]=d,e[7]=0,e[8]=R,e[9]=V,e[10]=m,e[11]=0,e[12]=-(x*r+z*a+R*i),e[13]=-(g*r+w*a+V*i),e[14]=-(M*r+d*a+m*i),e[15]=1,e}static targetTo(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=s[0],y=s[1],L=s[2],k=r-n[0],l=a-n[1],b=i-n[2],M=k*k+l*l+b*b;M>0&&(M=1/Math.sqrt(M),k*=M,l*=M,b*=M);let d=y*b-L*l,m=L*k-c*b,o=c*l-y*k;return M=d*d+m*m+o*o,M>0&&(M=1/Math.sqrt(M),d*=M,m*=M,o*=M),e[0]=d,e[1]=m,e[2]=o,e[3]=0,e[4]=l*o-b*m,e[5]=b*d-k*o,e[6]=k*m-l*d,e[7]=0,e[8]=k,e[9]=l,e[10]=b,e[11]=0,e[12]=r,e[13]=a,e[14]=i,e[15]=1,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8]+e[9]*e[9]+e[10]*e[10]+e[11]*e[11]+e[12]*e[12]+e[13]*e[13]+e[14]*e[14]+e[15]*e[15])}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}static sub(e,t,n){return e}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e[6]=t[6]+n[6]*s,e[7]=t[7]+n[7]*s,e[8]=t[8]+n[8]*s,e[9]=t[9]+n[9]*s,e[10]=t[10]+n[10]*s,e[11]=t[11]+n[11]*s,e[12]=t[12]+n[12]*s,e[13]=t[13]+n[13]*s,e[14]=t[14]+n[14]*s,e[15]=t[15]+n[15]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=e[8],l=e[9],b=e[10],M=e[11],d=e[12],m=e[13],o=e[14],x=e[15],z=t[0],R=t[1],g=t[2],w=t[3],V=t[4],T=t[5],A=t[6],D=t[7],f=t[8],I=t[9],S=t[10],F=t[11],Q=t[12],Y=t[13],X=t[14],C=t[15];return Math.abs(n-z)<=1e-6*Math.max(1,Math.abs(n),Math.abs(z))&&Math.abs(s-R)<=1e-6*Math.max(1,Math.abs(s),Math.abs(R))&&Math.abs(r-g)<=1e-6*Math.max(1,Math.abs(r),Math.abs(g))&&Math.abs(a-w)<=1e-6*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(i-V)<=1e-6*Math.max(1,Math.abs(i),Math.abs(V))&&Math.abs(c-T)<=1e-6*Math.max(1,Math.abs(c),Math.abs(T))&&Math.abs(y-A)<=1e-6*Math.max(1,Math.abs(y),Math.abs(A))&&Math.abs(L-D)<=1e-6*Math.max(1,Math.abs(L),Math.abs(D))&&Math.abs(k-f)<=1e-6*Math.max(1,Math.abs(k),Math.abs(f))&&Math.abs(l-I)<=1e-6*Math.max(1,Math.abs(l),Math.abs(I))&&Math.abs(b-S)<=1e-6*Math.max(1,Math.abs(b),Math.abs(S))&&Math.abs(M-F)<=1e-6*Math.max(1,Math.abs(M),Math.abs(F))&&Math.abs(d-Q)<=1e-6*Math.max(1,Math.abs(d),Math.abs(Q))&&Math.abs(m-Y)<=1e-6*Math.max(1,Math.abs(m),Math.abs(Y))&&Math.abs(o-X)<=1e-6*Math.max(1,Math.abs(o),Math.abs(X))&&Math.abs(x-C)<=1e-6*Math.max(1,Math.abs(x),Math.abs(C))}static str(e){return`Mat4(${e.join(", ")})`}};P.prototype.mul=P.prototype.multiply;P.sub=P.subtract;P.mul=P.multiply;P.frustum=P.frustumNO;P.perspective=P.perspectiveNO;P.ortho=P.orthoNO;var q=class h extends Float64Array{constructor(...e){switch(e.length){case 3:super(e);break;case 2:super(e[0],e[1],3);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t]):super(t,0,3);break}default:super(3);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get b(){return this[2]}set b(e){this[2]=e}get magnitude(){let e=this[0],t=this[1],n=this[2];return Math.sqrt(e*e+t*t+n*n)}get mag(){return this.magnitude}get squaredMagnitude(){let e=this[0],t=this[1],n=this[2];return e*e+t*t+n*n}get sqrMag(){return this.squaredMagnitude}get str(){return h.str(this)}copy(e){return this.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this[2]+=e[2],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this[2]-=e[2],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this[2]*=e[2],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this[2]/=e[2],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this[2]+=e[2]*t,this}distance(e){return h.distance(this,e)}dist(e){return 0}squaredDistance(e){return h.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this[2]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this[2]=1/this[2],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this[2]=Math.abs(this[2]),this}dot(e){return this[0]*e[0]+this[1]*e[1]+this[2]*e[2]}normalize(){return h.normalize(this,this)}static get BYTE_LENGTH(){return 3*Float64Array.BYTES_PER_ELEMENT}static create(){return new h}static clone(e){return new h(e)}static magnitude(e){let t=e[0],n=e[1],s=e[2];return Math.sqrt(t*t+n*n+s*s)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static fromValues(e,t,n){return new h(e,t,n)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}static set(e,t,n,s){return e[0]=t,e[1]=n,e[2]=s,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}static sub(e,t,n){return[0,0,0]}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}static mul(e,t,n){return[0,0,0]}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e}static div(e,t,n){return[0,0,0]}static ceil(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}static floor(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e}static distance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2];return Math.sqrt(n*n+s*s+r*r)}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2];return n*n+s*s+r*r}static sqrDist(e,t){return 0}static squaredLength(e){let t=e[0],n=e[1],s=e[2];return t*t+n*n+s*s}static sqrLen(e,t){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e}static normalize(e,t){let n=t[0],s=t[1],r=t[2],a=n*n+s*s+r*r;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}static cross(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[0],c=n[1],y=n[2];return e[0]=r*y-a*c,e[1]=a*i-s*y,e[2]=s*c-r*i,e}static lerp(e,t,n,s){let r=t[0],a=t[1],i=t[2];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e[2]=i+s*(n[2]-i),e}static slerp(e,t,n,s){let r=Math.acos(Math.min(Math.max(h.dot(t,n),-1),1)),a=Math.sin(r),i=Math.sin((1-s)*r)/a,c=Math.sin(s*r)/a;return e[0]=i*t[0]+c*n[0],e[1]=i*t[1]+c*n[1],e[2]=i*t[2]+c*n[2],e}static hermite(e,t,n,s,r,a){let i=a*a,c=i*(2*a-3)+1,y=i*(a-2)+a,L=i*(a-1),k=i*(3-2*a);return e[0]=t[0]*c+n[0]*y+s[0]*L+r[0]*k,e[1]=t[1]*c+n[1]*y+s[1]*L+r[1]*k,e[2]=t[2]*c+n[2]*y+s[2]*L+r[2]*k,e}static bezier(e,t,n,s,r,a){let i=1-a,c=i*i,y=a*a,L=c*i,k=3*a*c,l=3*y*i,b=y*a;return e[0]=t[0]*L+n[0]*k+s[0]*l+r[0]*b,e[1]=t[1]*L+n[1]*k+s[1]*l+r[1]*b,e[2]=t[2]*L+n[2]*k+s[2]*l+r[2]*b,e}static transformMat4(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[3]*s+n[7]*r+n[11]*a+n[15]||1;return e[0]=(n[0]*s+n[4]*r+n[8]*a+n[12])/i,e[1]=(n[1]*s+n[5]*r+n[9]*a+n[13])/i,e[2]=(n[2]*s+n[6]*r+n[10]*a+n[14])/i,e}static transformMat3(e,t,n){let s=t[0],r=t[1],a=t[2];return e[0]=s*n[0]+r*n[3]+a*n[6],e[1]=s*n[1]+r*n[4]+a*n[7],e[2]=s*n[2]+r*n[5]+a*n[8],e}static transformQuat(e,t,n){let s=n[0],r=n[1],a=n[2],i=n[3]*2,c=t[0],y=t[1],L=t[2],k=r*L-a*y,l=a*c-s*L,b=s*y-r*c,M=(r*b-a*l)*2,d=(a*k-s*b)*2,m=(s*l-r*k)*2;return e[0]=c+k*i+M,e[1]=y+l*i+d,e[2]=L+b*i+m,e}static rotateX(e,t,n,s){let r=n[1],a=n[2],i=t[1]-r,c=t[2]-a;return e[0]=t[0],e[1]=i*Math.cos(s)-c*Math.sin(s)+r,e[2]=i*Math.sin(s)+c*Math.cos(s)+a,e}static rotateY(e,t,n,s){let r=n[0],a=n[2],i=t[0]-r,c=t[2]-a;return e[0]=c*Math.sin(s)+i*Math.cos(s)+r,e[1]=t[1],e[2]=c*Math.cos(s)-i*Math.sin(s)+a,e}static rotateZ(e,t,n,s){let r=n[0],a=n[1],i=t[0]-r,c=t[1]-a;return e[0]=i*Math.cos(s)-c*Math.sin(s)+r,e[1]=i*Math.sin(s)+c*Math.cos(s)+a,e[2]=n[2],e}static angle(e,t){let n=e[0],s=e[1],r=e[2],a=t[0],i=t[1],c=t[2],y=Math.sqrt((n*n+s*s+r*r)*(a*a+i*i+c*c)),L=y&&h.dot(e,t)/y;return Math.acos(Math.min(Math.max(L,-1),1))}static zero(e){return e[0]=0,e[1]=0,e[2]=0,e}static str(e){return`Vec3(${e.join(", ")})`}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=t[0],i=t[1],c=t[2];return Math.abs(n-a)<=1e-6*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(s-i)<=1e-6*Math.max(1,Math.abs(s),Math.abs(i))&&Math.abs(r-c)<=1e-6*Math.max(1,Math.abs(r),Math.abs(c))}};q.prototype.sub=q.prototype.subtract;q.prototype.mul=q.prototype.multiply;q.prototype.div=q.prototype.divide;q.prototype.dist=q.prototype.distance;q.prototype.sqrDist=q.prototype.squaredDistance;q.sub=q.subtract;q.mul=q.multiply;q.div=q.divide;q.dist=q.distance;q.sqrDist=q.squaredDistance;q.sqrLen=q.squaredLength;q.mag=q.magnitude;q.length=q.magnitude;q.len=q.magnitude;var E=class h extends Float64Array{constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t,t]):super(t,0,4);break}default:super(4);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get w(){return this[3]}set w(e){this[3]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get b(){return this[2]}set b(e){this[2]=e}get a(){return this[3]}set a(e){this[3]=e}get magnitude(){let e=this[0],t=this[1],n=this[2],s=this[3];return Math.sqrt(e*e+t*t+n*n+s*s)}get mag(){return this.magnitude}get str(){return h.str(this)}copy(e){return super.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this[2]+=e[2],this[3]+=e[3],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this[2]-=e[2],this[3]-=e[3],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this[2]*=e[2],this[3]*=e[3],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this[2]/=e[2],this[3]/=e[3],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this[3]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this[2]+=e[2]*t,this[3]+=e[3]*t,this}distance(e){return h.distance(this,e)}dist(e){return 0}squaredDistance(e){return h.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this[2]*=-1,this[3]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this[2]=1/this[2],this[3]=1/this[3],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this[2]=Math.abs(this[2]),this[3]=Math.abs(this[3]),this}dot(e){return this[0]*e[0]+this[1]*e[1]+this[2]*e[2]+this[3]*e[3]}normalize(){return h.normalize(this,this)}static get BYTE_LENGTH(){return 4*Float64Array.BYTES_PER_ELEMENT}static create(){return new h}static clone(e){return new h(e)}static fromValues(e,t,n,s){return new h(e,t,n,s)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static set(e,t,n,s,r){return e[0]=t,e[1]=n,e[2]=s,e[3]=r,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}static sub(e,t,n){return e}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e[3]=t[3]*n[3],e}static mul(e,t,n){return e}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e[3]=t[3]/n[3],e}static div(e,t,n){return e}static ceil(e,t){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}static floor(e,t){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}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e[3]=Math.min(t[3],n[3]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e[3]=Math.max(t[3],n[3]),e}static round(e,t){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}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e}static distance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2],a=t[3]-e[3];return Math.hypot(n,s,r,a)}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2],a=t[3]-e[3];return n*n+s*s+r*r+a*a}static sqrDist(e,t){return 0}static magnitude(e){let t=e[0],n=e[1],s=e[2],r=e[3];return Math.sqrt(t*t+n*n+s*s+r*r)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){let t=e[0],n=e[1],s=e[2],r=e[3];return t*t+n*n+s*s+r*r}static sqrLen(e){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e}static normalize(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*n+s*s+r*r+a*a;return i>0&&(i=1/Math.sqrt(i)),e[0]=n*i,e[1]=s*i,e[2]=r*i,e[3]=a*i,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}static cross(e,t,n,s){let r=n[0]*s[1]-n[1]*s[0],a=n[0]*s[2]-n[2]*s[0],i=n[0]*s[3]-n[3]*s[0],c=n[1]*s[2]-n[2]*s[1],y=n[1]*s[3]-n[3]*s[1],L=n[2]*s[3]-n[3]*s[2],k=t[0],l=t[1],b=t[2],M=t[3];return e[0]=l*L-b*y+M*c,e[1]=-(k*L)+b*i-M*a,e[2]=k*y-l*i+M*r,e[3]=-(k*c)+l*a-b*r,e}static lerp(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e[2]=i+s*(n[2]-i),e[3]=c+s*(n[3]-c),e}static transformMat4(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3];return e[0]=n[0]*s+n[4]*r+n[8]*a+n[12]*i,e[1]=n[1]*s+n[5]*r+n[9]*a+n[13]*i,e[2]=n[2]*s+n[6]*r+n[10]*a+n[14]*i,e[3]=n[3]*s+n[7]*r+n[11]*a+n[15]*i,e}static transformQuat(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[0],c=n[1],y=n[2],L=n[3],k=L*s+c*a-y*r,l=L*r+y*s-i*a,b=L*a+i*r-c*s,M=-i*s-c*r-y*a;return e[0]=k*L+M*-i+l*-y-b*-c,e[1]=l*L+M*-c+b*-i-k*-y,e[2]=b*L+M*-y+k*-c-l*-i,e[3]=t[3],e}static zero(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}static str(e){return`Vec4(${e.join(", ")})`}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=t[0],c=t[1],y=t[2],L=t[3];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(a-L)<=1e-6*Math.max(1,Math.abs(a),Math.abs(L))}};E.prototype.sub=E.prototype.subtract;E.prototype.mul=E.prototype.multiply;E.prototype.div=E.prototype.divide;E.prototype.dist=E.prototype.distance;E.prototype.sqrDist=E.prototype.squaredDistance;E.sub=E.subtract;E.mul=E.multiply;E.div=E.divide;E.dist=E.distance;E.sqrDist=E.squaredDistance;E.sqrLen=E.squaredLength;E.mag=E.magnitude;E.length=E.magnitude;E.len=E.magnitude;var N=class h extends Float64Array{static#t="zyx";static#e=new Float64Array(4);static#r=new Float64Array(4);static#n=new Float64Array(9);static#s=new Float64Array(3);static#a=new Float64Array([1,0,0]);static#i=new Float64Array([0,1,0]);constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t,t]):super(t,0,4);break}default:super(4),this[3]=1;break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get w(){return this[3]}set w(e){this[3]=e}get magnitude(){let e=this[0],t=this[1],n=this[2],s=this[3];return Math.sqrt(e*e+t*t+n*n+s*s)}get mag(){return this.magnitude}get str(){return h.str(this)}copy(e){return super.set(e),this}identity(){return this[0]=0,this[1]=0,this[2]=0,this[3]=1,this}multiply(e){return h.multiply(this,this,e)}mul(e){return this}rotateX(e){return h.rotateX(this,this,e)}rotateY(e){return h.rotateY(this,this,e)}rotateZ(e){return h.rotateZ(this,this,e)}invert(){return h.invert(this,this)}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this[3]*=e,this}dot(e){return h.dot(this,e)}static get BYTE_LENGTH(){return 4*Float64Array.BYTES_PER_ELEMENT}static create(){return new h}static identity(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}static setAxisAngle(e,t,n){n*=.5;let s=Math.sin(n);return e[0]=s*t[0],e[1]=s*t[1],e[2]=s*t[2],e[3]=Math.cos(n),e}static getAxisAngle(e,t){let n=Math.acos(t[3])*2,s=Math.sin(n/2);return s>1e-6?(e[0]=t[0]/s,e[1]=t[1]/s,e[2]=t[2]/s):(e[0]=1,e[1]=0,e[2]=0),n}static getAngle(e,t){let n=h.dot(e,t);return Math.acos(2*n*n-1)}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*k+i*c+r*L-a*y,e[1]=r*k+i*y+a*c-s*L,e[2]=a*k+i*L+s*y-r*c,e[3]=i*k-s*c-r*y-a*L,e}static rotateX(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+i*c,e[1]=r*y+a*c,e[2]=a*y-r*c,e[3]=i*y-s*c,e}static rotateY(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y-a*c,e[1]=r*y+i*c,e[2]=a*y+s*c,e[3]=i*y-r*c,e}static rotateZ(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+r*c,e[1]=r*y-s*c,e[2]=a*y+i*c,e[3]=i*y-a*c,e}static calculateW(e,t){let n=t[0],s=t[1],r=t[2];return e[0]=n,e[1]=s,e[2]=r,e[3]=Math.sqrt(Math.abs(1-n*n-s*s-r*r)),e}static exp(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=Math.sqrt(n*n+s*s+r*r),c=Math.exp(a),y=i>0?c*Math.sin(i)/i:0;return e[0]=n*y,e[1]=s*y,e[2]=r*y,e[3]=c*Math.cos(i),e}static ln(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=Math.sqrt(n*n+s*s+r*r),c=i>0?Math.atan2(i,a)/i:0;return e[0]=n*c,e[1]=s*c,e[2]=r*c,e[3]=.5*Math.log(n*n+s*s+r*r+a*a),e}static pow(e,t,n){return h.ln(e,t),h.scale(e,e,n),h.exp(e,e),e}static slerp(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3],y=n[0],L=n[1],k=n[2],l=n[3],b,M,d=r*y+a*L+i*k+c*l;if(d<0&&(d=-d,y=-y,L=-L,k=-k,l=-l),1-d>1e-6){let m=Math.acos(d),o=Math.sin(m);b=Math.sin((1-s)*m)/o,M=Math.sin(s*m)/o}else b=1-s,M=s;return e[0]=b*r+M*y,e[1]=b*a+M*L,e[2]=b*i+M*k,e[3]=b*c+M*l,e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*n+s*s+r*r+a*a,c=i?1/i:0;return e[0]=-n*c,e[1]=-s*c,e[2]=-r*c,e[3]=a*c,e}static conjugate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}static fromMat3(e,t){let n=t[0]+t[4]+t[8],s;if(n>0)s=Math.sqrt(n+1),e[3]=.5*s,s=.5/s,e[0]=(t[5]-t[7])*s,e[1]=(t[6]-t[2])*s,e[2]=(t[1]-t[3])*s;else{let r=0;t[4]>t[0]&&(r=1),t[8]>t[r*3+r]&&(r=2);let a=(r+1)%3,i=(r+2)%3;s=Math.sqrt(t[r*3+r]-t[a*3+a]-t[i*3+i]+1),e[r]=.5*s,s=.5/s,e[3]=(t[a*3+i]-t[i*3+a])*s,e[a]=(t[a*3+r]+t[r*3+a])*s,e[i]=(t[i*3+r]+t[r*3+i])*s}return e}static fromEuler(e,t,n,s,r=h.#t){let a=.5*Math.PI/180;t*=a,n*=a,s*=a;let i=Math.sin(t),c=Math.cos(t),y=Math.sin(n),L=Math.cos(n),k=Math.sin(s),l=Math.cos(s);switch(r){case"xyz":e[0]=i*L*l+c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l-i*y*k;break;case"xzy":e[0]=i*L*l-c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l+i*y*k;break;case"yxz":e[0]=i*L*l+c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l+i*y*k;break;case"yzx":e[0]=i*L*l+c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l-i*y*k;break;case"zxy":e[0]=i*L*l-c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l-i*y*k;break;case"zyx":e[0]=i*L*l-c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l+i*y*k;break;default:throw new Error(`Unknown angle order ${r}`)}return e}static str(e){return`Quat(${e.join(", ")})`}static clone(e){return new h(e)}static fromValues(e,t,n,s){return new h(e,t,n,s)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static set(e,t,n,s,r){return e}static add(e,t,n){return e}static mul(e,t,n){return e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}static lerp(e,t,n,s){return e}static magnitude(e){return 0}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){return 0}static sqrLen(e){return 0}static normalize(e,t){return e}static exactEquals(e,t){return!1}static equals(e,t){return!1}static rotationTo(e,t,n){let s=q.dot(t,n);return s<-.999999?(q.cross(h.#s,h.#a,t),q.mag(h.#s)<1e-6&&q.cross(h.#s,h.#i,t),q.normalize(h.#s,h.#s),h.setAxisAngle(e,h.#s,Math.PI),e):s>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(q.cross(h.#s,t,n),e[0]=h.#s[0],e[1]=h.#s[1],e[2]=h.#s[2],e[3]=1+s,h.normalize(e,e))}static sqlerp(e,t,n,s,r,a){return h.slerp(h.#e,t,r,a),h.slerp(h.#r,n,s,a),h.slerp(e,h.#e,h.#r,2*a*(1-a)),e}static setAxes(e,t,n,s){return h.#n[0]=n[0],h.#n[3]=n[1],h.#n[6]=n[2],h.#n[1]=s[0],h.#n[4]=s[1],h.#n[7]=s[2],h.#n[2]=-t[0],h.#n[5]=-t[1],h.#n[8]=-t[2],h.normalize(e,h.fromMat3(e,h.#n))}};N.set=E.set;N.add=E.add;N.lerp=E.lerp;N.normalize=E.normalize;N.squaredLength=E.squaredLength;N.sqrLen=E.squaredLength;N.exactEquals=E.exactEquals;N.equals=E.equals;N.magnitude=E.magnitude;N.prototype.mul=N.prototype.multiply;N.mul=N.multiply;N.mag=N.magnitude;N.length=N.magnitude;N.len=N.magnitude;var O=class h extends Float64Array{static#t=new Float64Array(4);static#e=new Float64Array(3);constructor(...e){switch(e.length){case 8:super(e);break;case 2:super(e[0],e[1],8);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t,t,t,t,t,t]):super(t,0,8);break}default:super(8),this[3]=1;break}}get str(){return h.str(this)}copy(e){return super.set(e),this}static get BYTE_LENGTH(){return 8*Float64Array.BYTES_PER_ELEMENT}static create(){return new h}static clone(e){return new h(e)}static fromValues(e,t,n,s,r,a,i,c){return new h(e,t,n,s,r,a,i,c)}static fromRotationTranslationValues(e,t,n,s,r,a,i){let c=r*.5,y=a*.5,L=i*.5;return new h(e,t,n,s,c*s+y*n-L*t,y*s+L*e-c*n,L*s+c*t-y*e,-c*e-y*t-L*n)}static fromRotationTranslation(e,t,n){let s=n[0]*.5,r=n[1]*.5,a=n[2]*.5,i=t[0],c=t[1],y=t[2],L=t[3];return e[0]=i,e[1]=c,e[2]=y,e[3]=L,e[4]=s*L+r*y-a*c,e[5]=r*L+a*i-s*y,e[6]=a*L+s*c-r*i,e[7]=-s*i-r*c-a*y,e}static fromTranslation(e,t){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0]*.5,e[5]=t[1]*.5,e[6]=t[2]*.5,e[7]=0,e}static fromRotation(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=0,e[5]=0,e[6]=0,e[7]=0,e}static fromMat4(e,t){return P.getRotation(h.#t,t),P.getTranslation(h.#e,t),h.fromRotationTranslation(e,h.#t,h.#e)}static copy(e,t){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}static identity(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e}static set(e,t,n,s,r,a,i,c,y){return e[0]=t,e[1]=n,e[2]=s,e[3]=r,e[4]=a,e[5]=i,e[6]=c,e[7]=y,e}static getReal(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static getDual(e,t){return e[0]=t[4],e[1]=t[5],e[2]=t[6],e[3]=t[7],e}static setReal(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static setDual(e,t){return e[4]=t[0],e[5]=t[1],e[6]=t[2],e[7]=t[3],e}static getTranslation(e,t){let n=t[4],s=t[5],r=t[6],a=t[7],i=-t[0],c=-t[1],y=-t[2],L=t[3];return e[0]=(n*L+a*i+s*y-r*c)*2,e[1]=(s*L+a*c+r*i-n*y)*2,e[2]=(r*L+a*y+n*c-s*i)*2,e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0]*.5,y=n[1]*.5,L=n[2]*.5,k=t[4],l=t[5],b=t[6],M=t[7];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=i*c+r*L-a*y+k,e[5]=i*y+a*c-s*L+l,e[6]=i*L+s*y-r*c+b,e[7]=-s*c-r*y-a*L+M,e}static rotateX(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,b=y*i+k*r+L*s-c*a,M=L*i+k*a+c*r-y*s,d=k*i-c*s-y*r-L*a;return N.rotateX(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+d*s+b*a-M*r,e[5]=b*i+d*r+M*s-l*a,e[6]=M*i+d*a+l*r-b*s,e[7]=d*i-l*s-b*r-M*a,e}static rotateY(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,b=y*i+k*r+L*s-c*a,M=L*i+k*a+c*r-y*s,d=k*i-c*s-y*r-L*a;return N.rotateY(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+d*s+b*a-M*r,e[5]=b*i+d*r+M*s-l*a,e[6]=M*i+d*a+l*r-b*s,e[7]=d*i-l*s-b*r-M*a,e}static rotateZ(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,b=y*i+k*r+L*s-c*a,M=L*i+k*a+c*r-y*s,d=k*i-c*s-y*r-L*a;return N.rotateZ(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+d*s+b*a-M*r,e[5]=b*i+d*r+M*s-l*a,e[6]=M*i+d*a+l*r-b*s,e[7]=d*i-l*s-b*r-M*a,e}static rotateByQuatAppend(e,t,n){let s=n[0],r=n[1],a=n[2],i=n[3],c=t[0],y=t[1],L=t[2],k=t[3];return e[0]=c*i+k*s+y*a-L*r,e[1]=y*i+k*r+L*s-c*a,e[2]=L*i+k*a+c*r-y*s,e[3]=k*i-c*s-y*r-L*a,c=t[4],y=t[5],L=t[6],k=t[7],e[4]=c*i+k*s+y*a-L*r,e[5]=y*i+k*r+L*s-c*a,e[6]=L*i+k*a+c*r-y*s,e[7]=k*i-c*s-y*r-L*a,e}static rotateByQuatPrepend(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*k+i*c+r*L-a*y,e[1]=r*k+i*y+a*c-s*L,e[2]=a*k+i*L+s*y-r*c,e[3]=i*k-s*c-r*y-a*L,c=n[4],y=n[5],L=n[6],k=n[7],e[4]=s*k+i*c+r*L-a*y,e[5]=r*k+i*y+a*c-s*L,e[6]=a*k+i*L+s*y-r*c,e[7]=i*k-s*c-r*y-a*L,e}static rotateAroundAxis(e,t,n,s){if(Math.abs(s)<1e-6)return h.copy(e,t);let r=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);s*=.5;let a=Math.sin(s),i=a*n[0]/r,c=a*n[1]/r,y=a*n[2]/r,L=Math.cos(s),k=t[0],l=t[1],b=t[2],M=t[3];e[0]=k*L+M*i+l*y-b*c,e[1]=l*L+M*c+b*i-k*y,e[2]=b*L+M*y+k*c-l*i,e[3]=M*L-k*i-l*c-b*y;let d=t[4],m=t[5],o=t[6],x=t[7];return e[4]=d*L+x*i+m*y-o*c,e[5]=m*L+x*c+o*i-d*y,e[6]=o*L+x*y+d*c-m*i,e[7]=x*L-d*i-m*c-o*y,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[4],y=n[5],L=n[6],k=n[7],l=t[4],b=t[5],M=t[6],d=t[7],m=n[0],o=n[1],x=n[2],z=n[3];return e[0]=s*z+i*m+r*x-a*o,e[1]=r*z+i*o+a*m-s*x,e[2]=a*z+i*x+s*o-r*m,e[3]=i*z-s*m-r*o-a*x,e[4]=s*k+i*c+r*L-a*y+l*z+d*m+b*x-M*o,e[5]=r*k+i*y+a*c-s*L+b*z+d*o+M*m-l*x,e[6]=a*k+i*L+s*y-r*c+M*z+d*x+l*o-b*m,e[7]=i*k-s*c-r*y-a*L+d*z-l*m-b*o-M*x,e}static mul(e,t,n){return e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e}static dot(e,t){return 0}static lerp(e,t,n,s){let r=1-s;return h.dot(t,n)<0&&(s=-s),e[0]=t[0]*r+n[0]*s,e[1]=t[1]*r+n[1]*s,e[2]=t[2]*r+n[2]*s,e[3]=t[3]*r+n[3]*s,e[4]=t[4]*r+n[4]*s,e[5]=t[5]*r+n[5]*s,e[6]=t[6]*r+n[6]*s,e[7]=t[7]*r+n[7]*s,e}static invert(e,t){let n=h.squaredLength(t);return e[0]=-t[0]/n,e[1]=-t[1]/n,e[2]=-t[2]/n,e[3]=t[3]/n,e[4]=-t[4]/n,e[5]=-t[5]/n,e[6]=-t[6]/n,e[7]=t[7]/n,e}static conjugate(e,t){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}static magnitude(e){return 0}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){return 0}static sqrLen(e){return 0}static normalize(e,t){let n=h.squaredLength(t);if(n>0){n=Math.sqrt(n);let s=t[0]/n,r=t[1]/n,a=t[2]/n,i=t[3]/n,c=t[4],y=t[5],L=t[6],k=t[7],l=s*c+r*y+a*L+i*k;e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=(c-s*l)/n,e[5]=(y-r*l)/n,e[6]=(L-a*l)/n,e[7]=(k-i*l)/n}return e}static str(e){return`Quat2(${e.join(", ")})`}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=t[0],l=t[1],b=t[2],M=t[3],d=t[4],m=t[5],o=t[6],x=t[7];return Math.abs(n-k)<=1e-6*Math.max(1,Math.abs(n),Math.abs(k))&&Math.abs(s-l)<=1e-6*Math.max(1,Math.abs(s),Math.abs(l))&&Math.abs(r-b)<=1e-6*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(a-M)<=1e-6*Math.max(1,Math.abs(a),Math.abs(M))&&Math.abs(i-d)<=1e-6*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(c-m)<=1e-6*Math.max(1,Math.abs(c),Math.abs(m))&&Math.abs(y-o)<=1e-6*Math.max(1,Math.abs(y),Math.abs(o))&&Math.abs(L-x)<=1e-6*Math.max(1,Math.abs(L),Math.abs(x))}};O.dot=N.dot;O.squaredLength=N.squaredLength;O.sqrLen=N.squaredLength;O.mag=N.magnitude;O.length=N.magnitude;O.len=N.magnitude;O.mul=O.multiply;var B=class h extends Float64Array{constructor(...e){switch(e.length){case 2:{let t=e[0];typeof t=="number"?super([t,e[1]]):super(t,e[1],2);break}case 1:{let t=e[0];typeof t=="number"?super([t,t]):super(t,0,2);break}default:super(2);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get magnitude(){return Math.hypot(this[0],this[1])}get mag(){return this.magnitude}get squaredMagnitude(){let e=this[0],t=this[1];return e*e+t*t}get sqrMag(){return this.squaredMagnitude}get str(){return h.str(this)}copy(e){return this.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this}distance(e){return h.distance(this,e)}dist(e){return 0}squaredDistance(e){return h.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this}dot(e){return this[0]*e[0]+this[1]*e[1]}normalize(){return h.normalize(this,this)}static get BYTE_LENGTH(){return 2*Float64Array.BYTES_PER_ELEMENT}static create(){return new h}static clone(e){return new h(e)}static fromValues(e,t){return new h(e,t)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e}static set(e,t,n){return e[0]=t,e[1]=n,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}static sub(e,t,n){return[0,0]}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e}static mul(e,t,n){return[0,0]}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e}static div(e,t,n){return[0,0]}static ceil(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}static floor(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e}static round(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e}static distance(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1])}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1];return n*n+s*s}static sqrDist(e,t){return 0}static magnitude(e){let t=e[0],n=e[1];return Math.sqrt(t*t+n*n)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){let t=e[0],n=e[1];return t*t+n*n}static sqrLen(e,t){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e}static normalize(e,t){let n=t[0],s=t[1],r=n*n+s*s;return r>0&&(r=1/Math.sqrt(r)),e[0]=t[0]*r,e[1]=t[1]*r,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]}static cross(e,t,n){let s=t[0]*n[1]-t[1]*n[0];return e[0]=e[1]=0,e[2]=s,e}static lerp(e,t,n,s){let r=t[0],a=t[1];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e}static transformMat2(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[2]*r,e[1]=n[1]*s+n[3]*r,e}static transformMat2d(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[2]*r+n[4],e[1]=n[1]*s+n[3]*r+n[5],e}static transformMat3(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[3]*r+n[6],e[1]=n[1]*s+n[4]*r+n[7],e}static transformMat4(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[4]*r+n[12],e[1]=n[1]*s+n[5]*r+n[13],e}static rotate(e,t,n,s){let r=t[0]-n[0],a=t[1]-n[1],i=Math.sin(s),c=Math.cos(s);return e[0]=r*c-a*i+n[0],e[1]=r*i+a*c+n[1],e}static angle(e,t){let n=e[0],s=e[1],r=t[0],a=t[1],i=Math.sqrt(n*n+s*s)*Math.sqrt(r*r+a*a),c=i&&(n*r+s*a)/i;return Math.acos(Math.min(Math.max(c,-1),1))}static zero(e){return e[0]=0,e[1]=0,e}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]}static equals(e,t){let n=e[0],s=e[1],r=t[0],a=t[1];return Math.abs(n-r)<=1e-6*Math.max(1,Math.abs(n),Math.abs(r))&&Math.abs(s-a)<=1e-6*Math.max(1,Math.abs(s),Math.abs(a))}static str(e){return`Vec2(${e.join(", ")})`}};B.prototype.sub=B.prototype.subtract;B.prototype.mul=B.prototype.multiply;B.prototype.div=B.prototype.divide;B.prototype.dist=B.prototype.distance;B.prototype.sqrDist=B.prototype.squaredDistance;B.sub=B.subtract;B.mul=B.multiply;B.div=B.divide;B.dist=B.distance;B.sqrDist=B.squaredDistance;B.sqrLen=B.squaredLength;B.mag=B.magnitude;B.length=B.magnitude;B.len=B.magnitude;var U=!1;function te(){if(U)return;let h=["xx","xy","yx","yy","xxx","xxy","xyx","xyy","yxx","yxy","yyx","yyy","xxxx","xxxy","xxyx","xxyy","xyxx","xyxy","xyyx","xyyy","yxxx","yxxy","yxyx","yxyy","yyxx","yyxy","yyyx","yyyy","rr","rg","gr","gg","rrr","rrg","rgr","rgg","grr","grg","ggr","ggg","rrrr","rrrg","rrgr","rrgg","rgrr","rgrg","rggr","rggg","grrr","grrg","grgr","grgg","ggrr","ggrg","gggr","gggg"],e=["xz","yz","zx","zy","zz","xxz","xyz","xzx","xzy","xzz","yxz","yyz","yzx","yzy","yzz","zxx","zxy","zxz","zyx","zyy","zyz","zzx","zzy","zzz","xxxz","xxyz","xxzx","xxzy","xxzz","xyxz","xyyz","xyzx","xyzy","xyzz","xzxx","xzxy","xzxz","xzyx","xzyy","xzyz","xzzx","xzzy","xzzz","yxxz","yxyz","yxzx","yxzy","yxzz","yyxz","yyyz","yyzx","yyzy","yyzz","yzxx","yzxy","yzxz","yzyx","yzyy","yzyz","yzzx","yzzy","yzzz","zxxx","zxxy","zxxz","zxyx","zxyy","zxyz","zxzx","zxzy","zxzz","zyxx","zyxy","zyxz","zyyx","zyyy","zyyz","zyzx","zyzy","zyzz","zzxx","zzxy","zzxz","zzyx","zzyy","zzyz","zzzx","zzzy","zzzz","rb","gb","br","bg","bb","rrb","rgb","rbr","rbg","rbb","grb","ggb","gbr","gbg","gbb","brr","brg","brb","bgr","bgg","bgb","bbr","bbg","bbb","rrrb","rrgb","rrbr","rrbg","rrbb","rgrb","rggb","rgbr","rgbg","rgbb","rbrr","rbrg","rbrb","rbgr","rbgg","rbgb","rbbr","rbbg","rbbb","grrb","grgb","grbr","grbg","grbb","ggrb","gggb","ggbr","ggbg","ggbb","gbrr","gbrg","gbrb","gbgr","gbgg","gbgb","gbbr","gbbg","gbbb","brrr","brrg","brrb","brgr","brgg","brgb","brbr","brbg","brbb","bgrr","bgrg","bgrb","bggr","bggg","bggb","bgbr","bgbg","bgbb","bbrr","bbrg","bbrb","bbgr","bbgg","bbgb","bbbr","bbbg","bbbb"],t=["xw","yw","zw","wx","wy","wz","ww","xxw","xyw","xzw","xwx","xwy","xwz","xww","yxw","yyw","yzw","ywx","ywy","ywz","yww","zxw","zyw","zzw","zwx","zwy","zwz","zww","wxx","wxy","wxz","wxw","wyx","wyy","wyz","wyw","wzx","wzy","wzz","wzw","wwx","wwy","wwz","www","xxxw","xxyw","xxzw","xxwx","xxwy","xxwz","xxww","xyxw","xyyw","xyzw","xywx","xywy","xywz","xyww","xzxw","xzyw","xzzw","xzwx","xzwy","xzwz","xzww","xwxx","xwxy","xwxz","xwxw","xwyx","xwyy","xwyz","xwyw","xwzx","xwzy","xwzz","xwzw","xwwx","xwwy","xwwz","xwww","yxxw","yxyw","yxzw","yxwx","yxwy","yxwz","yxww","yyxw","yyyw","yyzw","yywx","yywy","yywz","yyww","yzxw","yzyw","yzzw","yzwx","yzwy","yzwz","yzww","ywxx","ywxy","ywxz","ywxw","ywyx","ywyy","ywyz","ywyw","ywzx","ywzy","ywzz","ywzw","ywwx","ywwy","ywwz","ywww","zxxw","zxyw","zxzw","zxwx","zxwy","zxwz","zxww","zyxw","zyyw","zyzw","zywx","zywy","zywz","zyww","zzxw","zzyw","zzzw","zzwx","zzwy","zzwz","zzww","zwxx","zwxy","zwxz","zwxw","zwyx","zwyy","zwyz","zwyw","zwzx","zwzy","zwzz","zwzw","zwwx","zwwy","zwwz","zwww","wxxx","wxxy","wxxz","wxxw","wxyx","wxyy","wxyz","wxyw","wxzx","wxzy","wxzz","wxzw","wxwx","wxwy","wxwz","wxww","wyxx","wyxy","wyxz","wyxw","wyyx","wyyy","wyyz","wyyw","wyzx","wyzy","wyzz","wyzw","wywx","wywy","wywz","wyww","wzxx","wzxy","wzxz","wzxw","wzyx","wzyy","wzyz","wzyw","wzzx","wzzy","wzzz","wzzw","wzwx","wzwy","wzwz","wzww","wwxx","wwxy","wwxz","wwxw","wwyx","wwyy","wwyz","wwyw","wwzx","wwzy","wwzz","wwzw","wwwx","wwwy","wwwz","wwww","ra","ga","ba","ar","ag","ab","aa","rra","rga","rba","rar","rag","rab","raa","gra","gga","gba","gar","gag","gab","gaa","bra","bga","bba","bar","bag","bab","baa","arr","arg","arb","ara","agr","agg","agb","aga","abr","abg","abb","aba","aar","aag","aab","aaa","rrra","rrga","rrba","rrar","rrag","rrab","rraa","rgra","rgga","rgba","rgar","rgag","rgab","rgaa","rbra","rbga","rbba","rbar","rbag","rbab","rbaa","rarr","rarg","rarb","rara","ragr","ragg","ragb","raga","rabr","rabg","rabb","raba","raar","raag","raab","raaa","grra","grga","grba","grar","grag","grab","graa","ggra","ggga","ggba","ggar","ggag","ggab","ggaa","gbra","gbga","gbba","gbar","gbag","gbab","gbaa","garr","garg","garb","gara","gagr","gagg","gagb","gaga","gabr","gabg","gabb","gaba","gaar","gaag","gaab","gaaa","brra","brga","brba","brar","brag","brab","braa","bgra","bgga","bgba","bgar","bgag","bgab","bgaa","bbra","bbga","bbba","bbar","bbag","bbab","bbaa","barr","barg","barb","bara","bagr","bagg","bagb","baga","babr","babg","babb","baba","baar","baag","baab","baaa","arrr","arrg","arrb","arra","argr","argg","argb","arga","arbr","arbg","arbb","arba","arar","arag","arab","araa","agrr","agrg","agrb","agra","aggr","aggg","aggb","agga","agbr","agbg","agbb","agba","agar","agag","agab","agaa","abrr","abrg","abrb","abra","abgr","abgg","abgb","abga","abbr","abbg","abbb","abba","abar","abag","abab","abaa","aarr","aarg","aarb","aara","aagr","aagg","aagb","aaga","aabr","aabg","aabb","aaba","aaar","aaag","aaab","aaaa"],n={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};function s(r){switch(r.length){case 2:return function(){return new B(this[n[r[0]]],this[n[r[1]]])};case 3:return function(){return new q(this[n[r[0]]],this[n[r[1]]],this[n[r[2]]])};case 4:return function(){return new E(this[n[r[0]]],this[n[r[1]]],this[n[r[2]]],this[n[r[3]]])}}throw new Error("Illegal swizzle length")}for(let r of h){let a=s(r);Object.defineProperty(B.prototype,r,{get:a}),Object.defineProperty(q.prototype,r,{get:a}),Object.defineProperty(E.prototype,r,{get:a})}for(let r of e){let a=s(r);Object.defineProperty(q.prototype,r,{get:a}),Object.defineProperty(E.prototype,r,{get:a})}for(let r of t){let a=s(r);Object.defineProperty(E.prototype,r,{get:a})}U=!0}var ne=Math.PI/180,se=180/Math.PI;function re(h){return h*se}function ae(h){return h*ne} +//# sourceMappingURL=gl-matrix-f64.min.cjs.map diff --git a/dist-cdn/cjs/2022/gl-matrix-f64.min.cjs.map b/dist-cdn/cjs/2022/gl-matrix-f64.min.cjs.map new file mode 100644 index 00000000..9c0977ec --- /dev/null +++ b/dist-cdn/cjs/2022/gl-matrix-f64.min.cjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../../../src/cdn/f64/index.ts", "../../../src/_lib/f64/Mat2.ts", "../../../src/_lib/f64/Mat2d.ts", "../../../src/_lib/f64/Mat3.ts", "../../../src/_lib/f64/Mat4.ts", "../../../src/_lib/f64/Vec3.ts", "../../../src/_lib/f64/Vec4.ts", "../../../src/_lib/f64/Quat.ts", "../../../src/_lib/f64/Quat2.ts", "../../../src/_lib/f64/Vec2.ts", "../../../src/swizzle/f64/index.ts", "../../../src/util/angleConversion.ts"], + "sourcesContent": ["/**\r\n * Provides an all-inclusive ESM distribution of `gl-matrix` (64-bit). All library classes extends `Float64Array`.\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\n/* v8 ignore next 5 */\r\nexport * from '#gl-matrix/f64';\r\nexport * from '#gl-matrix/swizzle/f64';\r\nexport * from '#gl-matrix/types';\r\nexport * from '#gl-matrix/types/swizzle/f64';\r\nexport * from '#gl-matrix/util';\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x2 Matrix\r\n */\r\nexport class Mat2 extends Float64Array {\r\n static #IDENTITY_2X2 = new Float64Array([\r\n 1, 0,\r\n 0, 1\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n default:\r\n super(Mat2.#IDENTITY_2X2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2} into `this`.\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2.identity(this)\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n identity(): this {\r\n this.set(Mat2.#IDENTITY_2X2);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2} against another one\r\n * Equivalent to `Mat2.multiply(this, this, b);`\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat2}\r\n * Equivalent to `Mat2.transpose(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n transpose(): this {\r\n return Mat2.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat2}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n invert(): this {\r\n return Mat2.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2.scale(this, this, v);`\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2} by the given angle around the given axis\r\n * Equivalent to `Mat2.rotate(this, this, rad);`\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n rotate(rad: number): this {\r\n return Mat2.rotate(this, this, rad) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2}\r\n */\r\n static create(): Mat2 {\r\n return new Mat2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2}\r\n */\r\n static clone(a: Readonly): Mat2 {\r\n return new Mat2(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2Like, a: Readonly): Mat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2}\r\n */\r\n static fromValues(...values: number[]): Mat2 {\r\n return new Mat2(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2Like, ...values: number[]): Mat2Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2Like): Mat2Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat2Like, a: Readonly): Mat2Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache\r\n // some values\r\n if (out === a) {\r\n const a1 = a[1];\r\n out[1] = a[2];\r\n out[2] = a1;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[2];\r\n out[2] = a[1];\r\n out[3] = a[3];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2Like, a: Mat2Like): Mat2Like | null {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n // Calculate the determinant\r\n let det = a0 * a3 - a2 * a1;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = a3 * det;\r\n out[1] = -a1 * det;\r\n out[2] = -a2 * det;\r\n out[3] = a0 * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat2Like, a: Mat2Like): Mat2Like {\r\n // Caching this value is necessary if out == a\r\n const a0 = a[0];\r\n out[0] = a[3];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[2] * a[1];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n return out;\r\n }\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Rotates a {@link Mat2} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2Like, a: Readonly, rad: number): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2Like, a: Readonly, v: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2Like, rad: number): Mat2Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2Like, v: Readonly): Mat2Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2Like, a: Readonly, b: number): Mat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2Like, a: Readonly, b: Readonly, scale: number): Mat2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\r\n * @category Static\r\n *\r\n * @param L - the lower triangular matrix\r\n * @param D - the diagonal matrix\r\n * @param U - the upper triangular matrix\r\n * @param a - the input matrix to factorize\r\n */\r\n\r\n static LDU(L: Mat2Like, D: Readonly, U: Mat2Like, a: Readonly):\r\n [Mat2Like, Readonly, Mat2Like] {\r\n L[2] = a[2] / a[0];\r\n U[0] = a[0];\r\n U[1] = a[1];\r\n U[3] = a[3] - L[2] * U[1];\r\n return [L, D, U];\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat2.prototype.mul = Mat2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat2.mul = Mat2.multiply;\r\nMat2.sub = Mat2.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x3 Matrix\r\n */\r\nexport class Mat2d extends Float64Array {\r\n static #IDENTITY_2X3 = new Float64Array([\r\n 1, 0,\r\n 0, 1,\r\n 0, 0,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 6:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 6); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 6);\r\n }\r\n break;\r\n default:\r\n super(Mat2d.#IDENTITY_2X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2d.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2d.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2d} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2d.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat2d.#IDENTITY_2X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2d} against another one\r\n * Equivalent to `Mat2d.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2d.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Translate this {@link Mat2d} by the given vector\r\n * Equivalent to `Mat2d.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat2d.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2d} by the given angle around the given axis\r\n * Equivalent to `Mat2d.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat2d.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2d.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2d.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2d}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 6 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2d}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2d}\r\n */\r\n static create(): Mat2d {\r\n return new Mat2d();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2d} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2d}\r\n */\r\n static clone(a: Readonly): Mat2d {\r\n return new Mat2d(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2d} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2dLike, a: Readonly): Mat2dLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2d} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2d}\r\n */\r\n static fromValues(...values: number[]): Mat2d {\r\n return new Mat2d(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2d} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2dLike, ...values: number[]): Mat2dLike {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2d} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2dLike): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2dLike, a: Mat2dLike): Mat2dLike | null {\r\n const aa = a[0];\r\n const ab = a[1];\r\n const ac = a[2];\r\n const ad = a[3];\r\n const atx = a[4];\r\n const aty = a[5];\r\n\r\n let det = aa * ad - ab * ac;\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = ad * det;\r\n out[1] = -ab * det;\r\n out[2] = -ac * det;\r\n out[3] = aa * det;\r\n out[4] = (ac * aty - ad * atx) * det;\r\n out[5] = (ab * atx - aa * aty) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[1] * a[2];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2d}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n out[4] = a0 * b4 + a2 * b5 + a4;\r\n out[5] = a1 * b4 + a3 * b5 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat2d} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n out[4] = a0 * v0 + a2 * v1 + a4;\r\n out[5] = a1 * v0 + a3 * v1 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat2d} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2dLike, a: Readonly, rad: number): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n // TODO: Got to fromRotation\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = v[0];\r\n out[5] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2dLike, rad: number): Mat2dLike {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2d} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2dLike, a: Readonly, b: number): Mat2dLike {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2dLike, a: Readonly, b: Readonly, scale: number):\r\n Mat2dLike {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2d(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Static method alias assignments\r\nMat2d.mul = Mat2d.multiply;\r\nMat2d.sub = Mat2d.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Mat3Like, Mat4Like, Vec2Like, QuatLike } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 3x3 Matrix\r\n */\r\nexport class Mat3 extends Float64Array {\r\n static #IDENTITY_3X3 = new Float64Array([\r\n 1, 0, 0,\r\n 0, 1, 0,\r\n 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 9:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 9); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v,\r\n v, v, v,\r\n v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 9);\r\n }\r\n break;\r\n default:\r\n super(Mat3.#IDENTITY_3X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat3.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat3.#IDENTITY_3X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat3} against another one\r\n * Equivalent to `Mat3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat3.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat3}\r\n * Equivalent to `Mat3.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat3.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat3}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat3.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat3} by the given vector\r\n * Equivalent to `Mat3.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat3.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat3} by the given angle around the given axis\r\n * Equivalent to `Mat3.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat3.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat3.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat3.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 9 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat3}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat3}\r\n */\r\n static create(): Mat3 {\r\n return new Mat3();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat3} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat3}\r\n */\r\n static clone(a: Readonly): Mat3 {\r\n return new Mat3(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat3} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat3} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat3}\r\n */\r\n static fromValues(...values: number[]): Mat3 {\r\n return new Mat3(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat3} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat3Like, ...values: number[]): Mat3Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat3} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat3Like): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat3Like, a: Readonly): Mat3Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a12 = a[5];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a01;\r\n out[5] = a[7];\r\n out[6] = a02;\r\n out[7] = a12;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a[1];\r\n out[4] = a[4];\r\n out[5] = a[7];\r\n out[6] = a[2];\r\n out[7] = a[5];\r\n out[8] = a[8];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat3Like, a: Mat3Like): Mat3Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2];\r\n const a10 = a[3],\r\n a11 = a[4],\r\n a12 = a[5];\r\n const a20 = a[6],\r\n a21 = a[7],\r\n a22 = a[8];\r\n\r\n const b01 = a22 * a11 - a12 * a21;\r\n const b11 = -a22 * a10 + a12 * a20;\r\n const b21 = a21 * a10 - a11 * a20;\r\n\r\n // Calculate the determinant\r\n let det = a00 * b01 + a01 * b11 + a02 * b21;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = b01 * det;\r\n out[1] = (-a22 * a01 + a02 * a21) * det;\r\n out[2] = (a12 * a01 - a02 * a11) * det;\r\n out[3] = b11 * det;\r\n out[4] = (a22 * a00 - a02 * a20) * det;\r\n out[5] = (-a12 * a00 + a02 * a10) * det;\r\n out[6] = b21 * det;\r\n out[7] = (-a21 * a00 + a01 * a20) * det;\r\n out[8] = (a11 * a00 - a01 * a10) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat3Like, a: Mat3Like): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n out[0] = a11 * a22 - a12 * a21;\r\n out[1] = a02 * a21 - a01 * a22;\r\n out[2] = a01 * a12 - a02 * a11;\r\n out[3] = a12 * a20 - a10 * a22;\r\n out[4] = a00 * a22 - a02 * a20;\r\n out[5] = a02 * a10 - a00 * a12;\r\n out[6] = a10 * a21 - a11 * a20;\r\n out[7] = a01 * a20 - a00 * a21;\r\n out[8] = a00 * a11 - a01 * a10;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n return (\r\n a00 * (a22 * a11 - a12 * a21) +\r\n a01 * (-a22 * a10 + a12 * a20) +\r\n a02 * (a21 * a10 - a11 * a20)\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[3];\r\n b1 = b[4];\r\n b2 = b[5];\r\n out[3] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[4] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[5] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[6];\r\n b1 = b[7];\r\n b2 = b[8];\r\n out[6] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[7] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[8] = b0 * a02 + b1 * a12 + b2 * a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat3} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n\r\n out[3] = a10;\r\n out[4] = a11;\r\n out[5] = a12;\r\n\r\n out[6] = x * a00 + y * a10 + a20;\r\n out[7] = x * a01 + y * a11 + a21;\r\n out[8] = x * a02 + y * a12 + a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat3} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat3Like, a: Readonly, rad: number): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c * a00 + s * a10;\r\n out[1] = c * a01 + s * a11;\r\n out[2] = c * a02 + s * a12;\r\n\r\n out[3] = c * a10 - s * a00;\r\n out[4] = c * a11 - s * a01;\r\n out[5] = c * a12 - s * a02;\r\n\r\n out[6] = a20;\r\n out[7] = a21;\r\n out[8] = a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat3} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = x * a[0];\r\n out[1] = x * a[1];\r\n out[2] = x * a[2];\r\n\r\n out[3] = y * a[3];\r\n out[4] = y * a[4];\r\n out[5] = y * a[5];\r\n\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = v[0];\r\n out[7] = v[1];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.rotate(dest, dest, rad);\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat3Like, rad: number): Mat3Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n\r\n out[3] = -s;\r\n out[4] = c;\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n\r\n out[3] = 0;\r\n out[4] = v[1];\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat2d} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 2x3 matrix\r\n * @returns `out`\r\n */\r\n static fromMat2d(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = 0;\r\n\r\n out[3] = a[2];\r\n out[4] = a[3];\r\n out[5] = 0;\r\n\r\n out[6] = a[4];\r\n out[7] = a[5];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param q - {@link Quat} to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat3Like, q: Readonly): Mat3Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[3] = yx - wz;\r\n out[6] = zx + wy;\r\n\r\n out[1] = yx + wz;\r\n out[4] = 1 - xx - zz;\r\n out[7] = zy - wx;\r\n\r\n out[2] = zx - wy;\r\n out[5] = zy + wx;\r\n out[8] = 1 - xx - yy;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat4} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 4x4 matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[4];\r\n out[4] = a[5];\r\n out[5] = a[6];\r\n out[6] = a[8];\r\n out[7] = a[9];\r\n out[8] = a[10];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\r\n * @category Static\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat3Like, a: Readonly): Mat3Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n\r\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n\r\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat3Like, a: Readonly): Mat3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n\r\n out[3] = cy * az - cz * ay;\r\n out[4] = cz * ax - cx * az;\r\n out[5] = cx * ay - cy * ax;\r\n\r\n out[6] = ay * bz - az * by;\r\n out[7] = az * bx - ax * bz;\r\n out[8] = ax * by - ay * bx;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a 2D projection matrix with the given bounds\r\n * @category Static\r\n *\r\n * @param out mat3 frustum matrix will be written into\r\n * @param width Width of your gl context\r\n * @param height Height of gl context\r\n * @returns `out`\r\n */\r\n static projection(out: Mat3Like, width: number, height: number): Mat3Like {\r\n out[0] = 2 / width;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -2 / height;\r\n out[5] = 0;\r\n out[6] = -1;\r\n out[7] = 1;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8]\r\n );\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat3} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat3Like, a: Readonly, b: number): Mat3Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat3Like, a: Readonly, b: Readonly, scale: number): Mat3Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat3(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat3.prototype.mul = Mat3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat3.mul = Mat3.multiply;\r\nMat3.sub = Mat3.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 4x4 Matrix\r\n */\r\nexport class Mat4 extends Float64Array {\r\n static #IDENTITY_4X4 = new Float64Array([\r\n 1, 0, 0, 0,\r\n 0, 1, 0, 0,\r\n 0, 0, 1, 0,\r\n 0, 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Temporary variable to prevent repeated allocations in the algorithms within Mat4.\r\n * These are declared as TypedArrays to aid in tree-shaking.\r\n */\r\n static #TMP_VEC3 = new Float64Array(3);\r\n\r\n /**\r\n * Create a {@link Mat4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 16:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 16); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 16);\r\n }\r\n break;\r\n default:\r\n super(Mat4.#IDENTITY_4X4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat4.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat4.#IDENTITY_4X4);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat4} against another one\r\n * Equivalent to `Mat4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat4.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat4}\r\n * Equivalent to `Mat4.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat4.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat4}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat4.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat4} by the given vector\r\n * Equivalent to `Mat4.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat4.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the given axis\r\n * Equivalent to `Mat4.rotate(this, this, rad, axis);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `this`\r\n */\r\n rotate(rad: number, axis: Readonly): this {\r\n return Mat4.rotate(this, this, rad, axis) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat4.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat4.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the X axis\r\n * Equivalent to `Mat4.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Mat4.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Y axis\r\n * Equivalent to `Mat4.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Mat4.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Z axis\r\n * Equivalent to `Mat4.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Mat4.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveNO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveNO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveZO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveZO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoNO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoNO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoZO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoZO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 16 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat4}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat4}\r\n */\r\n static create(): Mat4 {\r\n return new Mat4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat4} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat4}\r\n */\r\n static clone(a: Readonly): Mat4 {\r\n return new Mat4(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat4} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat4Like, a: Readonly): Mat4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new mat4 with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat4}\r\n */\r\n static fromValues(...values: number[]): Mat4 {\r\n return new Mat4(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a mat4 to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat4Like, ...values: number[]): Mat4Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n out[9] = values[9];\r\n out[10] = values[10];\r\n out[11] = values[11];\r\n out[12] = values[12];\r\n out[13] = values[13];\r\n out[14] = values[14];\r\n out[15] = values[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat4} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat4Like): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat4Like, a: Readonly): Mat4Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a12 = a[6],\r\n a13 = a[7];\r\n const a23 = a[11];\r\n\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a01;\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a02;\r\n out[9] = a12;\r\n out[11] = a[14];\r\n out[12] = a03;\r\n out[13] = a13;\r\n out[14] = a23;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a[1];\r\n out[5] = a[5];\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a[2];\r\n out[9] = a[6];\r\n out[10] = a[10];\r\n out[11] = a[14];\r\n out[12] = a[3];\r\n out[13] = a[7];\r\n out[14] = a[11];\r\n out[15] = a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat4Like, a: Mat4Like): Mat4Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\r\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\r\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\r\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\r\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\r\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\r\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat4Like, a: Mat4Like): Mat4Like {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n out[0] = a11 * b11 - a12 * b10 + a13 * b09;\r\n out[1] = a02 * b10 - a01 * b11 - a03 * b09;\r\n out[2] = a31 * b05 - a32 * b04 + a33 * b03;\r\n out[3] = a22 * b04 - a21 * b05 - a23 * b03;\r\n out[4] = a12 * b08 - a10 * b11 - a13 * b07;\r\n out[5] = a00 * b11 - a02 * b08 + a03 * b07;\r\n out[6] = a32 * b02 - a30 * b05 - a33 * b01;\r\n out[7] = a20 * b05 - a22 * b02 + a23 * b01;\r\n out[8] = a10 * b10 - a11 * b08 + a13 * b06;\r\n out[9] = a01 * b08 - a00 * b10 - a03 * b06;\r\n out[10] = a30 * b04 - a31 * b02 + a33 * b00;\r\n out[11] = a21 * b02 - a20 * b04 - a23 * b00;\r\n out[12] = a11 * b07 - a10 * b09 - a12 * b06;\r\n out[13] = a00 * b09 - a01 * b07 + a02 * b06;\r\n out[14] = a31 * b01 - a30 * b03 - a32 * b00;\r\n out[15] = a20 * b03 - a21 * b01 + a22 * b00;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b0 = a00 * a11 - a01 * a10;\r\n const b1 = a00 * a12 - a02 * a10;\r\n const b2 = a01 * a12 - a02 * a11;\r\n const b3 = a20 * a31 - a21 * a30;\r\n const b4 = a20 * a32 - a22 * a30;\r\n const b5 = a21 * a32 - a22 * a31;\r\n const b6 = a00 * b5 - a01 * b4 + a02 * b3;\r\n const b7 = a10 * b5 - a11 * b4 + a12 * b3;\r\n const b8 = a20 * b2 - a21 * b1 + a22 * b0;\r\n const b9 = a30 * b2 - a31 * b1 + a32 * b0;\r\n\r\n // Calculate the determinant\r\n return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Mat4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n // Cache only the current line of the second matrix\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n let b3 = b[3];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[4];\r\n b1 = b[5];\r\n b2 = b[6];\r\n b3 = b[7];\r\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[8];\r\n b1 = b[9];\r\n b2 = b[10];\r\n b3 = b[11];\r\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[12];\r\n b1 = b[13];\r\n b2 = b[14];\r\n b3 = b[15];\r\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat4} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n if (a === out) {\r\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\r\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\r\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\r\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\r\n } else {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n out[3] = a03;\r\n out[4] = a10;\r\n out[5] = a11;\r\n out[6] = a12;\r\n out[7] = a13;\r\n out[8] = a20;\r\n out[9] = a21;\r\n out[10] = a22;\r\n out[11] = a23;\r\n\r\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\r\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\r\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\r\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec3} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n out[0] = a[0] * x;\r\n out[1] = a[1] * x;\r\n out[2] = a[2] * x;\r\n out[3] = a[3] * x;\r\n out[4] = a[4] * y;\r\n out[5] = a[5] * y;\r\n out[6] = a[6] * y;\r\n out[7] = a[7] * y;\r\n out[8] = a[8] * z;\r\n out[9] = a[9] * z;\r\n out[10] = a[10] * z;\r\n out[11] = a[11] * z;\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat4} by the given angle around the given axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if axis has a length of 0\r\n */\r\n static rotate(out: Mat4Like, a: Readonly, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n // Construct the elements of the rotation matrix\r\n const b00 = x * x * t + c;\r\n const b01 = y * x * t + z * s;\r\n const b02 = z * x * t - y * s;\r\n const b10 = x * y * t - z * s;\r\n const b11 = y * y * t + c;\r\n const b12 = z * y * t + x * s;\r\n const b20 = x * z * t + y * s;\r\n const b21 = y * z * t - x * s;\r\n const b22 = z * z * t + c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\r\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\r\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\r\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\r\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\r\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\r\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\r\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\r\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\r\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\r\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\r\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateX(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[4] = a10 * c + a20 * s;\r\n out[5] = a11 * c + a21 * s;\r\n out[6] = a12 * c + a22 * s;\r\n out[7] = a13 * c + a23 * s;\r\n out[8] = a20 * c - a10 * s;\r\n out[9] = a21 * c - a11 * s;\r\n out[10] = a22 * c - a12 * s;\r\n out[11] = a23 * c - a13 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateY(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c - a20 * s;\r\n out[1] = a01 * c - a21 * s;\r\n out[2] = a02 * c - a22 * s;\r\n out[3] = a03 * c - a23 * s;\r\n out[8] = a00 * s + a20 * c;\r\n out[9] = a01 * s + a21 * c;\r\n out[10] = a02 * s + a22 * c;\r\n out[11] = a03 * s + a23 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c + a10 * s;\r\n out[1] = a01 * c + a11 * s;\r\n out[2] = a02 * c + a12 * s;\r\n out[3] = a03 * c + a13 * s;\r\n out[4] = a10 * c - a00 * s;\r\n out[5] = a11 * c - a01 * s;\r\n out[6] = a12 * c - a02 * s;\r\n out[7] = a13 * c - a03 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = v[1];\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = v[2];\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotate(dest, dest, rad, axis);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if `axis` has a length of 0\r\n */\r\n static fromRotation(out: Mat4Like, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = x * x * t + c;\r\n out[1] = y * x * t + z * s;\r\n out[2] = z * x * t - y * s;\r\n out[3] = 0;\r\n out[4] = x * y * t - z * s;\r\n out[5] = y * y * t + c;\r\n out[6] = z * y * t + x * s;\r\n out[7] = 0;\r\n out[8] = x * z * t + y * s;\r\n out[9] = y * z * t - x * s;\r\n out[10] = z * z * t + c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the X axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateX(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromXRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = c;\r\n out[6] = s;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = -s;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Y axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateY(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromYRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = 0;\r\n out[2] = -s;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = s;\r\n out[9] = 0;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Z axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateZ(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromZRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -s;\r\n out[5] = c;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation and vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Mat4Like, q: Readonly, v: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - (yy + zz);\r\n out[1] = xy + wz;\r\n out[2] = xz - wy;\r\n out[3] = 0;\r\n out[4] = xy - wz;\r\n out[5] = 1 - (xx + zz);\r\n out[6] = yz + wx;\r\n out[7] = 0;\r\n out[8] = xz + wy;\r\n out[9] = yz - wx;\r\n out[10] = 1 - (xx + yy);\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Mat4} from a {@link Quat2}.\r\n * @category Static\r\n *\r\n * @param out - Matrix\r\n * @param a - Dual Quaternion\r\n * @returns `out`\r\n */\r\n static fromQuat2(out: Mat4Like, a: Quat2Like): Mat4Like {\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n\r\n const magnitude = bx * bx + by * by + bz * bz + bw * bw;\r\n\r\n // Only scale if it makes sense\r\n if (magnitude > 0) {\r\n Mat4.#TMP_VEC3[0] = ((ax * bw + aw * bx + ay * bz - az * by) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[1] = ((ay * bw + aw * by + az * bx - ax * bz) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[2] = ((az * bw + aw * bz + ax * by - ay * bx) * 2) / magnitude;\r\n } else {\r\n Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n }\r\n Mat4.fromRotationTranslation(out, a as QuatLike, Mat4.#TMP_VEC3);\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat4Like, a: Readonly): Mat4Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[3] = 0;\r\n\r\n out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[7] = 0;\r\n\r\n out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat4Like, a: Readonly): Mat4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n out[3] = 0;\r\n\r\n out[4] = cy * az - cz * ay;\r\n out[5] = cz * ax - cx * az;\r\n out[6] = cx * ay - cy * ax;\r\n out[7] = 0;\r\n\r\n out[8] = ay * bz - az * by;\r\n out[9] = az * bx - ax * bz;\r\n out[10] = ax * by - ay * bx;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the translation vector component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslation,\r\n * the returned vector will be the same as the translation vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive translation component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getTranslation(out: Vec3Like, mat: Readonly): Vec3Like {\r\n out[0] = mat[12];\r\n out[1] = mat[13];\r\n out[2] = mat[14];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the scaling factor component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslationScale\r\n * with a normalized Quaternion parameter, the returned vector will be\r\n * the same as the scaling vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive scaling factor component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getScaling(out: Vec3Like, mat: Readonly): Vec3Like {\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a quaternion representing the rotational component\r\n * of a transformation matrix. If a matrix is built with\r\n * fromRotationTranslation, the returned quaternion will be the\r\n * same as the quaternion originally supplied.\r\n * @category Static\r\n *\r\n * @param out - Quaternion to receive the rotation component\r\n * @param mat - Matrix to be decomposed (input)\r\n * @return `out`\r\n */\r\n static getRotation(out: QuatLike, mat: Readonly): QuatLike {\r\n Mat4.getScaling(Mat4.#TMP_VEC3, mat);\r\n\r\n const is1 = 1 / Mat4.#TMP_VEC3[0];\r\n const is2 = 1 / Mat4.#TMP_VEC3[1];\r\n const is3 = 1 / Mat4.#TMP_VEC3[2];\r\n\r\n const sm11 = mat[0] * is1;\r\n const sm12 = mat[1] * is2;\r\n const sm13 = mat[2] * is3;\r\n const sm21 = mat[4] * is1;\r\n const sm22 = mat[5] * is2;\r\n const sm23 = mat[6] * is3;\r\n const sm31 = mat[8] * is1;\r\n const sm32 = mat[9] * is2;\r\n const sm33 = mat[10] * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out[3] = 0.25 * S;\r\n out[0] = (sm23 - sm32) / S;\r\n out[1] = (sm31 - sm13) / S;\r\n out[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out[3] = (sm23 - sm32) / S;\r\n out[0] = 0.25 * S;\r\n out[1] = (sm12 + sm21) / S;\r\n out[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out[3] = (sm31 - sm13) / S;\r\n out[0] = (sm12 + sm21) / S;\r\n out[1] = 0.25 * S;\r\n out[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out[3] = (sm12 - sm21) / S;\r\n out[0] = (sm31 + sm13) / S;\r\n out[1] = (sm23 + sm32) / S;\r\n out[2] = 0.25 * S;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Decomposes a transformation matrix into its rotation, translation\r\n * and scale components. Returns only the rotation component\r\n * @category Static\r\n *\r\n * @param out_r - Quaternion to receive the rotation component\r\n * @param out_t - Vector to receive the translation vector\r\n * @param out_s - Vector to receive the scaling factor\r\n * @param mat - Matrix to be decomposed (input)\r\n * @returns `out_r`\r\n */\r\n static decompose(out_r: QuatLike, out_t: Vec3Like, out_s: Vec3Like, mat: Readonly): QuatLike {\r\n out_t[0] = mat[12];\r\n out_t[1] = mat[13];\r\n out_t[2] = mat[14];\r\n\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n const is1 = 1 / out_s[0];\r\n const is2 = 1 / out_s[1];\r\n const is3 = 1 / out_s[2];\r\n\r\n const sm11 = m11 * is1;\r\n const sm12 = m12 * is2;\r\n const sm13 = m13 * is3;\r\n const sm21 = m21 * is1;\r\n const sm22 = m22 * is2;\r\n const sm23 = m23 * is3;\r\n const sm31 = m31 * is1;\r\n const sm32 = m32 * is2;\r\n const sm33 = m33 * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out_r[3] = 0.25 * S;\r\n out_r[0] = (sm23 - sm32) / S;\r\n out_r[1] = (sm31 - sm13) / S;\r\n out_r[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out_r[3] = (sm23 - sm32) / S;\r\n out_r[0] = 0.25 * S;\r\n out_r[1] = (sm12 + sm21) / S;\r\n out_r[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out_r[3] = (sm31 - sm13) / S;\r\n out_r[0] = (sm12 + sm21) / S;\r\n out_r[1] = 0.25 * S;\r\n out_r[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out_r[3] = (sm12 - sm21) / S;\r\n out_r[0] = (sm31 + sm13) / S;\r\n out_r[1] = (sm23 + sm32) / S;\r\n out_r[2] = 0.25 * S;\r\n }\r\n\r\n return out_r;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScale(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n out[0] = (1 - (yy + zz)) * sx;\r\n out[1] = (xy + wz) * sx;\r\n out[2] = (xz - wy) * sx;\r\n out[3] = 0;\r\n out[4] = (xy - wz) * sy;\r\n out[5] = (1 - (xx + zz)) * sy;\r\n out[6] = (yz + wx) * sy;\r\n out[7] = 0;\r\n out[8] = (xz + wy) * sz;\r\n out[9] = (yz - wx) * sz;\r\n out[10] = (1 - (xx + yy)) * sz;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the\r\n * given origin. This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * mat4.translate(dest, origin);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n * mat4.translate(dest, negativeOrigin);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @param o - The origin vector around which to scale and rotate\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScaleOrigin(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly, o: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n const ox = o[0];\r\n const oy = o[1];\r\n const oz = o[2];\r\n\r\n const out0 = (1 - (yy + zz)) * sx;\r\n const out1 = (xy + wz) * sx;\r\n const out2 = (xz - wy) * sx;\r\n const out4 = (xy - wz) * sy;\r\n const out5 = (1 - (xx + zz)) * sy;\r\n const out6 = (yz + wx) * sy;\r\n const out8 = (xz + wy) * sz;\r\n const out9 = (yz - wx) * sz;\r\n const out10 = (1 - (xx + yy)) * sz;\r\n\r\n out[0] = out0;\r\n out[1] = out1;\r\n out[2] = out2;\r\n out[3] = 0;\r\n out[4] = out4;\r\n out[5] = out5;\r\n out[6] = out6;\r\n out[7] = 0;\r\n out[8] = out8;\r\n out[9] = out9;\r\n out[10] = out10;\r\n out[11] = 0;\r\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\r\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\r\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 4x4 matrix from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Quaternion to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat4Like, q: Readonly): Mat4Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[1] = yx + wz;\r\n out[2] = zx - wy;\r\n out[3] = 0;\r\n\r\n out[4] = yx - wz;\r\n out[5] = 1 - xx - zz;\r\n out[6] = zy + wx;\r\n out[7] = 0;\r\n\r\n out[8] = zx + wy;\r\n out[9] = zy - wx;\r\n out[10] = 1 - xx - yy;\r\n out[11] = 0;\r\n\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.frustumNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly\r\n */\r\n static frustum(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like { return out; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveNO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.perspectiveNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static perspective(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveZO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating\r\n * projection matrices to be used with the still experimental WebVR API.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n * @deprecated\r\n */\r\n static perspectiveFromFieldOfView(out: Mat4Like,\r\n fov: { upDegrees: number, downDegrees: number, leftDegrees: number, rightDegrees: number }, near: number,\r\n far: number): Mat4Like {\r\n\r\n const upTan = Math.tan((fov.upDegrees * Math.PI) / 180.0);\r\n const downTan = Math.tan((fov.downDegrees * Math.PI) / 180.0);\r\n const leftTan = Math.tan((fov.leftDegrees * Math.PI) / 180.0);\r\n const rightTan = Math.tan((fov.rightDegrees * Math.PI) / 180.0);\r\n const xScale = 2.0 / (leftTan + rightTan);\r\n const yScale = 2.0 / (upTan + downTan);\r\n\r\n out[0] = xScale;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n out[4] = 0.0;\r\n out[5] = yScale;\r\n out[6] = 0.0;\r\n out[7] = 0.0;\r\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\r\n out[9] = (upTan - downTan) * yScale * 0.5;\r\n out[10] = far / (near - far);\r\n out[11] = -1.0;\r\n out[12] = 0.0;\r\n out[13] = 0.0;\r\n out[14] = (far * near) / (near - far);\r\n out[15] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 2 * nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = (far + near) * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.orthoNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static ortho(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, far: number):\r\n Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = near * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that\r\n * actually makes an object look at another object, you should use targetTo instead.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param center - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static lookAt(out: Mat4Like, eye: Readonly, center: Readonly, up: Readonly): Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n const centerx = center[0];\r\n const centery = center[1];\r\n const centerz = center[2];\r\n\r\n if (\r\n Math.abs(eyex - centerx) < GLM_EPSILON &&\r\n Math.abs(eyey - centery) < GLM_EPSILON &&\r\n Math.abs(eyez - centerz) < GLM_EPSILON\r\n ) {\r\n return Mat4.identity(out);\r\n }\r\n\r\n let z0 = eyex - centerx;\r\n let z1 = eyey - centery;\r\n let z2 = eyez - centerz;\r\n\r\n let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\r\n if (!len) {\r\n x0 = 0;\r\n x1 = 0;\r\n x2 = 0;\r\n } else {\r\n len = 1 / len;\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n let y0 = z1 * x2 - z2 * x1;\r\n let y1 = z2 * x0 - z0 * x2;\r\n let y2 = z0 * x1 - z1 * x0;\r\n\r\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\r\n if (!len) {\r\n y0 = 0;\r\n y1 = 0;\r\n y2 = 0;\r\n } else {\r\n len = 1 / len;\r\n y0 *= len;\r\n y1 *= len;\r\n y2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = y0;\r\n out[2] = z0;\r\n out[3] = 0;\r\n out[4] = x1;\r\n out[5] = y1;\r\n out[6] = z1;\r\n out[7] = 0;\r\n out[8] = x2;\r\n out[9] = y2;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\r\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\r\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a matrix that makes something look at something else.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param target - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static targetTo(out: Mat4Like, eye: Readonly, target: Readonly, up: Readonly):\r\n Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n\r\n let z0 = eyex - target[0];\r\n let z1 = eyey - target[1];\r\n let z2 = eyez - target[2];\r\n\r\n let len = z0 * z0 + z1 * z1 + z2 * z2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n }\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n\r\n len = x0 * x0 + x1 * x1 + x2 * x2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = x1;\r\n out[2] = x2;\r\n out[3] = 0;\r\n out[4] = z1 * x2 - z2 * x1;\r\n out[5] = z2 * x0 - z0 * x2;\r\n out[6] = z0 * x1 - z1 * x0;\r\n out[7] = 0;\r\n out[8] = z0;\r\n out[9] = z1;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = eyex;\r\n out[13] = eyey;\r\n out[14] = eyez;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8] +\r\n a[9] * a[9] +\r\n a[10] * a[10] +\r\n a[11] * a[11] +\r\n a[12] * a[12] +\r\n a[13] * a[13] +\r\n a[14] * a[14] +\r\n a[15] * a[15]\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n out[9] = a[9] + b[9];\r\n out[10] = a[10] + b[10];\r\n out[11] = a[11] + b[11];\r\n out[12] = a[12] + b[12];\r\n out[13] = a[13] + b[13];\r\n out[14] = a[14] + b[14];\r\n out[15] = a[15] + b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n out[9] = a[9] - b[9];\r\n out[10] = a[10] - b[10];\r\n out[11] = a[11] - b[11];\r\n out[12] = a[12] - b[12];\r\n out[13] = a[13] - b[13];\r\n out[14] = a[14] - b[14];\r\n out[15] = a[15] - b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Multiply each element of the matrix by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat4Like, a: Readonly, b: number): Mat4Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n out[9] = a[9] * b;\r\n out[10] = a[10] * b;\r\n out[11] = a[11] * b;\r\n out[12] = a[12] * b;\r\n out[13] = a[13] * b;\r\n out[14] = a[14] * b;\r\n out[15] = a[15] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat4Like, a: Readonly, b: Readonly, scale: number): Mat4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n out[9] = a[9] + b[9] * scale;\r\n out[10] = a[10] + b[10] * scale;\r\n out[11] = a[11] + b[11] * scale;\r\n out[12] = a[12] + b[12] * scale;\r\n out[13] = a[13] + b[13] * scale;\r\n out[14] = a[14] + b[14] * scale;\r\n out[15] = a[15] + b[15] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8] &&\r\n a[9] === b[9] &&\r\n a[10] === b[10] &&\r\n a[11] === b[11] &&\r\n a[12] === b[12] &&\r\n a[13] === b[13] &&\r\n a[14] === b[14] &&\r\n a[15] === b[15]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n const a9 = a[9];\r\n const a10 = a[10];\r\n const a11 = a[11];\r\n const a12 = a[12];\r\n const a13 = a[13];\r\n const a14 = a[14];\r\n const a15 = a[15];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n const b9 = b[9];\r\n const b10 = b[10];\r\n const b11 = b[11];\r\n const b12 = b[12];\r\n const b13 = b[13];\r\n const b14 = b[14];\r\n const b15 = b[15];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) &&\r\n Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) &&\r\n Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) &&\r\n Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) &&\r\n Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) &&\r\n Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) &&\r\n Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) &&\r\n Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat4(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat4.prototype.mul = Mat4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat4.sub = Mat4.subtract;\r\nMat4.mul = Mat4.multiply;\r\nMat4.frustum = Mat4.frustumNO;\r\nMat4.perspective = Mat4.perspectiveNO;\r\nMat4.ortho = Mat4.orthoNO;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, Mat4Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 3 Dimensional Vector\r\n */\r\nexport class Vec3 extends Float64Array {\r\n /**\r\n * Create a {@link Vec3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 3:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 3); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 3);\r\n }\r\n break;\r\n }\r\n default:\r\n super(3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec3.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec3.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec3} to `this`.\r\n * Equivalent to `Vec3.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec3} from `this`.\r\n * Equivalent to `Vec3.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec3.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec3.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec3.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec3.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec3.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to its absolute value.\r\n * Equivalent to `Vec3.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec3}.\r\n * Equivalent to `Vec3.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec3.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec3.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 3 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty vec3\r\n * @category Static\r\n *\r\n * @returns a new 3D vector\r\n */\r\n static create(): Vec3 {\r\n return new Vec3();\r\n }\r\n\r\n /**\r\n * Creates a new vec3 initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 3D vector\r\n */\r\n static clone(a: Readonly): Vec3 {\r\n return new Vec3(a);\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Creates a new vec3 initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns a new 3D vector\r\n */\r\n static fromValues(x: number, y: number, z: number): Vec3 {\r\n return new Vec3(x, y, z);\r\n }\r\n\r\n /**\r\n * Copy the values from one vec3 to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns `out`\r\n */\r\n static set(out: Vec3Like, x: number, y: number, z: number): Vec3Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Multiplies two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; }\r\n\r\n /**\r\n * Divides two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Math.ceil the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * symmetric round the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n /*\r\n static round(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = glMatrix.round(a[0]);\r\n out[1] = glMatrix.round(a[1]);\r\n out[2] = glMatrix.round(a[2]);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Scales a vec3 by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec3Like, a: Readonly, scale: number): Vec3Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two vec3's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec3Like, a: Readonly, b: Readonly, scale: number) {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared length of a vec3\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec3Like, a: Readonly): Vec3Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n let len = x * x + y * y + z * z;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n out[2] = a[2] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2];\r\n const bx = b[0],\r\n by = b[1],\r\n bz = b[2];\r\n\r\n out[0] = ay * bz - az * by;\r\n out[1] = az * bx - ax * bz;\r\n out[2] = ax * by - ay * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const angle = Math.acos(Math.min(Math.max(Vec3.dot(a, b), -1), 1));\r\n const sinTotal = Math.sin(angle);\r\n\r\n const ratioA = Math.sin((1 - t) * angle) / sinTotal;\r\n const ratioB = Math.sin(t * angle) / sinTotal;\r\n out[0] = ratioA * a[0] + ratioB * b[0];\r\n out[1] = ratioA * a[1] + ratioB * b[1];\r\n out[2] = ratioA * a[2] + ratioB * b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a hermite interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static hermite(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const factorTimes2 = t * t;\r\n const factor1 = factorTimes2 * (2 * t - 3) + 1;\r\n const factor2 = factorTimes2 * (t - 2) + t;\r\n const factor3 = factorTimes2 * (t - 1);\r\n const factor4 = factorTimes2 * (3 - 2 * t);\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a bezier interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static bezier(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const inverseFactor = 1 - t;\r\n const inverseFactorTimesTwo = inverseFactor * inverseFactor;\r\n const factorTimes2 = t * t;\r\n const factor1 = inverseFactorTimesTwo * inverseFactor;\r\n const factor2 = 3 * t * inverseFactorTimesTwo;\r\n const factor3 = 3 * factorTimes2 * inverseFactor;\r\n const factor4 = factorTimes2 * t;\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec3Like, scale) {\r\n scale = scale === undefined ? 1.0 : scale;\r\n\r\n let r = glMatrix.RANDOM() * 2.0 * Math.PI;\r\n let z = glMatrix.RANDOM() * 2.0 - 1.0;\r\n let zScale = Math.sqrt(1.0 - z * z) * scale;\r\n\r\n out[0] = Math.cos(r) * zScale;\r\n out[1] = Math.sin(r) * zScale;\r\n out[2] = z * scale;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the vec3 with a mat4.\r\n * 4th vector component is implicitly '1'\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec3Like, a: Readonly, m: Readonly): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1.0;\r\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\r\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\r\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a mat3.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - the 3x3 matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat3(out: Vec3Like, a: Vec3Like, m: Mat3Like): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n out[0] = x * m[0] + y * m[3] + z * m[6];\r\n out[1] = x * m[1] + y * m[4] + z * m[7];\r\n out[2] = x * m[2] + y * m[5] + z * m[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a quat\r\n * Can also be used for dual quaternions. (Multiply it with the real part)\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec3Like, a: Readonly, q: Readonly): Vec3Like {\r\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const w2 = q[3] * 2;\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n // var qvec = [qx, qy, qz];\r\n // var uv = vec3.cross([], qvec, a);\r\n const uvx = (qy * z - qz * y);\r\n const uvy = (qz * x - qx * z);\r\n const uvz = (qx * y - qy * x);\r\n // var uuv = vec3.cross([], qvec, uv);\r\n // vec3.scale(uuv, uuv, 2);\r\n const uuvx = (qy * uvz - qz * uvy) * 2;\r\n const uuvy = (qz * uvx - qx * uvz) * 2;\r\n const uuvz = (qx * uvy - qy * uvx) * 2;\r\n // vec3.scale(uv, uv, 2 * w);\r\n // return vec3.add(out, a, vec3.add(out, uv, uuv));\r\n out[0] = x + (uvx * w2) + uuvx;\r\n out[1] = y + (uvy * w2) + uuvy;\r\n out[2] = z + (uvz * w2) + uuvz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the x-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateX(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const by = b[1];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const py = a[1] - by;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = a[0];\r\n out[1] = (py * Math.cos(rad) - pz * Math.sin(rad)) + by;\r\n out[2] = (py * Math.sin(rad) + pz * Math.cos(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the y-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateY(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (pz * Math.sin(rad) + px * Math.cos(rad)) + bx;\r\n out[1] = a[1];\r\n out[2] = (pz * Math.cos(rad) - px * Math.sin(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the z-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const by = b[1];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const py = a[1] - by;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (px * Math.cos(rad) - py * Math.sin(rad)) + bx;\r\n out[1] = (px * Math.sin(rad) + py * Math.cos(rad)) + by;\r\n out[2] = b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 3D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly) {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz));\r\n const cosine = mag && Vec3.dot(a, b) / mag;\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec3Like): Vec3Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec3(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec3.prototype.sub = Vec3.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.mul = Vec3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.div = Vec3.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.dist = Vec3.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.sqrDist = Vec3.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec3.sub = Vec3.subtract;\r\nVec3.mul = Vec3.multiply;\r\nVec3.div = Vec3.divide;\r\nVec3.dist = Vec3.distance;\r\nVec3.sqrDist = Vec3.squaredDistance;\r\nVec3.sqrLen = Vec3.squaredLength;\r\nVec3.mag = Vec3.magnitude;\r\nVec3.length = Vec3.magnitude;\r\nVec3.len = Vec3.magnitude;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Vec4Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 4 Dimensional Vector\r\n */\r\nexport class Vec4 extends Float64Array {\r\n /**\r\n * Create a {@link Vec4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the vector. Equivalent to `this[3];`\r\n * @category Vector Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The a component of the vector. Equivalent to `this[3];`\r\n * @category Color Components\r\n */\r\n get a(): number { return this[3]; }\r\n set a(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec4.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec4} to `this`.\r\n * Equivalent to `Vec4.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n this[3] += b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec4} from `this`.\r\n * Equivalent to `Vec4.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n this[3] -= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n this[3] *= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n this[3] /= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec4.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n this[3] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n this[3] += b[3] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec4.distance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec4.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec4.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n this[3] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec4.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n this[3] = 1.0 / this[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec4.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n this[3] = Math.abs(this[3]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec4}.\r\n * Equivalent to `Vec4.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec4.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec4.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec4}\r\n * @category Static\r\n *\r\n * @returns a new 4D vector\r\n */\r\n static create(): Vec4 {\r\n return new Vec4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 4D vector\r\n */\r\n static clone(a: Vec4Like): Vec4 {\r\n return new Vec4(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new 4D vector\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Vec4 {\r\n return new Vec4(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec4} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n static set(out: Vec4Like, x: number, y: number, z: number, w: number): Vec4Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n out[3] = a[3] * b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Divides two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n out[3] = a[3] / b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n out[3] = Math.ceil(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n out[3] = Math.floor(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n out[3] = Math.min(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n out[3] = Math.max(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n out[2] = Math.round(a[2]);\r\n out[3] = Math.round(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec4} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec4Like, a: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}'s after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec4Like, a: Readonly, b: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return Math.hypot(x, y, z, w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of `a`\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = -a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n out[3] = 1.0 / a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n out[3] = Math.abs(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec4Like, a: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n let len = x * x + y * y + z * z + w * w;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = x * len;\r\n out[1] = y * len;\r\n out[2] = z * len;\r\n out[3] = w * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Returns the cross-product of three vectors in a 4-dimensional space\r\n * @category Static\r\n *\r\n * @param out the receiving vector\r\n * @param u - the first vector\r\n * @param v - the second vector\r\n * @param w - the third vector\r\n * @returns result\r\n */\r\n static cross(out: Vec4Like, u: Readonly, v: Readonly, w: Readonly): Vec4Like {\r\n const a = v[0] * w[1] - v[1] * w[0];\r\n const b = v[0] * w[2] - v[2] * w[0];\r\n const c = v[0] * w[3] - v[3] * w[0];\r\n const d = v[1] * w[2] - v[2] * w[1];\r\n const e = v[1] * w[3] - v[3] * w[1];\r\n const f = v[2] * w[3] - v[3] * w[2];\r\n const g = u[0];\r\n const h = u[1];\r\n const i = u[2];\r\n const j = u[3];\r\n\r\n out[0] = h * f - i * e + j * d;\r\n out[1] = -(g * f) + i * c - j * b;\r\n out[2] = g * e - h * c + j * a;\r\n out[3] = -(g * d) + h * b - i * a;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec4Like, a: Readonly, b: Readonly, t: number): Vec4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n out[3] = aw + t * (b[3] - aw);\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec4Like, scale): Vec4Like {\r\n scale = scale || 1.0;\r\n\r\n // Marsaglia, George. Choosing a Point from the Surface of a\r\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\r\n // http://projecteuclid.org/euclid.aoms/1177692644;\r\n var v1, v2, v3, v4;\r\n var s1, s2;\r\n do {\r\n v1 = glMatrix.RANDOM() * 2 - 1;\r\n v2 = glMatrix.RANDOM() * 2 - 1;\r\n s1 = v1 * v1 + v2 * v2;\r\n } while (s1 >= 1);\r\n do {\r\n v3 = glMatrix.RANDOM() * 2 - 1;\r\n v4 = glMatrix.RANDOM() * 2 - 1;\r\n s2 = v3 * v3 + v4 * v4;\r\n } while (s2 >= 1);\r\n\r\n var d = Math.sqrt((1 - s1) / s2);\r\n out[0] = scale * v1;\r\n out[1] = scale * v2;\r\n out[2] = scale * v3 * d;\r\n out[3] = scale * v4 * d;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Mat4}.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec4Like, a: Readonly, m: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\r\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\r\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\r\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec4Like, a: Readonly, q: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n\r\n // calculate quat * vec\r\n const ix = qw * x + qy * z - qz * y;\r\n const iy = qw * y + qz * x - qx * z;\r\n const iz = qw * z + qx * y - qy * x;\r\n const iw = -qx * x - qy * y - qz * z;\r\n\r\n // calculate result * inverse quat\r\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\r\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\r\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec4Like): Vec4Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec4(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec4.prototype.sub = Vec4.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.mul = Vec4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.div = Vec4.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.dist = Vec4.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.sqrDist = Vec4.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec4.sub = Vec4.subtract;\r\nVec4.mul = Vec4.multiply;\r\nVec4.div = Vec4.divide;\r\nVec4.dist = Vec4.distance;\r\nVec4.sqrDist = Vec4.squaredDistance;\r\nVec4.sqrLen = Vec4.squaredLength;\r\nVec4.mag = Vec4.magnitude;\r\nVec4.length = Vec4.magnitude;\r\nVec4.len = Vec4.magnitude;\r\n", "import { Vec3 } from './Vec3.js';\r\nimport { Vec4 } from './Vec4.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Quaternion\r\n */\r\nexport class Quat extends Float64Array {\r\n static #DEFAULT_ANGLE_ORDER = 'zyx';\r\n\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT1 = new Float64Array(4);\r\n static #TMP_QUAT2 = new Float64Array(4);\r\n static #TMP_MAT3 = new Float64Array(9);\r\n\r\n static #TMP_VEC3 = new Float64Array(3);\r\n static #X_UNIT_VEC3 = new Float64Array([1, 0, 0]);\r\n static #Y_UNIT_VEC3 = new Float64Array([0, 1, 0]);\r\n\r\n /**\r\n * Create a {@link Quat}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the quaternion. Equivalent to `this[0];`\r\n * @category Quaternion Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the quaternion. Equivalent to `this[1];`\r\n * @category Quaternion Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the quaternion. Equivalent to `this[2];`\r\n * @category Quaternion Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the quaternion. Equivalent to `this[3];`\r\n * @category Quaternion Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Quat.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity quaternion\r\n * Equivalent to Quat.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this[0] = 0;\r\n this[1] = 0;\r\n this[2] = 0;\r\n this[3] = 1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies `this` by a {@link Quat}.\r\n * Equivalent to `Quat.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Quat.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Rotates `this` by the given angle about the X axis\r\n * Equivalent to `Quat.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Quat.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Y axis\r\n * Equivalent to `Quat.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Quat.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Z axis\r\n * Equivalent to `Quat.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Quat.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Inverts `this`\r\n * Equivalent to `Quat.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Quat.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales `this` by a scalar number\r\n * Equivalent to `Quat.scale(this, this, scale);`\r\n * @category Methods\r\n *\r\n * @param scale - amount to scale the vector by\r\n * @returns `this`\r\n */\r\n scale(scale: number): QuatLike {\r\n this[0] *= scale;\r\n this[1] *= scale;\r\n this[2] *= scale;\r\n this[3] *= scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of `this` and another {@link Quat}\r\n * Equivalent to `Quat.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - the second operand\r\n * @returns dot product of `this` and b\r\n */\r\n dot(b: Readonly): number {\r\n return Quat.dot(this, b);\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity quat\r\n * @category Static\r\n *\r\n * @returns a new quaternion\r\n */\r\n static create(): Quat {\r\n return new Quat();\r\n }\r\n\r\n /**\r\n * Set a quat to the identity quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a quat from the given angle and rotation axis,\r\n * then returns it.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param axis - the axis around which to rotate\r\n * @param rad - the angle in radians\r\n * @returns `out`\r\n **/\r\n static setAxisAngle(out: QuatLike, axis: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n out[0] = s * axis[0];\r\n out[1] = s * axis[1];\r\n out[2] = s * axis[2];\r\n out[3] = Math.cos(rad);\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the rotation axis and angle for a given\r\n * quaternion. If a quaternion is created with\r\n * setAxisAngle, this method will return the same\r\n * values as provided in the original parameter list\r\n * OR functionally equivalent values.\r\n * Example: The quaternion formed by axis [0, 0, 1] and\r\n * angle -90 is the same as the quaternion formed by\r\n * [0, 0, 1] and 270. This method favors the latter.\r\n * @category Static\r\n *\r\n * @param out_axis - Vector receiving the axis of rotation\r\n * @param q - Quaternion to be decomposed\r\n * @return Angle, in radians, of the rotation\r\n */\r\n static getAxisAngle(out_axis: Vec3Like, q: Readonly): number {\r\n const rad = Math.acos(q[3]) * 2.0;\r\n const s = Math.sin(rad / 2.0);\r\n if (s > GLM_EPSILON) {\r\n out_axis[0] = q[0] / s;\r\n out_axis[1] = q[1] / s;\r\n out_axis[2] = q[2] / s;\r\n } else {\r\n // If s is zero, return any axis (no rotation - axis does not matter)\r\n out_axis[0] = 1;\r\n out_axis[1] = 0;\r\n out_axis[2] = 0;\r\n }\r\n return rad;\r\n }\r\n\r\n /**\r\n * Gets the angular distance between two unit quaternions\r\n * @category Static\r\n *\r\n * @param {ReadonlyQuat} a Origin unit quaternion\r\n * @param {ReadonlyQuat} b Destination unit quaternion\r\n * @return {Number} Angle, in radians, between the two quaternions\r\n */\r\n static getAngle(a: Readonly, b: Readonly): number {\r\n const dotproduct = Quat.dot(a, b);\r\n\r\n return Math.acos(2 * dotproduct * dotproduct - 1);\r\n }\r\n\r\n /**\r\n * Multiplies two quaternions.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const bw = b[3];\r\n\r\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the X axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + aw * bx;\r\n out[1] = ay * bw + az * bx;\r\n out[2] = az * bw - ay * bx;\r\n out[3] = aw * bw - ax * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Y axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const by = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw - az * by;\r\n out[1] = ay * bw + aw * by;\r\n out[2] = az * bw + ax * by;\r\n out[3] = aw * bw - ay * by;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Z axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bz = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + ay * bz;\r\n out[1] = ay * bw - ax * bz;\r\n out[2] = az * bw + aw * bz;\r\n out[3] = aw * bw - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the W component of a quat from the X, Y, and Z components.\r\n * Assumes that quaternion is 1 unit in length.\r\n * Any existing W component will be ignored.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate W component of\r\n * @returns `out`\r\n */\r\n static calculateW(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the exponential of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static exp(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const et = Math.exp(w);\r\n const s = r > 0 ? (et * Math.sin(r)) / r : 0;\r\n\r\n out[0] = x * s;\r\n out[1] = y * s;\r\n out[2] = z * s;\r\n out[3] = et * Math.cos(r);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the natural logarithm of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static ln(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const t = r > 0 ? Math.atan2(r, w) / r : 0;\r\n\r\n out[0] = x * t;\r\n out[1] = y * t;\r\n out[2] = z * t;\r\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the scalar power of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @param b - amount to scale the quaternion by\r\n * @returns `out`\r\n */\r\n static pow(out: QuatLike, a: Readonly, b: number): QuatLike {\r\n Quat.ln(out, a);\r\n Quat.scale(out, out, b);\r\n Quat.exp(out, out);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike {\r\n // benchmarks:\r\n // http://jsperf.com/quaternion-slerp-implementations\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2],\r\n aw = a[3];\r\n let bx = b[0],\r\n by = b[1],\r\n bz = b[2],\r\n bw = b[3];\r\n\r\n let scale0: number;\r\n let scale1: number;\r\n\r\n // calc cosine\r\n let cosom = ax * bx + ay * by + az * bz + aw * bw;\r\n // adjust signs (if necessary)\r\n if (cosom < 0.0) {\r\n cosom = -cosom;\r\n bx = -bx;\r\n by = -by;\r\n bz = -bz;\r\n bw = -bw;\r\n }\r\n // calculate coefficients\r\n if (1.0 - cosom > GLM_EPSILON) {\r\n // standard case (slerp)\r\n const omega = Math.acos(cosom);\r\n const sinom = Math.sin(omega);\r\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\r\n scale1 = Math.sin(t * omega) / sinom;\r\n } else {\r\n // \"from\" and \"to\" quaternions are very close\r\n // ... so we can do a linear interpolation\r\n scale0 = 1.0 - t;\r\n scale1 = t;\r\n }\r\n // calculate final values\r\n out[0] = scale0 * ax + scale1 * bx;\r\n out[1] = scale0 * ay + scale1 * by;\r\n out[2] = scale0 * az + scale1 * bz;\r\n out[3] = scale0 * aw + scale1 * bw;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random unit quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n /* static random(out: QuatLike): QuatLike {\r\n // Implementation of http://planning.cs.uiuc.edu/node198.html\r\n // TODO: Calling random 3 times is probably not the fastest solution\r\n let u1 = glMatrix.RANDOM();\r\n let u2 = glMatrix.RANDOM();\r\n let u3 = glMatrix.RANDOM();\r\n\r\n let sqrt1MinusU1 = Math.sqrt(1 - u1);\r\n let sqrtU1 = Math.sqrt(u1);\r\n\r\n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\r\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\r\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\r\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Calculates the inverse of a quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: QuatLike, a: Readonly): QuatLike {\r\n const a0 = a[0],\r\n a1 = a[1],\r\n a2 = a[2],\r\n a3 = a[3];\r\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\r\n const invDot = dot ? 1.0 / dot : 0;\r\n\r\n // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\r\n\r\n out[0] = -a0 * invDot;\r\n out[1] = -a1 * invDot;\r\n out[2] = -a2 * invDot;\r\n out[3] = a3 * invDot;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a quat\r\n * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given 3x3 rotation matrix.\r\n *\r\n * NOTE: The resultant quaternion is not normalized, so you should be sure\r\n * to re-normalize the quaternion yourself where necessary.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param m - rotation matrix\r\n * @returns `out`\r\n */\r\n static fromMat3(out: QuatLike, m: Readonly): QuatLike {\r\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\r\n // article \"Quaternion Calculus and Fast Animation\".\r\n const fTrace = m[0] + m[4] + m[8];\r\n let fRoot: number;\r\n\r\n if (fTrace > 0.0) {\r\n // |w| > 1/2, may as well choose w > 1/2\r\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\r\n out[3] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot; // 1/(4w)\r\n out[0] = (m[5] - m[7]) * fRoot;\r\n out[1] = (m[6] - m[2]) * fRoot;\r\n out[2] = (m[1] - m[3]) * fRoot;\r\n } else {\r\n // |w| <= 1/2\r\n let i = 0;\r\n if (m[4] > m[0]) { i = 1; }\r\n if (m[8] > m[i * 3 + i]) { i = 2; }\r\n const j = (i + 1) % 3;\r\n const k = (i + 2) % 3;\r\n\r\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\r\n out[i] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot;\r\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\r\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\r\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given euler angle x, y, z.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - Angle to rotate around X axis in degrees.\r\n * @param y - Angle to rotate around Y axis in degrees.\r\n * @param z - Angle to rotate around Z axis in degrees.\r\n * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx.\r\n * @returns `out`\r\n */\r\n static fromEuler(out: QuatLike, x: number, y: number, z: number, order = Quat.#DEFAULT_ANGLE_ORDER): QuatLike {\r\n const halfToRad = (0.5 * Math.PI) / 180.0;\r\n x *= halfToRad;\r\n y *= halfToRad;\r\n z *= halfToRad;\r\n\r\n const sx = Math.sin(x);\r\n const cx = Math.cos(x);\r\n const sy = Math.sin(y);\r\n const cy = Math.cos(y);\r\n const sz = Math.sin(z);\r\n const cz = Math.cos(z);\r\n\r\n switch (order) {\r\n case 'xyz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'xzy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yxz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yzx':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zxy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zyx':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n default:\r\n throw new Error(`Unknown angle order ${order}`);\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a quatenion\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - quaternion to clone\r\n * @returns a new quaternion\r\n */\r\n static clone(a: Readonly): Quat {\r\n return new Quat(a);\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new quaternion\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Quat {\r\n return new Quat(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one quat to another\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the source quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static set(out: QuatLike, x: number, y: number, z: number, w: number): QuatLike { return out; }\r\n\r\n /**\r\n * Adds two {@link Quat}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static add(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Scales a quat by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param b - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: QuatLike, a: Readonly, scale: number): QuatLike {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two quat's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two quat's\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static lerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike { return out; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mag(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quaternion to normalize\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static normalize(out: QuatLike, a: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first quaternion.\r\n * @param b - The second quaternion.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static exactEquals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Returns whether the quaternions have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static equals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Sets a quaternion to represent the shortest rotation from one\r\n * vector to another.\r\n *\r\n * Both vectors are assumed to be unit length.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion.\r\n * @param a - the initial vector\r\n * @param b - the destination vector\r\n * @returns `out`\r\n */\r\n static rotationTo(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const dot = Vec3.dot(a, b);\r\n\r\n if (dot < -0.999999) {\r\n Vec3.cross(Quat.#TMP_VEC3, Quat.#X_UNIT_VEC3, a);\r\n if (Vec3.mag(Quat.#TMP_VEC3) < 0.000001) { Vec3.cross(Quat.#TMP_VEC3, Quat.#Y_UNIT_VEC3, a); }\r\n Vec3.normalize(Quat.#TMP_VEC3, Quat.#TMP_VEC3);\r\n Quat.setAxisAngle(out, Quat.#TMP_VEC3, Math.PI);\r\n return out;\r\n } else if (dot > 0.999999) {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n } else {\r\n Vec3.cross(Quat.#TMP_VEC3, a, b);\r\n out[0] = Quat.#TMP_VEC3[0];\r\n out[1] = Quat.#TMP_VEC3[1];\r\n out[2] = Quat.#TMP_VEC3[2];\r\n out[3] = 1 + dot;\r\n return Quat.normalize(out, out);\r\n }\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static sqlerp(out: QuatLike, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): QuatLike {\r\n Quat.slerp(Quat.#TMP_QUAT1, a, d, t);\r\n Quat.slerp(Quat.#TMP_QUAT2, b, c, t);\r\n Quat.slerp(out, Quat.#TMP_QUAT1, Quat.#TMP_QUAT2, 2 * t * (1 - t));\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets the specified quaternion with values corresponding to the given\r\n * axes. Each axis is a vec3 and is expected to be unit length and\r\n * perpendicular to all other specified axes.\r\n * @category Static\r\n *\r\n * @param out - The receiving quaternion\r\n * @param view - the vector representing the viewing direction\r\n * @param right - the vector representing the local `right` direction\r\n * @param up - the vector representing the local `up` direction\r\n * @returns `out`\r\n */\r\n static setAxes(out: QuatLike, view: Readonly, right: Readonly, up: Readonly): QuatLike {\r\n Quat.#TMP_MAT3[0] = right[0];\r\n Quat.#TMP_MAT3[3] = right[1];\r\n Quat.#TMP_MAT3[6] = right[2];\r\n\r\n Quat.#TMP_MAT3[1] = up[0];\r\n Quat.#TMP_MAT3[4] = up[1];\r\n Quat.#TMP_MAT3[7] = up[2];\r\n\r\n Quat.#TMP_MAT3[2] = -view[0];\r\n Quat.#TMP_MAT3[5] = -view[1];\r\n Quat.#TMP_MAT3[8] = -view[2];\r\n\r\n return Quat.normalize(out, Quat.fromMat3(out, Quat.#TMP_MAT3));\r\n }\r\n}\r\n\r\n// Methods which re-use the Vec4 implementation\r\nQuat.set = Vec4.set;\r\nQuat.add = Vec4.add;\r\nQuat.lerp = Vec4.lerp;\r\nQuat.normalize = Vec4.normalize;\r\nQuat.squaredLength = Vec4.squaredLength;\r\nQuat.sqrLen = Vec4.squaredLength;\r\nQuat.exactEquals = Vec4.exactEquals;\r\nQuat.equals = Vec4.equals;\r\nQuat.magnitude = Vec4.magnitude;\r\n\r\n// Instance method alias assignments\r\nQuat.prototype.mul = Quat.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nQuat.mul = Quat.multiply;\r\nQuat.mag = Quat.magnitude;\r\nQuat.length = Quat.magnitude;\r\nQuat.len = Quat.magnitude;\r\n", "import { Mat4 } from './Mat4.js';\r\nimport { Quat } from './Quat.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Dual Quaternion\r\n */\r\nexport class Quat2 extends Float64Array {\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat2.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT = new Float64Array(4);\r\n static #TMP_VEC3 = new Float64Array(3);\r\n\r\n /**\r\n * Create a {@link Quat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 8:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 8); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v, v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 8);\r\n }\r\n break;\r\n }\r\n default:\r\n super(8);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source dual quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 8 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity {@link Quat2}\r\n * @category Static\r\n *\r\n * @returns a new dual quaternion [real -> rotation, dual -> translation]\r\n */\r\n static create(): Quat2 {\r\n return new Quat2();\r\n }\r\n\r\n /**\r\n * Creates a {@link Quat2} quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to clone\r\n * @returns a new dual quaternion\r\n */\r\n static clone(a: Quat2Like): Quat2 {\r\n return new Quat2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns a new dual quaternion\r\n */\r\n static fromValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2 {\r\n return new Quat2(x1, y1, z1, w1, x2, y2, z2, w2);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} from the given values (quat and translation)\r\n * @category Static\r\n *\r\n * @param x1 - X component (rotation)\r\n * @param y1 - Y component (rotation)\r\n * @param z1 - Z component (rotation)\r\n * @param w1 - W component (rotation)\r\n * @param x2 - X component (translation)\r\n * @param y2 - Y component (translation)\r\n * @param z2 - Z component (translation)\r\n * @returns a new dual quaternion\r\n */\r\n static fromRotationTranslationValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number): Quat2 {\r\n const ax = x2 * 0.5;\r\n const ay = y2 * 0.5;\r\n const az = z2 * 0.5;\r\n\r\n return new Quat2(x1, y1, z1, w1,\r\n ax * w1 + ay * z1 - az * y1,\r\n ay * w1 + az * x1 - ax * z1,\r\n az * w1 + ax * y1 - ay * x1,\r\n -ax * x1 - ay * y1 - az * z1);\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion and a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Quat2Like, q: Readonly, t: Readonly): Quat2Like {\r\n const ax = t[0] * 0.5;\r\n const ay = t[1] * 0.5;\r\n const az = t[2] * 0.5;\r\n const bx = q[0];\r\n const by = q[1];\r\n const bz = q[2];\r\n const bw = q[3];\r\n out[0] = bx;\r\n out[1] = by;\r\n out[2] = bz;\r\n out[3] = bw;\r\n out[4] = ax * bw + ay * bz - az * by;\r\n out[5] = ay * bw + az * bx - ax * bz;\r\n out[6] = az * bw + ax * by - ay * bx;\r\n out[7] = -ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Quat2Like, t: Readonly): Quat2Like {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = t[0] * 0.5;\r\n out[5] = t[1] * 0.5;\r\n out[6] = t[2] * 0.5;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Quat2Like, q: Readonly): Quat2Like {\r\n out[0] = q[0];\r\n out[1] = q[1];\r\n out[2] = q[2];\r\n out[3] = q[3];\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param a - the matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Quat2Like, a: Readonly): Quat2Like {\r\n Mat4.getRotation(Quat2.#TMP_QUAT, a);\r\n Mat4.getTranslation(Quat2.#TMP_VEC3, a);\r\n return Quat2.fromRotationTranslation(out, Quat2.#TMP_QUAT, Quat2.#TMP_VEC3);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Quat2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the source dual quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Quat2} to the identity dual quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns `out`\r\n */\r\n static set(out: Quat2Like, x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2Like {\r\n out[0] = x1;\r\n out[1] = y1;\r\n out[2] = z1;\r\n out[3] = w1;\r\n out[4] = x2;\r\n out[5] = y2;\r\n out[6] = z2;\r\n out[7] = w2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the real part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - real part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getReal(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Gets the dual part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - dual part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getDual(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[4];\r\n out[1] = a[5];\r\n out[2] = a[6];\r\n out[3] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the real component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the real part\r\n * @return `out`\r\n */\r\n static setReal(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Set the dual component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the dual part\r\n * @return `out`\r\n */\r\n static setDual(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[4] = a[0];\r\n out[5] = a[1];\r\n out[6] = a[2];\r\n out[7] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the translation of a normalized {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving translation vector\r\n * @param a - Dual Quaternion to be decomposed\r\n * @return `out`\r\n */\r\n static getTranslation(out: Vec3Like, a: Readonly): Vec3Like {\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Translates a {@link Quat2} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Quat2Like, a: Readonly, v: Readonly): Quat2Like {\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n const bx1 = v[0] * 0.5;\r\n const by1 = v[1] * 0.5;\r\n const bz1 = v[2] * 0.5;\r\n const ax2 = a[4];\r\n const ay2 = a[5];\r\n const az2 = a[6];\r\n const aw2 = a[7];\r\n out[0] = ax1;\r\n out[1] = ay1;\r\n out[2] = az1;\r\n out[3] = aw1;\r\n out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2;\r\n out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2;\r\n out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2;\r\n out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateX(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateY(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateZ(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (a * q)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param q - quaternion to rotate by\r\n * @returns `out`\r\n */\r\n static rotateByQuatAppend(out: Quat2Like, a: Readonly, q: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let ax = a[0];\r\n let ay = a[1];\r\n let az = a[2];\r\n let aw = a[3];\r\n\r\n out[0] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[1] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[2] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[3] = aw * qw - ax * qx - ay * qy - az * qz;\r\n ax = a[4];\r\n ay = a[5];\r\n az = a[6];\r\n aw = a[7];\r\n out[4] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[5] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[6] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[7] = aw * qw - ax * qx - ay * qy - az * qz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (q * a)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param q - quaternion to rotate by\r\n * @param a - the dual quaternion to rotate\r\n * @returns `out`\r\n */\r\n static rotateByQuatPrepend(out: Quat2Like, q: Readonly, a: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let bx = a[0];\r\n let by = a[1];\r\n let bz = a[2];\r\n let bw = a[3];\r\n\r\n out[0] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[1] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[2] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[3] = qw * bw - qx * bx - qy * by - qz * bz;\r\n bx = a[4];\r\n by = a[5];\r\n bz = a[6];\r\n bw = a[7];\r\n out[4] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[5] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[6] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[7] = qw * bw - qx * bx - qy * by - qz * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around a given axis. Does the normalization automatically\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param axis - the axis to rotate around\r\n * @param rad - how far the rotation should be\r\n * @returns `out`\r\n */\r\n static rotateAroundAxis(out: Quat2Like, a: Readonly, axis: Readonly, rad: number): Quat2Like {\r\n // Special case for rad = 0\r\n if (Math.abs(rad) < GLM_EPSILON) {\r\n return Quat2.copy(out, a);\r\n }\r\n const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);\r\n\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n const bx = (s * axis[0]) / axisLength;\r\n const by = (s * axis[1]) / axisLength;\r\n const bz = (s * axis[2]) / axisLength;\r\n const bw = Math.cos(rad);\r\n\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n out[4] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[5] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[6] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[7] = aw * bw - ax * bx - ay * by - az * bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns {quat2} out\r\n */\r\n static multiply(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n const ax0 = a[0];\r\n const ay0 = a[1];\r\n const az0 = a[2];\r\n const aw0 = a[3];\r\n const bx1 = b[4];\r\n const by1 = b[5];\r\n const bz1 = b[6];\r\n const bw1 = b[7];\r\n const ax1 = a[4];\r\n const ay1 = a[5];\r\n const az1 = a[6];\r\n const aw1 = a[7];\r\n const bx0 = b[0];\r\n const by0 = b[1];\r\n const bz0 = b[2];\r\n const bw0 = b[3];\r\n out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0;\r\n out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0;\r\n out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0;\r\n out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0;\r\n out[4] =\r\n ax0 * bw1 +\r\n aw0 * bx1 +\r\n ay0 * bz1 -\r\n az0 * by1 +\r\n ax1 * bw0 +\r\n aw1 * bx0 +\r\n ay1 * bz0 -\r\n az1 * by0;\r\n out[5] =\r\n ay0 * bw1 +\r\n aw0 * by1 +\r\n az0 * bx1 -\r\n ax0 * bz1 +\r\n ay1 * bw0 +\r\n aw1 * by0 +\r\n az1 * bx0 -\r\n ax1 * bz0;\r\n out[6] =\r\n az0 * bw1 +\r\n aw0 * bz1 +\r\n ax0 * by1 -\r\n ay0 * bx1 +\r\n az1 * bw0 +\r\n aw1 * bz0 +\r\n ax1 * by0 -\r\n ay1 * bx0;\r\n out[7] =\r\n aw0 * bw1 -\r\n ax0 * bx1 -\r\n ay0 * by1 -\r\n az0 * bz1 +\r\n aw1 * bw0 -\r\n ax1 * bx0 -\r\n ay1 * by0 -\r\n az1 * bz0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like { return out; }\r\n\r\n /**\r\n * Scales a {@link Quat2} by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaterion\r\n * @param a - the dual quaternion to scale\r\n * @param b - scalar value to scale the dual quaterion by\r\n * @returns `out`\r\n */\r\n static scale(out: Quat2Like, a: Readonly, b: number): Quat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts)\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dot(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Quat2}s\r\n * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quat\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Quat2Like, a: Readonly, b: Readonly, t: number): Quat2Like {\r\n const mt = 1 - t;\r\n if (Quat2.dot(a, b) < 0) { t = -t; }\r\n\r\n out[0] = a[0] * mt + b[0] * t;\r\n out[1] = a[1] * mt + b[1] * t;\r\n out[2] = a[2] * mt + b[2] * t;\r\n out[3] = a[3] * mt + b[3] * t;\r\n out[4] = a[4] * mt + b[4] * t;\r\n out[5] = a[5] * mt + b[5] * t;\r\n out[6] = a[6] * mt + b[6] * t;\r\n out[7] = a[7] * mt + b[7] * t;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: Quat2Like, a: Readonly): Quat2Like {\r\n const sqlen = Quat2.squaredLength(a);\r\n out[0] = -a[0] / sqlen;\r\n out[1] = -a[1] / sqlen;\r\n out[2] = -a[2] / sqlen;\r\n out[3] = a[3] / sqlen;\r\n out[4] = -a[4] / sqlen;\r\n out[5] = -a[5] / sqlen;\r\n out[6] = -a[6] / sqlen;\r\n out[7] = a[7] / sqlen;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than\r\n * {@link Quat2.invert} and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n out[4] = -a[4];\r\n out[5] = -a[5];\r\n out[6] = -a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Quat2Like, a: Readonly): Quat2Like {\r\n let magnitude = Quat2.squaredLength(a);\r\n if (magnitude > 0) {\r\n magnitude = Math.sqrt(magnitude);\r\n\r\n const a0 = a[0] / magnitude;\r\n const a1 = a[1] / magnitude;\r\n const a2 = a[2] / magnitude;\r\n const a3 = a[3] / magnitude;\r\n\r\n const b0 = a[4];\r\n const b1 = a[5];\r\n const b2 = a[6];\r\n const b3 = a[7];\r\n\r\n const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3;\r\n\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n\r\n out[4] = (b0 - a0 * a_dot_b) / magnitude;\r\n out[5] = (b1 - a1 * a_dot_b) / magnitude;\r\n out[6] = (b2 - a2 * a_dot_b) / magnitude;\r\n out[7] = (b3 - a3 * a_dot_b) / magnitude;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat2(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7))\r\n );\r\n }\r\n}\r\n\r\n// Methods which re-use the Quat implementation\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.dot = Quat.dot;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.squaredLength = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.sqrLen = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.mag = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.length = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.len = Quat.magnitude;\r\n\r\n// Static method alias assignments\r\nQuat2.mul = Quat2.multiply;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Mat2dLike, Mat3Like, Mat4Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 2 Dimensional Vector\r\n */\r\nexport class Vec2 extends Float64Array {\r\n /**\r\n * Create a {@link Vec2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 2:{\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, values[1]!]);\r\n } else {\r\n super(v as ArrayBufferLike, values[1], 2);\r\n }\r\n break;\r\n }\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 2);\r\n }\r\n break;\r\n }\r\n default:\r\n super(2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec2.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n return Math.hypot(this[0], this[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec2.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n // Instead of zero(), use a.fill(0) for instances;\r\n\r\n /**\r\n * Adds a {@link Vec2} to `this`.\r\n * Equivalent to `Vec2.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec2} from `this`.\r\n * Equivalent to `Vec2.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec2.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec2.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec2.squaredDistance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec2.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec2.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec2.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec2}.\r\n * Equivalent to `Vec2.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec2.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec2.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 2 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec2}\r\n * @category Static\r\n *\r\n * @returns A new 2D vector\r\n */\r\n static create(): Vec2 {\r\n return new Vec2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - Vector to clone\r\n * @returns A new 2D vector\r\n */\r\n static clone(a: Readonly): Vec2 {\r\n return new Vec2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns A new 2D vector\r\n */\r\n static fromValues(x: number, y: number): Vec2 {\r\n return new Vec2(x, y);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - The source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns `out`\r\n */\r\n static set(out: Vec2Like, x: number, y: number): Vec2Like {\r\n out[0] = x;\r\n out[1] = y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Multiplies two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Divides two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec2} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to scale\r\n * @param b - Amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec2Like, a: Readonly, b: number): Vec2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two Vec2's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param scale - The amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec2Like, a: Readonly, b: Readonly, scale: number): Vec2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns distance between `a` and `b`\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n return Math.hypot(b[0] - a[0], b[1] - a[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Squared distance between `a` and `b`\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return Math.sqrt(x * x + y * y);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate squared length of\r\n * @returns Squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec2Like, a: Readonly) {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec2Like, a: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n let len = x * x + y * y;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Dot product of `a` and `b`\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two {@link Vec2}s\r\n * Note that the cross product must by definition produce a 3D vector.\r\n * For this reason there is also not instance equivalent for this function.\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n const z = a[0] * b[1] - a[1] * b[0];\r\n out[0] = out[1] = 0;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param t - Interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec2Like, a: Readonly, b: Readonly, t: number): Vec2Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y;\r\n out[1] = m[1] * x + m[3] * y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2d}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2d(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y + m[4];\r\n out[1] = m[1] * x + m[3] * y + m[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat3}\r\n * 3rd vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat3(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[3] * y + m[6];\r\n out[1] = m[1] * x + m[4] * y + m[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat4}\r\n * 3rd vector component is implicitly '0'\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat4(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[4] * y + m[12];\r\n out[1] = m[1] * x + m[5] * y + m[13];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 2D vector\r\n * @category Static\r\n *\r\n * @param out - The receiving {@link Vec2}\r\n * @param a - The {@link Vec2} point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotate(out: Vec2Like, a: Readonly, b: Readonly, rad: number): Vec2Like {\r\n // Translate point to the origin\r\n const p0 = a[0] - b[0];\r\n const p1 = a[1] - b[1];\r\n const sinC = Math.sin(rad);\r\n const cosC = Math.cos(rad);\r\n\r\n // perform rotation and translate to correct position\r\n out[0] = p0 * cosC - p1 * sinC + b[0];\r\n out[1] = p0 * sinC + p1 * cosC + b[1];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 2D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly): number {\r\n const x1 = a[0];\r\n const y1 = a[1];\r\n const x2 = b[0];\r\n const y2 = b[1];\r\n // mag is the product of the magnitudes of a and b\r\n const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2);\r\n // mag &&.. short circuits if mag == 0\r\n const cosine = mag && (x1 * x2 + y1 * y2) / mag;\r\n // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to zero\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec2Like): Vec2Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors components are ===, `false` otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors are approximately equal, `false` otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - Vector to represent as a string\r\n * @returns String representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec2.prototype.sub = Vec2.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.mul = Vec2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.div = Vec2.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.dist = Vec2.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.sqrDist = Vec2.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec2.sub = Vec2.subtract;\r\nVec2.mul = Vec2.multiply;\r\nVec2.div = Vec2.divide;\r\nVec2.dist = Vec2.distance;\r\nVec2.sqrDist = Vec2.squaredDistance;\r\nVec2.sqrLen = Vec2.squaredLength;\r\nVec2.mag = Vec2.magnitude;\r\nVec2.length = Vec2.magnitude;\r\nVec2.len = Vec2.magnitude;\r\n", "/**\r\n * To enable additional swizzle accessors for vector classes (64-bit) invoke the {@link EnableSwizzlesF64} function from\r\n * the `gl-matrix/swizzle/f64` sub-path export. To enable ambient module declarations for IDE / Typescript support\r\n * please see {@link gl-matrix/types/swizzle/f64}.\r\n *\r\n * To enable swizzling for the 32-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle}.\r\n *\r\n * @example\r\n * ```ts\r\n * import { Vec3 } from 'gl-matrix/f64';\r\n * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64';\r\n *\r\n * EnableSwizzlesF64();\r\n *\r\n * const vec = new Vec3(0, 1, 2);\r\n * const vecSwizzled = vec.zyx; // Returns a new Vec3(2, 1, 0).\r\n * ```\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\nimport { Vec2, Vec3, Vec4 } from '#gl-matrix/f64';\r\n\r\n/**\r\n * Internal `gl-matrix` variable tracking if swizzling is enabled (64-bit).\r\n */\r\nlet GLM_SWIZZLES_ENABLED_F64 = false;\r\n\r\n/**\r\n * Enables Swizzle operations on {@link gl-matrix/f64.Vec2 | Vec2} / {@link gl-matrix/f64.Vec3 | Vec3} /\r\n * {@link gl-matrix/f64.Vec4 | Vec4} types from {@link gl-matrix/f64} (64-bit).\r\n *\r\n * Swizzle operations are performed by using the `.` operator in conjunction with any combination\r\n * of between two and four component names, either from the set `xyzw` or `rgbw` (though not intermixed).\r\n * They return a new vector with the same number of components as specified in the swizzle attribute.\r\n *\r\n * @example\r\n * ```js\r\n * import { Vec3 } from 'gl-matrix/f64';\r\n * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64';\r\n *\r\n * EnableSwizzlesF64();\r\n *\r\n * let v = new Vec3(0, 1, 2);\r\n *\r\n * v.yx; // returns new Vec2(1, 0)\r\n * v.xzy; // returns new Vec3(0, 2, 1)\r\n * v.zyxz; // returns new Vec4(2, 1, 0, 2)\r\n *\r\n * v.rgb; // returns new Vec3(0, 1, 2)\r\n * v.rbg; // returns new Vec3(0, 2, 1)\r\n * v.gg; // returns new Vec2(1, 1)\r\n * ```\r\n */\r\nexport function EnableSwizzlesF64(): void {\r\n /* v8 ignore next 1 */\r\n if (GLM_SWIZZLES_ENABLED_F64) { return; }\r\n\r\n /* eslint-disable comma-spacing, max-len */\r\n\r\n // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should\r\n // not be modified by hand.\r\n // [Swizzle Autogen]\r\n\r\n const VEC2_SWIZZLES = ['xx','xy','yx','yy','xxx','xxy','xyx','xyy','yxx','yxy','yyx','yyy','xxxx','xxxy','xxyx','xxyy','xyxx','xyxy','xyyx','xyyy','yxxx','yxxy','yxyx','yxyy','yyxx','yyxy','yyyx','yyyy','rr','rg','gr','gg','rrr','rrg','rgr','rgg','grr','grg','ggr','ggg','rrrr','rrrg','rrgr','rrgg','rgrr','rgrg','rggr','rggg','grrr','grrg','grgr','grgg','ggrr','ggrg','gggr','gggg'];\r\n const VEC3_SWIZZLES = ['xz','yz','zx','zy','zz','xxz','xyz','xzx','xzy','xzz','yxz','yyz','yzx','yzy','yzz','zxx','zxy','zxz','zyx','zyy','zyz','zzx','zzy','zzz','xxxz','xxyz','xxzx','xxzy','xxzz','xyxz','xyyz','xyzx','xyzy','xyzz','xzxx','xzxy','xzxz','xzyx','xzyy','xzyz','xzzx','xzzy','xzzz','yxxz','yxyz','yxzx','yxzy','yxzz','yyxz','yyyz','yyzx','yyzy','yyzz','yzxx','yzxy','yzxz','yzyx','yzyy','yzyz','yzzx','yzzy','yzzz','zxxx','zxxy','zxxz','zxyx','zxyy','zxyz','zxzx','zxzy','zxzz','zyxx','zyxy','zyxz','zyyx','zyyy','zyyz','zyzx','zyzy','zyzz','zzxx','zzxy','zzxz','zzyx','zzyy','zzyz','zzzx','zzzy','zzzz','rb','gb','br','bg','bb','rrb','rgb','rbr','rbg','rbb','grb','ggb','gbr','gbg','gbb','brr','brg','brb','bgr','bgg','bgb','bbr','bbg','bbb','rrrb','rrgb','rrbr','rrbg','rrbb','rgrb','rggb','rgbr','rgbg','rgbb','rbrr','rbrg','rbrb','rbgr','rbgg','rbgb','rbbr','rbbg','rbbb','grrb','grgb','grbr','grbg','grbb','ggrb','gggb','ggbr','ggbg','ggbb','gbrr','gbrg','gbrb','gbgr','gbgg','gbgb','gbbr','gbbg','gbbb','brrr','brrg','brrb','brgr','brgg','brgb','brbr','brbg','brbb','bgrr','bgrg','bgrb','bggr','bggg','bggb','bgbr','bgbg','bgbb','bbrr','bbrg','bbrb','bbgr','bbgg','bbgb','bbbr','bbbg','bbbb'];\r\n const VEC4_SWIZZLES = ['xw','yw','zw','wx','wy','wz','ww','xxw','xyw','xzw','xwx','xwy','xwz','xww','yxw','yyw','yzw','ywx','ywy','ywz','yww','zxw','zyw','zzw','zwx','zwy','zwz','zww','wxx','wxy','wxz','wxw','wyx','wyy','wyz','wyw','wzx','wzy','wzz','wzw','wwx','wwy','wwz','www','xxxw','xxyw','xxzw','xxwx','xxwy','xxwz','xxww','xyxw','xyyw','xyzw','xywx','xywy','xywz','xyww','xzxw','xzyw','xzzw','xzwx','xzwy','xzwz','xzww','xwxx','xwxy','xwxz','xwxw','xwyx','xwyy','xwyz','xwyw','xwzx','xwzy','xwzz','xwzw','xwwx','xwwy','xwwz','xwww','yxxw','yxyw','yxzw','yxwx','yxwy','yxwz','yxww','yyxw','yyyw','yyzw','yywx','yywy','yywz','yyww','yzxw','yzyw','yzzw','yzwx','yzwy','yzwz','yzww','ywxx','ywxy','ywxz','ywxw','ywyx','ywyy','ywyz','ywyw','ywzx','ywzy','ywzz','ywzw','ywwx','ywwy','ywwz','ywww','zxxw','zxyw','zxzw','zxwx','zxwy','zxwz','zxww','zyxw','zyyw','zyzw','zywx','zywy','zywz','zyww','zzxw','zzyw','zzzw','zzwx','zzwy','zzwz','zzww','zwxx','zwxy','zwxz','zwxw','zwyx','zwyy','zwyz','zwyw','zwzx','zwzy','zwzz','zwzw','zwwx','zwwy','zwwz','zwww','wxxx','wxxy','wxxz','wxxw','wxyx','wxyy','wxyz','wxyw','wxzx','wxzy','wxzz','wxzw','wxwx','wxwy','wxwz','wxww','wyxx','wyxy','wyxz','wyxw','wyyx','wyyy','wyyz','wyyw','wyzx','wyzy','wyzz','wyzw','wywx','wywy','wywz','wyww','wzxx','wzxy','wzxz','wzxw','wzyx','wzyy','wzyz','wzyw','wzzx','wzzy','wzzz','wzzw','wzwx','wzwy','wzwz','wzww','wwxx','wwxy','wwxz','wwxw','wwyx','wwyy','wwyz','wwyw','wwzx','wwzy','wwzz','wwzw','wwwx','wwwy','wwwz','wwww','ra','ga','ba','ar','ag','ab','aa','rra','rga','rba','rar','rag','rab','raa','gra','gga','gba','gar','gag','gab','gaa','bra','bga','bba','bar','bag','bab','baa','arr','arg','arb','ara','agr','agg','agb','aga','abr','abg','abb','aba','aar','aag','aab','aaa','rrra','rrga','rrba','rrar','rrag','rrab','rraa','rgra','rgga','rgba','rgar','rgag','rgab','rgaa','rbra','rbga','rbba','rbar','rbag','rbab','rbaa','rarr','rarg','rarb','rara','ragr','ragg','ragb','raga','rabr','rabg','rabb','raba','raar','raag','raab','raaa','grra','grga','grba','grar','grag','grab','graa','ggra','ggga','ggba','ggar','ggag','ggab','ggaa','gbra','gbga','gbba','gbar','gbag','gbab','gbaa','garr','garg','garb','gara','gagr','gagg','gagb','gaga','gabr','gabg','gabb','gaba','gaar','gaag','gaab','gaaa','brra','brga','brba','brar','brag','brab','braa','bgra','bgga','bgba','bgar','bgag','bgab','bgaa','bbra','bbga','bbba','bbar','bbag','bbab','bbaa','barr','barg','barb','bara','bagr','bagg','bagb','baga','babr','babg','babb','baba','baar','baag','baab','baaa','arrr','arrg','arrb','arra','argr','argg','argb','arga','arbr','arbg','arbb','arba','arar','arag','arab','araa','agrr','agrg','agrb','agra','aggr','aggg','aggb','agga','agbr','agbg','agbb','agba','agar','agag','agab','agaa','abrr','abrg','abrb','abra','abgr','abgg','abgb','abga','abbr','abbg','abbb','abba','abar','abag','abab','abaa','aarr','aarg','aarb','aara','aagr','aagg','aagb','aaga','aabr','aabg','aabb','aaba','aaar','aaag','aaab','aaaa'];\r\n\r\n // [/Swizzle Autogen]\r\n\r\n /* eslint-enable comma-spacing, max-len */\r\n\r\n /**\r\n * Internal swizzle index table for `gl-matrix`.\r\n */\r\n const SWIZZLE_INDEX: Record = {\r\n x: 0, r: 0,\r\n y: 1, g: 1,\r\n z: 2, b: 2,\r\n w: 3, a: 3,\r\n };\r\n\r\n /**\r\n * Internal helper function to convert and return a `gl-matrix` vector by swizzle format.\r\n *\r\n * @param swizzle - Swizzle format to apply.\r\n * @returns {Vec2 | Vec3 | Vec4} New swizzled vector instance.\r\n */\r\n function getSwizzleImpl(swizzle: string): () => Vec2 | Vec3 | Vec4 {\r\n switch (swizzle.length) {\r\n case 2:\r\n return function(this: Float64Array) {\r\n return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]);\r\n };\r\n case 3:\r\n return function(this: Float64Array) {\r\n return new Vec3(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]]);\r\n };\r\n case 4:\r\n return function(this: Float64Array) {\r\n return new Vec4(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]], this[SWIZZLE_INDEX[swizzle[3]]]);\r\n };\r\n }\r\n\r\n throw new Error('Illegal swizzle length');\r\n }\r\n\r\n for (const swizzle of VEC2_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec2.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC3_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC4_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n GLM_SWIZZLES_ENABLED_F64 = true;\r\n}\r\n", "/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_DEG_TO_RAD: number = Math.PI / 180;\r\n\r\n/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_RAD_TO_DEG: number = 180 / Math.PI;\r\n\r\n/**\r\n * Convert `radians` to `degrees`.\r\n *\r\n * @param value - Angle in `radians`.\r\n * @returns Angle in `degrees`.\r\n */\r\nexport function toDegree(value: number): number {\r\n return value * GLM_RAD_TO_DEG;\r\n}\r\n\r\n/**\r\n * Convert `degrees` to `radians`.\r\n *\r\n * @param value - Angle in `degrees`.\r\n * @returns Angle in `radians`.\r\n */\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S,CAC7C,IAAKI,CACP,CAAC,EACD,OAAO,eAAeF,EAAK,UAAWF,EAAS,CAC7C,IAAKI,CACP,CAAC,EACD,OAAO,eAAeD,EAAK,UAAWH,EAAS,CAC7C,IAAKI,CACP,CAAC,CACH,CAEA,QAAWJ,KAAWJ,EAAe,CACnC,IAAMQ,EAAOL,EAAeC,CAAO,EACnC,OAAO,eAAeE,EAAK,UAAWF,EAAS,CAC7C,IAAKI,CACP,CAAC,EACD,OAAO,eAAeD,EAAK,UAAWH,EAAS,CAC7C,IAAKI,CACP,CAAC,CACH,CAEA,QAAWJ,KAAWH,EAAe,CACnC,IAAMO,EAAOL,EAAeC,CAAO,EACnC,OAAO,eAAeG,EAAK,UAAWH,EAAS,CAC7C,IAAKI,CACP,CAAC,CACH,CAEAX,EAA2B,EAC7B,CCzIA,IAAMY,GAAyB,KAAK,GAAK,IAKnCC,GAAyB,IAAM,KAAK,GAQnC,SAASC,GAASC,EAAuB,CAC9C,OAAOA,EAAQF,EACjB,CAQO,SAASG,GAASD,EAAuB,CAC9C,OAAOA,EAAQH,EACjB", + "names": ["f64_exports", "__export", "EnableSwizzlesF64", "Mat2", "Mat2d", "Mat3", "Mat4", "Quat", "Quat2", "Vec2", "Vec3", "Vec4", "toDegree", "toRadian", "__toCommonJS", "Mat2", "_Mat2", "#IDENTITY_2X2", "values", "v", "a", "b", "rad", "out", "a1", "a0", "a2", "a3", "det", "b0", "b1", "b2", "b3", "s", "c", "v0", "v1", "scale", "L", "D", "U", "Mat2d", "_Mat2d", "#IDENTITY_2X3", "values", "v", "a", "b", "rad", "out", "aa", "ab", "ac", "ad", "atx", "aty", "det", "a0", "a1", "a2", "a3", "a4", "a5", "b0", "b1", "b2", "b3", "b4", "b5", "v0", "v1", "s", "c", "scale", "Mat3", "_Mat3", "#IDENTITY_3X3", "values", "v", "a", "b", "rad", "out", "a01", "a02", "a12", "a00", "a10", "a11", "a20", "a21", "a22", "b01", "b11", "b21", "det", "b0", "b1", "b2", "x", "y", "s", "c", "q", "z", "w", "x2", "y2", "z2", "xx", "yx", "yy", "zx", "zy", "zz", "wx", "wy", "wz", "a03", "a13", "a23", "a30", "a31", "a32", "a33", "b00", "b02", "b03", "b04", "b05", "b06", "b07", "b08", "b09", "b10", "ax", "ay", "az", "bx", "by", "bz", "cx", "cy", "cz", "width", "height", "scale", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "b3", "b4", "b5", "b6", "b7", "b8", "Mat4", "_Mat4", "#IDENTITY_4X4", "#TMP_VEC3", "values", "v", "a", "b", "rad", "axis", "fovy", "aspect", "near", "far", "left", "right", "bottom", "top", "out", "a01", "a02", "a03", "a12", "a13", "a23", "a00", "a10", "a11", "a20", "a21", "a22", "a30", "a31", "a32", "a33", "b00", "b01", "b02", "b03", "b04", "b05", "b06", "b07", "b08", "b09", "b10", "b11", "det", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "x", "y", "z", "len", "s", "c", "t", "b12", "b20", "b21", "b22", "q", "w", "x2", "y2", "z2", "xx", "xy", "xz", "yy", "yz", "zz", "wx", "wy", "wz", "bx", "by", "bz", "bw", "ax", "ay", "az", "aw", "magnitude", "cx", "cy", "cz", "mat", "m11", "m12", "m13", "m21", "m22", "m23", "m31", "m32", "m33", "is1", "is2", "is3", "sm11", "sm12", "sm13", "sm21", "sm22", "sm23", "sm31", "sm32", "sm33", "trace", "S", "out_r", "out_t", "out_s", "sx", "sy", "sz", "o", "ox", "oy", "oz", "out0", "out1", "out2", "out4", "out5", "out6", "out8", "out9", "out10", "yx", "zx", "zy", "rl", "tb", "nf", "f", "fov", "upTan", "downTan", "leftTan", "rightTan", "xScale", "yScale", "lr", "bt", "eye", "center", "up", "eyex", "eyey", "eyez", "upx", "upy", "upz", "centerx", "centery", "centerz", "z0", "z1", "x0", "x1", "y0", "y1", "target", "scale", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a14", "a15", "b13", "b14", "b15", "Vec3", "_Vec3", "values", "v", "value", "x", "y", "z", "a", "b", "scale", "out", "len", "ax", "ay", "az", "bx", "by", "bz", "t", "angle", "sinTotal", "ratioA", "ratioB", "c", "d", "factorTimes2", "factor1", "factor2", "factor3", "factor4", "inverseFactor", "inverseFactorTimesTwo", "m", "w", "q", "qx", "qy", "qz", "w2", "uvx", "uvy", "uvz", "uuvx", "uuvy", "uuvz", "rad", "py", "pz", "px", "mag", "cosine", "a0", "a1", "a2", "b0", "b1", "b2", "Vec4", "_Vec4", "values", "v", "value", "x", "y", "z", "w", "a", "b", "scale", "out", "len", "u", "c", "d", "e", "f", "g", "h", "i", "j", "t", "ax", "ay", "az", "aw", "m", "q", "qx", "qy", "qz", "qw", "ix", "iy", "iz", "iw", "a0", "a1", "a2", "a3", "b0", "b1", "b2", "b3", "Quat", "_Quat", "#DEFAULT_ANGLE_ORDER", "#TMP_QUAT1", "#TMP_QUAT2", "#TMP_MAT3", "#TMP_VEC3", "#X_UNIT_VEC3", "#Y_UNIT_VEC3", "values", "v", "value", "x", "y", "z", "w", "a", "b", "rad", "scale", "out", "axis", "out_axis", "q", "dotproduct", "ax", "ay", "az", "aw", "bx", "by", "bz", "bw", "r", "et", "s", "t", "scale0", "scale1", "cosom", "omega", "sinom", "a0", "a1", "a2", "a3", "dot", "invDot", "m", "fTrace", "fRoot", "i", "j", "k", "order", "halfToRad", "sx", "cx", "sy", "cy", "sz", "cz", "Vec3", "c", "d", "view", "right", "up", "Vec4", "Quat2", "_Quat2", "#TMP_QUAT", "#TMP_VEC3", "values", "v", "a", "x1", "y1", "z1", "w1", "x2", "y2", "z2", "w2", "ax", "ay", "az", "out", "q", "t", "bx", "by", "bz", "bw", "Mat4", "aw", "ax1", "ay1", "az1", "aw1", "bx1", "by1", "bz1", "ax2", "ay2", "az2", "aw2", "rad", "Quat", "qx", "qy", "qz", "qw", "axis", "axisLength", "s", "b", "ax0", "ay0", "az0", "aw0", "bw1", "bx0", "by0", "bz0", "bw0", "mt", "sqlen", "magnitude", "a0", "a1", "a2", "a3", "b0", "b1", "b2", "b3", "a_dot_b", "a4", "a5", "a6", "a7", "b4", "b5", "b6", "b7", "Vec2", "_Vec2", "values", "v", "value", "x", "y", "a", "b", "scale", "out", "len", "z", "t", "ax", "ay", "m", "rad", "p0", "p1", "sinC", "cosC", "x1", "y1", "x2", "y2", "mag", "cosine", "a0", "a1", "b0", "b1", "GLM_SWIZZLES_ENABLED_F64", "EnableSwizzlesF64", "VEC2_SWIZZLES", "VEC3_SWIZZLES", "VEC4_SWIZZLES", "SWIZZLE_INDEX", "getSwizzleImpl", "swizzle", "Vec2", "Vec3", "Vec4", "impl", "GLM_DEG_TO_RAD", "GLM_RAD_TO_DEG", "toDegree", "value", "toRadian"] +} diff --git a/dist-cdn/esm/2016/gl-matrix-f32.js b/dist-cdn/esm/2016/gl-matrix-f32.js new file mode 100644 index 00000000..03fd6c01 --- /dev/null +++ b/dist-cdn/esm/2016/gl-matrix-f32.js @@ -0,0 +1,9547 @@ +// gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library. +// @author Brandon Jones +// @author Colin MacKenzie IV +// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md) +var __typeError = (msg) => { + throw TypeError(msg); +}; +var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg); +var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); +var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); + +// src/common/index.ts +var GLM_EPSILON = 1e-6; + +// src/_lib/f32/Mat2.ts +var _IDENTITY_2X2; +var _Mat2 = class _Mat2 extends Float32Array { + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 4: + super(values); + break; + case 2: + super(values[0], values[1], 4); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v + ]); + } else { + super(v, 0, 4); + } + break; + default: + super(__privateGet(_Mat2, _IDENTITY_2X2)); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat2.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat2.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat2} into `this`. + * + * @param a the source vector + * @returns `this` + * @category Methods + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat2.identity(this) + * + * @returns `this` + * @category Methods + */ + identity() { + this.set(__privateGet(_Mat2, _IDENTITY_2X2)); + return this; + } + /** + * Multiplies this {@link Mat2} against another one + * Equivalent to `Mat2.multiply(this, this, b);` + * + * @param b - The second operand + * @returns `this` + * @category Methods + */ + multiply(b) { + return _Mat2.multiply(this, this, b); + } + /** + * Alias for {@link Mat2.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat2} + * Equivalent to `Mat2.transpose(this, this);` + * + * @returns `this` + * @category Methods + */ + transpose() { + return _Mat2.transpose(this, this); + } + /** + * Inverts this {@link Mat2} + * Equivalent to `Mat4.invert(this, this);` + * + * @returns `this` + * @category Methods + */ + invert() { + return _Mat2.invert(this, this); + } + /** + * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2.scale(this, this, v);` + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + * @category Methods + */ + scale(v) { + return _Mat2.scale(this, this, v); + } + /** + * Rotates this {@link Mat2} by the given angle around the given axis + * Equivalent to `Mat2.rotate(this, this, rad);` + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + * @category Methods + */ + rotate(rad) { + return _Mat2.rotate(this, this, rad); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2}. + */ + static get BYTE_LENGTH() { + return 4 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat2} + * @category Static + * + * @returns A new {@link Mat2} + */ + static create() { + return new _Mat2(); + } + /** + * Creates a new {@link Mat2} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2} + */ + static clone(a) { + return new _Mat2(a); + } + /** + * Copy the values from one {@link Mat2} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Create a new {@link Mat2} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2} + */ + static fromValues(...values) { + return new _Mat2(...values); + } + /** + * Set the components of a {@link Mat2} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + return out; + } + /** + * Set a {@link Mat2} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out, a) { + if (out === a) { + const a1 = a[1]; + out[1] = a[2]; + out[2] = a1; + } else { + out[0] = a[0]; + out[1] = a[2]; + out[2] = a[1]; + out[3] = a[3]; + } + return out; + } + /** + * Inverts a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + let det = a0 * a3 - a2 * a1; + if (!det) { + return null; + } + det = 1 / det; + out[0] = a3 * det; + out[1] = -a1 * det; + out[2] = -a2 * det; + out[3] = a0 * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out, a) { + const a0 = a[0]; + out[0] = a[3]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a0; + return out; + } + /** + * Calculates the determinant of a {@link Mat2} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + return a[0] * a[3] - a[2] * a[1]; + } + /** + * Adds two {@link Mat2}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + return out; + } + /** + * Alias for {@link Mat2.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat2}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + out[0] = a0 * b0 + a2 * b1; + out[1] = a1 * b0 + a3 * b1; + out[2] = a0 * b2 + a2 * b3; + out[3] = a1 * b2 + a3 * b3; + return out; + } + /** + * Alias for {@link Mat2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Rotates a {@link Mat2} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out, a, rad) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = a0 * c + a2 * s; + out[1] = a1 * c + a3 * s; + out[2] = a0 * -s + a2 * c; + out[3] = a1 * -s + a3 * c; + return out; + } + /** + * Scales the {@link Mat2} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0 * v0; + out[1] = a1 * v0; + out[2] = a2 * v1; + out[3] = a3 * v1; + return out; + } + /** + * Creates a {@link Mat2} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = -s; + out[3] = c; + return out; + } + /** + * Creates a {@link Mat2} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = v[1]; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat2} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]); + } + /** + * Multiply each element of a {@link Mat2} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + return out; + } + /** + * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + return out; + } + /** + * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix + * @category Static + * + * @param L - the lower triangular matrix + * @param D - the diagonal matrix + * @param U - the upper triangular matrix + * @param a - the input matrix to factorize + */ + static LDU(L, D, U, a) { + L[2] = a[2] / a[0]; + U[0] = a[0]; + U[1] = a[1]; + U[3] = a[3] - L[2] * U[1]; + return [L, D, U]; + } + /** + * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + /** + * Returns whether two {@link Mat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)); + } + /** + * Returns a string representation of a {@link Mat2} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat2(${a.join(", ")})`; + } +}; +_IDENTITY_2X2 = new WeakMap(); +__privateAdd(_Mat2, _IDENTITY_2X2, new Float32Array([ + 1, + 0, + 0, + 1 +])); +var Mat2 = _Mat2; +Mat2.prototype.mul = Mat2.prototype.multiply; +Mat2.mul = Mat2.multiply; +Mat2.sub = Mat2.subtract; + +// src/_lib/f32/Mat2d.ts +var _IDENTITY_2X3; +var _Mat2d = class _Mat2d extends Float32Array { + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 6: + super(values); + break; + case 2: + super(values[0], values[1], 6); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v, + v, + v + ]); + } else { + super(v, 0, 6); + } + break; + default: + super(__privateGet(_Mat2d, _IDENTITY_2X3)); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat2d.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat2d.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Mat2d} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat2d.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this.set(__privateGet(_Mat2d, _IDENTITY_2X3)); + return this; + } + /** + * Multiplies this {@link Mat2d} against another one + * Equivalent to `Mat2d.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b) { + return _Mat2d.multiply(this, this, b); + } + /** + * Alias for {@link Mat2d.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Translate this {@link Mat2d} by the given vector + * Equivalent to `Mat2d.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v) { + return _Mat2d.translate(this, this, v); + } + /** + * Rotates this {@link Mat2d} by the given angle around the given axis + * Equivalent to `Mat2d.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad) { + return _Mat2d.rotate(this, this, rad); + } + /** + * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2d.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v) { + return _Mat2d.scale(this, this, v); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2d}. + */ + static get BYTE_LENGTH() { + return 6 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat2d} + * @category Static + * + * @returns A new {@link Mat2d} + */ + static create() { + return new _Mat2d(); + } + /** + * Creates a new {@link Mat2d} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2d} + */ + static clone(a) { + return new _Mat2d(a); + } + /** + * Copy the values from one {@link Mat2d} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + return out; + } + /** + * Create a new {@link Mat2d} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2d} + */ + static fromValues(...values) { + return new _Mat2d(...values); + } + /** + * Set the components of a {@link Mat2d} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + return out; + } + /** + * Set a {@link Mat2d} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Inverts a {@link Mat2d} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const aa = a[0]; + const ab = a[1]; + const ac = a[2]; + const ad = a[3]; + const atx = a[4]; + const aty = a[5]; + let det = aa * ad - ab * ac; + if (!det) { + return null; + } + det = 1 / det; + out[0] = ad * det; + out[1] = -ab * det; + out[2] = -ac * det; + out[3] = aa * det; + out[4] = (ac * aty - ad * atx) * det; + out[5] = (ab * atx - aa * aty) * det; + return out; + } + /** + * Calculates the determinant of a {@link Mat2d} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + return a[0] * a[3] - a[1] * a[2]; + } + /** + * Adds two {@link Mat2d}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + return out; + } + /** + * Alias for {@link Mat2d.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat2d}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + out[0] = a0 * b0 + a2 * b1; + out[1] = a1 * b0 + a3 * b1; + out[2] = a0 * b2 + a2 * b3; + out[3] = a1 * b2 + a3 * b3; + out[4] = a0 * b4 + a2 * b5 + a4; + out[5] = a1 * b4 + a3 * b5 + a5; + return out; + } + /** + * Alias for {@link Mat2d.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat2d} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0; + out[1] = a1; + out[2] = a2; + out[3] = a3; + out[4] = a0 * v0 + a2 * v1 + a4; + out[5] = a1 * v0 + a3 * v1 + a5; + return out; + } + /** + * Rotates a {@link Mat2d} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out, a, rad) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = a0 * c + a2 * s; + out[1] = a1 * c + a3 * s; + out[2] = a0 * -s + a2 * c; + out[3] = a1 * -s + a3 * c; + out[4] = a4; + out[5] = a5; + return out; + } + /** + * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0 * v0; + out[1] = a1 * v0; + out[2] = a2 * v1; + out[3] = a3 * v1; + out[4] = a4; + out[5] = a5; + return out; + } + // TODO: Got to fromRotation + /** + * Creates a {@link Mat2d} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = v[0]; + out[5] = v[1]; + return out; + } + /** + * Creates a {@link Mat2d} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = -s; + out[3] = c; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Creates a {@link Mat2d} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = v[1]; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat2d} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1); + } + /** + * Multiply each element of a {@link Mat2d} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + return out; + } + /** + * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + return out; + } + /** + * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5]; + } + /** + * Returns whether two {@link Mat2d}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)); + } + /** + * Returns a string representation of a {@link Mat2d} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat2d(${a.join(", ")})`; + } +}; +_IDENTITY_2X3 = new WeakMap(); +__privateAdd(_Mat2d, _IDENTITY_2X3, new Float32Array([ + 1, + 0, + 0, + 1, + 0, + 0 +])); +var Mat2d = _Mat2d; +Mat2d.mul = Mat2d.multiply; +Mat2d.sub = Mat2d.subtract; + +// src/_lib/f32/Mat3.ts +var _IDENTITY_3X3; +var _Mat3 = class _Mat3 extends Float32Array { + /** + * Create a {@link Mat3}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 9: + super(values); + break; + case 2: + super(values[0], values[1], 9); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v, + v, + v, + v, + v, + v + ]); + } else { + super(v, 0, 9); + } + break; + default: + super(__privateGet(_Mat3, _IDENTITY_3X3)); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat3.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat3.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat3.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this.set(__privateGet(_Mat3, _IDENTITY_3X3)); + return this; + } + /** + * Multiplies this {@link Mat3} against another one + * Equivalent to `Mat3.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b) { + return _Mat3.multiply(this, this, b); + } + /** + * Alias for {@link Mat3.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat3} + * Equivalent to `Mat3.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose() { + return _Mat3.transpose(this, this); + } + /** + * Inverts this {@link Mat3} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + return _Mat3.invert(this, this); + } + /** + * Translate this {@link Mat3} by the given vector + * Equivalent to `Mat3.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v) { + return _Mat3.translate(this, this, v); + } + /** + * Rotates this {@link Mat3} by the given angle around the given axis + * Equivalent to `Mat3.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad) { + return _Mat3.rotate(this, this, rad); + } + /** + * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat3.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v) { + return _Mat3.scale(this, this, v); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat3}. + */ + static get BYTE_LENGTH() { + return 9 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat3} + * @category Static + * + * @returns A new {@link Mat3} + */ + static create() { + return new _Mat3(); + } + /** + * Creates a new {@link Mat3} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat3} + */ + static clone(a) { + return new _Mat3(a); + } + /** + * Copy the values from one {@link Mat3} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + return out; + } + /** + * Create a new {@link Mat3} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat3} + */ + static fromValues(...values) { + return new _Mat3(...values); + } + /** + * Set the components of a {@link Mat3} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + out[6] = values[6]; + out[7] = values[7]; + out[8] = values[8]; + return out; + } + /** + * Set a {@link Mat3} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out, a) { + if (out === a) { + const a01 = a[1], a02 = a[2], a12 = a[5]; + out[1] = a[3]; + out[2] = a[6]; + out[3] = a01; + out[5] = a[7]; + out[6] = a02; + out[7] = a12; + } else { + out[0] = a[0]; + out[1] = a[3]; + out[2] = a[6]; + out[3] = a[1]; + out[4] = a[4]; + out[5] = a[7]; + out[6] = a[2]; + out[7] = a[5]; + out[8] = a[8]; + } + return out; + } + /** + * Inverts a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const a00 = a[0], a01 = a[1], a02 = a[2]; + const a10 = a[3], a11 = a[4], a12 = a[5]; + const a20 = a[6], a21 = a[7], a22 = a[8]; + const b01 = a22 * a11 - a12 * a21; + const b11 = -a22 * a10 + a12 * a20; + const b21 = a21 * a10 - a11 * a20; + let det = a00 * b01 + a01 * b11 + a02 * b21; + if (!det) { + return null; + } + det = 1 / det; + out[0] = b01 * det; + out[1] = (-a22 * a01 + a02 * a21) * det; + out[2] = (a12 * a01 - a02 * a11) * det; + out[3] = b11 * det; + out[4] = (a22 * a00 - a02 * a20) * det; + out[5] = (-a12 * a00 + a02 * a10) * det; + out[6] = b21 * det; + out[7] = (-a21 * a00 + a01 * a20) * det; + out[8] = (a11 * a00 - a01 * a10) * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out, a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + out[0] = a11 * a22 - a12 * a21; + out[1] = a02 * a21 - a01 * a22; + out[2] = a01 * a12 - a02 * a11; + out[3] = a12 * a20 - a10 * a22; + out[4] = a00 * a22 - a02 * a20; + out[5] = a02 * a10 - a00 * a12; + out[6] = a10 * a21 - a11 * a20; + out[7] = a01 * a20 - a00 * a21; + out[8] = a00 * a11 - a01 * a10; + return out; + } + /** + * Calculates the determinant of a {@link Mat3} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20); + } + /** + * Adds two {@link Mat3}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + out[8] = a[8] + b[8]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + out[6] = a[6] - b[6]; + out[7] = a[7] - b[7]; + out[8] = a[8] - b[8]; + return out; + } + /** + * Alias for {@link Mat3.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat3}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + let b0 = b[0]; + let b1 = b[1]; + let b2 = b[2]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20; + out[1] = b0 * a01 + b1 * a11 + b2 * a21; + out[2] = b0 * a02 + b1 * a12 + b2 * a22; + b0 = b[3]; + b1 = b[4]; + b2 = b[5]; + out[3] = b0 * a00 + b1 * a10 + b2 * a20; + out[4] = b0 * a01 + b1 * a11 + b2 * a21; + out[5] = b0 * a02 + b1 * a12 + b2 * a22; + b0 = b[6]; + b1 = b[7]; + b2 = b[8]; + out[6] = b0 * a00 + b1 * a10 + b2 * a20; + out[7] = b0 * a01 + b1 * a11 + b2 * a21; + out[8] = b0 * a02 + b1 * a12 + b2 * a22; + return out; + } + /** + * Alias for {@link Mat3.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat3} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + const x = v[0]; + const y = v[1]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a10; + out[4] = a11; + out[5] = a12; + out[6] = x * a00 + y * a10 + a20; + out[7] = x * a01 + y * a11 + a21; + out[8] = x * a02 + y * a12 + a22; + return out; + } + /** + * Rotates a {@link Mat3} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out, a, rad) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c * a00 + s * a10; + out[1] = c * a01 + s * a11; + out[2] = c * a02 + s * a12; + out[3] = c * a10 - s * a00; + out[4] = c * a11 - s * a01; + out[5] = c * a12 - s * a02; + out[6] = a20; + out[7] = a21; + out[8] = a22; + return out; + } + /** + * Scales the {@link Mat3} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const x = v[0]; + const y = v[1]; + out[0] = x * a[0]; + out[1] = x * a[1]; + out[2] = x * a[2]; + out[3] = y * a[3]; + out[4] = y * a[4]; + out[5] = y * a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + return out; + } + /** + * Creates a {@link Mat3} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = v[0]; + out[7] = v[1]; + out[8] = 1; + return out; + } + /** + * Creates a {@link Mat3} from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat3.identity(dest); + * mat3.rotate(dest, dest, rad); + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = 0; + out[3] = -s; + out[4] = c; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Creates a {@link Mat3} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = v[1]; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Copies the upper-left 3x3 values of a {@link Mat2d} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 2x3 matrix + * @returns `out` + */ + static fromMat2d(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = 0; + out[3] = a[2]; + out[4] = a[3]; + out[5] = 0; + out[6] = a[4]; + out[7] = a[5]; + out[8] = 1; + return out; + } + /** + * Calculates a {@link Mat3} from the given quaternion + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param q - {@link Quat} to create matrix from + * @returns `out` + */ + static fromQuat(out, q) { + 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; + out[0] = 1 - yy - zz; + out[3] = yx - wz; + out[6] = zx + wy; + out[1] = yx + wz; + out[4] = 1 - xx - zz; + out[7] = zy - wx; + out[2] = zx - wy; + out[5] = zy + wx; + out[8] = 1 - xx - yy; + return out; + } + /** + * Copies the upper-left 3x3 values of a {@link Mat4} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 4x4 matrix + * @returns `out` + */ + static fromMat4(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[4]; + out[4] = a[5]; + out[5] = a[6]; + out[6] = a[8]; + out[7] = a[9]; + out[8] = a[10]; + return out; + } + /** + * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix + * @category Static + * + * @param {mat3} out mat3 receiving operation result + * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out, a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + return out; + } + /** + * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out, a) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const bx = a[4]; + const by = a[5]; + const bz = a[6]; + const cx = a[8]; + const cy = a[9]; + const cz = a[10]; + out[0] = by * cz - cz * cy; + out[1] = bz * cx - cx * cz; + out[2] = bx * cy - cy * cx; + out[3] = cy * az - cz * ay; + out[4] = cz * ax - cx * az; + out[5] = cx * ay - cy * ax; + out[6] = ay * bz - az * by; + out[7] = az * bx - ax * bz; + out[8] = ax * by - ay * bx; + return out; + } + /** + * Generates a 2D projection matrix with the given bounds + * @category Static + * + * @param out mat3 frustum matrix will be written into + * @param width Width of your gl context + * @param height Height of gl context + * @returns `out` + */ + static projection(out, width, height) { + out[0] = 2 / width; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = -2 / height; + out[5] = 0; + out[6] = -1; + out[7] = 1; + out[8] = 1; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat3} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt( + a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + ); + } + /** + * Multiply each element of a {@link Mat3} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + out[8] = a[8] * b; + return out; + } + /** + * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + out[6] = a[6] + b[6] * scale; + out[7] = a[7] + b[7] * scale; + out[8] = a[8] + b[8] * scale; + return out; + } + /** + * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8]; + } + /** + * Returns whether two {@link Mat3}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const a8 = a[8]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + const b8 = b[8]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)); + } + /** + * Returns a string representation of a {@link Mat3} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat3(${a.join(", ")})`; + } +}; +_IDENTITY_3X3 = new WeakMap(); +__privateAdd(_Mat3, _IDENTITY_3X3, new Float32Array([ + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1 +])); +var Mat3 = _Mat3; +Mat3.prototype.mul = Mat3.prototype.multiply; +Mat3.mul = Mat3.multiply; +Mat3.sub = Mat3.subtract; + +// src/_lib/f32/Mat4.ts +var _IDENTITY_4X4, _TMP_VEC3; +var _Mat4 = class _Mat4 extends Float32Array { + /** + * Create a {@link Mat4}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 16: + super(values); + break; + case 2: + super(values[0], values[1], 16); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v + ]); + } else { + super(v, 0, 16); + } + break; + default: + super(__privateGet(_Mat4, _IDENTITY_4X4)); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat4.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat4.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat4.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this.set(__privateGet(_Mat4, _IDENTITY_4X4)); + return this; + } + /** + * Multiplies this {@link Mat4} against another one + * Equivalent to `Mat4.multiply(this, this, b);` + * @category Methods + * + * @param b - The second operand + * @returns `this` + */ + multiply(b) { + return _Mat4.multiply(this, this, b); + } + /** + * Alias for {@link Mat4.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat4} + * Equivalent to `Mat4.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose() { + return _Mat4.transpose(this, this); + } + /** + * Inverts this {@link Mat4} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + return _Mat4.invert(this, this); + } + /** + * Translate this {@link Mat4} by the given vector + * Equivalent to `Mat4.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to translate by + * @returns `this` + */ + translate(v) { + return _Mat4.translate(this, this, v); + } + /** + * Rotates this {@link Mat4} by the given angle around the given axis + * Equivalent to `Mat4.rotate(this, this, rad, axis);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `this` + */ + rotate(rad, axis) { + return _Mat4.rotate(this, this, rad, axis); + } + /** + * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat4.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to scale the matrix by + * @returns `this` + */ + scale(v) { + return _Mat4.scale(this, this, v); + } + /** + * Rotates this {@link Mat4} by the given angle around the X axis + * Equivalent to `Mat4.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateX(rad) { + return _Mat4.rotateX(this, this, rad); + } + /** + * Rotates this {@link Mat4} by the given angle around the Y axis + * Equivalent to `Mat4.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateY(rad) { + return _Mat4.rotateY(this, this, rad); + } + /** + * Rotates this {@link Mat4} by the given angle around the Z axis + * Equivalent to `Mat4.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateZ(rad) { + return _Mat4.rotateZ(this, this, rad); + } + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveNO(fovy, aspect, near, far) { + return _Mat4.perspectiveNO(this, fovy, aspect, near, far); + } + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveZO(fovy, aspect, near, far) { + return _Mat4.perspectiveZO(this, fovy, aspect, near, far); + } + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoNO(left, right, bottom, top, near, far) { + return _Mat4.orthoNO(this, left, right, bottom, top, near, far); + } + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoZO(left, right, bottom, top, near, far) { + return _Mat4.orthoZO(this, left, right, bottom, top, near, far); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat4}. + */ + static get BYTE_LENGTH() { + return 16 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat4} + * @category Static + * + * @returns A new {@link Mat4} + */ + static create() { + return new _Mat4(); + } + /** + * Creates a new {@link Mat4} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat4} + */ + static clone(a) { + return new _Mat4(a); + } + /** + * Copy the values from one {@link Mat4} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + /** + * Create a new mat4 with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat4} + */ + static fromValues(...values) { + return new _Mat4(...values); + } + /** + * Set the components of a mat4 to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + out[6] = values[6]; + out[7] = values[7]; + out[8] = values[8]; + out[9] = values[9]; + out[10] = values[10]; + out[11] = values[11]; + out[12] = values[12]; + out[13] = values[13]; + out[14] = values[14]; + out[15] = values[15]; + return out; + } + /** + * Set a {@link Mat4} to the identity matrix + * @category Static + * + * @param out - The receiving Matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out, a) { + if (out === a) { + const a01 = a[1], a02 = a[2], a03 = a[3]; + const a12 = a[6], a13 = a[7]; + const a23 = a[11]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a01; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a02; + out[9] = a12; + out[11] = a[14]; + out[12] = a03; + out[13] = a13; + out[14] = a23; + } else { + out[0] = a[0]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a[1]; + out[5] = a[5]; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a[2]; + out[9] = a[6]; + out[10] = a[10]; + out[11] = a[14]; + out[12] = a[3]; + out[13] = a[7]; + out[14] = a[11]; + out[15] = a[15]; + } + return out; + } + /** + * Inverts a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out, a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + out[0] = a11 * b11 - a12 * b10 + a13 * b09; + out[1] = a02 * b10 - a01 * b11 - a03 * b09; + out[2] = a31 * b05 - a32 * b04 + a33 * b03; + out[3] = a22 * b04 - a21 * b05 - a23 * b03; + out[4] = a12 * b08 - a10 * b11 - a13 * b07; + out[5] = a00 * b11 - a02 * b08 + a03 * b07; + out[6] = a32 * b02 - a30 * b05 - a33 * b01; + out[7] = a20 * b05 - a22 * b02 + a23 * b01; + out[8] = a10 * b10 - a11 * b08 + a13 * b06; + out[9] = a01 * b08 - a00 * b10 - a03 * b06; + out[10] = a30 * b04 - a31 * b02 + a33 * b00; + out[11] = a21 * b02 - a20 * b04 - a23 * b00; + out[12] = a11 * b07 - a10 * b09 - a12 * b06; + out[13] = a00 * b09 - a01 * b07 + a02 * b06; + out[14] = a31 * b01 - a30 * b03 - a32 * b00; + out[15] = a20 * b03 - a21 * b01 + a22 * b00; + return out; + } + /** + * Calculates the determinant of a {@link Mat4} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b0 = a00 * a11 - a01 * a10; + const b1 = a00 * a12 - a02 * a10; + const b2 = a01 * a12 - a02 * a11; + const b3 = a20 * a31 - a21 * a30; + const b4 = a20 * a32 - a22 * a30; + const b5 = a21 * a32 - a22 * a31; + const b6 = a00 * b5 - a01 * b4 + a02 * b3; + const b7 = a10 * b5 - a11 * b4 + a12 * b3; + const b8 = a20 * b2 - a21 * b1 + a22 * b0; + const b9 = a30 * b2 - a31 * b1 + a32 * b0; + return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9; + } + /** + * Multiplies two {@link Mat4}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + let b0 = b[0]; + let b1 = b[1]; + let b2 = b[2]; + let b3 = b[3]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[4]; + b1 = b[5]; + b2 = b[6]; + b3 = b[7]; + out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[8]; + b1 = b[9]; + b2 = b[10]; + b3 = b[11]; + out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[12]; + b1 = b[13]; + b2 = b[14]; + b3 = b[15]; + out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + return out; + } + /** + * Alias for {@link Mat4.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat4} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const x = v[0]; + const y = v[1]; + const z = v[2]; + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a03; + out[4] = a10; + out[5] = a11; + out[6] = a12; + out[7] = a13; + out[8] = a20; + out[9] = a21; + out[10] = a22; + out[11] = a23; + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + return out; + } + /** + * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec3} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const x = v[0]; + const y = v[1]; + const z = v[2]; + out[0] = a[0] * x; + out[1] = a[1] * x; + out[2] = a[2] * x; + out[3] = a[3] * x; + out[4] = a[4] * y; + out[5] = a[5] * y; + out[6] = a[6] * y; + out[7] = a[7] * y; + out[8] = a[8] * z; + out[9] = a[9] * z; + out[10] = a[10] * z; + out[11] = a[11] * z; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + /** + * Rotates a {@link Mat4} by the given angle around the given axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if axis has a length of 0 + */ + static rotate(out, a, rad, axis) { + let x = axis[0]; + let y = axis[1]; + let z = axis[2]; + let len = Math.sqrt(x * x + y * y + z * z); + if (len < GLM_EPSILON) { + return null; + } + len = 1 / len; + x *= len; + y *= len; + z *= len; + const s = Math.sin(rad); + const c = Math.cos(rad); + const t = 1 - c; + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const b00 = x * x * t + c; + const b01 = y * x * t + z * s; + const b02 = z * x * t - y * s; + const b10 = x * y * t - z * s; + const b11 = y * y * t + c; + const b12 = z * y * t + x * s; + const b20 = x * z * t + y * s; + const b21 = y * z * t - x * s; + const b22 = z * z * t + c; + out[0] = a00 * b00 + a10 * b01 + a20 * b02; + out[1] = a01 * b00 + a11 * b01 + a21 * b02; + out[2] = a02 * b00 + a12 * b01 + a22 * b02; + out[3] = a03 * b00 + a13 * b01 + a23 * b02; + out[4] = a00 * b10 + a10 * b11 + a20 * b12; + out[5] = a01 * b10 + a11 * b11 + a21 * b12; + out[6] = a02 * b10 + a12 * b11 + a22 * b12; + out[7] = a03 * b10 + a13 * b11 + a23 * b12; + out[8] = a00 * b20 + a10 * b21 + a20 * b22; + out[9] = a01 * b20 + a11 * b21 + a21 * b22; + out[10] = a02 * b20 + a12 * b21 + a22 * b22; + out[11] = a03 * b20 + a13 * b21 + a23 * b22; + if (a !== out) { + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + return out; + } + /** + * Rotates a matrix by the given angle around the X axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateX(out, a, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + if (a !== out) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[4] = a10 * c + a20 * s; + out[5] = a11 * c + a21 * s; + out[6] = a12 * c + a22 * s; + out[7] = a13 * c + a23 * s; + out[8] = a20 * c - a10 * s; + out[9] = a21 * c - a11 * s; + out[10] = a22 * c - a12 * s; + out[11] = a23 * c - a13 * s; + return out; + } + /** + * Rotates a matrix by the given angle around the Y axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateY(out, a, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + if (a !== out) { + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[0] = a00 * c - a20 * s; + out[1] = a01 * c - a21 * s; + out[2] = a02 * c - a22 * s; + out[3] = a03 * c - a23 * s; + out[8] = a00 * s + a20 * c; + out[9] = a01 * s + a21 * c; + out[10] = a02 * s + a22 * c; + out[11] = a03 * s + a23 * c; + return out; + } + /** + * Rotates a matrix by the given angle around the Z axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateZ(out, a, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + if (a !== out) { + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[0] = a00 * c + a10 * s; + out[1] = a01 * c + a11 * s; + out[2] = a02 * c + a12 * s; + out[3] = a03 * c + a13 * s; + out[4] = a10 * c - a00 * s; + out[5] = a11 * c - a01 * s; + out[6] = a12 * c - a02 * s; + out[7] = a13 * c - a03 * s; + return out; + } + /** + * Creates a {@link Mat4} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Creates a {@link Mat4} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = v[1]; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = v[2]; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a {@link Mat4} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotate(dest, dest, rad, axis); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if `axis` has a length of 0 + */ + static fromRotation(out, rad, axis) { + let x = axis[0]; + let y = axis[1]; + let z = axis[2]; + let len = Math.sqrt(x * x + y * y + z * z); + if (len < GLM_EPSILON) { + return null; + } + len = 1 / len; + x *= len; + y *= len; + z *= len; + const s = Math.sin(rad); + const c = Math.cos(rad); + const t = 1 - c; + out[0] = x * x * t + c; + out[1] = y * x * t + z * s; + out[2] = z * x * t - y * s; + out[3] = 0; + out[4] = x * y * t - z * s; + out[5] = y * y * t + c; + out[6] = z * y * t + x * s; + out[7] = 0; + out[8] = x * z * t + y * s; + out[9] = y * z * t - x * s; + out[10] = z * z * t + c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateX(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromXRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = c; + out[6] = s; + out[7] = 0; + out[8] = 0; + out[9] = -s; + out[10] = c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateY(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromYRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = 0; + out[2] = -s; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = s; + out[9] = 0; + out[10] = c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateZ(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromZRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = 0; + out[3] = 0; + out[4] = -s; + out[5] = c; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @returns `out` + */ + static fromRotationTranslation(out, q, v) { + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Sets a {@link Mat4} from a {@link Quat2}. + * @category Static + * + * @param out - Matrix + * @param a - Dual Quaternion + * @returns `out` + */ + static fromQuat2(out, a) { + const bx = -a[0]; + const by = -a[1]; + const bz = -a[2]; + const bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const magnitude = bx * bx + by * by + bz * bz + bw * bw; + if (magnitude > 0) { + __privateGet(_Mat4, _TMP_VEC3)[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude; + __privateGet(_Mat4, _TMP_VEC3)[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude; + __privateGet(_Mat4, _TMP_VEC3)[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude; + } else { + __privateGet(_Mat4, _TMP_VEC3)[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; + __privateGet(_Mat4, _TMP_VEC3)[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; + __privateGet(_Mat4, _TMP_VEC3)[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + } + _Mat4.fromRotationTranslation(out, a, __privateGet(_Mat4, _TMP_VEC3)); + return out; + } + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out, a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[3] = 0; + out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[7] = 0; + out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out, a) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const bx = a[4]; + const by = a[5]; + const bz = a[6]; + const cx = a[8]; + const cy = a[9]; + const cz = a[10]; + out[0] = by * cz - cz * cy; + out[1] = bz * cx - cx * cz; + out[2] = bx * cy - cy * cx; + out[3] = 0; + out[4] = cy * az - cz * ay; + out[5] = cz * ax - cx * az; + out[6] = cx * ay - cy * ax; + out[7] = 0; + out[8] = ay * bz - az * by; + out[9] = az * bx - ax * bz; + out[10] = ax * by - ay * bx; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Returns the translation vector component of a transformation + * matrix. If a matrix is built with fromRotationTranslation, + * the returned vector will be the same as the translation vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive translation component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getTranslation(out, mat) { + out[0] = mat[12]; + out[1] = mat[13]; + out[2] = mat[14]; + return out; + } + /** + * Returns the scaling factor component of a transformation + * matrix. If a matrix is built with fromRotationTranslationScale + * with a normalized Quaternion parameter, the returned vector will be + * the same as the scaling vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive scaling factor component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getScaling(out, mat) { + const m11 = mat[0]; + const m12 = mat[1]; + const m13 = mat[2]; + const m21 = mat[4]; + const m22 = mat[5]; + const m23 = mat[6]; + const m31 = mat[8]; + const m32 = mat[9]; + const m33 = mat[10]; + out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + return out; + } + /** + * Returns a quaternion representing the rotational component + * of a transformation matrix. If a matrix is built with + * fromRotationTranslation, the returned quaternion will be the + * same as the quaternion originally supplied. + * @category Static + * + * @param out - Quaternion to receive the rotation component + * @param mat - Matrix to be decomposed (input) + * @return `out` + */ + static getRotation(out, mat) { + _Mat4.getScaling(__privateGet(_Mat4, _TMP_VEC3), mat); + const is1 = 1 / __privateGet(_Mat4, _TMP_VEC3)[0]; + const is2 = 1 / __privateGet(_Mat4, _TMP_VEC3)[1]; + const is3 = 1 / __privateGet(_Mat4, _TMP_VEC3)[2]; + const sm11 = mat[0] * is1; + const sm12 = mat[1] * is2; + const sm13 = mat[2] * is3; + const sm21 = mat[4] * is1; + const sm22 = mat[5] * is2; + const sm23 = mat[6] * is3; + const sm31 = mat[8] * is1; + const sm32 = mat[9] * is2; + const sm33 = mat[10] * is3; + const trace = sm11 + sm22 + sm33; + let S = 0; + if (trace > 0) { + S = Math.sqrt(trace + 1) * 2; + out[3] = 0.25 * S; + out[0] = (sm23 - sm32) / S; + out[1] = (sm31 - sm13) / S; + out[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2; + out[3] = (sm23 - sm32) / S; + out[0] = 0.25 * S; + out[1] = (sm12 + sm21) / S; + out[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2; + out[3] = (sm31 - sm13) / S; + out[0] = (sm12 + sm21) / S; + out[1] = 0.25 * S; + out[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2; + out[3] = (sm12 - sm21) / S; + out[0] = (sm31 + sm13) / S; + out[1] = (sm23 + sm32) / S; + out[2] = 0.25 * S; + } + return out; + } + /** + * Decomposes a transformation matrix into its rotation, translation + * and scale components. Returns only the rotation component + * @category Static + * + * @param out_r - Quaternion to receive the rotation component + * @param out_t - Vector to receive the translation vector + * @param out_s - Vector to receive the scaling factor + * @param mat - Matrix to be decomposed (input) + * @returns `out_r` + */ + static decompose(out_r, out_t, out_s, mat) { + out_t[0] = mat[12]; + out_t[1] = mat[13]; + out_t[2] = mat[14]; + const m11 = mat[0]; + const m12 = mat[1]; + const m13 = mat[2]; + const m21 = mat[4]; + const m22 = mat[5]; + const m23 = mat[6]; + const m31 = mat[8]; + const m32 = mat[9]; + const m33 = mat[10]; + out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + const is1 = 1 / out_s[0]; + const is2 = 1 / out_s[1]; + const is3 = 1 / out_s[2]; + const sm11 = m11 * is1; + const sm12 = m12 * is2; + const sm13 = m13 * is3; + const sm21 = m21 * is1; + const sm22 = m22 * is2; + const sm23 = m23 * is3; + const sm31 = m31 * is1; + const sm32 = m32 * is2; + const sm33 = m33 * is3; + const trace = sm11 + sm22 + sm33; + let S = 0; + if (trace > 0) { + S = Math.sqrt(trace + 1) * 2; + out_r[3] = 0.25 * S; + out_r[0] = (sm23 - sm32) / S; + out_r[1] = (sm31 - sm13) / S; + out_r[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2; + out_r[3] = (sm23 - sm32) / S; + out_r[0] = 0.25 * S; + out_r[1] = (sm12 + sm21) / S; + out_r[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2; + out_r[3] = (sm31 - sm13) / S; + out_r[0] = (sm12 + sm21) / S; + out_r[1] = 0.25 * S; + out_r[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2; + out_r[3] = (sm12 - sm21) / S; + out_r[0] = (sm31 + sm13) / S; + out_r[1] = (sm23 + sm32) / S; + out_r[2] = 0.25 * S; + } + return out_r; + } + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @returns `out` + */ + static fromRotationTranslationScale(out, q, v, s) { + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + const sx = s[0]; + const sy = s[1]; + const sz = s[2]; + out[0] = (1 - (yy + zz)) * sx; + out[1] = (xy + wz) * sx; + out[2] = (xz - wy) * sx; + out[3] = 0; + out[4] = (xy - wz) * sy; + out[5] = (1 - (xx + zz)) * sy; + out[6] = (yz + wx) * sy; + out[7] = 0; + out[8] = (xz + wy) * sz; + out[9] = (yz - wx) * sz; + out[10] = (1 - (xx + yy)) * sz; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the + * given origin. This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * mat4.translate(dest, origin); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * mat4.translate(dest, negativeOrigin); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @param o - The origin vector around which to scale and rotate + * @returns `out` + */ + static fromRotationTranslationScaleOrigin(out, q, v, s, o) { + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + const sx = s[0]; + const sy = s[1]; + const sz = s[2]; + const ox = o[0]; + const oy = o[1]; + const oz = o[2]; + const out0 = (1 - (yy + zz)) * sx; + const out1 = (xy + wz) * sx; + const out2 = (xz - wy) * sx; + const out4 = (xy - wz) * sy; + const out5 = (1 - (xx + zz)) * sy; + const out6 = (yz + wx) * sy; + const out8 = (xz + wy) * sz; + const out9 = (yz - wx) * sz; + const out10 = (1 - (xx + yy)) * sz; + out[0] = out0; + out[1] = out1; + out[2] = out2; + out[3] = 0; + out[4] = out4; + out[5] = out5; + out[6] = out6; + out[7] = 0; + out[8] = out8; + out[9] = out9; + out[10] = out10; + out[11] = 0; + out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz); + out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz); + out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); + out[15] = 1; + return out; + } + /** + * Calculates a 4x4 matrix from the given quaternion + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Quaternion to create matrix from + * @returns `out` + */ + static fromQuat(out, q) { + 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; + out[0] = 1 - yy - zz; + out[1] = yx + wz; + out[2] = zx - wy; + out[3] = 0; + out[4] = yx - wz; + out[5] = 1 - xx - zz; + out[6] = zy + wx; + out[7] = 0; + out[8] = zx + wy; + out[9] = zy - wx; + out[10] = 1 - xx - yy; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumNO(out, left, right, bottom, top, near, far = Infinity) { + const rl = 1 / (right - left); + const tb = 1 / (top - bottom); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + /** + * Alias for {@link Mat4.frustumNO} + * @category Static + * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly + */ + static frustum(out, left, right, bottom, top, near, far = Infinity) { + return out; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumZO(out, left, right, bottom, top, near, far = Infinity) { + const rl = 1 / (right - left); + const tb = 1 / (top - bottom); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = far * nf; + out[14] = far * near * nf; + } else { + out[10] = -1; + out[14] = -near; + } + return out; + } + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveNO(out, fovy, aspect, near, far = Infinity) { + const f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + /** + * Alias for {@link Mat4.perspectiveNO} + * @category Static + * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static perspective(out, fovy, aspect, near, far = Infinity) { + return out; + } + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveZO(out, fovy, aspect, near, far = Infinity) { + const f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = far * nf; + out[14] = far * near * nf; + } else { + out[10] = -1; + out[14] = -near; + } + return out; + } + /** + * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating + * projection matrices to be used with the still experimental WebVR API. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + * @deprecated + */ + static perspectiveFromFieldOfView(out, fov, near, far) { + const upTan = Math.tan(fov.upDegrees * Math.PI / 180); + const downTan = Math.tan(fov.downDegrees * Math.PI / 180); + const leftTan = Math.tan(fov.leftDegrees * Math.PI / 180); + const rightTan = Math.tan(fov.rightDegrees * Math.PI / 180); + const xScale = 2 / (leftTan + rightTan); + const yScale = 2 / (upTan + downTan); + out[0] = xScale; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = yScale; + out[6] = 0; + out[7] = 0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = (upTan - downTan) * yScale * 0.5; + out[10] = far / (near - far); + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = far * near / (near - far); + out[15] = 0; + return out; + } + /** + * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoNO(out, left, right, bottom, top, near, far) { + const lr = 1 / (left - right); + const bt = 1 / (bottom - top); + const nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; + } + /** + * Alias for {@link Mat4.orthoNO} + * @category Static + * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static ortho(out, left, right, bottom, top, near, far) { + return out; + } + /** + * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoZO(out, left, right, bottom, top, near, far) { + const lr = 1 / (left - right); + const bt = 1 / (bottom - top); + const nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = near * nf; + out[15] = 1; + return out; + } + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that + * actually makes an object look at another object, you should use targetTo instead. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param center - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static lookAt(out, eye, center, up) { + const eyex = eye[0]; + const eyey = eye[1]; + const eyez = eye[2]; + const upx = up[0]; + const upy = up[1]; + const upz = up[2]; + const centerx = center[0]; + const centery = center[1]; + const centerz = center[2]; + if (Math.abs(eyex - centerx) < GLM_EPSILON && Math.abs(eyey - centery) < GLM_EPSILON && Math.abs(eyez - centerz) < GLM_EPSILON) { + return _Mat4.identity(out); + } + let z0 = eyex - centerx; + let z1 = eyey - centery; + let z2 = eyez - centerz; + let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + z0 *= len; + z1 *= len; + z2 *= len; + let x0 = upy * z2 - upz * z1; + let x1 = upz * z0 - upx * z2; + let x2 = upx * z1 - upy * z0; + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + if (!len) { + x0 = 0; + x1 = 0; + x2 = 0; + } else { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + let y0 = z1 * x2 - z2 * x1; + let y1 = z2 * x0 - z0 * x2; + let y2 = z0 * x1 - z1 * x0; + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + if (!len) { + y0 = 0; + y1 = 0; + y2 = 0; + } else { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + out[0] = x0; + out[1] = y0; + out[2] = z0; + out[3] = 0; + out[4] = x1; + out[5] = y1; + out[6] = z1; + out[7] = 0; + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); + out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); + out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + return out; + } + /** + * Generates a matrix that makes something look at something else. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param target - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static targetTo(out, eye, target, up) { + const eyex = eye[0]; + const eyey = eye[1]; + const eyez = eye[2]; + const upx = up[0]; + const upy = up[1]; + const upz = up[2]; + let z0 = eyex - target[0]; + let z1 = eyey - target[1]; + let z2 = eyez - target[2]; + let len = z0 * z0 + z1 * z1 + z2 * z2; + if (len > 0) { + len = 1 / Math.sqrt(len); + z0 *= len; + z1 *= len; + z2 *= len; + } + let x0 = upy * z2 - upz * z1; + let x1 = upz * z0 - upx * z2; + let x2 = upx * z1 - upy * z0; + len = x0 * x0 + x1 * x1 + x2 * x2; + if (len > 0) { + len = 1 / Math.sqrt(len); + x0 *= len; + x1 *= len; + x2 *= len; + } + out[0] = x0; + out[1] = x1; + out[2] = x2; + out[3] = 0; + out[4] = z1 * x2 - z2 * x1; + out[5] = z2 * x0 - z0 * x2; + out[6] = z0 * x1 - z1 * x0; + out[7] = 0; + out[8] = z0; + out[9] = z1; + out[10] = z2; + out[11] = 0; + out[12] = eyex; + out[13] = eyey; + out[14] = eyez; + out[15] = 1; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat4} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt( + a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + a[9] * a[9] + a[10] * a[10] + a[11] * a[11] + a[12] * a[12] + a[13] * a[13] + a[14] * a[14] + a[15] * a[15] + ); + } + /** + * Adds two {@link Mat4}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + out[8] = a[8] + b[8]; + out[9] = a[9] + b[9]; + out[10] = a[10] + b[10]; + out[11] = a[11] + b[11]; + out[12] = a[12] + b[12]; + out[13] = a[13] + b[13]; + out[14] = a[14] + b[14]; + out[15] = a[15] + b[15]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + out[6] = a[6] - b[6]; + out[7] = a[7] - b[7]; + out[8] = a[8] - b[8]; + out[9] = a[9] - b[9]; + out[10] = a[10] - b[10]; + out[11] = a[11] - b[11]; + out[12] = a[12] - b[12]; + out[13] = a[13] - b[13]; + out[14] = a[14] - b[14]; + out[15] = a[15] - b[15]; + return out; + } + /** + * Alias for {@link Mat4.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiply each element of the matrix by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + out[8] = a[8] * b; + out[9] = a[9] * b; + out[10] = a[10] * b; + out[11] = a[11] * b; + out[12] = a[12] * b; + out[13] = a[13] * b; + out[14] = a[14] * b; + out[15] = a[15] * b; + return out; + } + /** + * Adds two mat4's after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + out[6] = a[6] + b[6] * scale; + out[7] = a[7] + b[7] * scale; + out[8] = a[8] + b[8] * scale; + out[9] = a[9] + b[9] * scale; + out[10] = a[10] + b[10] * scale; + out[11] = a[11] + b[11] * scale; + out[12] = a[12] + b[12] * scale; + out[13] = a[13] + b[13] * scale; + out[14] = a[14] + b[14] * scale; + out[15] = a[15] + b[15] * scale; + return out; + } + /** + * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15]; + } + /** + * Returns whether two {@link Mat4}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const a8 = a[8]; + const a9 = a[9]; + const a10 = a[10]; + const a11 = a[11]; + const a12 = a[12]; + const a13 = a[13]; + const a14 = a[14]; + const a15 = a[15]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + const b8 = b[8]; + const b9 = b[9]; + const b10 = b[10]; + const b11 = b[11]; + const b12 = b[12]; + const b13 = b[13]; + const b14 = b[14]; + const b15 = b[15]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15)); + } + /** + * Returns a string representation of a {@link Mat4} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat4(${a.join(", ")})`; + } +}; +_IDENTITY_4X4 = new WeakMap(); +_TMP_VEC3 = new WeakMap(); +__privateAdd(_Mat4, _IDENTITY_4X4, new Float32Array([ + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 +])); +/** + * Temporary variable to prevent repeated allocations in the algorithms within Mat4. + * These are declared as TypedArrays to aid in tree-shaking. + */ +__privateAdd(_Mat4, _TMP_VEC3, new Float32Array(3)); +var Mat4 = _Mat4; +Mat4.prototype.mul = Mat4.prototype.multiply; +Mat4.sub = Mat4.subtract; +Mat4.mul = Mat4.multiply; +Mat4.frustum = Mat4.frustumNO; +Mat4.perspective = Mat4.perspectiveNO; +Mat4.ortho = Mat4.orthoNO; + +// src/_lib/f32/Vec3.ts +var Vec3 = class _Vec3 extends Float32Array { + /** + * Create a {@link Vec3}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 3: + super(values); + break; + case 2: + super(values[0], values[1], 3); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v]); + } else { + super(v, 0, 3); + } + break; + } + default: + super(3); + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z() { + return this[2]; + } + set z(value) { + this[2] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r() { + return this[0]; + } + set r(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g() { + return this[1]; + } + set g(value) { + this[1] = value; + } + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b() { + return this[2]; + } + set b(value) { + this[2] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec3.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec3.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag() { + return this.squaredMagnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec3.str(this);` + * + * @category Accessors + */ + get str() { + return _Vec3.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Adds a {@link Vec3} to `this`. + * Equivalent to `Vec3.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b) { + this[0] += b[0]; + this[1] += b[1]; + this[2] += b[2]; + return this; + } + /** + * Subtracts a {@link Vec3} from `this`. + * Equivalent to `Vec3.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + this[2] -= b[2]; + return this; + } + /** + * Alias for {@link Vec3.subtract} + * @category Methods + */ + sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec3}. + * Equivalent to `Vec3.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + this[2] *= b[2]; + return this; + } + /** + * Alias for {@link Vec3.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec3}. + * Equivalent to `Vec3.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + this[2] /= b[2]; + return this; + } + /** + * Alias for {@link Vec3.divide} + * @category Methods + */ + div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec3.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b) { + this[0] *= b; + this[1] *= b; + this[2] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + this[2] += b[2] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b) { + return _Vec3.distance(this, b); + } + /** + * Alias for {@link Vec3.distance} + * @category Methods + */ + dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b) { + return _Vec3.squaredDistance(this, b); + } + /** + * Alias for {@link Vec3.squaredDistance} + * @category Methods + */ + sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec3.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate() { + this[0] *= -1; + this[1] *= -1; + this[2] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec3.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + this[2] = 1 / this[2]; + return this; + } + /** + * Sets each component of `this` to its absolute value. + * Equivalent to `Vec3.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + this[2] = Math.abs(this[2]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec3}. + * Equivalent to `Vec3.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b) { + return this[0] * b[0] + this[1] * b[1] + this[2] * b[2]; + } + /** + * Normalize `this`. + * Equivalent to `Vec3.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize() { + return _Vec3.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec3}. + */ + static get BYTE_LENGTH() { + return 3 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty vec3 + * @category Static + * + * @returns a new 3D vector + */ + static create() { + return new _Vec3(); + } + /** + * Creates a new vec3 initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 3D vector + */ + static clone(a) { + return new _Vec3(a); + } + /** + * Calculates the magnitude (length) of a {@link Vec3} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Creates a new vec3 initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns a new 3D vector + */ + static fromValues(x, y, z) { + return new _Vec3(x, y, z); + } + /** + * Copy the values from one vec3 to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + return out; + } + /** + * Set the components of a vec3 to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns `out` + */ + static set(out, x, y, z) { + out[0] = x; + out[1] = y; + out[2] = z; + return out; + } + /** + * Adds two {@link Vec3}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + return out; + } + /** + * Alias for {@link Vec3.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return [0, 0, 0]; + } + /** + * Multiplies two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + return out; + } + /** + * Alias for {@link Vec3.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return [0, 0, 0]; + } + /** + * Divides two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + out[2] = a[2] / b[2]; + return out; + } + /** + * Alias for {@link Vec3.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out, a, b) { + return [0, 0, 0]; + } + /** + * Math.ceil the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + out[2] = Math.ceil(a[2]); + return out; + } + /** + * Math.floor the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + out[2] = Math.floor(a[2]); + return out; + } + /** + * Returns the minimum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + return out; + } + /** + * Returns the maximum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + return out; + } + /** + * symmetric round the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + /* + static round(out: Vec3Like, a: Readonly): Vec3Like { + out[0] = glMatrix.round(a[0]); + out[1] = glMatrix.round(a[1]); + out[2] = glMatrix.round(a[2]); + return out; + }*/ + /** + * Scales a vec3 by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out, a, scale) { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + return out; + } + /** + * Adds two vec3's after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredDistance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a, b) { + return 0; + } + /** + * Calculates the squared length of a vec3 + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredLength} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrLen(a, b) { + return 0; + } + /** + * Negates the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + return out; + } + /** + * Returns the inverse of the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + out[2] = 1 / a[2]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec3} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + out[2] = Math.abs(a[2]); + return out; + } + /** + * Normalize a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out, a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + let len = x * x + y * y + z * z; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + out[2] = a[2] * len; + return out; + } + /** + * Calculates the dot product of two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; + } + /** + * Computes the cross product of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static cross(out, a, b) { + const ax = a[0], ay = a[1], az = a[2]; + const bx = b[0], by = b[1], bz = b[2]; + out[0] = ay * bz - az * by; + out[1] = az * bx - ax * bz; + out[2] = ax * by - ay * bx; + return out; + } + /** + * Performs a linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + return out; + } + /** + * Performs a spherical linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out, a, b, t) { + const angle = Math.acos(Math.min(Math.max(_Vec3.dot(a, b), -1), 1)); + const sinTotal = Math.sin(angle); + const ratioA = Math.sin((1 - t) * angle) / sinTotal; + const ratioB = Math.sin(t * angle) / sinTotal; + out[0] = ratioA * a[0] + ratioB * b[0]; + out[1] = ratioA * a[1] + ratioB * b[1]; + out[2] = ratioA * a[2] + ratioB * b[2]; + return out; + } + /** + * Performs a hermite interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static hermite(out, a, b, c, d, t) { + const factorTimes2 = t * t; + const factor1 = factorTimes2 * (2 * t - 3) + 1; + const factor2 = factorTimes2 * (t - 2) + t; + const factor3 = factorTimes2 * (t - 1); + const factor4 = factorTimes2 * (3 - 2 * t); + out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; + out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; + out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; + return out; + } + /** + * Performs a bezier interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static bezier(out, a, b, c, d, t) { + const inverseFactor = 1 - t; + const inverseFactorTimesTwo = inverseFactor * inverseFactor; + const factorTimes2 = t * t; + const factor1 = inverseFactorTimesTwo * inverseFactor; + const factor2 = 3 * t * inverseFactorTimesTwo; + const factor3 = 3 * factorTimes2 * inverseFactor; + const factor4 = factorTimes2 * t; + out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; + out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; + out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; + return out; + } + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned + * @returns `out` + */ + /* + static random(out: Vec3Like, scale) { + scale = scale === undefined ? 1.0 : scale; + + let r = glMatrix.RANDOM() * 2.0 * Math.PI; + let z = glMatrix.RANDOM() * 2.0 - 1.0; + let zScale = Math.sqrt(1.0 - z * z) * scale; + + out[0] = Math.cos(r) * zScale; + out[1] = Math.sin(r) * zScale; + out[2] = z * scale; + return out; + }*/ + /** + * Transforms the vec3 with a mat4. + * 4th vector component is implicitly '1' + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out, a, m) { + const x = a[0], y = a[1], z = a[2]; + const w = m[3] * x + m[7] * y + m[11] * z + m[15] || 1; + out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; + out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; + out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; + return out; + } + /** + * Transforms the vec3 with a mat3. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - the 3x3 matrix to transform with + * @returns `out` + */ + static transformMat3(out, a, m) { + const x = a[0], y = a[1], z = a[2]; + out[0] = x * m[0] + y * m[3] + z * m[6]; + out[1] = x * m[1] + y * m[4] + z * m[7]; + out[2] = x * m[2] + y * m[5] + z * m[8]; + return out; + } + /** + * Transforms the vec3 with a quat + * Can also be used for dual quaternions. (Multiply it with the real part) + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out, a, q) { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const w2 = q[3] * 2; + const x = a[0]; + const y = a[1]; + const z = a[2]; + const uvx = qy * z - qz * y; + const uvy = qz * x - qx * z; + const uvz = qx * y - qy * x; + const uuvx = (qy * uvz - qz * uvy) * 2; + const uuvy = (qz * uvx - qx * uvz) * 2; + const uuvz = (qx * uvy - qy * uvx) * 2; + out[0] = x + uvx * w2 + uuvx; + out[1] = y + uvy * w2 + uuvy; + out[2] = z + uvz * w2 + uuvz; + return out; + } + /** + * Rotate a 3D vector around the x-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateX(out, a, b, rad) { + const by = b[1]; + const bz = b[2]; + const py = a[1] - by; + const pz = a[2] - bz; + out[0] = a[0]; + out[1] = py * Math.cos(rad) - pz * Math.sin(rad) + by; + out[2] = py * Math.sin(rad) + pz * Math.cos(rad) + bz; + return out; + } + /** + * Rotate a 3D vector around the y-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateY(out, a, b, rad) { + const bx = b[0]; + const bz = b[2]; + const px = a[0] - bx; + const pz = a[2] - bz; + out[0] = pz * Math.sin(rad) + px * Math.cos(rad) + bx; + out[1] = a[1]; + out[2] = pz * Math.cos(rad) - px * Math.sin(rad) + bz; + return out; + } + /** + * Rotate a 3D vector around the z-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateZ(out, a, b, rad) { + const bx = b[0]; + const by = b[1]; + const px = a[0] - bx; + const py = a[1] - by; + out[0] = px * Math.cos(rad) - py * Math.sin(rad) + bx; + out[1] = px * Math.sin(rad) + py * Math.cos(rad) + by; + out[2] = b[2]; + return out; + } + /** + * Get the angle between two 3D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static 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 mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz)); + const cosine = mag && _Vec3.dot(a, b) / mag; + return Math.acos(Math.min(Math.max(cosine, -1), 1)); + } + /** + * Set the components of a vec3 to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + return out; + } + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Vec3(${a.join(", ")})`; + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)); + } +}; +Vec3.prototype.sub = Vec3.prototype.subtract; +Vec3.prototype.mul = Vec3.prototype.multiply; +Vec3.prototype.div = Vec3.prototype.divide; +Vec3.prototype.dist = Vec3.prototype.distance; +Vec3.prototype.sqrDist = Vec3.prototype.squaredDistance; +Vec3.sub = Vec3.subtract; +Vec3.mul = Vec3.multiply; +Vec3.div = Vec3.divide; +Vec3.dist = Vec3.distance; +Vec3.sqrDist = Vec3.squaredDistance; +Vec3.sqrLen = Vec3.squaredLength; +Vec3.mag = Vec3.magnitude; +Vec3.length = Vec3.magnitude; +Vec3.len = Vec3.magnitude; + +// src/_lib/f32/Vec4.ts +var Vec4 = class _Vec4 extends Float32Array { + /** + * Create a {@link Vec4}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 4: + super(values); + break; + case 2: + super(values[0], values[1], 4); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v, v]); + } else { + super(v, 0, 4); + } + break; + } + default: + super(4); + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z() { + return this[2]; + } + set z(value) { + this[2] = value; + } + /** + * The w component of the vector. Equivalent to `this[3];` + * @category Vector Components + */ + get w() { + return this[3]; + } + set w(value) { + this[3] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r() { + return this[0]; + } + set r(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g() { + return this[1]; + } + set g(value) { + this[1] = value; + } + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b() { + return this[2]; + } + set b(value) { + this[2] = value; + } + /** + * The a component of the vector. Equivalent to `this[3];` + * @category Color Components + */ + get a() { + return this[3]; + } + set a(value) { + this[3] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec4.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + const w = this[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Vec4.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec4.str(this);` + * + * @category Accessors + */ + get str() { + return _Vec4.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + super.set(a); + return this; + } + /** + * Adds a {@link Vec4} to `this`. + * Equivalent to `Vec4.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b) { + this[0] += b[0]; + this[1] += b[1]; + this[2] += b[2]; + this[3] += b[3]; + return this; + } + /** + * Subtracts a {@link Vec4} from `this`. + * Equivalent to `Vec4.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + this[2] -= b[2]; + this[3] -= b[3]; + return this; + } + /** + * Alias for {@link Vec4.subtract} + * @category Methods + */ + sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec4}. + * Equivalent to `Vec4.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + this[2] *= b[2]; + this[3] *= b[3]; + return this; + } + /** + * Alias for {@link Vec4.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec4}. + * Equivalent to `Vec4.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + this[2] /= b[2]; + this[3] /= b[3]; + return this; + } + /** + * Alias for {@link Vec4.divide} + * @category Methods + */ + div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec4.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b) { + this[0] *= b; + this[1] *= b; + this[2] *= b; + this[3] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + this[2] += b[2] * scale; + this[3] += b[3] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b) { + return _Vec4.distance(this, b); + } + /** + * Alias for {@link Vec4.distance} + * @category Methods + */ + dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b) { + return _Vec4.squaredDistance(this, b); + } + /** + * Alias for {@link Vec4.squaredDistance} + * @category Methods + */ + sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec4.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate() { + this[0] *= -1; + this[1] *= -1; + this[2] *= -1; + this[3] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec4.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + this[2] = 1 / this[2]; + this[3] = 1 / this[3]; + return this; + } + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec4.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + this[2] = Math.abs(this[2]); + this[3] = Math.abs(this[3]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec4}. + * Equivalent to `Vec4.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b) { + return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3]; + } + /** + * Normalize `this`. + * Equivalent to `Vec4.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize() { + return _Vec4.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec4}. + */ + static get BYTE_LENGTH() { + return 4 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty {@link Vec4} + * @category Static + * + * @returns a new 4D vector + */ + static create() { + return new _Vec4(); + } + /** + * Creates a new {@link Vec4} initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 4D vector + */ + static clone(a) { + return new _Vec4(a); + } + /** + * Creates a new {@link Vec4} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new 4D vector + */ + static fromValues(x, y, z, w) { + return new _Vec4(x, y, z, w); + } + /** + * Copy the values from one {@link Vec4} to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Vec4} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + static set(out, x, y, z, w) { + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = w; + return out; + } + /** + * Adds two {@link Vec4}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + return out; + } + /** + * Alias for {@link Vec4.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + out[3] = a[3] * b[3]; + return out; + } + /** + * Alias for {@link Vec4.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Divides two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + out[2] = a[2] / b[2]; + out[3] = a[3] / b[3]; + return out; + } + /** + * Alias for {@link Vec4.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out, a, b) { + return out; + } + /** + * Math.ceil the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + out[2] = Math.ceil(a[2]); + out[3] = Math.ceil(a[3]); + return out; + } + /** + * Math.floor the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + out[2] = Math.floor(a[2]); + out[3] = Math.floor(a[3]); + return out; + } + /** + * Returns the minimum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + out[3] = Math.min(a[3], b[3]); + return out; + } + /** + * Returns the maximum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + out[3] = Math.max(a[3], b[3]); + return out; + } + /** + * Math.round the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + static round(out, a) { + out[0] = Math.round(a[0]); + out[1] = Math.round(a[1]); + out[2] = Math.round(a[2]); + out[3] = Math.round(a[3]); + return out; + } + /** + * Scales a {@link Vec4} by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out, a, scale) { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + out[3] = a[3] * scale; + return out; + } + /** + * Adds two {@link Vec4}'s after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + const w = b[3] - a[3]; + return Math.hypot(x, y, z, w); + } + /** + * Alias for {@link Vec4.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + const w = b[3] - a[3]; + return x * x + y * y + z * z + w * w; + } + /** + * Alias for {@link Vec4.squaredDistance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a, b) { + return 0; + } + /** + * Calculates the magnitude (length) of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate length of + * @returns length of `a` + */ + static magnitude(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Vec4.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + return x * x + y * y + z * z + w * w; + } + /** + * Alias for {@link Vec4.squaredLength} + * @category Static + */ + static sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = -a[3]; + return out; + } + /** + * Returns the inverse of the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + out[2] = 1 / a[2]; + out[3] = 1 / a[3]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec4} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + out[2] = Math.abs(a[2]); + out[3] = Math.abs(a[3]); + return out; + } + /** + * Normalize a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out, a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + let len = x * x + y * y + z * z + w * w; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = x * len; + out[1] = y * len; + out[2] = z * len; + out[3] = w * len; + return out; + } + /** + * Calculates the dot product of two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + /** + * Returns the cross-product of three vectors in a 4-dimensional space + * @category Static + * + * @param out the receiving vector + * @param u - the first vector + * @param v - the second vector + * @param w - the third vector + * @returns result + */ + static cross(out, u, v, w) { + const a = v[0] * w[1] - v[1] * w[0]; + const b = v[0] * w[2] - v[2] * w[0]; + const c = v[0] * w[3] - v[3] * w[0]; + const d = v[1] * w[2] - v[2] * w[1]; + const e = v[1] * w[3] - v[3] * w[1]; + const f = v[2] * w[3] - v[3] * w[2]; + const g = u[0]; + const h = u[1]; + const i = u[2]; + const j = u[3]; + out[0] = h * f - i * e + j * d; + out[1] = -(g * f) + i * c - j * b; + out[2] = g * e - h * c + j * a; + out[3] = -(g * d) + h * b - i * a; + return out; + } + /** + * Performs a linear interpolation between two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + out[3] = aw + t * (b[3] - aw); + return out; + } + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns `out` + */ + /* + static random(out: Vec4Like, scale): Vec4Like { + scale = scale || 1.0; + + // Marsaglia, George. Choosing a Point from the Surface of a + // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646. + // http://projecteuclid.org/euclid.aoms/1177692644; + var v1, v2, v3, v4; + var s1, s2; + do { + v1 = glMatrix.RANDOM() * 2 - 1; + v2 = glMatrix.RANDOM() * 2 - 1; + s1 = v1 * v1 + v2 * v2; + } while (s1 >= 1); + do { + v3 = glMatrix.RANDOM() * 2 - 1; + v4 = glMatrix.RANDOM() * 2 - 1; + s2 = v3 * v3 + v4 * v4; + } while (s2 >= 1); + + var d = Math.sqrt((1 - s1) / s2); + out[0] = scale * v1; + out[1] = scale * v2; + out[2] = scale * v3 * d; + out[3] = scale * v4 * d; + return out; + }*/ + /** + * Transforms the {@link Vec4} with a {@link Mat4}. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out, a, m) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; + out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; + out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; + out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; + return out; + } + /** + * Transforms the {@link Vec4} with a {@link Quat} + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out, a, q) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + const ix = qw * x + qy * z - qz * y; + const iy = qw * y + qz * x - qx * z; + const iz = qw * z + qx * y - qy * x; + const iw = -qx * x - qy * y - qz * z; + out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy; + out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz; + out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Vec4} to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 0; + return out; + } + /** + * Returns a string representation of a {@link Vec4} + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Vec4(${a.join(", ")})`; + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)); + } +}; +Vec4.prototype.sub = Vec4.prototype.subtract; +Vec4.prototype.mul = Vec4.prototype.multiply; +Vec4.prototype.div = Vec4.prototype.divide; +Vec4.prototype.dist = Vec4.prototype.distance; +Vec4.prototype.sqrDist = Vec4.prototype.squaredDistance; +Vec4.sub = Vec4.subtract; +Vec4.mul = Vec4.multiply; +Vec4.div = Vec4.divide; +Vec4.dist = Vec4.distance; +Vec4.sqrDist = Vec4.squaredDistance; +Vec4.sqrLen = Vec4.squaredLength; +Vec4.mag = Vec4.magnitude; +Vec4.length = Vec4.magnitude; +Vec4.len = Vec4.magnitude; + +// src/_lib/f32/Quat.ts +var _DEFAULT_ANGLE_ORDER, _TMP_QUAT1, _TMP_QUAT2, _TMP_MAT3, _TMP_VEC32, _X_UNIT_VEC3, _Y_UNIT_VEC3; +var _Quat = class _Quat extends Float32Array { + /** + * Create a {@link Quat}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 4: + super(values); + break; + case 2: + super(values[0], values[1], 4); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v, v]); + } else { + super(v, 0, 4); + } + break; + } + default: + super(4); + this[3] = 1; + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the quaternion. Equivalent to `this[0];` + * @category Quaternion Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the quaternion. Equivalent to `this[1];` + * @category Quaternion Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + /** + * The z component of the quaternion. Equivalent to `this[2];` + * @category Quaternion Components + */ + get z() { + return this[2]; + } + set z(value) { + this[2] = value; + } + /** + * The w component of the quaternion. Equivalent to `this[3];` + * @category Quaternion Components + */ + get w() { + return this[3]; + } + set w(value) { + this[3] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Quat.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + const w = this[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Quat.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * A string representation of `this` + * Equivalent to `Quat.str(this);` + * + * @category Accessors + */ + get str() { + return _Quat.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Quat} into `this`. + * @category Methods + * + * @param a the source quaternion + * @returns `this` + */ + copy(a) { + super.set(a); + return this; + } + /** + * Set `this` to the identity quaternion + * Equivalent to Quat.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this[0] = 0; + this[1] = 0; + this[2] = 0; + this[3] = 1; + return this; + } + /** + * Multiplies `this` by a {@link Quat}. + * Equivalent to `Quat.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + return _Quat.multiply(this, this, b); + } + /** + * Alias for {@link Quat.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Rotates `this` by the given angle about the X axis + * Equivalent to `Quat.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateX(rad) { + return _Quat.rotateX(this, this, rad); + } + /** + * Rotates `this` by the given angle about the Y axis + * Equivalent to `Quat.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateY(rad) { + return _Quat.rotateY(this, this, rad); + } + /** + * Rotates `this` by the given angle about the Z axis + * Equivalent to `Quat.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateZ(rad) { + return _Quat.rotateZ(this, this, rad); + } + /** + * Inverts `this` + * Equivalent to `Quat.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + return _Quat.invert(this, this); + } + /** + * Scales `this` by a scalar number + * Equivalent to `Quat.scale(this, this, scale);` + * @category Methods + * + * @param scale - amount to scale the vector by + * @returns `this` + */ + scale(scale) { + this[0] *= scale; + this[1] *= scale; + this[2] *= scale; + this[3] *= scale; + return this; + } + /** + * Calculates the dot product of `this` and another {@link Quat} + * Equivalent to `Quat.dot(this, b);` + * @category Methods + * + * @param b - the second operand + * @returns dot product of `this` and b + */ + dot(b) { + return _Quat.dot(this, b); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat}. + */ + static get BYTE_LENGTH() { + return 4 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new identity quat + * @category Static + * + * @returns a new quaternion + */ + static create() { + return new _Quat(); + } + /** + * Set a quat to the identity quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + static identity(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * @category Static + * + * @param out - the receiving quaternion + * @param axis - the axis around which to rotate + * @param rad - the angle in radians + * @returns `out` + **/ + static setAxisAngle(out, axis, rad) { + rad *= 0.5; + const s = Math.sin(rad); + out[0] = s * axis[0]; + out[1] = s * axis[1]; + out[2] = s * axis[2]; + out[3] = Math.cos(rad); + return out; + } + /** + * Gets the rotation axis and angle for a given + * quaternion. If a quaternion is created with + * setAxisAngle, this method will return the same + * values as provided in the original parameter list + * OR functionally equivalent values. + * Example: The quaternion formed by axis [0, 0, 1] and + * angle -90 is the same as the quaternion formed by + * [0, 0, 1] and 270. This method favors the latter. + * @category Static + * + * @param out_axis - Vector receiving the axis of rotation + * @param q - Quaternion to be decomposed + * @return Angle, in radians, of the rotation + */ + static getAxisAngle(out_axis, q) { + const rad = Math.acos(q[3]) * 2; + const s = Math.sin(rad / 2); + if (s > GLM_EPSILON) { + out_axis[0] = q[0] / s; + out_axis[1] = q[1] / s; + out_axis[2] = q[2] / s; + } else { + out_axis[0] = 1; + out_axis[1] = 0; + out_axis[2] = 0; + } + return rad; + } + /** + * Gets the angular distance between two unit quaternions + * @category Static + * + * @param {ReadonlyQuat} a Origin unit quaternion + * @param {ReadonlyQuat} b Destination unit quaternion + * @return {Number} Angle, in radians, between the two quaternions + */ + static getAngle(a, b) { + const dotproduct = _Quat.dot(a, b); + return Math.acos(2 * dotproduct * dotproduct - 1); + } + /** + * Multiplies two quaternions. + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out, a, b) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bx = b[0]; + const by = b[1]; + const bz = b[2]; + const bw = b[3]; + out[0] = ax * bw + aw * bx + ay * bz - az * by; + out[1] = ay * bw + aw * by + az * bx - ax * bz; + out[2] = az * bw + aw * bz + ax * by - ay * bx; + out[3] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + /** + * Rotates a quaternion by the given angle about the X axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out, a, rad) { + rad *= 0.5; + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bx = Math.sin(rad); + const bw = Math.cos(rad); + out[0] = ax * bw + aw * bx; + out[1] = ay * bw + az * bx; + out[2] = az * bw - ay * bx; + out[3] = aw * bw - ax * bx; + return out; + } + /** + * Rotates a quaternion by the given angle about the Y axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out, a, rad) { + rad *= 0.5; + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const by = Math.sin(rad); + const bw = Math.cos(rad); + out[0] = ax * bw - az * by; + out[1] = ay * bw + aw * by; + out[2] = az * bw + ax * by; + out[3] = aw * bw - ay * by; + return out; + } + /** + * Rotates a quaternion by the given angle about the Z axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out, a, rad) { + rad *= 0.5; + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bz = Math.sin(rad); + const bw = Math.cos(rad); + out[0] = ax * bw + ay * bz; + out[1] = ay * bw - ax * bz; + out[2] = az * bw + aw * bz; + out[3] = aw * bw - az * bz; + return out; + } + /** + * Calculates the W component of a quat from the X, Y, and Z components. + * Assumes that quaternion is 1 unit in length. + * Any existing W component will be ignored. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate W component of + * @returns `out` + */ + static calculateW(out, a) { + const x = a[0], y = a[1], z = a[2]; + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = Math.sqrt(Math.abs(1 - x * x - y * y - z * z)); + return out; + } + /** + * Calculate the exponential of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static exp(out, a) { + const x = a[0], y = a[1], z = a[2], w = a[3]; + const r = Math.sqrt(x * x + y * y + z * z); + const et = Math.exp(w); + const s = r > 0 ? et * Math.sin(r) / r : 0; + out[0] = x * s; + out[1] = y * s; + out[2] = z * s; + out[3] = et * Math.cos(r); + return out; + } + /** + * Calculate the natural logarithm of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static ln(out, a) { + const x = a[0], y = a[1], z = a[2], w = a[3]; + const r = Math.sqrt(x * x + y * y + z * z); + const t = r > 0 ? Math.atan2(r, w) / r : 0; + out[0] = x * t; + out[1] = y * t; + out[2] = z * t; + out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w); + return out; + } + /** + * Calculate the scalar power of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @param b - amount to scale the quaternion by + * @returns `out` + */ + static pow(out, a, b) { + _Quat.ln(out, a); + _Quat.scale(out, out, b); + _Quat.exp(out, out); + return out; + } + /** + * Performs a spherical linear interpolation between two quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out, a, b, t) { + const ax = a[0], ay = a[1], az = a[2], aw = a[3]; + let bx = b[0], by = b[1], bz = b[2], bw = b[3]; + let scale0; + let scale1; + let cosom = ax * bx + ay * by + az * bz + aw * bw; + if (cosom < 0) { + cosom = -cosom; + bx = -bx; + by = -by; + bz = -bz; + bw = -bw; + } + if (1 - cosom > GLM_EPSILON) { + const omega = Math.acos(cosom); + const sinom = Math.sin(omega); + scale0 = Math.sin((1 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; + } else { + scale0 = 1 - t; + scale1 = t; + } + out[0] = scale0 * ax + scale1 * bx; + out[1] = scale0 * ay + scale1 * by; + out[2] = scale0 * az + scale1 * bz; + out[3] = scale0 * aw + scale1 * bw; + return out; + } + /** + * Generates a random unit quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + /* static random(out: QuatLike): QuatLike { + // Implementation of http://planning.cs.uiuc.edu/node198.html + // TODO: Calling random 3 times is probably not the fastest solution + let u1 = glMatrix.RANDOM(); + let u2 = glMatrix.RANDOM(); + let u3 = glMatrix.RANDOM(); + + let sqrt1MinusU1 = Math.sqrt(1 - u1); + let sqrtU1 = Math.sqrt(u1); + + out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2); + out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2); + out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3); + out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3); + return out; + }*/ + /** + * Calculates the inverse of a quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate inverse of + * @returns `out` + */ + static invert(out, a) { + const a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; + const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; + const invDot = dot ? 1 / dot : 0; + out[0] = -a0 * invDot; + out[1] = -a1 * invDot; + out[2] = -a2 * invDot; + out[3] = a3 * invDot; + return out; + } + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate conjugate of + * @returns `out` + */ + static conjugate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + return out; + } + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to re-normalize the quaternion yourself where necessary. + * @category Static + * + * @param out - the receiving quaternion + * @param m - rotation matrix + * @returns `out` + */ + static fromMat3(out, m) { + const fTrace = m[0] + m[4] + m[8]; + let fRoot; + if (fTrace > 0) { + fRoot = Math.sqrt(fTrace + 1); + out[3] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[0] = (m[5] - m[7]) * fRoot; + out[1] = (m[6] - m[2]) * fRoot; + out[2] = (m[1] - m[3]) * fRoot; + } else { + let i = 0; + if (m[4] > m[0]) { + i = 1; + } + if (m[8] > m[i * 3 + i]) { + i = 2; + } + const j = (i + 1) % 3; + const k = (i + 2) % 3; + fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1); + out[i] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot; + out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; + out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + } + return out; + } + /** + * Creates a quaternion from the given euler angle x, y, z. + * @category Static + * + * @param out - the receiving quaternion + * @param x - Angle to rotate around X axis in degrees. + * @param y - Angle to rotate around Y axis in degrees. + * @param z - Angle to rotate around Z axis in degrees. + * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx. + * @returns `out` + */ + static fromEuler(out, x, y, z, order = __privateGet(_Quat, _DEFAULT_ANGLE_ORDER)) { + const halfToRad = 0.5 * Math.PI / 180; + x *= halfToRad; + y *= halfToRad; + z *= halfToRad; + const sx = Math.sin(x); + const cx = Math.cos(x); + const sy = Math.sin(y); + const cy = Math.cos(y); + const sz = Math.sin(z); + const cz = Math.cos(z); + switch (order) { + case "xyz": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "xzy": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + case "yxz": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + case "yzx": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "zxy": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "zyx": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + default: + throw new Error(`Unknown angle order ${order}`); + } + return out; + } + /** + * Returns a string representation of a quatenion + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Quat(${a.join(", ")})`; + } + /** + * Creates a new quat initialized with values from an existing quaternion + * @category Static + * + * @param a - quaternion to clone + * @returns a new quaternion + */ + static clone(a) { + return new _Quat(a); + } + /** + * Creates a new quat initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new quaternion + */ + static fromValues(x, y, z, w) { + return new _Quat(x, y, z, w); + } + /** + * Copy the values from one quat to another + * @category Static + * + * @param out - the receiving quaternion + * @param a - the source quaternion + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Quat} to the given values + * @category Static + * + * @param out - the receiving quaternion + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static set(out, x, y, z, w) { + return out; + } + /** + * Adds two {@link Quat}'s + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static add(out, a, b) { + return out; + } + /** + * Alias for {@link Quat.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Scales a quat by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param b - amount to scale the vector by + * @returns `out` + */ + static scale(out, a, scale) { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + out[3] = a[3] * scale; + return out; + } + /** + * Calculates the dot product of two quat's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + /** + * Performs a linear interpolation between two quat's + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static lerp(out, a, b, t) { + return out; + } + /** + * Calculates the magnitude (length) of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate length of + * @returns length of `a` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static magnitude(a) { + return 0; + } + /** + * Alias for {@link Quat.magnitude} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mag(a) { + return 0; + } + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate squared length of + * @returns squared length of a + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static squaredLength(a) { + return 0; + } + /** + * Alias for {@link Quat.squaredLength} + * @category Static + */ + static sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Normalize a {@link Quat} + * @category Static + * + * @param out - the receiving quaternion + * @param a - quaternion to normalize + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static normalize(out, a) { + return out; + } + /** + * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first quaternion. + * @param b - The second quaternion. + * @returns True if the vectors are equal, false otherwise. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static exactEquals(a, b) { + return false; + } + /** + * Returns whether the quaternions have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static equals(a, b) { + return false; + } + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * @category Static + * + * @param out - the receiving quaternion. + * @param a - the initial vector + * @param b - the destination vector + * @returns `out` + */ + static rotationTo(out, a, b) { + const dot = Vec3.dot(a, b); + if (dot < -0.999999) { + Vec3.cross(__privateGet(_Quat, _TMP_VEC32), __privateGet(_Quat, _X_UNIT_VEC3), a); + if (Vec3.mag(__privateGet(_Quat, _TMP_VEC32)) < 1e-6) { + Vec3.cross(__privateGet(_Quat, _TMP_VEC32), __privateGet(_Quat, _Y_UNIT_VEC3), a); + } + Vec3.normalize(__privateGet(_Quat, _TMP_VEC32), __privateGet(_Quat, _TMP_VEC32)); + _Quat.setAxisAngle(out, __privateGet(_Quat, _TMP_VEC32), Math.PI); + return out; + } else if (dot > 0.999999) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } else { + Vec3.cross(__privateGet(_Quat, _TMP_VEC32), a, b); + out[0] = __privateGet(_Quat, _TMP_VEC32)[0]; + out[1] = __privateGet(_Quat, _TMP_VEC32)[1]; + out[2] = __privateGet(_Quat, _TMP_VEC32)[2]; + out[3] = 1 + dot; + return _Quat.normalize(out, out); + } + } + /** + * Performs a spherical linear interpolation with two control points + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static sqlerp(out, a, b, c, d, t) { + _Quat.slerp(__privateGet(_Quat, _TMP_QUAT1), a, d, t); + _Quat.slerp(__privateGet(_Quat, _TMP_QUAT2), b, c, t); + _Quat.slerp(out, __privateGet(_Quat, _TMP_QUAT1), __privateGet(_Quat, _TMP_QUAT2), 2 * t * (1 - t)); + return out; + } + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * @category Static + * + * @param out - The receiving quaternion + * @param view - the vector representing the viewing direction + * @param right - the vector representing the local `right` direction + * @param up - the vector representing the local `up` direction + * @returns `out` + */ + static setAxes(out, view, right, up) { + __privateGet(_Quat, _TMP_MAT3)[0] = right[0]; + __privateGet(_Quat, _TMP_MAT3)[3] = right[1]; + __privateGet(_Quat, _TMP_MAT3)[6] = right[2]; + __privateGet(_Quat, _TMP_MAT3)[1] = up[0]; + __privateGet(_Quat, _TMP_MAT3)[4] = up[1]; + __privateGet(_Quat, _TMP_MAT3)[7] = up[2]; + __privateGet(_Quat, _TMP_MAT3)[2] = -view[0]; + __privateGet(_Quat, _TMP_MAT3)[5] = -view[1]; + __privateGet(_Quat, _TMP_MAT3)[8] = -view[2]; + return _Quat.normalize(out, _Quat.fromMat3(out, __privateGet(_Quat, _TMP_MAT3))); + } +}; +_DEFAULT_ANGLE_ORDER = new WeakMap(); +_TMP_QUAT1 = new WeakMap(); +_TMP_QUAT2 = new WeakMap(); +_TMP_MAT3 = new WeakMap(); +_TMP_VEC32 = new WeakMap(); +_X_UNIT_VEC3 = new WeakMap(); +_Y_UNIT_VEC3 = new WeakMap(); +__privateAdd(_Quat, _DEFAULT_ANGLE_ORDER, "zyx"); +// Temporary variables to prevent repeated allocations in the algorithms within Quat. +// These are declared as TypedArrays to aid in tree-shaking. +__privateAdd(_Quat, _TMP_QUAT1, new Float32Array(4)); +__privateAdd(_Quat, _TMP_QUAT2, new Float32Array(4)); +__privateAdd(_Quat, _TMP_MAT3, new Float32Array(9)); +__privateAdd(_Quat, _TMP_VEC32, new Float32Array(3)); +__privateAdd(_Quat, _X_UNIT_VEC3, new Float32Array([1, 0, 0])); +__privateAdd(_Quat, _Y_UNIT_VEC3, new Float32Array([0, 1, 0])); +var Quat = _Quat; +Quat.set = Vec4.set; +Quat.add = Vec4.add; +Quat.lerp = Vec4.lerp; +Quat.normalize = Vec4.normalize; +Quat.squaredLength = Vec4.squaredLength; +Quat.sqrLen = Vec4.squaredLength; +Quat.exactEquals = Vec4.exactEquals; +Quat.equals = Vec4.equals; +Quat.magnitude = Vec4.magnitude; +Quat.prototype.mul = Quat.prototype.multiply; +Quat.mul = Quat.multiply; +Quat.mag = Quat.magnitude; +Quat.length = Quat.magnitude; +Quat.len = Quat.magnitude; + +// src/_lib/f32/Quat2.ts +var _TMP_QUAT, _TMP_VEC33; +var _Quat2 = class _Quat2 extends Float32Array { + /** + * Create a {@link Quat2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 8: + super(values); + break; + case 2: + super(values[0], values[1], 8); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v, v, v, v, v, v]); + } else { + super(v, 0, 8); + } + break; + } + default: + super(8); + this[3] = 1; + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Quat2.str(this);` + * + * @category Accessors + */ + get str() { + return _Quat2.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Quat2} into `this`. + * @category Methods + * + * @param a the source dual quaternion + * @returns `this` + */ + copy(a) { + super.set(a); + return this; + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat2}. + */ + static get BYTE_LENGTH() { + return 8 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new identity {@link Quat2} + * @category Static + * + * @returns a new dual quaternion [real -> rotation, dual -> translation] + */ + static create() { + return new _Quat2(); + } + /** + * Creates a {@link Quat2} quat initialized with values from an existing quaternion + * @category Static + * + * @param a - dual quaternion to clone + * @returns a new dual quaternion + */ + static clone(a) { + return new _Quat2(a); + } + /** + * Creates a new {@link Quat2} initialized with the given values + * @category Static + * + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns a new dual quaternion + */ + static fromValues(x1, y1, z1, w1, x2, y2, z2, w2) { + return new _Quat2(x1, y1, z1, w1, x2, y2, z2, w2); + } + /** + * Creates a new {@link Quat2} from the given values (quat and translation) + * @category Static + * + * @param x1 - X component (rotation) + * @param y1 - Y component (rotation) + * @param z1 - Z component (rotation) + * @param w1 - W component (rotation) + * @param x2 - X component (translation) + * @param y2 - Y component (translation) + * @param z2 - Z component (translation) + * @returns a new dual quaternion + */ + static fromRotationTranslationValues(x1, y1, z1, w1, x2, y2, z2) { + const ax = x2 * 0.5; + const ay = y2 * 0.5; + const az = z2 * 0.5; + return new _Quat2( + x1, + y1, + z1, + w1, + ax * w1 + ay * z1 - az * y1, + ay * w1 + az * x1 - ax * z1, + az * w1 + ax * y1 - ay * x1, + -ax * x1 - ay * y1 - az * z1 + ); + } + /** + * Sets a {@link Quat2} from a quaternion and a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @param t - translation vector + * @returns `out` + */ + static fromRotationTranslation(out, q, t) { + const ax = t[0] * 0.5; + const ay = t[1] * 0.5; + const az = t[2] * 0.5; + const bx = q[0]; + const by = q[1]; + const bz = q[2]; + const bw = q[3]; + out[0] = bx; + out[1] = by; + out[2] = bz; + out[3] = bw; + out[4] = ax * bw + ay * bz - az * by; + out[5] = ay * bw + az * bx - ax * bz; + out[6] = az * bw + ax * by - ay * bx; + out[7] = -ax * bx - ay * by - az * bz; + return out; + } + /** + * Sets a {@link Quat2} from a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param t - translation vector + * @returns `out` + */ + static fromTranslation(out, t) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = t[0] * 0.5; + out[5] = t[1] * 0.5; + out[6] = t[2] * 0.5; + out[7] = 0; + return out; + } + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @returns `out` + */ + static fromRotation(out, q) { + out[0] = q[0]; + out[1] = q[1]; + out[2] = q[2]; + out[3] = q[3]; + out[4] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + return out; + } + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param a - the matrix + * @returns `out` + */ + static fromMat4(out, a) { + Mat4.getRotation(__privateGet(_Quat2, _TMP_QUAT), a); + Mat4.getTranslation(__privateGet(_Quat2, _TMP_VEC33), a); + return _Quat2.fromRotationTranslation(out, __privateGet(_Quat2, _TMP_QUAT), __privateGet(_Quat2, _TMP_VEC33)); + } + /** + * Copy the values from one {@link Quat2} to another + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the source dual quaternion + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + return out; + } + /** + * Set a {@link Quat2} to the identity dual quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @returns `out` + */ + static identity(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + return out; + } + /** + * Set the components of a {@link Quat2} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns `out` + */ + static set(out, x1, y1, z1, w1, x2, y2, z2, w2) { + out[0] = x1; + out[1] = y1; + out[2] = z1; + out[3] = w1; + out[4] = x2; + out[5] = y2; + out[6] = z2; + out[7] = w2; + return out; + } + /** + * Gets the real part of a dual quat + * @category Static + * + * @param out - real part + * @param a - Dual Quaternion + * @return `out` + */ + static getReal(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Gets the dual part of a dual quat + * @category Static + * + * @param out - dual part + * @param a - Dual Quaternion + * @return `out` + */ + static getDual(out, a) { + out[0] = a[4]; + out[1] = a[5]; + out[2] = a[6]; + out[3] = a[7]; + return out; + } + /** + * Set the real component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the real part + * @return `out` + */ + static setReal(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the dual component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the dual part + * @return `out` + */ + static setDual(out, a) { + out[4] = a[0]; + out[5] = a[1]; + out[6] = a[2]; + out[7] = a[3]; + return out; + } + /** + * Gets the translation of a normalized {@link Quat2} + * @category Static + * + * @param out - the receiving translation vector + * @param a - Dual Quaternion to be decomposed + * @return `out` + */ + static getTranslation(out, a) { + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const bx = -a[0]; + const by = -a[1]; + const bz = -a[2]; + const bw = a[3]; + out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; + out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; + out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + return out; + } + /** + * Translates a {@link Quat2} by the given vector + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const ax1 = a[0]; + const ay1 = a[1]; + const az1 = a[2]; + const aw1 = a[3]; + const bx1 = v[0] * 0.5; + const by1 = v[1] * 0.5; + const bz1 = v[2] * 0.5; + const ax2 = a[4]; + const ay2 = a[5]; + const az2 = a[6]; + const aw2 = a[7]; + out[0] = ax1; + out[1] = ay1; + out[2] = az1; + out[3] = aw1; + out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2; + out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2; + out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2; + out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2; + return out; + } + /** + * Rotates a {@link Quat2} around the X axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out, a, rad) { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateX(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} around the Y axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out, a, rad) { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateY(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} around the Z axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out, a, rad) { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateZ(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} by a given quaternion (a * q) + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param q - quaternion to rotate by + * @returns `out` + */ + static rotateByQuatAppend(out, a, q) { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + let ax = a[0]; + let ay = a[1]; + let az = a[2]; + let aw = a[3]; + out[0] = ax * qw + aw * qx + ay * qz - az * qy; + out[1] = ay * qw + aw * qy + az * qx - ax * qz; + out[2] = az * qw + aw * qz + ax * qy - ay * qx; + out[3] = aw * qw - ax * qx - ay * qy - az * qz; + ax = a[4]; + ay = a[5]; + az = a[6]; + aw = a[7]; + out[4] = ax * qw + aw * qx + ay * qz - az * qy; + out[5] = ay * qw + aw * qy + az * qx - ax * qz; + out[6] = az * qw + aw * qz + ax * qy - ay * qx; + out[7] = aw * qw - ax * qx - ay * qy - az * qz; + return out; + } + /** + * Rotates a {@link Quat2} by a given quaternion (q * a) + * @category Static + * + * @param out - the receiving dual quaternion + * @param q - quaternion to rotate by + * @param a - the dual quaternion to rotate + * @returns `out` + */ + static rotateByQuatPrepend(out, q, a) { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + let bx = a[0]; + let by = a[1]; + let bz = a[2]; + let bw = a[3]; + out[0] = qx * bw + qw * bx + qy * bz - qz * by; + out[1] = qy * bw + qw * by + qz * bx - qx * bz; + out[2] = qz * bw + qw * bz + qx * by - qy * bx; + out[3] = qw * bw - qx * bx - qy * by - qz * bz; + bx = a[4]; + by = a[5]; + bz = a[6]; + bw = a[7]; + out[4] = qx * bw + qw * bx + qy * bz - qz * by; + out[5] = qy * bw + qw * by + qz * bx - qx * bz; + out[6] = qz * bw + qw * bz + qx * by - qy * bx; + out[7] = qw * bw - qx * bx - qy * by - qz * bz; + return out; + } + /** + * Rotates a {@link Quat2} around a given axis. Does the normalization automatically + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param axis - the axis to rotate around + * @param rad - how far the rotation should be + * @returns `out` + */ + static rotateAroundAxis(out, a, axis, rad) { + if (Math.abs(rad) < GLM_EPSILON) { + return _Quat2.copy(out, a); + } + const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]); + rad *= 0.5; + const s = Math.sin(rad); + const bx = s * axis[0] / axisLength; + const by = s * axis[1] / axisLength; + const bz = s * axis[2] / axisLength; + const bw = Math.cos(rad); + const ax1 = a[0]; + const ay1 = a[1]; + const az1 = a[2]; + const aw1 = a[3]; + out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + out[4] = ax * bw + aw * bx + ay * bz - az * by; + out[5] = ay * bw + aw * by + az * bx - ax * bz; + out[6] = az * bw + aw * bz + ax * by - ay * bx; + out[7] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + /** + * Adds two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + return out; + } + /** + * Multiplies two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns {quat2} out + */ + static multiply(out, a, b) { + const ax0 = a[0]; + const ay0 = a[1]; + const az0 = a[2]; + const aw0 = a[3]; + const bx1 = b[4]; + const by1 = b[5]; + const bz1 = b[6]; + const bw1 = b[7]; + const ax1 = a[4]; + const ay1 = a[5]; + const az1 = a[6]; + const aw1 = a[7]; + const bx0 = b[0]; + const by0 = b[1]; + const bz0 = b[2]; + const bw0 = b[3]; + out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0; + out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0; + out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0; + out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0; + out[4] = ax0 * bw1 + aw0 * bx1 + ay0 * bz1 - az0 * by1 + ax1 * bw0 + aw1 * bx0 + ay1 * bz0 - az1 * by0; + out[5] = ay0 * bw1 + aw0 * by1 + az0 * bx1 - ax0 * bz1 + ay1 * bw0 + aw1 * by0 + az1 * bx0 - ax1 * bz0; + out[6] = az0 * bw1 + aw0 * bz1 + ax0 * by1 - ay0 * bx1 + az1 * bw0 + aw1 * bz0 + ax1 * by0 - ay1 * bx0; + out[7] = aw0 * bw1 - ax0 * bx1 - ay0 * by1 - az0 * bz1 + aw1 * bw0 - ax1 * bx0 - ay1 * by0 - az1 * bz0; + return out; + } + /** + * Alias for {@link Quat2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Scales a {@link Quat2} by a scalar value + * @category Static + * + * @param out - the receiving dual quaterion + * @param a - the dual quaternion to scale + * @param b - scalar value to scale the dual quaterion by + * @returns `out` + */ + static scale(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + return out; + } + /** + * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts) + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dot(a, b) { + return 0; + } + /** + * Performs a linear interpolation between two {@link Quat2}s + * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`) + * @category Static + * + * @param out - the receiving dual quat + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const mt = 1 - t; + if (_Quat2.dot(a, b) < 0) { + t = -t; + } + out[0] = a[0] * mt + b[0] * t; + out[1] = a[1] * mt + b[1] * t; + out[2] = a[2] * mt + b[2] * t; + out[3] = a[3] * mt + b[3] * t; + out[4] = a[4] * mt + b[4] * t; + out[5] = a[5] * mt + b[5] * t; + out[6] = a[6] * mt + b[6] * t; + out[7] = a[7] * mt + b[7] * t; + return out; + } + /** + * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quat to calculate inverse of + * @returns `out` + */ + static invert(out, a) { + const sqlen = _Quat2.squaredLength(a); + out[0] = -a[0] / sqlen; + out[1] = -a[1] / sqlen; + out[2] = -a[2] / sqlen; + out[3] = a[3] / sqlen; + out[4] = -a[4] / sqlen; + out[5] = -a[5] / sqlen; + out[6] = -a[6] / sqlen; + out[7] = a[7] / sqlen; + return out; + } + /** + * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than + * {@link Quat2.invert} and produces the same result. + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to calculate conjugate of + * @returns `out` + */ + static conjugate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + out[4] = -a[4]; + out[5] = -a[5]; + out[6] = -a[6]; + out[7] = a[7]; + return out; + } + /** + * Calculates the magnitude (length) of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate length of + * @returns length of `a` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static magnitude(a) { + return 0; + } + /** + * Alias for {@link Quat2.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate squared length of + * @returns squared length of a + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static squaredLength(a) { + return 0; + } + /** + * Alias for {@link Quat2.squaredLength} + * @category Static + */ + static sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Normalize a {@link Quat2} + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to normalize + * @returns `out` + */ + static normalize(out, a) { + let magnitude = _Quat2.squaredLength(a); + if (magnitude > 0) { + magnitude = Math.sqrt(magnitude); + const a0 = a[0] / magnitude; + const a1 = a[1] / magnitude; + const a2 = a[2] / magnitude; + const a3 = a[3] / magnitude; + const b0 = a[4]; + const b1 = a[5]; + const b2 = a[6]; + const b3 = a[7]; + const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3; + out[0] = a0; + out[1] = a1; + out[2] = a2; + out[3] = a3; + out[4] = (b0 - a0 * a_dot_b) / magnitude; + out[5] = (b1 - a1 * a_dot_b) / magnitude; + out[6] = (b2 - a2 * a_dot_b) / magnitude; + out[7] = (b3 - a3 * a_dot_b) / magnitude; + } + return out; + } + /** + * Returns a string representation of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Quat2(${a.join(", ")})`; + } + /** + * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7]; + } + /** + * Returns whether the {@link Quat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)); + } +}; +_TMP_QUAT = new WeakMap(); +_TMP_VEC33 = new WeakMap(); +// Temporary variables to prevent repeated allocations in the algorithms within Quat2. +// These are declared as TypedArrays to aid in tree-shaking. +__privateAdd(_Quat2, _TMP_QUAT, new Float32Array(4)); +__privateAdd(_Quat2, _TMP_VEC33, new Float32Array(3)); +var Quat2 = _Quat2; +Quat2.dot = Quat.dot; +Quat2.squaredLength = Quat.squaredLength; +Quat2.sqrLen = Quat.squaredLength; +Quat2.mag = Quat.magnitude; +Quat2.length = Quat.magnitude; +Quat2.len = Quat.magnitude; +Quat2.mul = Quat2.multiply; + +// src/_lib/f32/Vec2.ts +var Vec2 = class _Vec2 extends Float32Array { + /** + * Create a {@link Vec2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 2: { + const v = values[0]; + if (typeof v === "number") { + super([v, values[1]]); + } else { + super(v, values[1], 2); + } + break; + } + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v]); + } else { + super(v, 0, 2); + } + break; + } + default: + super(2); + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r() { + return this[0]; + } + set r(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g() { + return this[1]; + } + set g(value) { + this[1] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec2.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + return Math.hypot(this[0], this[1]); + } + /** + * Alias for {@link Vec2.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec2.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude() { + const x = this[0]; + const y = this[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag() { + return this.squaredMagnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec2.str(this);` + * + * @category Accessors + */ + get str() { + return _Vec2.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec2} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + // Instead of zero(), use a.fill(0) for instances; + /** + * Adds a {@link Vec2} to `this`. + * Equivalent to `Vec2.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b) { + this[0] += b[0]; + this[1] += b[1]; + return this; + } + /** + * Subtracts a {@link Vec2} from `this`. + * Equivalent to `Vec2.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + return this; + } + /** + * Alias for {@link Vec2.subtract} + * @category Methods + */ + sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec2}. + * Equivalent to `Vec2.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + return this; + } + /** + * Alias for {@link Vec2.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec2}. + * Equivalent to `Vec2.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + return this; + } + /** + * Alias for {@link Vec2.divide} + * @category Methods + */ + div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec2.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b) { + this[0] *= b; + this[1] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b) { + return _Vec2.distance(this, b); + } + /** + * Alias for {@link Vec2.distance} + * @category Methods + */ + dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b) { + return _Vec2.squaredDistance(this, b); + } + /** + * Alias for {@link Vec2.squaredDistance} + * @category Methods + */ + sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec2.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate() { + this[0] *= -1; + this[1] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec2.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + return this; + } + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec2.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec2}. + * Equivalent to `Vec2.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b) { + return this[0] * b[0] + this[1] * b[1]; + } + /** + * Normalize `this`. + * Equivalent to `Vec2.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize() { + return _Vec2.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec2}. + */ + static get BYTE_LENGTH() { + return 2 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty {@link Vec2} + * @category Static + * + * @returns A new 2D vector + */ + static create() { + return new _Vec2(); + } + /** + * Creates a new {@link Vec2} initialized with values from an existing vector + * @category Static + * + * @param a - Vector to clone + * @returns A new 2D vector + */ + static clone(a) { + return new _Vec2(a); + } + /** + * Creates a new {@link Vec2} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @returns A new 2D vector + */ + static fromValues(x, y) { + return new _Vec2(x, y); + } + /** + * Copy the values from one {@link Vec2} to another + * @category Static + * + * @param out - the receiving vector + * @param a - The source vector + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + return out; + } + /** + * Set the components of a {@link Vec2} to the given values + * @category Static + * + * @param out - The receiving vector + * @param x - X component + * @param y - Y component + * @returns `out` + */ + static set(out, x, y) { + out[0] = x; + out[1] = y; + return out; + } + /** + * Adds two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + return out; + } + /** + * Alias for {@link Vec2.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return [0, 0]; + } + /** + * Multiplies two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + return out; + } + /** + * Alias for {@link Vec2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return [0, 0]; + } + /** + * Divides two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + return out; + } + /** + * Alias for {@link Vec2.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out, a, b) { + return [0, 0]; + } + /** + * Math.ceil the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to ceil + * @returns `out` + */ + static ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + return out; + } + /** + * Math.floor the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to floor + * @returns `out` + */ + static floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + return out; + } + /** + * Returns the minimum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + return out; + } + /** + * Returns the maximum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + return out; + } + /** + * Math.round the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to round + * @returns `out` + */ + static round(out, a) { + out[0] = Math.round(a[0]); + out[1] = Math.round(a[1]); + return out; + } + /** + * Scales a {@link Vec2} by a scalar number + * @category Static + * + * @param out - The receiving vector + * @param a - The vector to scale + * @param b - Amount to scale the vector by + * @returns `out` + */ + static scale(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + return out; + } + /** + * Adds two Vec2's after scaling the second operand by a scalar value + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param scale - The amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns distance between `a` and `b` + */ + static distance(a, b) { + return Math.hypot(b[0] - a[0], b[1] - a[1]); + } + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Squared distance between `a` and `b` + */ + static squaredDistance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a, b) { + return 0; + } + /** + * Calculates the magnitude (length) of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a) { + const x = a[0]; + const y = a[1]; + return Math.sqrt(x * x + y * y); + } + /** + * Alias for {@link Vec2.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate squared length of + * @returns Squared length of a + */ + static squaredLength(a) { + const x = a[0]; + const y = a[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.squaredLength} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrLen(a, b) { + return 0; + } + /** + * Negates the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to negate + * @returns `out` + */ + static negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + return out; + } + /** + * Returns the inverse of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to invert + * @returns `out` + */ + static inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + return out; + } + /** + * Normalize a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to normalize + * @returns `out` + */ + static normalize(out, a) { + const x = a[0]; + const y = a[1]; + let len = x * x + y * y; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + return out; + } + /** + * Calculates the dot product of two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Dot product of `a` and `b` + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1]; + } + /** + * Computes the cross product of two {@link Vec2}s + * Note that the cross product must by definition produce a 3D vector. + * For this reason there is also not instance equivalent for this function. + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static cross(out, a, b) { + const z = a[0] * b[1] - a[1] * b[0]; + out[0] = out[1] = 0; + out[2] = z; + return out; + } + /** + * Performs a linear interpolation between two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param t - Interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const ax = a[0]; + const ay = a[1]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat2} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[2] * y; + out[1] = m[1] * x + m[3] * y; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat2d} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2d(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[2] * y + m[4]; + out[1] = m[1] * x + m[3] * y + m[5]; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat3} + * 3rd vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat3(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[3] * y + m[6]; + out[1] = m[1] * x + m[4] * y + m[7]; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat4} + * 3rd vector component is implicitly '0' + * 4th vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat4(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[4] * y + m[12]; + out[1] = m[1] * x + m[5] * y + m[13]; + return out; + } + /** + * Rotate a 2D vector + * @category Static + * + * @param out - The receiving {@link Vec2} + * @param a - The {@link Vec2} point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotate(out, a, b, rad) { + const p0 = a[0] - b[0]; + const p1 = a[1] - b[1]; + const sinC = Math.sin(rad); + const cosC = Math.cos(rad); + out[0] = p0 * cosC - p1 * sinC + b[0]; + out[1] = p0 * sinC + p1 * cosC + b[1]; + return out; + } + /** + * Get the angle between two 2D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static angle(a, b) { + const x1 = a[0]; + const y1 = a[1]; + const x2 = b[0]; + const y2 = b[1]; + const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2); + const cosine = mag && (x1 * x2 + y1 * y2) / mag; + return Math.acos(Math.min(Math.max(cosine, -1), 1)); + } + /** + * Set the components of a {@link Vec2} to zero + * @category Static + * + * @param out - The receiving vector + * @returns `out` + */ + static zero(out) { + out[0] = 0; + out[1] = 0; + return out; + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors components are ===, `false` otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors are approximately equal, `false` otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const b0 = b[0]; + const b1 = b[1]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)); + } + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - Vector to represent as a string + * @returns String representation of the vector + */ + static str(a) { + return `Vec2(${a.join(", ")})`; + } +}; +Vec2.prototype.sub = Vec2.prototype.subtract; +Vec2.prototype.mul = Vec2.prototype.multiply; +Vec2.prototype.div = Vec2.prototype.divide; +Vec2.prototype.dist = Vec2.prototype.distance; +Vec2.prototype.sqrDist = Vec2.prototype.squaredDistance; +Vec2.sub = Vec2.subtract; +Vec2.mul = Vec2.multiply; +Vec2.div = Vec2.divide; +Vec2.dist = Vec2.distance; +Vec2.sqrDist = Vec2.squaredDistance; +Vec2.sqrLen = Vec2.squaredLength; +Vec2.mag = Vec2.magnitude; +Vec2.length = Vec2.magnitude; +Vec2.len = Vec2.magnitude; + +// src/swizzle/index.ts +var GLM_SWIZZLES_ENABLED_F32 = false; +function EnableSwizzles() { + if (GLM_SWIZZLES_ENABLED_F32) { + return; + } + const VEC2_SWIZZLES = ["xx", "xy", "yx", "yy", "xxx", "xxy", "xyx", "xyy", "yxx", "yxy", "yyx", "yyy", "xxxx", "xxxy", "xxyx", "xxyy", "xyxx", "xyxy", "xyyx", "xyyy", "yxxx", "yxxy", "yxyx", "yxyy", "yyxx", "yyxy", "yyyx", "yyyy", "rr", "rg", "gr", "gg", "rrr", "rrg", "rgr", "rgg", "grr", "grg", "ggr", "ggg", "rrrr", "rrrg", "rrgr", "rrgg", "rgrr", "rgrg", "rggr", "rggg", "grrr", "grrg", "grgr", "grgg", "ggrr", "ggrg", "gggr", "gggg"]; + const VEC3_SWIZZLES = ["xz", "yz", "zx", "zy", "zz", "xxz", "xyz", "xzx", "xzy", "xzz", "yxz", "yyz", "yzx", "yzy", "yzz", "zxx", "zxy", "zxz", "zyx", "zyy", "zyz", "zzx", "zzy", "zzz", "xxxz", "xxyz", "xxzx", "xxzy", "xxzz", "xyxz", "xyyz", "xyzx", "xyzy", "xyzz", "xzxx", "xzxy", "xzxz", "xzyx", "xzyy", "xzyz", "xzzx", "xzzy", "xzzz", "yxxz", "yxyz", "yxzx", "yxzy", "yxzz", "yyxz", "yyyz", "yyzx", "yyzy", "yyzz", "yzxx", "yzxy", "yzxz", "yzyx", "yzyy", "yzyz", "yzzx", "yzzy", "yzzz", "zxxx", "zxxy", "zxxz", "zxyx", "zxyy", "zxyz", "zxzx", "zxzy", "zxzz", "zyxx", "zyxy", "zyxz", "zyyx", "zyyy", "zyyz", "zyzx", "zyzy", "zyzz", "zzxx", "zzxy", "zzxz", "zzyx", "zzyy", "zzyz", "zzzx", "zzzy", "zzzz", "rb", "gb", "br", "bg", "bb", "rrb", "rgb", "rbr", "rbg", "rbb", "grb", "ggb", "gbr", "gbg", "gbb", "brr", "brg", "brb", "bgr", "bgg", "bgb", "bbr", "bbg", "bbb", "rrrb", "rrgb", "rrbr", "rrbg", "rrbb", "rgrb", "rggb", "rgbr", "rgbg", "rgbb", "rbrr", "rbrg", "rbrb", "rbgr", "rbgg", "rbgb", "rbbr", "rbbg", "rbbb", "grrb", "grgb", "grbr", "grbg", "grbb", "ggrb", "gggb", "ggbr", "ggbg", "ggbb", "gbrr", "gbrg", "gbrb", "gbgr", "gbgg", "gbgb", "gbbr", "gbbg", "gbbb", "brrr", "brrg", "brrb", "brgr", "brgg", "brgb", "brbr", "brbg", "brbb", "bgrr", "bgrg", "bgrb", "bggr", "bggg", "bggb", "bgbr", "bgbg", "bgbb", "bbrr", "bbrg", "bbrb", "bbgr", "bbgg", "bbgb", "bbbr", "bbbg", "bbbb"]; + const VEC4_SWIZZLES = ["xw", "yw", "zw", "wx", "wy", "wz", "ww", "xxw", "xyw", "xzw", "xwx", "xwy", "xwz", "xww", "yxw", "yyw", "yzw", "ywx", "ywy", "ywz", "yww", "zxw", "zyw", "zzw", "zwx", "zwy", "zwz", "zww", "wxx", "wxy", "wxz", "wxw", "wyx", "wyy", "wyz", "wyw", "wzx", "wzy", "wzz", "wzw", "wwx", "wwy", "wwz", "www", "xxxw", "xxyw", "xxzw", "xxwx", "xxwy", "xxwz", "xxww", "xyxw", "xyyw", "xyzw", "xywx", "xywy", "xywz", "xyww", "xzxw", "xzyw", "xzzw", "xzwx", "xzwy", "xzwz", "xzww", "xwxx", "xwxy", "xwxz", "xwxw", "xwyx", "xwyy", "xwyz", "xwyw", "xwzx", "xwzy", "xwzz", "xwzw", "xwwx", "xwwy", "xwwz", "xwww", "yxxw", "yxyw", "yxzw", "yxwx", "yxwy", "yxwz", "yxww", "yyxw", "yyyw", "yyzw", "yywx", "yywy", "yywz", "yyww", "yzxw", "yzyw", "yzzw", "yzwx", "yzwy", "yzwz", "yzww", "ywxx", "ywxy", "ywxz", "ywxw", "ywyx", "ywyy", "ywyz", "ywyw", "ywzx", "ywzy", "ywzz", "ywzw", "ywwx", "ywwy", "ywwz", "ywww", "zxxw", "zxyw", "zxzw", "zxwx", "zxwy", "zxwz", "zxww", "zyxw", "zyyw", "zyzw", "zywx", "zywy", "zywz", "zyww", "zzxw", "zzyw", "zzzw", "zzwx", "zzwy", "zzwz", "zzww", "zwxx", "zwxy", "zwxz", "zwxw", "zwyx", "zwyy", "zwyz", "zwyw", "zwzx", "zwzy", "zwzz", "zwzw", "zwwx", "zwwy", "zwwz", "zwww", "wxxx", "wxxy", "wxxz", "wxxw", "wxyx", "wxyy", "wxyz", "wxyw", "wxzx", "wxzy", "wxzz", "wxzw", "wxwx", "wxwy", "wxwz", "wxww", "wyxx", "wyxy", "wyxz", "wyxw", "wyyx", "wyyy", "wyyz", "wyyw", "wyzx", "wyzy", "wyzz", "wyzw", "wywx", "wywy", "wywz", "wyww", "wzxx", "wzxy", "wzxz", "wzxw", "wzyx", "wzyy", "wzyz", "wzyw", "wzzx", "wzzy", "wzzz", "wzzw", "wzwx", "wzwy", "wzwz", "wzww", "wwxx", "wwxy", "wwxz", "wwxw", "wwyx", "wwyy", "wwyz", "wwyw", "wwzx", "wwzy", "wwzz", "wwzw", "wwwx", "wwwy", "wwwz", "wwww", "ra", "ga", "ba", "ar", "ag", "ab", "aa", "rra", "rga", "rba", "rar", "rag", "rab", "raa", "gra", "gga", "gba", "gar", "gag", "gab", "gaa", "bra", "bga", "bba", "bar", "bag", "bab", "baa", "arr", "arg", "arb", "ara", "agr", "agg", "agb", "aga", "abr", "abg", "abb", "aba", "aar", "aag", "aab", "aaa", "rrra", "rrga", "rrba", "rrar", "rrag", "rrab", "rraa", "rgra", "rgga", "rgba", "rgar", "rgag", "rgab", "rgaa", "rbra", "rbga", "rbba", "rbar", "rbag", "rbab", "rbaa", "rarr", "rarg", "rarb", "rara", "ragr", "ragg", "ragb", "raga", "rabr", "rabg", "rabb", "raba", "raar", "raag", "raab", "raaa", "grra", "grga", "grba", "grar", "grag", "grab", "graa", "ggra", "ggga", "ggba", "ggar", "ggag", "ggab", "ggaa", "gbra", "gbga", "gbba", "gbar", "gbag", "gbab", "gbaa", "garr", "garg", "garb", "gara", "gagr", "gagg", "gagb", "gaga", "gabr", "gabg", "gabb", "gaba", "gaar", "gaag", "gaab", "gaaa", "brra", "brga", "brba", "brar", "brag", "brab", "braa", "bgra", "bgga", "bgba", "bgar", "bgag", "bgab", "bgaa", "bbra", "bbga", "bbba", "bbar", "bbag", "bbab", "bbaa", "barr", "barg", "barb", "bara", "bagr", "bagg", "bagb", "baga", "babr", "babg", "babb", "baba", "baar", "baag", "baab", "baaa", "arrr", "arrg", "arrb", "arra", "argr", "argg", "argb", "arga", "arbr", "arbg", "arbb", "arba", "arar", "arag", "arab", "araa", "agrr", "agrg", "agrb", "agra", "aggr", "aggg", "aggb", "agga", "agbr", "agbg", "agbb", "agba", "agar", "agag", "agab", "agaa", "abrr", "abrg", "abrb", "abra", "abgr", "abgg", "abgb", "abga", "abbr", "abbg", "abbb", "abba", "abar", "abag", "abab", "abaa", "aarr", "aarg", "aarb", "aara", "aagr", "aagg", "aagb", "aaga", "aabr", "aabg", "aabb", "aaba", "aaar", "aaag", "aaab", "aaaa"]; + const SWIZZLE_INDEX = { + x: 0, + r: 0, + y: 1, + g: 1, + z: 2, + b: 2, + w: 3, + a: 3 + }; + function getSwizzleImpl(swizzle) { + switch (swizzle.length) { + case 2: + return function() { + return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]); + }; + case 3: + return function() { + return new Vec3( + this[SWIZZLE_INDEX[swizzle[0]]], + this[SWIZZLE_INDEX[swizzle[1]]], + this[SWIZZLE_INDEX[swizzle[2]]] + ); + }; + case 4: + return function() { + return new Vec4( + this[SWIZZLE_INDEX[swizzle[0]]], + this[SWIZZLE_INDEX[swizzle[1]]], + this[SWIZZLE_INDEX[swizzle[2]]], + this[SWIZZLE_INDEX[swizzle[3]]] + ); + }; + } + throw new Error("Illegal swizzle length"); + } + for (const swizzle of VEC2_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec2.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec3.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + for (const swizzle of VEC3_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec3.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + for (const swizzle of VEC4_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + GLM_SWIZZLES_ENABLED_F32 = true; +} + +// src/util/angleConversion.ts +var GLM_DEG_TO_RAD = Math.PI / 180; +var GLM_RAD_TO_DEG = 180 / Math.PI; +function toDegree(value) { + return value * GLM_RAD_TO_DEG; +} +function toRadian(value) { + return value * GLM_DEG_TO_RAD; +} +export { + EnableSwizzles, + Mat2, + Mat2d, + Mat3, + Mat4, + Quat, + Quat2, + Vec2, + Vec3, + Vec4, + Mat2 as mat2, + Mat2d as mat2d, + Mat3 as mat3, + Mat4 as mat4, + Quat as quat, + Quat2 as quat2, + toDegree, + toRadian, + Vec2 as vec2, + Vec3 as vec3, + Vec4 as vec4 +}; +//# sourceMappingURL=gl-matrix-f32.js.map diff --git a/dist-cdn/esm/2016/gl-matrix-f32.js.map b/dist-cdn/esm/2016/gl-matrix-f32.js.map new file mode 100644 index 00000000..7bd77004 --- /dev/null +++ b/dist-cdn/esm/2016/gl-matrix-f32.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../../../src/common/index.ts", "../../../src/_lib/f32/Mat2.ts", "../../../src/_lib/f32/Mat2d.ts", "../../../src/_lib/f32/Mat3.ts", "../../../src/_lib/f32/Mat4.ts", "../../../src/_lib/f32/Vec3.ts", "../../../src/_lib/f32/Vec4.ts", "../../../src/_lib/f32/Quat.ts", "../../../src/_lib/f32/Quat2.ts", "../../../src/_lib/f32/Vec2.ts", "../../../src/swizzle/index.ts", "../../../src/util/angleConversion.ts"], + "sourcesContent": ["/**\r\n * Provides common resources and constants shared across `gl-matrix`.\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\n/**\r\n * A small constant used to determine the acceptable error margin in floating-point calculations.\r\n */\r\nexport const GLM_EPSILON = 0.000001;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x2 Matrix\r\n */\r\nexport class Mat2 extends Float32Array {\r\n static #IDENTITY_2X2 = new Float32Array([\r\n 1, 0,\r\n 0, 1\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n default:\r\n super(Mat2.#IDENTITY_2X2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2} into `this`.\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2.identity(this)\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n identity(): this {\r\n this.set(Mat2.#IDENTITY_2X2);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2} against another one\r\n * Equivalent to `Mat2.multiply(this, this, b);`\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat2}\r\n * Equivalent to `Mat2.transpose(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n transpose(): this {\r\n return Mat2.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat2}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n invert(): this {\r\n return Mat2.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2.scale(this, this, v);`\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2} by the given angle around the given axis\r\n * Equivalent to `Mat2.rotate(this, this, rad);`\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n rotate(rad: number): this {\r\n return Mat2.rotate(this, this, rad) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2}\r\n */\r\n static create(): Mat2 {\r\n return new Mat2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2}\r\n */\r\n static clone(a: Readonly): Mat2 {\r\n return new Mat2(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2Like, a: Readonly): Mat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2}\r\n */\r\n static fromValues(...values: number[]): Mat2 {\r\n return new Mat2(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2Like, ...values: number[]): Mat2Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2Like): Mat2Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat2Like, a: Readonly): Mat2Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache\r\n // some values\r\n if (out === a) {\r\n const a1 = a[1];\r\n out[1] = a[2];\r\n out[2] = a1;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[2];\r\n out[2] = a[1];\r\n out[3] = a[3];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2Like, a: Mat2Like): Mat2Like | null {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n // Calculate the determinant\r\n let det = a0 * a3 - a2 * a1;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = a3 * det;\r\n out[1] = -a1 * det;\r\n out[2] = -a2 * det;\r\n out[3] = a0 * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat2Like, a: Mat2Like): Mat2Like {\r\n // Caching this value is necessary if out == a\r\n const a0 = a[0];\r\n out[0] = a[3];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[2] * a[1];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n return out;\r\n }\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Rotates a {@link Mat2} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2Like, a: Readonly, rad: number): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2Like, a: Readonly, v: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2Like, rad: number): Mat2Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2Like, v: Readonly): Mat2Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2Like, a: Readonly, b: number): Mat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2Like, a: Readonly, b: Readonly, scale: number): Mat2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\r\n * @category Static\r\n *\r\n * @param L - the lower triangular matrix\r\n * @param D - the diagonal matrix\r\n * @param U - the upper triangular matrix\r\n * @param a - the input matrix to factorize\r\n */\r\n\r\n static LDU(L: Mat2Like, D: Readonly, U: Mat2Like, a: Readonly):\r\n [Mat2Like, Readonly, Mat2Like] {\r\n L[2] = a[2] / a[0];\r\n U[0] = a[0];\r\n U[1] = a[1];\r\n U[3] = a[3] - L[2] * U[1];\r\n return [L, D, U];\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat2.prototype.mul = Mat2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat2.mul = Mat2.multiply;\r\nMat2.sub = Mat2.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x3 Matrix\r\n */\r\nexport class Mat2d extends Float32Array {\r\n static #IDENTITY_2X3 = new Float32Array([\r\n 1, 0,\r\n 0, 1,\r\n 0, 0,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 6:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 6); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 6);\r\n }\r\n break;\r\n default:\r\n super(Mat2d.#IDENTITY_2X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2d.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2d.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2d} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2d.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat2d.#IDENTITY_2X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2d} against another one\r\n * Equivalent to `Mat2d.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2d.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Translate this {@link Mat2d} by the given vector\r\n * Equivalent to `Mat2d.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat2d.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2d} by the given angle around the given axis\r\n * Equivalent to `Mat2d.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat2d.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2d.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2d.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2d}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 6 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2d}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2d}\r\n */\r\n static create(): Mat2d {\r\n return new Mat2d();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2d} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2d}\r\n */\r\n static clone(a: Readonly): Mat2d {\r\n return new Mat2d(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2d} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2dLike, a: Readonly): Mat2dLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2d} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2d}\r\n */\r\n static fromValues(...values: number[]): Mat2d {\r\n return new Mat2d(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2d} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2dLike, ...values: number[]): Mat2dLike {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2d} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2dLike): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2dLike, a: Mat2dLike): Mat2dLike | null {\r\n const aa = a[0];\r\n const ab = a[1];\r\n const ac = a[2];\r\n const ad = a[3];\r\n const atx = a[4];\r\n const aty = a[5];\r\n\r\n let det = aa * ad - ab * ac;\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = ad * det;\r\n out[1] = -ab * det;\r\n out[2] = -ac * det;\r\n out[3] = aa * det;\r\n out[4] = (ac * aty - ad * atx) * det;\r\n out[5] = (ab * atx - aa * aty) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[1] * a[2];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2d}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n out[4] = a0 * b4 + a2 * b5 + a4;\r\n out[5] = a1 * b4 + a3 * b5 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat2d} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n out[4] = a0 * v0 + a2 * v1 + a4;\r\n out[5] = a1 * v0 + a3 * v1 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat2d} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2dLike, a: Readonly, rad: number): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n // TODO: Got to fromRotation\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = v[0];\r\n out[5] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2dLike, rad: number): Mat2dLike {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2d} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2dLike, a: Readonly, b: number): Mat2dLike {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2dLike, a: Readonly, b: Readonly, scale: number):\r\n Mat2dLike {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2d(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Static method alias assignments\r\nMat2d.mul = Mat2d.multiply;\r\nMat2d.sub = Mat2d.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Mat3Like, Mat4Like, Vec2Like, QuatLike } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 3x3 Matrix\r\n */\r\nexport class Mat3 extends Float32Array {\r\n static #IDENTITY_3X3 = new Float32Array([\r\n 1, 0, 0,\r\n 0, 1, 0,\r\n 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 9:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 9); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v,\r\n v, v, v,\r\n v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 9);\r\n }\r\n break;\r\n default:\r\n super(Mat3.#IDENTITY_3X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat3.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat3.#IDENTITY_3X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat3} against another one\r\n * Equivalent to `Mat3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat3.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat3}\r\n * Equivalent to `Mat3.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat3.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat3}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat3.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat3} by the given vector\r\n * Equivalent to `Mat3.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat3.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat3} by the given angle around the given axis\r\n * Equivalent to `Mat3.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat3.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat3.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat3.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 9 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat3}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat3}\r\n */\r\n static create(): Mat3 {\r\n return new Mat3();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat3} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat3}\r\n */\r\n static clone(a: Readonly): Mat3 {\r\n return new Mat3(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat3} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat3} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat3}\r\n */\r\n static fromValues(...values: number[]): Mat3 {\r\n return new Mat3(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat3} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat3Like, ...values: number[]): Mat3Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat3} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat3Like): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat3Like, a: Readonly): Mat3Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a12 = a[5];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a01;\r\n out[5] = a[7];\r\n out[6] = a02;\r\n out[7] = a12;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a[1];\r\n out[4] = a[4];\r\n out[5] = a[7];\r\n out[6] = a[2];\r\n out[7] = a[5];\r\n out[8] = a[8];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat3Like, a: Mat3Like): Mat3Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2];\r\n const a10 = a[3],\r\n a11 = a[4],\r\n a12 = a[5];\r\n const a20 = a[6],\r\n a21 = a[7],\r\n a22 = a[8];\r\n\r\n const b01 = a22 * a11 - a12 * a21;\r\n const b11 = -a22 * a10 + a12 * a20;\r\n const b21 = a21 * a10 - a11 * a20;\r\n\r\n // Calculate the determinant\r\n let det = a00 * b01 + a01 * b11 + a02 * b21;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = b01 * det;\r\n out[1] = (-a22 * a01 + a02 * a21) * det;\r\n out[2] = (a12 * a01 - a02 * a11) * det;\r\n out[3] = b11 * det;\r\n out[4] = (a22 * a00 - a02 * a20) * det;\r\n out[5] = (-a12 * a00 + a02 * a10) * det;\r\n out[6] = b21 * det;\r\n out[7] = (-a21 * a00 + a01 * a20) * det;\r\n out[8] = (a11 * a00 - a01 * a10) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat3Like, a: Mat3Like): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n out[0] = a11 * a22 - a12 * a21;\r\n out[1] = a02 * a21 - a01 * a22;\r\n out[2] = a01 * a12 - a02 * a11;\r\n out[3] = a12 * a20 - a10 * a22;\r\n out[4] = a00 * a22 - a02 * a20;\r\n out[5] = a02 * a10 - a00 * a12;\r\n out[6] = a10 * a21 - a11 * a20;\r\n out[7] = a01 * a20 - a00 * a21;\r\n out[8] = a00 * a11 - a01 * a10;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n return (\r\n a00 * (a22 * a11 - a12 * a21) +\r\n a01 * (-a22 * a10 + a12 * a20) +\r\n a02 * (a21 * a10 - a11 * a20)\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[3];\r\n b1 = b[4];\r\n b2 = b[5];\r\n out[3] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[4] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[5] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[6];\r\n b1 = b[7];\r\n b2 = b[8];\r\n out[6] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[7] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[8] = b0 * a02 + b1 * a12 + b2 * a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat3} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n\r\n out[3] = a10;\r\n out[4] = a11;\r\n out[5] = a12;\r\n\r\n out[6] = x * a00 + y * a10 + a20;\r\n out[7] = x * a01 + y * a11 + a21;\r\n out[8] = x * a02 + y * a12 + a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat3} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat3Like, a: Readonly, rad: number): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c * a00 + s * a10;\r\n out[1] = c * a01 + s * a11;\r\n out[2] = c * a02 + s * a12;\r\n\r\n out[3] = c * a10 - s * a00;\r\n out[4] = c * a11 - s * a01;\r\n out[5] = c * a12 - s * a02;\r\n\r\n out[6] = a20;\r\n out[7] = a21;\r\n out[8] = a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat3} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = x * a[0];\r\n out[1] = x * a[1];\r\n out[2] = x * a[2];\r\n\r\n out[3] = y * a[3];\r\n out[4] = y * a[4];\r\n out[5] = y * a[5];\r\n\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = v[0];\r\n out[7] = v[1];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.rotate(dest, dest, rad);\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat3Like, rad: number): Mat3Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n\r\n out[3] = -s;\r\n out[4] = c;\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n\r\n out[3] = 0;\r\n out[4] = v[1];\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat2d} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 2x3 matrix\r\n * @returns `out`\r\n */\r\n static fromMat2d(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = 0;\r\n\r\n out[3] = a[2];\r\n out[4] = a[3];\r\n out[5] = 0;\r\n\r\n out[6] = a[4];\r\n out[7] = a[5];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param q - {@link Quat} to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat3Like, q: Readonly): Mat3Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[3] = yx - wz;\r\n out[6] = zx + wy;\r\n\r\n out[1] = yx + wz;\r\n out[4] = 1 - xx - zz;\r\n out[7] = zy - wx;\r\n\r\n out[2] = zx - wy;\r\n out[5] = zy + wx;\r\n out[8] = 1 - xx - yy;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat4} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 4x4 matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[4];\r\n out[4] = a[5];\r\n out[5] = a[6];\r\n out[6] = a[8];\r\n out[7] = a[9];\r\n out[8] = a[10];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\r\n * @category Static\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat3Like, a: Readonly): Mat3Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n\r\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n\r\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat3Like, a: Readonly): Mat3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n\r\n out[3] = cy * az - cz * ay;\r\n out[4] = cz * ax - cx * az;\r\n out[5] = cx * ay - cy * ax;\r\n\r\n out[6] = ay * bz - az * by;\r\n out[7] = az * bx - ax * bz;\r\n out[8] = ax * by - ay * bx;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a 2D projection matrix with the given bounds\r\n * @category Static\r\n *\r\n * @param out mat3 frustum matrix will be written into\r\n * @param width Width of your gl context\r\n * @param height Height of gl context\r\n * @returns `out`\r\n */\r\n static projection(out: Mat3Like, width: number, height: number): Mat3Like {\r\n out[0] = 2 / width;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -2 / height;\r\n out[5] = 0;\r\n out[6] = -1;\r\n out[7] = 1;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8]\r\n );\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat3} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat3Like, a: Readonly, b: number): Mat3Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat3Like, a: Readonly, b: Readonly, scale: number): Mat3Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat3(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat3.prototype.mul = Mat3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat3.mul = Mat3.multiply;\r\nMat3.sub = Mat3.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 4x4 Matrix\r\n */\r\nexport class Mat4 extends Float32Array {\r\n static #IDENTITY_4X4 = new Float32Array([\r\n 1, 0, 0, 0,\r\n 0, 1, 0, 0,\r\n 0, 0, 1, 0,\r\n 0, 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Temporary variable to prevent repeated allocations in the algorithms within Mat4.\r\n * These are declared as TypedArrays to aid in tree-shaking.\r\n */\r\n static #TMP_VEC3 = new Float32Array(3);\r\n\r\n /**\r\n * Create a {@link Mat4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 16:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 16); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 16);\r\n }\r\n break;\r\n default:\r\n super(Mat4.#IDENTITY_4X4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat4.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat4.#IDENTITY_4X4);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat4} against another one\r\n * Equivalent to `Mat4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat4.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat4}\r\n * Equivalent to `Mat4.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat4.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat4}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat4.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat4} by the given vector\r\n * Equivalent to `Mat4.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat4.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the given axis\r\n * Equivalent to `Mat4.rotate(this, this, rad, axis);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `this`\r\n */\r\n rotate(rad: number, axis: Readonly): this {\r\n return Mat4.rotate(this, this, rad, axis) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat4.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat4.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the X axis\r\n * Equivalent to `Mat4.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Mat4.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Y axis\r\n * Equivalent to `Mat4.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Mat4.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Z axis\r\n * Equivalent to `Mat4.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Mat4.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveNO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveNO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveZO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveZO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoNO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoNO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoZO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoZO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 16 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat4}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat4}\r\n */\r\n static create(): Mat4 {\r\n return new Mat4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat4} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat4}\r\n */\r\n static clone(a: Readonly): Mat4 {\r\n return new Mat4(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat4} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat4Like, a: Readonly): Mat4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new mat4 with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat4}\r\n */\r\n static fromValues(...values: number[]): Mat4 {\r\n return new Mat4(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a mat4 to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat4Like, ...values: number[]): Mat4Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n out[9] = values[9];\r\n out[10] = values[10];\r\n out[11] = values[11];\r\n out[12] = values[12];\r\n out[13] = values[13];\r\n out[14] = values[14];\r\n out[15] = values[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat4} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat4Like): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat4Like, a: Readonly): Mat4Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a12 = a[6],\r\n a13 = a[7];\r\n const a23 = a[11];\r\n\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a01;\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a02;\r\n out[9] = a12;\r\n out[11] = a[14];\r\n out[12] = a03;\r\n out[13] = a13;\r\n out[14] = a23;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a[1];\r\n out[5] = a[5];\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a[2];\r\n out[9] = a[6];\r\n out[10] = a[10];\r\n out[11] = a[14];\r\n out[12] = a[3];\r\n out[13] = a[7];\r\n out[14] = a[11];\r\n out[15] = a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat4Like, a: Mat4Like): Mat4Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\r\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\r\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\r\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\r\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\r\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\r\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat4Like, a: Mat4Like): Mat4Like {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n out[0] = a11 * b11 - a12 * b10 + a13 * b09;\r\n out[1] = a02 * b10 - a01 * b11 - a03 * b09;\r\n out[2] = a31 * b05 - a32 * b04 + a33 * b03;\r\n out[3] = a22 * b04 - a21 * b05 - a23 * b03;\r\n out[4] = a12 * b08 - a10 * b11 - a13 * b07;\r\n out[5] = a00 * b11 - a02 * b08 + a03 * b07;\r\n out[6] = a32 * b02 - a30 * b05 - a33 * b01;\r\n out[7] = a20 * b05 - a22 * b02 + a23 * b01;\r\n out[8] = a10 * b10 - a11 * b08 + a13 * b06;\r\n out[9] = a01 * b08 - a00 * b10 - a03 * b06;\r\n out[10] = a30 * b04 - a31 * b02 + a33 * b00;\r\n out[11] = a21 * b02 - a20 * b04 - a23 * b00;\r\n out[12] = a11 * b07 - a10 * b09 - a12 * b06;\r\n out[13] = a00 * b09 - a01 * b07 + a02 * b06;\r\n out[14] = a31 * b01 - a30 * b03 - a32 * b00;\r\n out[15] = a20 * b03 - a21 * b01 + a22 * b00;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b0 = a00 * a11 - a01 * a10;\r\n const b1 = a00 * a12 - a02 * a10;\r\n const b2 = a01 * a12 - a02 * a11;\r\n const b3 = a20 * a31 - a21 * a30;\r\n const b4 = a20 * a32 - a22 * a30;\r\n const b5 = a21 * a32 - a22 * a31;\r\n const b6 = a00 * b5 - a01 * b4 + a02 * b3;\r\n const b7 = a10 * b5 - a11 * b4 + a12 * b3;\r\n const b8 = a20 * b2 - a21 * b1 + a22 * b0;\r\n const b9 = a30 * b2 - a31 * b1 + a32 * b0;\r\n\r\n // Calculate the determinant\r\n return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Mat4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n // Cache only the current line of the second matrix\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n let b3 = b[3];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[4];\r\n b1 = b[5];\r\n b2 = b[6];\r\n b3 = b[7];\r\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[8];\r\n b1 = b[9];\r\n b2 = b[10];\r\n b3 = b[11];\r\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[12];\r\n b1 = b[13];\r\n b2 = b[14];\r\n b3 = b[15];\r\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat4} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n if (a === out) {\r\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\r\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\r\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\r\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\r\n } else {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n out[3] = a03;\r\n out[4] = a10;\r\n out[5] = a11;\r\n out[6] = a12;\r\n out[7] = a13;\r\n out[8] = a20;\r\n out[9] = a21;\r\n out[10] = a22;\r\n out[11] = a23;\r\n\r\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\r\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\r\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\r\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec3} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n out[0] = a[0] * x;\r\n out[1] = a[1] * x;\r\n out[2] = a[2] * x;\r\n out[3] = a[3] * x;\r\n out[4] = a[4] * y;\r\n out[5] = a[5] * y;\r\n out[6] = a[6] * y;\r\n out[7] = a[7] * y;\r\n out[8] = a[8] * z;\r\n out[9] = a[9] * z;\r\n out[10] = a[10] * z;\r\n out[11] = a[11] * z;\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat4} by the given angle around the given axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if axis has a length of 0\r\n */\r\n static rotate(out: Mat4Like, a: Readonly, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n // Construct the elements of the rotation matrix\r\n const b00 = x * x * t + c;\r\n const b01 = y * x * t + z * s;\r\n const b02 = z * x * t - y * s;\r\n const b10 = x * y * t - z * s;\r\n const b11 = y * y * t + c;\r\n const b12 = z * y * t + x * s;\r\n const b20 = x * z * t + y * s;\r\n const b21 = y * z * t - x * s;\r\n const b22 = z * z * t + c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\r\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\r\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\r\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\r\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\r\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\r\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\r\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\r\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\r\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\r\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\r\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateX(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[4] = a10 * c + a20 * s;\r\n out[5] = a11 * c + a21 * s;\r\n out[6] = a12 * c + a22 * s;\r\n out[7] = a13 * c + a23 * s;\r\n out[8] = a20 * c - a10 * s;\r\n out[9] = a21 * c - a11 * s;\r\n out[10] = a22 * c - a12 * s;\r\n out[11] = a23 * c - a13 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateY(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c - a20 * s;\r\n out[1] = a01 * c - a21 * s;\r\n out[2] = a02 * c - a22 * s;\r\n out[3] = a03 * c - a23 * s;\r\n out[8] = a00 * s + a20 * c;\r\n out[9] = a01 * s + a21 * c;\r\n out[10] = a02 * s + a22 * c;\r\n out[11] = a03 * s + a23 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c + a10 * s;\r\n out[1] = a01 * c + a11 * s;\r\n out[2] = a02 * c + a12 * s;\r\n out[3] = a03 * c + a13 * s;\r\n out[4] = a10 * c - a00 * s;\r\n out[5] = a11 * c - a01 * s;\r\n out[6] = a12 * c - a02 * s;\r\n out[7] = a13 * c - a03 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = v[1];\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = v[2];\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotate(dest, dest, rad, axis);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if `axis` has a length of 0\r\n */\r\n static fromRotation(out: Mat4Like, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = x * x * t + c;\r\n out[1] = y * x * t + z * s;\r\n out[2] = z * x * t - y * s;\r\n out[3] = 0;\r\n out[4] = x * y * t - z * s;\r\n out[5] = y * y * t + c;\r\n out[6] = z * y * t + x * s;\r\n out[7] = 0;\r\n out[8] = x * z * t + y * s;\r\n out[9] = y * z * t - x * s;\r\n out[10] = z * z * t + c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the X axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateX(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromXRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = c;\r\n out[6] = s;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = -s;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Y axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateY(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromYRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = 0;\r\n out[2] = -s;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = s;\r\n out[9] = 0;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Z axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateZ(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromZRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -s;\r\n out[5] = c;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation and vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Mat4Like, q: Readonly, v: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - (yy + zz);\r\n out[1] = xy + wz;\r\n out[2] = xz - wy;\r\n out[3] = 0;\r\n out[4] = xy - wz;\r\n out[5] = 1 - (xx + zz);\r\n out[6] = yz + wx;\r\n out[7] = 0;\r\n out[8] = xz + wy;\r\n out[9] = yz - wx;\r\n out[10] = 1 - (xx + yy);\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Mat4} from a {@link Quat2}.\r\n * @category Static\r\n *\r\n * @param out - Matrix\r\n * @param a - Dual Quaternion\r\n * @returns `out`\r\n */\r\n static fromQuat2(out: Mat4Like, a: Quat2Like): Mat4Like {\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n\r\n const magnitude = bx * bx + by * by + bz * bz + bw * bw;\r\n\r\n // Only scale if it makes sense\r\n if (magnitude > 0) {\r\n Mat4.#TMP_VEC3[0] = ((ax * bw + aw * bx + ay * bz - az * by) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[1] = ((ay * bw + aw * by + az * bx - ax * bz) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[2] = ((az * bw + aw * bz + ax * by - ay * bx) * 2) / magnitude;\r\n } else {\r\n Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n }\r\n Mat4.fromRotationTranslation(out, a as QuatLike, Mat4.#TMP_VEC3);\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat4Like, a: Readonly): Mat4Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[3] = 0;\r\n\r\n out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[7] = 0;\r\n\r\n out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat4Like, a: Readonly): Mat4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n out[3] = 0;\r\n\r\n out[4] = cy * az - cz * ay;\r\n out[5] = cz * ax - cx * az;\r\n out[6] = cx * ay - cy * ax;\r\n out[7] = 0;\r\n\r\n out[8] = ay * bz - az * by;\r\n out[9] = az * bx - ax * bz;\r\n out[10] = ax * by - ay * bx;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the translation vector component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslation,\r\n * the returned vector will be the same as the translation vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive translation component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getTranslation(out: Vec3Like, mat: Readonly): Vec3Like {\r\n out[0] = mat[12];\r\n out[1] = mat[13];\r\n out[2] = mat[14];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the scaling factor component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslationScale\r\n * with a normalized Quaternion parameter, the returned vector will be\r\n * the same as the scaling vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive scaling factor component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getScaling(out: Vec3Like, mat: Readonly): Vec3Like {\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a quaternion representing the rotational component\r\n * of a transformation matrix. If a matrix is built with\r\n * fromRotationTranslation, the returned quaternion will be the\r\n * same as the quaternion originally supplied.\r\n * @category Static\r\n *\r\n * @param out - Quaternion to receive the rotation component\r\n * @param mat - Matrix to be decomposed (input)\r\n * @return `out`\r\n */\r\n static getRotation(out: QuatLike, mat: Readonly): QuatLike {\r\n Mat4.getScaling(Mat4.#TMP_VEC3, mat);\r\n\r\n const is1 = 1 / Mat4.#TMP_VEC3[0];\r\n const is2 = 1 / Mat4.#TMP_VEC3[1];\r\n const is3 = 1 / Mat4.#TMP_VEC3[2];\r\n\r\n const sm11 = mat[0] * is1;\r\n const sm12 = mat[1] * is2;\r\n const sm13 = mat[2] * is3;\r\n const sm21 = mat[4] * is1;\r\n const sm22 = mat[5] * is2;\r\n const sm23 = mat[6] * is3;\r\n const sm31 = mat[8] * is1;\r\n const sm32 = mat[9] * is2;\r\n const sm33 = mat[10] * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out[3] = 0.25 * S;\r\n out[0] = (sm23 - sm32) / S;\r\n out[1] = (sm31 - sm13) / S;\r\n out[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out[3] = (sm23 - sm32) / S;\r\n out[0] = 0.25 * S;\r\n out[1] = (sm12 + sm21) / S;\r\n out[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out[3] = (sm31 - sm13) / S;\r\n out[0] = (sm12 + sm21) / S;\r\n out[1] = 0.25 * S;\r\n out[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out[3] = (sm12 - sm21) / S;\r\n out[0] = (sm31 + sm13) / S;\r\n out[1] = (sm23 + sm32) / S;\r\n out[2] = 0.25 * S;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Decomposes a transformation matrix into its rotation, translation\r\n * and scale components. Returns only the rotation component\r\n * @category Static\r\n *\r\n * @param out_r - Quaternion to receive the rotation component\r\n * @param out_t - Vector to receive the translation vector\r\n * @param out_s - Vector to receive the scaling factor\r\n * @param mat - Matrix to be decomposed (input)\r\n * @returns `out_r`\r\n */\r\n static decompose(out_r: QuatLike, out_t: Vec3Like, out_s: Vec3Like, mat: Readonly): QuatLike {\r\n out_t[0] = mat[12];\r\n out_t[1] = mat[13];\r\n out_t[2] = mat[14];\r\n\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n const is1 = 1 / out_s[0];\r\n const is2 = 1 / out_s[1];\r\n const is3 = 1 / out_s[2];\r\n\r\n const sm11 = m11 * is1;\r\n const sm12 = m12 * is2;\r\n const sm13 = m13 * is3;\r\n const sm21 = m21 * is1;\r\n const sm22 = m22 * is2;\r\n const sm23 = m23 * is3;\r\n const sm31 = m31 * is1;\r\n const sm32 = m32 * is2;\r\n const sm33 = m33 * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out_r[3] = 0.25 * S;\r\n out_r[0] = (sm23 - sm32) / S;\r\n out_r[1] = (sm31 - sm13) / S;\r\n out_r[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out_r[3] = (sm23 - sm32) / S;\r\n out_r[0] = 0.25 * S;\r\n out_r[1] = (sm12 + sm21) / S;\r\n out_r[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out_r[3] = (sm31 - sm13) / S;\r\n out_r[0] = (sm12 + sm21) / S;\r\n out_r[1] = 0.25 * S;\r\n out_r[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out_r[3] = (sm12 - sm21) / S;\r\n out_r[0] = (sm31 + sm13) / S;\r\n out_r[1] = (sm23 + sm32) / S;\r\n out_r[2] = 0.25 * S;\r\n }\r\n\r\n return out_r;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScale(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n out[0] = (1 - (yy + zz)) * sx;\r\n out[1] = (xy + wz) * sx;\r\n out[2] = (xz - wy) * sx;\r\n out[3] = 0;\r\n out[4] = (xy - wz) * sy;\r\n out[5] = (1 - (xx + zz)) * sy;\r\n out[6] = (yz + wx) * sy;\r\n out[7] = 0;\r\n out[8] = (xz + wy) * sz;\r\n out[9] = (yz - wx) * sz;\r\n out[10] = (1 - (xx + yy)) * sz;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the\r\n * given origin. This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * mat4.translate(dest, origin);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n * mat4.translate(dest, negativeOrigin);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @param o - The origin vector around which to scale and rotate\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScaleOrigin(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly, o: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n const ox = o[0];\r\n const oy = o[1];\r\n const oz = o[2];\r\n\r\n const out0 = (1 - (yy + zz)) * sx;\r\n const out1 = (xy + wz) * sx;\r\n const out2 = (xz - wy) * sx;\r\n const out4 = (xy - wz) * sy;\r\n const out5 = (1 - (xx + zz)) * sy;\r\n const out6 = (yz + wx) * sy;\r\n const out8 = (xz + wy) * sz;\r\n const out9 = (yz - wx) * sz;\r\n const out10 = (1 - (xx + yy)) * sz;\r\n\r\n out[0] = out0;\r\n out[1] = out1;\r\n out[2] = out2;\r\n out[3] = 0;\r\n out[4] = out4;\r\n out[5] = out5;\r\n out[6] = out6;\r\n out[7] = 0;\r\n out[8] = out8;\r\n out[9] = out9;\r\n out[10] = out10;\r\n out[11] = 0;\r\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\r\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\r\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 4x4 matrix from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Quaternion to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat4Like, q: Readonly): Mat4Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[1] = yx + wz;\r\n out[2] = zx - wy;\r\n out[3] = 0;\r\n\r\n out[4] = yx - wz;\r\n out[5] = 1 - xx - zz;\r\n out[6] = zy + wx;\r\n out[7] = 0;\r\n\r\n out[8] = zx + wy;\r\n out[9] = zy - wx;\r\n out[10] = 1 - xx - yy;\r\n out[11] = 0;\r\n\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.frustumNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly\r\n */\r\n static frustum(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like { return out; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveNO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.perspectiveNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static perspective(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveZO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating\r\n * projection matrices to be used with the still experimental WebVR API.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n * @deprecated\r\n */\r\n static perspectiveFromFieldOfView(out: Mat4Like,\r\n fov: { upDegrees: number, downDegrees: number, leftDegrees: number, rightDegrees: number }, near: number,\r\n far: number): Mat4Like {\r\n\r\n const upTan = Math.tan((fov.upDegrees * Math.PI) / 180.0);\r\n const downTan = Math.tan((fov.downDegrees * Math.PI) / 180.0);\r\n const leftTan = Math.tan((fov.leftDegrees * Math.PI) / 180.0);\r\n const rightTan = Math.tan((fov.rightDegrees * Math.PI) / 180.0);\r\n const xScale = 2.0 / (leftTan + rightTan);\r\n const yScale = 2.0 / (upTan + downTan);\r\n\r\n out[0] = xScale;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n out[4] = 0.0;\r\n out[5] = yScale;\r\n out[6] = 0.0;\r\n out[7] = 0.0;\r\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\r\n out[9] = (upTan - downTan) * yScale * 0.5;\r\n out[10] = far / (near - far);\r\n out[11] = -1.0;\r\n out[12] = 0.0;\r\n out[13] = 0.0;\r\n out[14] = (far * near) / (near - far);\r\n out[15] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 2 * nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = (far + near) * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.orthoNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static ortho(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, far: number):\r\n Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = near * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that\r\n * actually makes an object look at another object, you should use targetTo instead.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param center - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static lookAt(out: Mat4Like, eye: Readonly, center: Readonly, up: Readonly): Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n const centerx = center[0];\r\n const centery = center[1];\r\n const centerz = center[2];\r\n\r\n if (\r\n Math.abs(eyex - centerx) < GLM_EPSILON &&\r\n Math.abs(eyey - centery) < GLM_EPSILON &&\r\n Math.abs(eyez - centerz) < GLM_EPSILON\r\n ) {\r\n return Mat4.identity(out);\r\n }\r\n\r\n let z0 = eyex - centerx;\r\n let z1 = eyey - centery;\r\n let z2 = eyez - centerz;\r\n\r\n let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\r\n if (!len) {\r\n x0 = 0;\r\n x1 = 0;\r\n x2 = 0;\r\n } else {\r\n len = 1 / len;\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n let y0 = z1 * x2 - z2 * x1;\r\n let y1 = z2 * x0 - z0 * x2;\r\n let y2 = z0 * x1 - z1 * x0;\r\n\r\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\r\n if (!len) {\r\n y0 = 0;\r\n y1 = 0;\r\n y2 = 0;\r\n } else {\r\n len = 1 / len;\r\n y0 *= len;\r\n y1 *= len;\r\n y2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = y0;\r\n out[2] = z0;\r\n out[3] = 0;\r\n out[4] = x1;\r\n out[5] = y1;\r\n out[6] = z1;\r\n out[7] = 0;\r\n out[8] = x2;\r\n out[9] = y2;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\r\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\r\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a matrix that makes something look at something else.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param target - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static targetTo(out: Mat4Like, eye: Readonly, target: Readonly, up: Readonly):\r\n Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n\r\n let z0 = eyex - target[0];\r\n let z1 = eyey - target[1];\r\n let z2 = eyez - target[2];\r\n\r\n let len = z0 * z0 + z1 * z1 + z2 * z2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n }\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n\r\n len = x0 * x0 + x1 * x1 + x2 * x2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = x1;\r\n out[2] = x2;\r\n out[3] = 0;\r\n out[4] = z1 * x2 - z2 * x1;\r\n out[5] = z2 * x0 - z0 * x2;\r\n out[6] = z0 * x1 - z1 * x0;\r\n out[7] = 0;\r\n out[8] = z0;\r\n out[9] = z1;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = eyex;\r\n out[13] = eyey;\r\n out[14] = eyez;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8] +\r\n a[9] * a[9] +\r\n a[10] * a[10] +\r\n a[11] * a[11] +\r\n a[12] * a[12] +\r\n a[13] * a[13] +\r\n a[14] * a[14] +\r\n a[15] * a[15]\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n out[9] = a[9] + b[9];\r\n out[10] = a[10] + b[10];\r\n out[11] = a[11] + b[11];\r\n out[12] = a[12] + b[12];\r\n out[13] = a[13] + b[13];\r\n out[14] = a[14] + b[14];\r\n out[15] = a[15] + b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n out[9] = a[9] - b[9];\r\n out[10] = a[10] - b[10];\r\n out[11] = a[11] - b[11];\r\n out[12] = a[12] - b[12];\r\n out[13] = a[13] - b[13];\r\n out[14] = a[14] - b[14];\r\n out[15] = a[15] - b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Multiply each element of the matrix by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat4Like, a: Readonly, b: number): Mat4Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n out[9] = a[9] * b;\r\n out[10] = a[10] * b;\r\n out[11] = a[11] * b;\r\n out[12] = a[12] * b;\r\n out[13] = a[13] * b;\r\n out[14] = a[14] * b;\r\n out[15] = a[15] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat4Like, a: Readonly, b: Readonly, scale: number): Mat4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n out[9] = a[9] + b[9] * scale;\r\n out[10] = a[10] + b[10] * scale;\r\n out[11] = a[11] + b[11] * scale;\r\n out[12] = a[12] + b[12] * scale;\r\n out[13] = a[13] + b[13] * scale;\r\n out[14] = a[14] + b[14] * scale;\r\n out[15] = a[15] + b[15] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8] &&\r\n a[9] === b[9] &&\r\n a[10] === b[10] &&\r\n a[11] === b[11] &&\r\n a[12] === b[12] &&\r\n a[13] === b[13] &&\r\n a[14] === b[14] &&\r\n a[15] === b[15]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n const a9 = a[9];\r\n const a10 = a[10];\r\n const a11 = a[11];\r\n const a12 = a[12];\r\n const a13 = a[13];\r\n const a14 = a[14];\r\n const a15 = a[15];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n const b9 = b[9];\r\n const b10 = b[10];\r\n const b11 = b[11];\r\n const b12 = b[12];\r\n const b13 = b[13];\r\n const b14 = b[14];\r\n const b15 = b[15];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) &&\r\n Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) &&\r\n Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) &&\r\n Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) &&\r\n Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) &&\r\n Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) &&\r\n Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) &&\r\n Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat4(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat4.prototype.mul = Mat4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat4.sub = Mat4.subtract;\r\nMat4.mul = Mat4.multiply;\r\nMat4.frustum = Mat4.frustumNO;\r\nMat4.perspective = Mat4.perspectiveNO;\r\nMat4.ortho = Mat4.orthoNO;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, Mat4Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 3 Dimensional Vector\r\n */\r\nexport class Vec3 extends Float32Array {\r\n /**\r\n * Create a {@link Vec3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 3:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 3); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 3);\r\n }\r\n break;\r\n }\r\n default:\r\n super(3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec3.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec3.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec3} to `this`.\r\n * Equivalent to `Vec3.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec3} from `this`.\r\n * Equivalent to `Vec3.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec3.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec3.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec3.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec3.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec3.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to its absolute value.\r\n * Equivalent to `Vec3.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec3}.\r\n * Equivalent to `Vec3.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec3.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec3.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 3 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty vec3\r\n * @category Static\r\n *\r\n * @returns a new 3D vector\r\n */\r\n static create(): Vec3 {\r\n return new Vec3();\r\n }\r\n\r\n /**\r\n * Creates a new vec3 initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 3D vector\r\n */\r\n static clone(a: Readonly): Vec3 {\r\n return new Vec3(a);\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Creates a new vec3 initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns a new 3D vector\r\n */\r\n static fromValues(x: number, y: number, z: number): Vec3 {\r\n return new Vec3(x, y, z);\r\n }\r\n\r\n /**\r\n * Copy the values from one vec3 to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns `out`\r\n */\r\n static set(out: Vec3Like, x: number, y: number, z: number): Vec3Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Multiplies two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; }\r\n\r\n /**\r\n * Divides two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Math.ceil the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * symmetric round the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n /*\r\n static round(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = glMatrix.round(a[0]);\r\n out[1] = glMatrix.round(a[1]);\r\n out[2] = glMatrix.round(a[2]);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Scales a vec3 by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec3Like, a: Readonly, scale: number): Vec3Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two vec3's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec3Like, a: Readonly, b: Readonly, scale: number) {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared length of a vec3\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec3Like, a: Readonly): Vec3Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n let len = x * x + y * y + z * z;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n out[2] = a[2] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2];\r\n const bx = b[0],\r\n by = b[1],\r\n bz = b[2];\r\n\r\n out[0] = ay * bz - az * by;\r\n out[1] = az * bx - ax * bz;\r\n out[2] = ax * by - ay * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const angle = Math.acos(Math.min(Math.max(Vec3.dot(a, b), -1), 1));\r\n const sinTotal = Math.sin(angle);\r\n\r\n const ratioA = Math.sin((1 - t) * angle) / sinTotal;\r\n const ratioB = Math.sin(t * angle) / sinTotal;\r\n out[0] = ratioA * a[0] + ratioB * b[0];\r\n out[1] = ratioA * a[1] + ratioB * b[1];\r\n out[2] = ratioA * a[2] + ratioB * b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a hermite interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static hermite(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const factorTimes2 = t * t;\r\n const factor1 = factorTimes2 * (2 * t - 3) + 1;\r\n const factor2 = factorTimes2 * (t - 2) + t;\r\n const factor3 = factorTimes2 * (t - 1);\r\n const factor4 = factorTimes2 * (3 - 2 * t);\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a bezier interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static bezier(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const inverseFactor = 1 - t;\r\n const inverseFactorTimesTwo = inverseFactor * inverseFactor;\r\n const factorTimes2 = t * t;\r\n const factor1 = inverseFactorTimesTwo * inverseFactor;\r\n const factor2 = 3 * t * inverseFactorTimesTwo;\r\n const factor3 = 3 * factorTimes2 * inverseFactor;\r\n const factor4 = factorTimes2 * t;\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec3Like, scale) {\r\n scale = scale === undefined ? 1.0 : scale;\r\n\r\n let r = glMatrix.RANDOM() * 2.0 * Math.PI;\r\n let z = glMatrix.RANDOM() * 2.0 - 1.0;\r\n let zScale = Math.sqrt(1.0 - z * z) * scale;\r\n\r\n out[0] = Math.cos(r) * zScale;\r\n out[1] = Math.sin(r) * zScale;\r\n out[2] = z * scale;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the vec3 with a mat4.\r\n * 4th vector component is implicitly '1'\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec3Like, a: Readonly, m: Readonly): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1.0;\r\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\r\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\r\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a mat3.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - the 3x3 matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat3(out: Vec3Like, a: Vec3Like, m: Mat3Like): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n out[0] = x * m[0] + y * m[3] + z * m[6];\r\n out[1] = x * m[1] + y * m[4] + z * m[7];\r\n out[2] = x * m[2] + y * m[5] + z * m[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a quat\r\n * Can also be used for dual quaternions. (Multiply it with the real part)\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec3Like, a: Readonly, q: Readonly): Vec3Like {\r\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const w2 = q[3] * 2;\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n // var qvec = [qx, qy, qz];\r\n // var uv = vec3.cross([], qvec, a);\r\n const uvx = (qy * z - qz * y);\r\n const uvy = (qz * x - qx * z);\r\n const uvz = (qx * y - qy * x);\r\n // var uuv = vec3.cross([], qvec, uv);\r\n // vec3.scale(uuv, uuv, 2);\r\n const uuvx = (qy * uvz - qz * uvy) * 2;\r\n const uuvy = (qz * uvx - qx * uvz) * 2;\r\n const uuvz = (qx * uvy - qy * uvx) * 2;\r\n // vec3.scale(uv, uv, 2 * w);\r\n // return vec3.add(out, a, vec3.add(out, uv, uuv));\r\n out[0] = x + (uvx * w2) + uuvx;\r\n out[1] = y + (uvy * w2) + uuvy;\r\n out[2] = z + (uvz * w2) + uuvz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the x-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateX(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const by = b[1];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const py = a[1] - by;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = a[0];\r\n out[1] = (py * Math.cos(rad) - pz * Math.sin(rad)) + by;\r\n out[2] = (py * Math.sin(rad) + pz * Math.cos(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the y-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateY(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (pz * Math.sin(rad) + px * Math.cos(rad)) + bx;\r\n out[1] = a[1];\r\n out[2] = (pz * Math.cos(rad) - px * Math.sin(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the z-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const by = b[1];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const py = a[1] - by;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (px * Math.cos(rad) - py * Math.sin(rad)) + bx;\r\n out[1] = (px * Math.sin(rad) + py * Math.cos(rad)) + by;\r\n out[2] = b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 3D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly) {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz));\r\n const cosine = mag && Vec3.dot(a, b) / mag;\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec3Like): Vec3Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec3(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec3.prototype.sub = Vec3.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.mul = Vec3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.div = Vec3.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.dist = Vec3.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.sqrDist = Vec3.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec3.sub = Vec3.subtract;\r\nVec3.mul = Vec3.multiply;\r\nVec3.div = Vec3.divide;\r\nVec3.dist = Vec3.distance;\r\nVec3.sqrDist = Vec3.squaredDistance;\r\nVec3.sqrLen = Vec3.squaredLength;\r\nVec3.mag = Vec3.magnitude;\r\nVec3.length = Vec3.magnitude;\r\nVec3.len = Vec3.magnitude;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Vec4Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 4 Dimensional Vector\r\n */\r\nexport class Vec4 extends Float32Array {\r\n /**\r\n * Create a {@link Vec4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the vector. Equivalent to `this[3];`\r\n * @category Vector Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The a component of the vector. Equivalent to `this[3];`\r\n * @category Color Components\r\n */\r\n get a(): number { return this[3]; }\r\n set a(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec4.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec4} to `this`.\r\n * Equivalent to `Vec4.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n this[3] += b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec4} from `this`.\r\n * Equivalent to `Vec4.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n this[3] -= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n this[3] *= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n this[3] /= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec4.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n this[3] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n this[3] += b[3] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec4.distance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec4.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec4.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n this[3] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec4.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n this[3] = 1.0 / this[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec4.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n this[3] = Math.abs(this[3]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec4}.\r\n * Equivalent to `Vec4.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec4.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec4.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec4}\r\n * @category Static\r\n *\r\n * @returns a new 4D vector\r\n */\r\n static create(): Vec4 {\r\n return new Vec4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 4D vector\r\n */\r\n static clone(a: Vec4Like): Vec4 {\r\n return new Vec4(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new 4D vector\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Vec4 {\r\n return new Vec4(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec4} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n static set(out: Vec4Like, x: number, y: number, z: number, w: number): Vec4Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n out[3] = a[3] * b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Divides two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n out[3] = a[3] / b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n out[3] = Math.ceil(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n out[3] = Math.floor(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n out[3] = Math.min(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n out[3] = Math.max(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n out[2] = Math.round(a[2]);\r\n out[3] = Math.round(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec4} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec4Like, a: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}'s after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec4Like, a: Readonly, b: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return Math.hypot(x, y, z, w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of `a`\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = -a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n out[3] = 1.0 / a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n out[3] = Math.abs(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec4Like, a: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n let len = x * x + y * y + z * z + w * w;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = x * len;\r\n out[1] = y * len;\r\n out[2] = z * len;\r\n out[3] = w * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Returns the cross-product of three vectors in a 4-dimensional space\r\n * @category Static\r\n *\r\n * @param out the receiving vector\r\n * @param u - the first vector\r\n * @param v - the second vector\r\n * @param w - the third vector\r\n * @returns result\r\n */\r\n static cross(out: Vec4Like, u: Readonly, v: Readonly, w: Readonly): Vec4Like {\r\n const a = v[0] * w[1] - v[1] * w[0];\r\n const b = v[0] * w[2] - v[2] * w[0];\r\n const c = v[0] * w[3] - v[3] * w[0];\r\n const d = v[1] * w[2] - v[2] * w[1];\r\n const e = v[1] * w[3] - v[3] * w[1];\r\n const f = v[2] * w[3] - v[3] * w[2];\r\n const g = u[0];\r\n const h = u[1];\r\n const i = u[2];\r\n const j = u[3];\r\n\r\n out[0] = h * f - i * e + j * d;\r\n out[1] = -(g * f) + i * c - j * b;\r\n out[2] = g * e - h * c + j * a;\r\n out[3] = -(g * d) + h * b - i * a;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec4Like, a: Readonly, b: Readonly, t: number): Vec4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n out[3] = aw + t * (b[3] - aw);\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec4Like, scale): Vec4Like {\r\n scale = scale || 1.0;\r\n\r\n // Marsaglia, George. Choosing a Point from the Surface of a\r\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\r\n // http://projecteuclid.org/euclid.aoms/1177692644;\r\n var v1, v2, v3, v4;\r\n var s1, s2;\r\n do {\r\n v1 = glMatrix.RANDOM() * 2 - 1;\r\n v2 = glMatrix.RANDOM() * 2 - 1;\r\n s1 = v1 * v1 + v2 * v2;\r\n } while (s1 >= 1);\r\n do {\r\n v3 = glMatrix.RANDOM() * 2 - 1;\r\n v4 = glMatrix.RANDOM() * 2 - 1;\r\n s2 = v3 * v3 + v4 * v4;\r\n } while (s2 >= 1);\r\n\r\n var d = Math.sqrt((1 - s1) / s2);\r\n out[0] = scale * v1;\r\n out[1] = scale * v2;\r\n out[2] = scale * v3 * d;\r\n out[3] = scale * v4 * d;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Mat4}.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec4Like, a: Readonly, m: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\r\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\r\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\r\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec4Like, a: Readonly, q: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n\r\n // calculate quat * vec\r\n const ix = qw * x + qy * z - qz * y;\r\n const iy = qw * y + qz * x - qx * z;\r\n const iz = qw * z + qx * y - qy * x;\r\n const iw = -qx * x - qy * y - qz * z;\r\n\r\n // calculate result * inverse quat\r\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\r\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\r\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec4Like): Vec4Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec4(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec4.prototype.sub = Vec4.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.mul = Vec4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.div = Vec4.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.dist = Vec4.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.sqrDist = Vec4.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec4.sub = Vec4.subtract;\r\nVec4.mul = Vec4.multiply;\r\nVec4.div = Vec4.divide;\r\nVec4.dist = Vec4.distance;\r\nVec4.sqrDist = Vec4.squaredDistance;\r\nVec4.sqrLen = Vec4.squaredLength;\r\nVec4.mag = Vec4.magnitude;\r\nVec4.length = Vec4.magnitude;\r\nVec4.len = Vec4.magnitude;\r\n", "import { Vec3 } from './Vec3.js';\r\nimport { Vec4 } from './Vec4.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Quaternion\r\n */\r\nexport class Quat extends Float32Array {\r\n static #DEFAULT_ANGLE_ORDER = 'zyx';\r\n\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT1 = new Float32Array(4);\r\n static #TMP_QUAT2 = new Float32Array(4);\r\n static #TMP_MAT3 = new Float32Array(9);\r\n\r\n static #TMP_VEC3 = new Float32Array(3);\r\n static #X_UNIT_VEC3 = new Float32Array([1, 0, 0]);\r\n static #Y_UNIT_VEC3 = new Float32Array([0, 1, 0]);\r\n\r\n /**\r\n * Create a {@link Quat}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the quaternion. Equivalent to `this[0];`\r\n * @category Quaternion Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the quaternion. Equivalent to `this[1];`\r\n * @category Quaternion Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the quaternion. Equivalent to `this[2];`\r\n * @category Quaternion Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the quaternion. Equivalent to `this[3];`\r\n * @category Quaternion Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Quat.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity quaternion\r\n * Equivalent to Quat.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this[0] = 0;\r\n this[1] = 0;\r\n this[2] = 0;\r\n this[3] = 1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies `this` by a {@link Quat}.\r\n * Equivalent to `Quat.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Quat.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Rotates `this` by the given angle about the X axis\r\n * Equivalent to `Quat.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Quat.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Y axis\r\n * Equivalent to `Quat.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Quat.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Z axis\r\n * Equivalent to `Quat.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Quat.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Inverts `this`\r\n * Equivalent to `Quat.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Quat.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales `this` by a scalar number\r\n * Equivalent to `Quat.scale(this, this, scale);`\r\n * @category Methods\r\n *\r\n * @param scale - amount to scale the vector by\r\n * @returns `this`\r\n */\r\n scale(scale: number): QuatLike {\r\n this[0] *= scale;\r\n this[1] *= scale;\r\n this[2] *= scale;\r\n this[3] *= scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of `this` and another {@link Quat}\r\n * Equivalent to `Quat.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - the second operand\r\n * @returns dot product of `this` and b\r\n */\r\n dot(b: Readonly): number {\r\n return Quat.dot(this, b);\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity quat\r\n * @category Static\r\n *\r\n * @returns a new quaternion\r\n */\r\n static create(): Quat {\r\n return new Quat();\r\n }\r\n\r\n /**\r\n * Set a quat to the identity quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a quat from the given angle and rotation axis,\r\n * then returns it.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param axis - the axis around which to rotate\r\n * @param rad - the angle in radians\r\n * @returns `out`\r\n **/\r\n static setAxisAngle(out: QuatLike, axis: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n out[0] = s * axis[0];\r\n out[1] = s * axis[1];\r\n out[2] = s * axis[2];\r\n out[3] = Math.cos(rad);\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the rotation axis and angle for a given\r\n * quaternion. If a quaternion is created with\r\n * setAxisAngle, this method will return the same\r\n * values as provided in the original parameter list\r\n * OR functionally equivalent values.\r\n * Example: The quaternion formed by axis [0, 0, 1] and\r\n * angle -90 is the same as the quaternion formed by\r\n * [0, 0, 1] and 270. This method favors the latter.\r\n * @category Static\r\n *\r\n * @param out_axis - Vector receiving the axis of rotation\r\n * @param q - Quaternion to be decomposed\r\n * @return Angle, in radians, of the rotation\r\n */\r\n static getAxisAngle(out_axis: Vec3Like, q: Readonly): number {\r\n const rad = Math.acos(q[3]) * 2.0;\r\n const s = Math.sin(rad / 2.0);\r\n if (s > GLM_EPSILON) {\r\n out_axis[0] = q[0] / s;\r\n out_axis[1] = q[1] / s;\r\n out_axis[2] = q[2] / s;\r\n } else {\r\n // If s is zero, return any axis (no rotation - axis does not matter)\r\n out_axis[0] = 1;\r\n out_axis[1] = 0;\r\n out_axis[2] = 0;\r\n }\r\n return rad;\r\n }\r\n\r\n /**\r\n * Gets the angular distance between two unit quaternions\r\n * @category Static\r\n *\r\n * @param {ReadonlyQuat} a Origin unit quaternion\r\n * @param {ReadonlyQuat} b Destination unit quaternion\r\n * @return {Number} Angle, in radians, between the two quaternions\r\n */\r\n static getAngle(a: Readonly, b: Readonly): number {\r\n const dotproduct = Quat.dot(a, b);\r\n\r\n return Math.acos(2 * dotproduct * dotproduct - 1);\r\n }\r\n\r\n /**\r\n * Multiplies two quaternions.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const bw = b[3];\r\n\r\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the X axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + aw * bx;\r\n out[1] = ay * bw + az * bx;\r\n out[2] = az * bw - ay * bx;\r\n out[3] = aw * bw - ax * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Y axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const by = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw - az * by;\r\n out[1] = ay * bw + aw * by;\r\n out[2] = az * bw + ax * by;\r\n out[3] = aw * bw - ay * by;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Z axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bz = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + ay * bz;\r\n out[1] = ay * bw - ax * bz;\r\n out[2] = az * bw + aw * bz;\r\n out[3] = aw * bw - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the W component of a quat from the X, Y, and Z components.\r\n * Assumes that quaternion is 1 unit in length.\r\n * Any existing W component will be ignored.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate W component of\r\n * @returns `out`\r\n */\r\n static calculateW(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the exponential of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static exp(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const et = Math.exp(w);\r\n const s = r > 0 ? (et * Math.sin(r)) / r : 0;\r\n\r\n out[0] = x * s;\r\n out[1] = y * s;\r\n out[2] = z * s;\r\n out[3] = et * Math.cos(r);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the natural logarithm of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static ln(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const t = r > 0 ? Math.atan2(r, w) / r : 0;\r\n\r\n out[0] = x * t;\r\n out[1] = y * t;\r\n out[2] = z * t;\r\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the scalar power of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @param b - amount to scale the quaternion by\r\n * @returns `out`\r\n */\r\n static pow(out: QuatLike, a: Readonly, b: number): QuatLike {\r\n Quat.ln(out, a);\r\n Quat.scale(out, out, b);\r\n Quat.exp(out, out);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike {\r\n // benchmarks:\r\n // http://jsperf.com/quaternion-slerp-implementations\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2],\r\n aw = a[3];\r\n let bx = b[0],\r\n by = b[1],\r\n bz = b[2],\r\n bw = b[3];\r\n\r\n let scale0: number;\r\n let scale1: number;\r\n\r\n // calc cosine\r\n let cosom = ax * bx + ay * by + az * bz + aw * bw;\r\n // adjust signs (if necessary)\r\n if (cosom < 0.0) {\r\n cosom = -cosom;\r\n bx = -bx;\r\n by = -by;\r\n bz = -bz;\r\n bw = -bw;\r\n }\r\n // calculate coefficients\r\n if (1.0 - cosom > GLM_EPSILON) {\r\n // standard case (slerp)\r\n const omega = Math.acos(cosom);\r\n const sinom = Math.sin(omega);\r\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\r\n scale1 = Math.sin(t * omega) / sinom;\r\n } else {\r\n // \"from\" and \"to\" quaternions are very close\r\n // ... so we can do a linear interpolation\r\n scale0 = 1.0 - t;\r\n scale1 = t;\r\n }\r\n // calculate final values\r\n out[0] = scale0 * ax + scale1 * bx;\r\n out[1] = scale0 * ay + scale1 * by;\r\n out[2] = scale0 * az + scale1 * bz;\r\n out[3] = scale0 * aw + scale1 * bw;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random unit quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n /* static random(out: QuatLike): QuatLike {\r\n // Implementation of http://planning.cs.uiuc.edu/node198.html\r\n // TODO: Calling random 3 times is probably not the fastest solution\r\n let u1 = glMatrix.RANDOM();\r\n let u2 = glMatrix.RANDOM();\r\n let u3 = glMatrix.RANDOM();\r\n\r\n let sqrt1MinusU1 = Math.sqrt(1 - u1);\r\n let sqrtU1 = Math.sqrt(u1);\r\n\r\n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\r\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\r\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\r\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Calculates the inverse of a quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: QuatLike, a: Readonly): QuatLike {\r\n const a0 = a[0],\r\n a1 = a[1],\r\n a2 = a[2],\r\n a3 = a[3];\r\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\r\n const invDot = dot ? 1.0 / dot : 0;\r\n\r\n // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\r\n\r\n out[0] = -a0 * invDot;\r\n out[1] = -a1 * invDot;\r\n out[2] = -a2 * invDot;\r\n out[3] = a3 * invDot;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a quat\r\n * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given 3x3 rotation matrix.\r\n *\r\n * NOTE: The resultant quaternion is not normalized, so you should be sure\r\n * to re-normalize the quaternion yourself where necessary.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param m - rotation matrix\r\n * @returns `out`\r\n */\r\n static fromMat3(out: QuatLike, m: Readonly): QuatLike {\r\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\r\n // article \"Quaternion Calculus and Fast Animation\".\r\n const fTrace = m[0] + m[4] + m[8];\r\n let fRoot: number;\r\n\r\n if (fTrace > 0.0) {\r\n // |w| > 1/2, may as well choose w > 1/2\r\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\r\n out[3] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot; // 1/(4w)\r\n out[0] = (m[5] - m[7]) * fRoot;\r\n out[1] = (m[6] - m[2]) * fRoot;\r\n out[2] = (m[1] - m[3]) * fRoot;\r\n } else {\r\n // |w| <= 1/2\r\n let i = 0;\r\n if (m[4] > m[0]) { i = 1; }\r\n if (m[8] > m[i * 3 + i]) { i = 2; }\r\n const j = (i + 1) % 3;\r\n const k = (i + 2) % 3;\r\n\r\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\r\n out[i] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot;\r\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\r\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\r\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given euler angle x, y, z.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - Angle to rotate around X axis in degrees.\r\n * @param y - Angle to rotate around Y axis in degrees.\r\n * @param z - Angle to rotate around Z axis in degrees.\r\n * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx.\r\n * @returns `out`\r\n */\r\n static fromEuler(out: QuatLike, x: number, y: number, z: number, order = Quat.#DEFAULT_ANGLE_ORDER): QuatLike {\r\n const halfToRad = (0.5 * Math.PI) / 180.0;\r\n x *= halfToRad;\r\n y *= halfToRad;\r\n z *= halfToRad;\r\n\r\n const sx = Math.sin(x);\r\n const cx = Math.cos(x);\r\n const sy = Math.sin(y);\r\n const cy = Math.cos(y);\r\n const sz = Math.sin(z);\r\n const cz = Math.cos(z);\r\n\r\n switch (order) {\r\n case 'xyz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'xzy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yxz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yzx':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zxy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zyx':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n default:\r\n throw new Error(`Unknown angle order ${order}`);\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a quatenion\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - quaternion to clone\r\n * @returns a new quaternion\r\n */\r\n static clone(a: Readonly): Quat {\r\n return new Quat(a);\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new quaternion\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Quat {\r\n return new Quat(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one quat to another\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the source quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static set(out: QuatLike, x: number, y: number, z: number, w: number): QuatLike { return out; }\r\n\r\n /**\r\n * Adds two {@link Quat}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static add(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Scales a quat by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param b - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: QuatLike, a: Readonly, scale: number): QuatLike {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two quat's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two quat's\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static lerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike { return out; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mag(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quaternion to normalize\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static normalize(out: QuatLike, a: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first quaternion.\r\n * @param b - The second quaternion.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static exactEquals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Returns whether the quaternions have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static equals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Sets a quaternion to represent the shortest rotation from one\r\n * vector to another.\r\n *\r\n * Both vectors are assumed to be unit length.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion.\r\n * @param a - the initial vector\r\n * @param b - the destination vector\r\n * @returns `out`\r\n */\r\n static rotationTo(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const dot = Vec3.dot(a, b);\r\n\r\n if (dot < -0.999999) {\r\n Vec3.cross(Quat.#TMP_VEC3, Quat.#X_UNIT_VEC3, a);\r\n if (Vec3.mag(Quat.#TMP_VEC3) < 0.000001) { Vec3.cross(Quat.#TMP_VEC3, Quat.#Y_UNIT_VEC3, a); }\r\n Vec3.normalize(Quat.#TMP_VEC3, Quat.#TMP_VEC3);\r\n Quat.setAxisAngle(out, Quat.#TMP_VEC3, Math.PI);\r\n return out;\r\n } else if (dot > 0.999999) {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n } else {\r\n Vec3.cross(Quat.#TMP_VEC3, a, b);\r\n out[0] = Quat.#TMP_VEC3[0];\r\n out[1] = Quat.#TMP_VEC3[1];\r\n out[2] = Quat.#TMP_VEC3[2];\r\n out[3] = 1 + dot;\r\n return Quat.normalize(out, out);\r\n }\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static sqlerp(out: QuatLike, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): QuatLike {\r\n Quat.slerp(Quat.#TMP_QUAT1, a, d, t);\r\n Quat.slerp(Quat.#TMP_QUAT2, b, c, t);\r\n Quat.slerp(out, Quat.#TMP_QUAT1, Quat.#TMP_QUAT2, 2 * t * (1 - t));\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets the specified quaternion with values corresponding to the given\r\n * axes. Each axis is a vec3 and is expected to be unit length and\r\n * perpendicular to all other specified axes.\r\n * @category Static\r\n *\r\n * @param out - The receiving quaternion\r\n * @param view - the vector representing the viewing direction\r\n * @param right - the vector representing the local `right` direction\r\n * @param up - the vector representing the local `up` direction\r\n * @returns `out`\r\n */\r\n static setAxes(out: QuatLike, view: Readonly, right: Readonly, up: Readonly): QuatLike {\r\n Quat.#TMP_MAT3[0] = right[0];\r\n Quat.#TMP_MAT3[3] = right[1];\r\n Quat.#TMP_MAT3[6] = right[2];\r\n\r\n Quat.#TMP_MAT3[1] = up[0];\r\n Quat.#TMP_MAT3[4] = up[1];\r\n Quat.#TMP_MAT3[7] = up[2];\r\n\r\n Quat.#TMP_MAT3[2] = -view[0];\r\n Quat.#TMP_MAT3[5] = -view[1];\r\n Quat.#TMP_MAT3[8] = -view[2];\r\n\r\n return Quat.normalize(out, Quat.fromMat3(out, Quat.#TMP_MAT3));\r\n }\r\n}\r\n\r\n// Methods which re-use the Vec4 implementation\r\nQuat.set = Vec4.set;\r\nQuat.add = Vec4.add;\r\nQuat.lerp = Vec4.lerp;\r\nQuat.normalize = Vec4.normalize;\r\nQuat.squaredLength = Vec4.squaredLength;\r\nQuat.sqrLen = Vec4.squaredLength;\r\nQuat.exactEquals = Vec4.exactEquals;\r\nQuat.equals = Vec4.equals;\r\nQuat.magnitude = Vec4.magnitude;\r\n\r\n// Instance method alias assignments\r\nQuat.prototype.mul = Quat.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nQuat.mul = Quat.multiply;\r\nQuat.mag = Quat.magnitude;\r\nQuat.length = Quat.magnitude;\r\nQuat.len = Quat.magnitude;\r\n", "import { Mat4 } from './Mat4.js';\r\nimport { Quat } from './Quat.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Dual Quaternion\r\n */\r\nexport class Quat2 extends Float32Array {\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat2.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT = new Float32Array(4);\r\n static #TMP_VEC3 = new Float32Array(3);\r\n\r\n /**\r\n * Create a {@link Quat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 8:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 8); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v, v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 8);\r\n }\r\n break;\r\n }\r\n default:\r\n super(8);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source dual quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 8 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity {@link Quat2}\r\n * @category Static\r\n *\r\n * @returns a new dual quaternion [real -> rotation, dual -> translation]\r\n */\r\n static create(): Quat2 {\r\n return new Quat2();\r\n }\r\n\r\n /**\r\n * Creates a {@link Quat2} quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to clone\r\n * @returns a new dual quaternion\r\n */\r\n static clone(a: Quat2Like): Quat2 {\r\n return new Quat2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns a new dual quaternion\r\n */\r\n static fromValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2 {\r\n return new Quat2(x1, y1, z1, w1, x2, y2, z2, w2);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} from the given values (quat and translation)\r\n * @category Static\r\n *\r\n * @param x1 - X component (rotation)\r\n * @param y1 - Y component (rotation)\r\n * @param z1 - Z component (rotation)\r\n * @param w1 - W component (rotation)\r\n * @param x2 - X component (translation)\r\n * @param y2 - Y component (translation)\r\n * @param z2 - Z component (translation)\r\n * @returns a new dual quaternion\r\n */\r\n static fromRotationTranslationValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number): Quat2 {\r\n const ax = x2 * 0.5;\r\n const ay = y2 * 0.5;\r\n const az = z2 * 0.5;\r\n\r\n return new Quat2(x1, y1, z1, w1,\r\n ax * w1 + ay * z1 - az * y1,\r\n ay * w1 + az * x1 - ax * z1,\r\n az * w1 + ax * y1 - ay * x1,\r\n -ax * x1 - ay * y1 - az * z1);\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion and a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Quat2Like, q: Readonly, t: Readonly): Quat2Like {\r\n const ax = t[0] * 0.5;\r\n const ay = t[1] * 0.5;\r\n const az = t[2] * 0.5;\r\n const bx = q[0];\r\n const by = q[1];\r\n const bz = q[2];\r\n const bw = q[3];\r\n out[0] = bx;\r\n out[1] = by;\r\n out[2] = bz;\r\n out[3] = bw;\r\n out[4] = ax * bw + ay * bz - az * by;\r\n out[5] = ay * bw + az * bx - ax * bz;\r\n out[6] = az * bw + ax * by - ay * bx;\r\n out[7] = -ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Quat2Like, t: Readonly): Quat2Like {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = t[0] * 0.5;\r\n out[5] = t[1] * 0.5;\r\n out[6] = t[2] * 0.5;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Quat2Like, q: Readonly): Quat2Like {\r\n out[0] = q[0];\r\n out[1] = q[1];\r\n out[2] = q[2];\r\n out[3] = q[3];\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param a - the matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Quat2Like, a: Readonly): Quat2Like {\r\n Mat4.getRotation(Quat2.#TMP_QUAT, a);\r\n Mat4.getTranslation(Quat2.#TMP_VEC3, a);\r\n return Quat2.fromRotationTranslation(out, Quat2.#TMP_QUAT, Quat2.#TMP_VEC3);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Quat2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the source dual quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Quat2} to the identity dual quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns `out`\r\n */\r\n static set(out: Quat2Like, x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2Like {\r\n out[0] = x1;\r\n out[1] = y1;\r\n out[2] = z1;\r\n out[3] = w1;\r\n out[4] = x2;\r\n out[5] = y2;\r\n out[6] = z2;\r\n out[7] = w2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the real part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - real part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getReal(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Gets the dual part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - dual part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getDual(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[4];\r\n out[1] = a[5];\r\n out[2] = a[6];\r\n out[3] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the real component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the real part\r\n * @return `out`\r\n */\r\n static setReal(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Set the dual component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the dual part\r\n * @return `out`\r\n */\r\n static setDual(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[4] = a[0];\r\n out[5] = a[1];\r\n out[6] = a[2];\r\n out[7] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the translation of a normalized {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving translation vector\r\n * @param a - Dual Quaternion to be decomposed\r\n * @return `out`\r\n */\r\n static getTranslation(out: Vec3Like, a: Readonly): Vec3Like {\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Translates a {@link Quat2} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Quat2Like, a: Readonly, v: Readonly): Quat2Like {\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n const bx1 = v[0] * 0.5;\r\n const by1 = v[1] * 0.5;\r\n const bz1 = v[2] * 0.5;\r\n const ax2 = a[4];\r\n const ay2 = a[5];\r\n const az2 = a[6];\r\n const aw2 = a[7];\r\n out[0] = ax1;\r\n out[1] = ay1;\r\n out[2] = az1;\r\n out[3] = aw1;\r\n out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2;\r\n out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2;\r\n out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2;\r\n out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateX(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateY(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateZ(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (a * q)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param q - quaternion to rotate by\r\n * @returns `out`\r\n */\r\n static rotateByQuatAppend(out: Quat2Like, a: Readonly, q: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let ax = a[0];\r\n let ay = a[1];\r\n let az = a[2];\r\n let aw = a[3];\r\n\r\n out[0] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[1] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[2] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[3] = aw * qw - ax * qx - ay * qy - az * qz;\r\n ax = a[4];\r\n ay = a[5];\r\n az = a[6];\r\n aw = a[7];\r\n out[4] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[5] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[6] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[7] = aw * qw - ax * qx - ay * qy - az * qz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (q * a)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param q - quaternion to rotate by\r\n * @param a - the dual quaternion to rotate\r\n * @returns `out`\r\n */\r\n static rotateByQuatPrepend(out: Quat2Like, q: Readonly, a: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let bx = a[0];\r\n let by = a[1];\r\n let bz = a[2];\r\n let bw = a[3];\r\n\r\n out[0] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[1] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[2] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[3] = qw * bw - qx * bx - qy * by - qz * bz;\r\n bx = a[4];\r\n by = a[5];\r\n bz = a[6];\r\n bw = a[7];\r\n out[4] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[5] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[6] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[7] = qw * bw - qx * bx - qy * by - qz * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around a given axis. Does the normalization automatically\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param axis - the axis to rotate around\r\n * @param rad - how far the rotation should be\r\n * @returns `out`\r\n */\r\n static rotateAroundAxis(out: Quat2Like, a: Readonly, axis: Readonly, rad: number): Quat2Like {\r\n // Special case for rad = 0\r\n if (Math.abs(rad) < GLM_EPSILON) {\r\n return Quat2.copy(out, a);\r\n }\r\n const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);\r\n\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n const bx = (s * axis[0]) / axisLength;\r\n const by = (s * axis[1]) / axisLength;\r\n const bz = (s * axis[2]) / axisLength;\r\n const bw = Math.cos(rad);\r\n\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n out[4] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[5] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[6] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[7] = aw * bw - ax * bx - ay * by - az * bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns {quat2} out\r\n */\r\n static multiply(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n const ax0 = a[0];\r\n const ay0 = a[1];\r\n const az0 = a[2];\r\n const aw0 = a[3];\r\n const bx1 = b[4];\r\n const by1 = b[5];\r\n const bz1 = b[6];\r\n const bw1 = b[7];\r\n const ax1 = a[4];\r\n const ay1 = a[5];\r\n const az1 = a[6];\r\n const aw1 = a[7];\r\n const bx0 = b[0];\r\n const by0 = b[1];\r\n const bz0 = b[2];\r\n const bw0 = b[3];\r\n out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0;\r\n out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0;\r\n out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0;\r\n out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0;\r\n out[4] =\r\n ax0 * bw1 +\r\n aw0 * bx1 +\r\n ay0 * bz1 -\r\n az0 * by1 +\r\n ax1 * bw0 +\r\n aw1 * bx0 +\r\n ay1 * bz0 -\r\n az1 * by0;\r\n out[5] =\r\n ay0 * bw1 +\r\n aw0 * by1 +\r\n az0 * bx1 -\r\n ax0 * bz1 +\r\n ay1 * bw0 +\r\n aw1 * by0 +\r\n az1 * bx0 -\r\n ax1 * bz0;\r\n out[6] =\r\n az0 * bw1 +\r\n aw0 * bz1 +\r\n ax0 * by1 -\r\n ay0 * bx1 +\r\n az1 * bw0 +\r\n aw1 * bz0 +\r\n ax1 * by0 -\r\n ay1 * bx0;\r\n out[7] =\r\n aw0 * bw1 -\r\n ax0 * bx1 -\r\n ay0 * by1 -\r\n az0 * bz1 +\r\n aw1 * bw0 -\r\n ax1 * bx0 -\r\n ay1 * by0 -\r\n az1 * bz0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like { return out; }\r\n\r\n /**\r\n * Scales a {@link Quat2} by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaterion\r\n * @param a - the dual quaternion to scale\r\n * @param b - scalar value to scale the dual quaterion by\r\n * @returns `out`\r\n */\r\n static scale(out: Quat2Like, a: Readonly, b: number): Quat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts)\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dot(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Quat2}s\r\n * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quat\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Quat2Like, a: Readonly, b: Readonly, t: number): Quat2Like {\r\n const mt = 1 - t;\r\n if (Quat2.dot(a, b) < 0) { t = -t; }\r\n\r\n out[0] = a[0] * mt + b[0] * t;\r\n out[1] = a[1] * mt + b[1] * t;\r\n out[2] = a[2] * mt + b[2] * t;\r\n out[3] = a[3] * mt + b[3] * t;\r\n out[4] = a[4] * mt + b[4] * t;\r\n out[5] = a[5] * mt + b[5] * t;\r\n out[6] = a[6] * mt + b[6] * t;\r\n out[7] = a[7] * mt + b[7] * t;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: Quat2Like, a: Readonly): Quat2Like {\r\n const sqlen = Quat2.squaredLength(a);\r\n out[0] = -a[0] / sqlen;\r\n out[1] = -a[1] / sqlen;\r\n out[2] = -a[2] / sqlen;\r\n out[3] = a[3] / sqlen;\r\n out[4] = -a[4] / sqlen;\r\n out[5] = -a[5] / sqlen;\r\n out[6] = -a[6] / sqlen;\r\n out[7] = a[7] / sqlen;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than\r\n * {@link Quat2.invert} and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n out[4] = -a[4];\r\n out[5] = -a[5];\r\n out[6] = -a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Quat2Like, a: Readonly): Quat2Like {\r\n let magnitude = Quat2.squaredLength(a);\r\n if (magnitude > 0) {\r\n magnitude = Math.sqrt(magnitude);\r\n\r\n const a0 = a[0] / magnitude;\r\n const a1 = a[1] / magnitude;\r\n const a2 = a[2] / magnitude;\r\n const a3 = a[3] / magnitude;\r\n\r\n const b0 = a[4];\r\n const b1 = a[5];\r\n const b2 = a[6];\r\n const b3 = a[7];\r\n\r\n const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3;\r\n\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n\r\n out[4] = (b0 - a0 * a_dot_b) / magnitude;\r\n out[5] = (b1 - a1 * a_dot_b) / magnitude;\r\n out[6] = (b2 - a2 * a_dot_b) / magnitude;\r\n out[7] = (b3 - a3 * a_dot_b) / magnitude;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat2(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7))\r\n );\r\n }\r\n}\r\n\r\n// Methods which re-use the Quat implementation\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.dot = Quat.dot;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.squaredLength = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.sqrLen = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.mag = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.length = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.len = Quat.magnitude;\r\n\r\n// Static method alias assignments\r\nQuat2.mul = Quat2.multiply;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Mat2dLike, Mat3Like, Mat4Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 2 Dimensional Vector\r\n */\r\nexport class Vec2 extends Float32Array {\r\n /**\r\n * Create a {@link Vec2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 2:{\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, values[1]!]);\r\n } else {\r\n super(v as ArrayBufferLike, values[1], 2);\r\n }\r\n break;\r\n }\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 2);\r\n }\r\n break;\r\n }\r\n default:\r\n super(2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec2.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n return Math.hypot(this[0], this[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec2.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n // Instead of zero(), use a.fill(0) for instances;\r\n\r\n /**\r\n * Adds a {@link Vec2} to `this`.\r\n * Equivalent to `Vec2.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec2} from `this`.\r\n * Equivalent to `Vec2.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec2.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec2.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec2.squaredDistance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec2.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec2.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec2.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec2}.\r\n * Equivalent to `Vec2.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec2.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec2.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 2 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec2}\r\n * @category Static\r\n *\r\n * @returns A new 2D vector\r\n */\r\n static create(): Vec2 {\r\n return new Vec2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - Vector to clone\r\n * @returns A new 2D vector\r\n */\r\n static clone(a: Readonly): Vec2 {\r\n return new Vec2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns A new 2D vector\r\n */\r\n static fromValues(x: number, y: number): Vec2 {\r\n return new Vec2(x, y);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - The source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns `out`\r\n */\r\n static set(out: Vec2Like, x: number, y: number): Vec2Like {\r\n out[0] = x;\r\n out[1] = y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Multiplies two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Divides two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec2} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to scale\r\n * @param b - Amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec2Like, a: Readonly, b: number): Vec2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two Vec2's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param scale - The amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec2Like, a: Readonly, b: Readonly, scale: number): Vec2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns distance between `a` and `b`\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n return Math.hypot(b[0] - a[0], b[1] - a[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Squared distance between `a` and `b`\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return Math.sqrt(x * x + y * y);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate squared length of\r\n * @returns Squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec2Like, a: Readonly) {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec2Like, a: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n let len = x * x + y * y;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Dot product of `a` and `b`\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two {@link Vec2}s\r\n * Note that the cross product must by definition produce a 3D vector.\r\n * For this reason there is also not instance equivalent for this function.\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n const z = a[0] * b[1] - a[1] * b[0];\r\n out[0] = out[1] = 0;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param t - Interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec2Like, a: Readonly, b: Readonly, t: number): Vec2Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y;\r\n out[1] = m[1] * x + m[3] * y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2d}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2d(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y + m[4];\r\n out[1] = m[1] * x + m[3] * y + m[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat3}\r\n * 3rd vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat3(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[3] * y + m[6];\r\n out[1] = m[1] * x + m[4] * y + m[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat4}\r\n * 3rd vector component is implicitly '0'\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat4(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[4] * y + m[12];\r\n out[1] = m[1] * x + m[5] * y + m[13];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 2D vector\r\n * @category Static\r\n *\r\n * @param out - The receiving {@link Vec2}\r\n * @param a - The {@link Vec2} point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotate(out: Vec2Like, a: Readonly, b: Readonly, rad: number): Vec2Like {\r\n // Translate point to the origin\r\n const p0 = a[0] - b[0];\r\n const p1 = a[1] - b[1];\r\n const sinC = Math.sin(rad);\r\n const cosC = Math.cos(rad);\r\n\r\n // perform rotation and translate to correct position\r\n out[0] = p0 * cosC - p1 * sinC + b[0];\r\n out[1] = p0 * sinC + p1 * cosC + b[1];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 2D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly): number {\r\n const x1 = a[0];\r\n const y1 = a[1];\r\n const x2 = b[0];\r\n const y2 = b[1];\r\n // mag is the product of the magnitudes of a and b\r\n const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2);\r\n // mag &&.. short circuits if mag == 0\r\n const cosine = mag && (x1 * x2 + y1 * y2) / mag;\r\n // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to zero\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec2Like): Vec2Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors components are ===, `false` otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors are approximately equal, `false` otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - Vector to represent as a string\r\n * @returns String representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec2.prototype.sub = Vec2.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.mul = Vec2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.div = Vec2.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.dist = Vec2.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.sqrDist = Vec2.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec2.sub = Vec2.subtract;\r\nVec2.mul = Vec2.multiply;\r\nVec2.div = Vec2.divide;\r\nVec2.dist = Vec2.distance;\r\nVec2.sqrDist = Vec2.squaredDistance;\r\nVec2.sqrLen = Vec2.squaredLength;\r\nVec2.mag = Vec2.magnitude;\r\nVec2.length = Vec2.magnitude;\r\nVec2.len = Vec2.magnitude;\r\n", "/**\r\n * To enable additional swizzle accessors for vector classes (32-bit) invoke the {@link EnableSwizzles} function from\r\n * the `gl-matrix/swizzle` sub-path export. To enable ambient module declarations for IDE / Typescript support please\r\n * see {@link gl-matrix/types/swizzle}.\r\n *\r\n * To enable swizzling for the 64-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle/f64}.\r\n *\r\n * @example\r\n * ```ts\r\n * import { Vec3 } from 'gl-matrix';\r\n * import { EnableSwizzles } from 'gl-matrix/swizzle';\r\n *\r\n * EnableSwizzles();\r\n *\r\n * const vec = new Vec3(0, 1, 2);\r\n * const vecSwizzled = vec.zyx; // Returns a new Vec3(2, 1, 0).\r\n * ```\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\nimport { Vec2, Vec3, Vec4 } from '#gl-matrix';\r\n\r\n/**\r\n * Internal `gl-matrix` variable tracking if swizzling is enabled (32-bit).\r\n */\r\nlet GLM_SWIZZLES_ENABLED_F32 = false;\r\n\r\n/**\r\n * Enables Swizzle operations on {@link gl-matrix.Vec2 | Vec2} / {@link gl-matrix.Vec3 | Vec3} /\r\n * {@link gl-matrix.Vec4 | Vec4} types from {@link gl-matrix | gl-matrix} (32-bit).\r\n *\r\n * Swizzle operations are performed by using the `.` operator in conjunction with any combination\r\n * of between two and four component names, either from the set `xyzw` or `rgbw` (though not intermixed).\r\n * They return a new vector with the same number of components as specified in the swizzle attribute.\r\n *\r\n * @example\r\n * ```js\r\n * import { Vec3, EnableSwizzles } from 'gl-matrix';\r\n *\r\n * EnableSwizzles();\r\n *\r\n * let v = new Vec3(0, 1, 2);\r\n *\r\n * v.yx; // returns new Vec2(1, 0)\r\n * v.xzy; // returns new Vec3(0, 2, 1)\r\n * v.zyxz; // returns new Vec4(2, 1, 0, 2)\r\n *\r\n * v.rgb; // returns new Vec3(0, 1, 2)\r\n * v.rbg; // returns new Vec3(0, 2, 1)\r\n * v.gg; // returns new Vec2(1, 1)\r\n * ```\r\n */\r\nexport function EnableSwizzles(): void {\r\n /* v8 ignore next 1 */\r\n if (GLM_SWIZZLES_ENABLED_F32) { return; }\r\n\r\n /* eslint-disable comma-spacing, max-len */\r\n\r\n // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should\r\n // not be modified by hand.\r\n // [Swizzle Autogen]\r\n\r\n const VEC2_SWIZZLES = ['xx','xy','yx','yy','xxx','xxy','xyx','xyy','yxx','yxy','yyx','yyy','xxxx','xxxy','xxyx','xxyy','xyxx','xyxy','xyyx','xyyy','yxxx','yxxy','yxyx','yxyy','yyxx','yyxy','yyyx','yyyy','rr','rg','gr','gg','rrr','rrg','rgr','rgg','grr','grg','ggr','ggg','rrrr','rrrg','rrgr','rrgg','rgrr','rgrg','rggr','rggg','grrr','grrg','grgr','grgg','ggrr','ggrg','gggr','gggg'];\r\n const VEC3_SWIZZLES = ['xz','yz','zx','zy','zz','xxz','xyz','xzx','xzy','xzz','yxz','yyz','yzx','yzy','yzz','zxx','zxy','zxz','zyx','zyy','zyz','zzx','zzy','zzz','xxxz','xxyz','xxzx','xxzy','xxzz','xyxz','xyyz','xyzx','xyzy','xyzz','xzxx','xzxy','xzxz','xzyx','xzyy','xzyz','xzzx','xzzy','xzzz','yxxz','yxyz','yxzx','yxzy','yxzz','yyxz','yyyz','yyzx','yyzy','yyzz','yzxx','yzxy','yzxz','yzyx','yzyy','yzyz','yzzx','yzzy','yzzz','zxxx','zxxy','zxxz','zxyx','zxyy','zxyz','zxzx','zxzy','zxzz','zyxx','zyxy','zyxz','zyyx','zyyy','zyyz','zyzx','zyzy','zyzz','zzxx','zzxy','zzxz','zzyx','zzyy','zzyz','zzzx','zzzy','zzzz','rb','gb','br','bg','bb','rrb','rgb','rbr','rbg','rbb','grb','ggb','gbr','gbg','gbb','brr','brg','brb','bgr','bgg','bgb','bbr','bbg','bbb','rrrb','rrgb','rrbr','rrbg','rrbb','rgrb','rggb','rgbr','rgbg','rgbb','rbrr','rbrg','rbrb','rbgr','rbgg','rbgb','rbbr','rbbg','rbbb','grrb','grgb','grbr','grbg','grbb','ggrb','gggb','ggbr','ggbg','ggbb','gbrr','gbrg','gbrb','gbgr','gbgg','gbgb','gbbr','gbbg','gbbb','brrr','brrg','brrb','brgr','brgg','brgb','brbr','brbg','brbb','bgrr','bgrg','bgrb','bggr','bggg','bggb','bgbr','bgbg','bgbb','bbrr','bbrg','bbrb','bbgr','bbgg','bbgb','bbbr','bbbg','bbbb'];\r\n const VEC4_SWIZZLES = ['xw','yw','zw','wx','wy','wz','ww','xxw','xyw','xzw','xwx','xwy','xwz','xww','yxw','yyw','yzw','ywx','ywy','ywz','yww','zxw','zyw','zzw','zwx','zwy','zwz','zww','wxx','wxy','wxz','wxw','wyx','wyy','wyz','wyw','wzx','wzy','wzz','wzw','wwx','wwy','wwz','www','xxxw','xxyw','xxzw','xxwx','xxwy','xxwz','xxww','xyxw','xyyw','xyzw','xywx','xywy','xywz','xyww','xzxw','xzyw','xzzw','xzwx','xzwy','xzwz','xzww','xwxx','xwxy','xwxz','xwxw','xwyx','xwyy','xwyz','xwyw','xwzx','xwzy','xwzz','xwzw','xwwx','xwwy','xwwz','xwww','yxxw','yxyw','yxzw','yxwx','yxwy','yxwz','yxww','yyxw','yyyw','yyzw','yywx','yywy','yywz','yyww','yzxw','yzyw','yzzw','yzwx','yzwy','yzwz','yzww','ywxx','ywxy','ywxz','ywxw','ywyx','ywyy','ywyz','ywyw','ywzx','ywzy','ywzz','ywzw','ywwx','ywwy','ywwz','ywww','zxxw','zxyw','zxzw','zxwx','zxwy','zxwz','zxww','zyxw','zyyw','zyzw','zywx','zywy','zywz','zyww','zzxw','zzyw','zzzw','zzwx','zzwy','zzwz','zzww','zwxx','zwxy','zwxz','zwxw','zwyx','zwyy','zwyz','zwyw','zwzx','zwzy','zwzz','zwzw','zwwx','zwwy','zwwz','zwww','wxxx','wxxy','wxxz','wxxw','wxyx','wxyy','wxyz','wxyw','wxzx','wxzy','wxzz','wxzw','wxwx','wxwy','wxwz','wxww','wyxx','wyxy','wyxz','wyxw','wyyx','wyyy','wyyz','wyyw','wyzx','wyzy','wyzz','wyzw','wywx','wywy','wywz','wyww','wzxx','wzxy','wzxz','wzxw','wzyx','wzyy','wzyz','wzyw','wzzx','wzzy','wzzz','wzzw','wzwx','wzwy','wzwz','wzww','wwxx','wwxy','wwxz','wwxw','wwyx','wwyy','wwyz','wwyw','wwzx','wwzy','wwzz','wwzw','wwwx','wwwy','wwwz','wwww','ra','ga','ba','ar','ag','ab','aa','rra','rga','rba','rar','rag','rab','raa','gra','gga','gba','gar','gag','gab','gaa','bra','bga','bba','bar','bag','bab','baa','arr','arg','arb','ara','agr','agg','agb','aga','abr','abg','abb','aba','aar','aag','aab','aaa','rrra','rrga','rrba','rrar','rrag','rrab','rraa','rgra','rgga','rgba','rgar','rgag','rgab','rgaa','rbra','rbga','rbba','rbar','rbag','rbab','rbaa','rarr','rarg','rarb','rara','ragr','ragg','ragb','raga','rabr','rabg','rabb','raba','raar','raag','raab','raaa','grra','grga','grba','grar','grag','grab','graa','ggra','ggga','ggba','ggar','ggag','ggab','ggaa','gbra','gbga','gbba','gbar','gbag','gbab','gbaa','garr','garg','garb','gara','gagr','gagg','gagb','gaga','gabr','gabg','gabb','gaba','gaar','gaag','gaab','gaaa','brra','brga','brba','brar','brag','brab','braa','bgra','bgga','bgba','bgar','bgag','bgab','bgaa','bbra','bbga','bbba','bbar','bbag','bbab','bbaa','barr','barg','barb','bara','bagr','bagg','bagb','baga','babr','babg','babb','baba','baar','baag','baab','baaa','arrr','arrg','arrb','arra','argr','argg','argb','arga','arbr','arbg','arbb','arba','arar','arag','arab','araa','agrr','agrg','agrb','agra','aggr','aggg','aggb','agga','agbr','agbg','agbb','agba','agar','agag','agab','agaa','abrr','abrg','abrb','abra','abgr','abgg','abgb','abga','abbr','abbg','abbb','abba','abar','abag','abab','abaa','aarr','aarg','aarb','aara','aagr','aagg','aagb','aaga','aabr','aabg','aabb','aaba','aaar','aaag','aaab','aaaa'];\r\n\r\n // [/Swizzle Autogen]\r\n\r\n /* eslint-enable comma-spacing, max-len */\r\n\r\n /**\r\n * Internal swizzle index table for `gl-matrix`.\r\n */\r\n const SWIZZLE_INDEX: Record = {\r\n x: 0, r: 0,\r\n y: 1, g: 1,\r\n z: 2, b: 2,\r\n w: 3, a: 3,\r\n };\r\n\r\n /**\r\n * Internal helper function to convert and return a `gl-matrix` vector by swizzle format.\r\n *\r\n * @param swizzle - Swizzle format to apply.\r\n * @returns {Vec2 | Vec3 | Vec4} New swizzled vector instance.\r\n */\r\n function getSwizzleImpl(swizzle: string): () => Vec2 | Vec3 | Vec4 {\r\n switch (swizzle.length) {\r\n case 2:\r\n return function(this: Float32Array) {\r\n return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]);\r\n };\r\n case 3:\r\n return function(this: Float32Array) {\r\n return new Vec3(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]]);\r\n };\r\n case 4:\r\n return function(this: Float32Array) {\r\n return new Vec4(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]], this[SWIZZLE_INDEX[swizzle[3]]]);\r\n };\r\n }\r\n\r\n throw new Error('Illegal swizzle length');\r\n }\r\n\r\n for (const swizzle of VEC2_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec2.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC3_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC4_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n GLM_SWIZZLES_ENABLED_F32 = true;\r\n}\r\n", "/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_DEG_TO_RAD: number = Math.PI / 180;\r\n\r\n/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_RAD_TO_DEG: number = 180 / Math.PI;\r\n\r\n/**\r\n * Convert `radians` to `degrees`.\r\n *\r\n * @param value - Angle in `radians`.\r\n * @returns Angle in `degrees`.\r\n */\r\nexport function toDegree(value: number): number {\r\n return value * GLM_RAD_TO_DEG;\r\n}\r\n\r\n/**\r\n * Convert `degrees` to `radians`.\r\n *\r\n * @param value - Angle in `degrees`.\r\n * @returns Angle in `radians`.\r\n */\r\nexport function toRadian(value: number): number {\r\n return value * GLM_DEG_TO_RAD;\r\n}\r\n"], + "mappings": ";;;;;;;;;;;;AASO,IAAM,cAAc;;;ACT3B;AAOO,IAAM,QAAN,MAAM,cAAa,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWrC,eAAe,QAAoE;AACjF,YAAQ,OAAO,QAAQ;AAAA,MACrB,KAAK;AACH,cAAM,MAAM;AAAG;AAAA,MACjB,KAAK;AACH,cAAM,OAAO,CAAC,GAAsB,OAAO,CAAC,GAAG,CAAC;AAAG;AAAA,MACrD,KAAK;AACH,cAAM,IAAI,OAAO,CAAC;AAClB,YAAI,OAAO,MAAM,UAAU;AACzB,gBAAM;AAAA,YACJ;AAAA,YAAG;AAAA,YACH;AAAA,YAAG;AAAA,UAAC,CAAC;AAAA,QACT,OAAO;AACL,gBAAM,GAAsB,GAAG,CAAC;AAAA,QAClC;AACA;AAAA,MACF;AACE,cAAM,oBAAK,cAAa;AAAG;AAAA,IAC/B;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,IAAI,MAAc;AAChB,WAAO,MAAK,IAAI,IAAI;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaA,KAAK,GAA6B;AAChC,SAAK,IAAI,CAAC;AACV,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,WAAiB;AACf,SAAK,IAAI,oBAAK,cAAa;AAC3B,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,SAAS,GAA6B;AACpC,WAAO,MAAK,SAAS,MAAM,MAAM,CAAC;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,GAA6B;AAAE,WA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AAC;AAAA,EACH;AAEA,6BAA2B;AAC7B;;;ACxIA,IAAM,iBAAyB,KAAK,KAAK;AAKzC,IAAM,iBAAyB,MAAM,KAAK;AAQnC,SAAS,SAAS,OAAuB;AAC9C,SAAO,QAAQ;AACjB;AAQO,SAAS,SAAS,OAAuB;AAC9C,SAAO,QAAQ;AACjB;", + "names": ["_TMP_VEC3", "_TMP_VEC3"] +} diff --git a/dist-cdn/esm/2016/gl-matrix-f32.min.js b/dist-cdn/esm/2016/gl-matrix-f32.min.js new file mode 100644 index 00000000..79ec372d --- /dev/null +++ b/dist-cdn/esm/2016/gl-matrix-f32.min.js @@ -0,0 +1,6 @@ +// gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library. +// @author Brandon Jones +// @author Colin MacKenzie IV +// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md) +var de=A=>{throw TypeError(A)};var oe=(A,e,t)=>e.has(A)||de("Cannot "+t);var E=(A,e,t)=>(oe(A,e,"read from private field"),t?t.call(A):e.get(A)),Z=(A,e,t)=>e.has(A)?de("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(A):e.set(A,t);var ne,C=class C extends Float32Array{constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t]):super(t,0,4);break;default:super(E(C,ne));break}}get str(){return C.str(this)}copy(e){return this.set(e),this}identity(){return this.set(E(C,ne)),this}multiply(e){return C.multiply(this,this,e)}mul(e){return this}transpose(){return C.transpose(this,this)}invert(){return C.invert(this,this)}scale(e){return C.scale(this,this,e)}rotate(e){return C.rotate(this,this,e)}static get BYTE_LENGTH(){return 4*Float32Array.BYTES_PER_ELEMENT}static create(){return new C}static clone(e){return new C(e)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static fromValues(...e){return new C(...e)}static set(e,...t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}static transpose(e,t){if(e===t){let n=t[1];e[1]=t[2],e[2]=n}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*a-r*s;return i?(i=1/i,e[0]=a*i,e[1]=-s*i,e[2]=-r*i,e[3]=n*i,e):null}static adjoint(e,t){let n=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=n,e}static determinant(e){return e[0]*e[3]-e[2]*e[1]}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*c+a*y,e[1]=r*c+i*y,e[2]=s*L+a*k,e[3]=r*L+i*k,e}static mul(e,t,n){return e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+a*c,e[1]=r*y+i*c,e[2]=s*-c+a*y,e[3]=r*-c+i*y,e}static scale(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1];return e[0]=s*c,e[1]=r*c,e[2]=a*y,e[3]=i*y,e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=-n,e[3]=s,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3])}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e}static LDU(e,t,n,s){return e[2]=s[2]/s[0],n[0]=s[0],n[1]=s[1],n[3]=s[3]-e[2]*n[1],[e,t,n]}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=t[0],c=t[1],y=t[2],L=t[3];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(a-L)<=1e-6*Math.max(1,Math.abs(a),Math.abs(L))}static str(e){return`Mat2(${e.join(", ")})`}};ne=new WeakMap,Z(C,ne,new Float32Array([1,0,0,1]));var v=C;v.prototype.mul=v.prototype.multiply;v.mul=v.multiply;v.sub=v.subtract;var se,H=class H extends Float32Array{constructor(...e){switch(e.length){case 6:super(e);break;case 2:super(e[0],e[1],6);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t,t,t]):super(t,0,6);break;default:super(E(H,se));break}}get str(){return H.str(this)}copy(e){return this.set(e),this}identity(){return this.set(E(H,se)),this}multiply(e){return H.multiply(this,this,e)}mul(e){return this}translate(e){return H.translate(this,this,e)}rotate(e){return H.rotate(this,this,e)}scale(e){return H.scale(this,this,e)}static get BYTE_LENGTH(){return 6*Float32Array.BYTES_PER_ELEMENT}static create(){return new H}static clone(e){return new H(e)}static copy(e,t){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}static fromValues(...e){return new H(...e)}static set(e,...t){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}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=n*a-s*r;return y?(y=1/y,e[0]=a*y,e[1]=-s*y,e[2]=-r*y,e[3]=n*y,e[4]=(r*c-a*i)*y,e[5]=(s*i-n*c)*y,e):null}static determinant(e){return e[0]*e[3]-e[1]*e[2]}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1],l=n[2],M=n[3],h=n[4],b=n[5];return e[0]=s*L+a*k,e[1]=r*L+i*k,e[2]=s*l+a*M,e[3]=r*l+i*M,e[4]=s*h+a*b+c,e[5]=r*h+i*b+y,e}static mul(e,t,n){return e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=s*L+a*k+c,e[5]=r*L+i*k+y,e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=Math.sin(n),k=Math.cos(n);return e[0]=s*k+a*L,e[1]=r*k+i*L,e[2]=s*-L+a*k,e[3]=r*-L+i*k,e[4]=c,e[5]=y,e}static scale(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1];return e[0]=s*L,e[1]=r*L,e[2]=a*k,e[3]=i*k,e[4]=c,e[5]=y,e}static fromTranslation(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0],e[5]=t[1],e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=-n,e[3]=s,e[4]=0,e[5]=0,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e[4]=0,e[5]=0,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+1)}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=t[0],L=t[1],k=t[2],l=t[3],M=t[4],h=t[5];return Math.abs(n-y)<=1e-6*Math.max(1,Math.abs(n),Math.abs(y))&&Math.abs(s-L)<=1e-6*Math.max(1,Math.abs(s),Math.abs(L))&&Math.abs(r-k)<=1e-6*Math.max(1,Math.abs(r),Math.abs(k))&&Math.abs(a-l)<=1e-6*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(i-M)<=1e-6*Math.max(1,Math.abs(i),Math.abs(M))&&Math.abs(c-h)<=1e-6*Math.max(1,Math.abs(c),Math.abs(h))}static str(e){return`Mat2d(${e.join(", ")})`}};se=new WeakMap,Z(H,se,new Float32Array([1,0,0,1,0,0]));var _=H;_.mul=_.multiply;_.sub=_.subtract;var re,X=class X extends Float32Array{constructor(...e){switch(e.length){case 9:super(e);break;case 2:super(e[0],e[1],9);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t,t,t,t,t,t]):super(t,0,9);break;default:super(E(X,re));break}}get str(){return X.str(this)}copy(e){return this.set(e),this}identity(){return this.set(E(X,re)),this}multiply(e){return X.multiply(this,this,e)}mul(e){return this}transpose(){return X.transpose(this,this)}invert(){return X.invert(this,this)}translate(e){return X.translate(this,this,e)}rotate(e){return X.rotate(this,this,e)}scale(e){return X.scale(this,this,e)}static get BYTE_LENGTH(){return 9*Float32Array.BYTES_PER_ELEMENT}static create(){return new X}static clone(e){return new X(e)}static copy(e,t){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}static fromValues(...e){return new X(...e)}static set(e,...t){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}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static transpose(e,t){if(e===t){let n=t[1],s=t[2],r=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=s,e[7]=r}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=k*i-c*L,M=-k*a+c*y,h=L*a-i*y,b=n*l+s*M+r*h;return b?(b=1/b,e[0]=l*b,e[1]=(-k*s+r*L)*b,e[2]=(c*s-r*i)*b,e[3]=M*b,e[4]=(k*n-r*y)*b,e[5]=(-c*n+r*a)*b,e[6]=h*b,e[7]=(-L*n+s*y)*b,e[8]=(i*n-s*a)*b,e):null}static adjoint(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8];return e[0]=i*k-c*L,e[1]=r*L-s*k,e[2]=s*c-r*i,e[3]=c*y-a*k,e[4]=n*k-r*y,e[5]=r*a-n*c,e[6]=a*L-i*y,e[7]=s*y-n*L,e[8]=n*i-s*a,e}static determinant(e){let t=e[0],n=e[1],s=e[2],r=e[3],a=e[4],i=e[5],c=e[6],y=e[7],L=e[8];return t*(L*a-i*y)+n*(-L*r+i*c)+s*(y*r-a*c)}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=n[0],h=n[1],b=n[2];return e[0]=M*s+h*i+b*L,e[1]=M*r+h*c+b*k,e[2]=M*a+h*y+b*l,M=n[3],h=n[4],b=n[5],e[3]=M*s+h*i+b*L,e[4]=M*r+h*c+b*k,e[5]=M*a+h*y+b*l,M=n[6],h=n[7],b=n[8],e[6]=M*s+h*i+b*L,e[7]=M*r+h*c+b*k,e[8]=M*a+h*y+b*l,e}static mul(e,t,n){return e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=n[0],h=n[1];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=c,e[5]=y,e[6]=M*s+h*i+L,e[7]=M*r+h*c+k,e[8]=M*a+h*y+l,e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=Math.sin(n),h=Math.cos(n);return e[0]=h*s+M*i,e[1]=h*r+M*c,e[2]=h*a+M*y,e[3]=h*i-M*s,e[4]=h*c-M*r,e[5]=h*y-M*a,e[6]=L,e[7]=k,e[8]=l,e}static scale(e,t,n){let s=n[0],r=n[1];return e[0]=s*t[0],e[1]=s*t[1],e[2]=s*t[2],e[3]=r*t[3],e[4]=r*t[4],e[5]=r*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}static fromTranslation(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=0,e[3]=-n,e[4]=s,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static fromMat2d(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}static fromQuat(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n+n,c=s+s,y=r+r,L=n*i,k=s*i,l=s*c,M=r*i,h=r*c,b=r*y,d=a*i,m=a*c,o=a*y;return e[0]=1-l-b,e[3]=k-o,e[6]=M+m,e[1]=k+o,e[4]=1-L-b,e[7]=h-d,e[2]=M-m,e[5]=h+d,e[8]=1-L-l,e}static fromMat4(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}static normalFromMat4(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],M=t[10],h=t[11],b=t[12],d=t[13],m=t[14],o=t[15],V=n*c-s*i,x=n*y-r*i,R=n*L-a*i,z=s*y-r*c,g=s*L-a*c,B=r*L-a*y,D=k*d-l*b,F=k*m-M*b,p=k*o-h*b,Y=l*m-M*d,I=l*o-h*d,P=M*o-h*m,Q=V*P-x*I+R*Y+z*p-g*F+B*D;return Q?(Q=1/Q,e[0]=(c*P-y*I+L*Y)*Q,e[1]=(y*p-i*P-L*F)*Q,e[2]=(i*I-c*p+L*D)*Q,e[3]=(r*I-s*P-a*Y)*Q,e[4]=(n*P-r*p+a*F)*Q,e[5]=(s*p-n*I-a*D)*Q,e[6]=(d*B-m*g+o*z)*Q,e[7]=(m*R-b*B-o*x)*Q,e[8]=(b*g-d*R+o*V)*Q,e):null}static normalFromMat4Fast(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=i*k-k*L,e[1]=c*y-y*k,e[2]=a*L-L*y,e[3]=L*r-k*s,e[4]=k*n-y*r,e[5]=y*s-L*n,e[6]=s*c-r*i,e[7]=r*a-n*c,e[8]=n*i-s*a,e}static projection(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8])}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e[6]=t[6]+n[6]*s,e[7]=t[7]+n[7]*s,e[8]=t[8]+n[8]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=e[8],l=t[0],M=t[1],h=t[2],b=t[3],d=t[4],m=t[5],o=t[6],V=t[7],x=t[8];return Math.abs(n-l)<=1e-6*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(s-M)<=1e-6*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(r-h)<=1e-6*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(a-b)<=1e-6*Math.max(1,Math.abs(a),Math.abs(b))&&Math.abs(i-d)<=1e-6*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(c-m)<=1e-6*Math.max(1,Math.abs(c),Math.abs(m))&&Math.abs(y-o)<=1e-6*Math.max(1,Math.abs(y),Math.abs(o))&&Math.abs(L-V)<=1e-6*Math.max(1,Math.abs(L),Math.abs(V))&&Math.abs(k-x)<=1e-6*Math.max(1,Math.abs(k),Math.abs(x))}static str(e){return`Mat3(${e.join(", ")})`}};re=new WeakMap,Z(X,re,new Float32Array([1,0,0,0,1,0,0,0,1]));var u=X;u.prototype.mul=u.prototype.multiply;u.mul=u.multiply;u.sub=u.subtract;var ae,$,S=class S extends Float32Array{constructor(...e){switch(e.length){case 16:super(e);break;case 2:super(e[0],e[1],16);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t]):super(t,0,16);break;default:super(E(S,ae));break}}get str(){return S.str(this)}copy(e){return this.set(e),this}identity(){return this.set(E(S,ae)),this}multiply(e){return S.multiply(this,this,e)}mul(e){return this}transpose(){return S.transpose(this,this)}invert(){return S.invert(this,this)}translate(e){return S.translate(this,this,e)}rotate(e,t){return S.rotate(this,this,e,t)}scale(e){return S.scale(this,this,e)}rotateX(e){return S.rotateX(this,this,e)}rotateY(e){return S.rotateY(this,this,e)}rotateZ(e){return S.rotateZ(this,this,e)}perspectiveNO(e,t,n,s){return S.perspectiveNO(this,e,t,n,s)}perspectiveZO(e,t,n,s){return S.perspectiveZO(this,e,t,n,s)}orthoNO(e,t,n,s,r,a){return S.orthoNO(this,e,t,n,s,r,a)}orthoZO(e,t,n,s,r,a){return S.orthoZO(this,e,t,n,s,r,a)}static get BYTE_LENGTH(){return 16*Float32Array.BYTES_PER_ELEMENT}static create(){return new S}static clone(e){return new S(e)}static copy(e,t){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}static fromValues(...e){return new S(...e)}static set(e,...t){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}static identity(e){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}static transpose(e,t){if(e===t){let n=t[1],s=t[2],r=t[3],a=t[6],i=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=s,e[9]=a,e[11]=t[14],e[12]=r,e[13]=i,e[14]=c}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],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F-i*Y-y*D,e[13]=n*Y-s*F+r*D,e[14]=d*x-b*z-m*V,e[15]=k*z-l*x+M*V,e}static determinant(e){let t=e[0],n=e[1],s=e[2],r=e[3],a=e[4],i=e[5],c=e[6],y=e[7],L=e[8],k=e[9],l=e[10],M=e[11],h=e[12],b=e[13],d=e[14],m=e[15],o=t*i-n*a,V=t*c-s*a,x=n*c-s*i,R=L*b-k*h,z=L*d-l*h,g=k*d-l*b,B=t*g-n*z+s*R,D=a*g-i*z+c*R,F=L*x-k*V+l*o,p=h*x-b*V+d*o;return y*B-r*D+m*F-M*p}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=t[9],h=t[10],b=t[11],d=t[12],m=t[13],o=t[14],V=t[15],x=n[0],R=n[1],z=n[2],g=n[3];return e[0]=x*s+R*c+z*l+g*d,e[1]=x*r+R*y+z*M+g*m,e[2]=x*a+R*L+z*h+g*o,e[3]=x*i+R*k+z*b+g*V,x=n[4],R=n[5],z=n[6],g=n[7],e[4]=x*s+R*c+z*l+g*d,e[5]=x*r+R*y+z*M+g*m,e[6]=x*a+R*L+z*h+g*o,e[7]=x*i+R*k+z*b+g*V,x=n[8],R=n[9],z=n[10],g=n[11],e[8]=x*s+R*c+z*l+g*d,e[9]=x*r+R*y+z*M+g*m,e[10]=x*a+R*L+z*h+g*o,e[11]=x*i+R*k+z*b+g*V,x=n[12],R=n[13],z=n[14],g=n[15],e[12]=x*s+R*c+z*l+g*d,e[13]=x*r+R*y+z*M+g*m,e[14]=x*a+R*L+z*h+g*o,e[15]=x*i+R*k+z*b+g*V,e}static mul(e,t,n){return e}static translate(e,t,n){let s=n[0],r=n[1],a=n[2];if(t===e)e[12]=t[0]*s+t[4]*r+t[8]*a+t[12],e[13]=t[1]*s+t[5]*r+t[9]*a+t[13],e[14]=t[2]*s+t[6]*r+t[10]*a+t[14],e[15]=t[3]*s+t[7]*r+t[11]*a+t[15];else{let i=t[0],c=t[1],y=t[2],L=t[3],k=t[4],l=t[5],M=t[6],h=t[7],b=t[8],d=t[9],m=t[10],o=t[11];e[0]=i,e[1]=c,e[2]=y,e[3]=L,e[4]=k,e[5]=l,e[6]=M,e[7]=h,e[8]=b,e[9]=d,e[10]=m,e[11]=o,e[12]=i*s+k*r+b*a+t[12],e[13]=c*s+l*r+d*a+t[13],e[14]=y*s+M*r+m*a+t[14],e[15]=L*s+h*r+o*a+t[15]}return e}static scale(e,t,n){let s=n[0],r=n[1],a=n[2];return e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e[3]=t[3]*s,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}static rotate(e,t,n,s){let r=s[0],a=s[1],i=s[2],c=Math.sqrt(r*r+a*a+i*i);if(c<1e-6)return null;c=1/c,r*=c,a*=c,i*=c;let y=Math.sin(n),L=Math.cos(n),k=1-L,l=t[0],M=t[1],h=t[2],b=t[3],d=t[4],m=t[5],o=t[6],V=t[7],x=t[8],R=t[9],z=t[10],g=t[11],B=r*r*k+L,D=a*r*k+i*y,F=i*r*k-a*y,p=r*a*k-i*y,Y=a*a*k+L,I=i*a*k+r*y,P=r*i*k+a*y,Q=a*i*k-r*y,K=i*i*k+L;return e[0]=l*B+d*D+x*F,e[1]=M*B+m*D+R*F,e[2]=h*B+o*D+z*F,e[3]=b*B+V*D+g*F,e[4]=l*p+d*Y+x*I,e[5]=M*p+m*Y+R*I,e[6]=h*p+o*Y+z*I,e[7]=b*p+V*Y+g*I,e[8]=l*P+d*Q+x*K,e[9]=M*P+m*Q+R*K,e[10]=h*P+o*Q+z*K,e[11]=b*P+V*Q+g*K,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e}static rotateX(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[4],i=t[5],c=t[6],y=t[7],L=t[8],k=t[9],l=t[10],M=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*r+L*s,e[5]=i*r+k*s,e[6]=c*r+l*s,e[7]=y*r+M*s,e[8]=L*r-a*s,e[9]=k*r-i*s,e[10]=l*r-c*s,e[11]=M*r-y*s,e}static rotateY(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[0],i=t[1],c=t[2],y=t[3],L=t[8],k=t[9],l=t[10],M=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*r-L*s,e[1]=i*r-k*s,e[2]=c*r-l*s,e[3]=y*r-M*s,e[8]=a*s+L*r,e[9]=i*s+k*r,e[10]=c*s+l*r,e[11]=y*s+M*r,e}static rotateZ(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[0],i=t[1],c=t[2],y=t[3],L=t[4],k=t[5],l=t[6],M=t[7];return t!==e&&(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[0]=a*r+L*s,e[1]=i*r+k*s,e[2]=c*r+l*s,e[3]=y*r+M*s,e[4]=L*r-a*s,e[5]=k*r-i*s,e[6]=l*r-c*s,e[7]=M*r-y*s,e}static fromTranslation(e,t){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]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromRotation(e,t,n){let s=n[0],r=n[1],a=n[2],i=Math.sqrt(s*s+r*r+a*a);if(i<1e-6)return null;i=1/i,s*=i,r*=i,a*=i;let c=Math.sin(t),y=Math.cos(t),L=1-y;return e[0]=s*s*L+y,e[1]=r*s*L+a*c,e[2]=a*s*L-r*c,e[3]=0,e[4]=s*r*L-a*c,e[5]=r*r*L+y,e[6]=a*r*L+s*c,e[7]=0,e[8]=s*a*L+r*c,e[9]=r*a*L-s*c,e[10]=a*a*L+y,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromXRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=n,e[7]=0,e[8]=0,e[9]=-n,e[10]=s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromYRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromZRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=0,e[3]=0,e[4]=-n,e[5]=s,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}static fromRotationTranslation(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=s+s,y=r+r,L=a+a,k=s*c,l=s*y,M=s*L,h=r*y,b=r*L,d=a*L,m=i*c,o=i*y,V=i*L;return e[0]=1-(h+d),e[1]=l+V,e[2]=M-o,e[3]=0,e[4]=l-V,e[5]=1-(k+d),e[6]=b+m,e[7]=0,e[8]=M+o,e[9]=b-m,e[10]=1-(k+h),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}static fromQuat2(e,t){let n=-t[0],s=-t[1],r=-t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=n*n+s*s+r*r+a*a;return k>0?(E(S,$)[0]=(i*a+L*n+c*r-y*s)*2/k,E(S,$)[1]=(c*a+L*s+y*n-i*r)*2/k,E(S,$)[2]=(y*a+L*r+i*s-c*n)*2/k):(E(S,$)[0]=(i*a+L*n+c*r-y*s)*2,E(S,$)[1]=(c*a+L*s+y*n-i*r)*2,E(S,$)[2]=(y*a+L*r+i*s-c*n)*2),S.fromRotationTranslation(e,t,E(S,$)),e}static normalFromMat4(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],M=t[10],h=t[11],b=t[12],d=t[13],m=t[14],o=t[15],V=n*c-s*i,x=n*y-r*i,R=n*L-a*i,z=s*y-r*c,g=s*L-a*c,B=r*L-a*y,D=k*d-l*b,F=k*m-M*b,p=k*o-h*b,Y=l*m-M*d,I=l*o-h*d,P=M*o-h*m,Q=V*P-x*I+R*Y+z*p-g*F+B*D;return Q?(Q=1/Q,e[0]=(c*P-y*I+L*Y)*Q,e[1]=(y*p-i*P-L*F)*Q,e[2]=(i*I-c*p+L*D)*Q,e[3]=0,e[4]=(r*I-s*P-a*Y)*Q,e[5]=(n*P-r*p+a*F)*Q,e[6]=(s*p-n*I-a*D)*Q,e[7]=0,e[8]=(d*B-m*g+o*z)*Q,e[9]=(m*R-b*B-o*x)*Q,e[10]=(b*g-d*R+o*V)*Q,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):null}static normalFromMat4Fast(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=i*k-k*L,e[1]=c*y-y*k,e[2]=a*L-L*y,e[3]=0,e[4]=L*r-k*s,e[5]=k*n-y*r,e[6]=y*s-L*n,e[7]=0,e[8]=s*c-r*i,e[9]=r*a-n*c,e[10]=n*i-s*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static getTranslation(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}static getScaling(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=Math.sqrt(n*n+s*s+r*r),e[1]=Math.sqrt(a*a+i*i+c*c),e[2]=Math.sqrt(y*y+L*L+k*k),e}static getRotation(e,t){S.getScaling(E(S,$),t);let n=1/E(S,$)[0],s=1/E(S,$)[1],r=1/E(S,$)[2],a=t[0]*n,i=t[1]*s,c=t[2]*r,y=t[4]*n,L=t[5]*s,k=t[6]*r,l=t[8]*n,M=t[9]*s,h=t[10]*r,b=a+L+h,d=0;return b>0?(d=Math.sqrt(b+1)*2,e[3]=.25*d,e[0]=(k-M)/d,e[1]=(l-c)/d,e[2]=(i-y)/d):a>L&&a>h?(d=Math.sqrt(1+a-L-h)*2,e[3]=(k-M)/d,e[0]=.25*d,e[1]=(i+y)/d,e[2]=(l+c)/d):L>h?(d=Math.sqrt(1+L-a-h)*2,e[3]=(l-c)/d,e[0]=(i+y)/d,e[1]=.25*d,e[2]=(k+M)/d):(d=Math.sqrt(1+h-a-L)*2,e[3]=(i-y)/d,e[0]=(l+c)/d,e[1]=(k+M)/d,e[2]=.25*d),e}static decompose(e,t,n,s){t[0]=s[12],t[1]=s[13],t[2]=s[14];let r=s[0],a=s[1],i=s[2],c=s[4],y=s[5],L=s[6],k=s[8],l=s[9],M=s[10];n[0]=Math.sqrt(r*r+a*a+i*i),n[1]=Math.sqrt(c*c+y*y+L*L),n[2]=Math.sqrt(k*k+l*l+M*M);let h=1/n[0],b=1/n[1],d=1/n[2],m=r*h,o=a*b,V=i*d,x=c*h,R=y*b,z=L*d,g=k*h,B=l*b,D=M*d,F=m+R+D,p=0;return F>0?(p=Math.sqrt(F+1)*2,e[3]=.25*p,e[0]=(z-B)/p,e[1]=(g-V)/p,e[2]=(o-x)/p):m>R&&m>D?(p=Math.sqrt(1+m-R-D)*2,e[3]=(z-B)/p,e[0]=.25*p,e[1]=(o+x)/p,e[2]=(g+V)/p):R>D?(p=Math.sqrt(1+R-m-D)*2,e[3]=(g-V)/p,e[0]=(o+x)/p,e[1]=.25*p,e[2]=(z+B)/p):(p=Math.sqrt(1+D-m-R)*2,e[3]=(o-x)/p,e[0]=(g+V)/p,e[1]=(z+B)/p,e[2]=.25*p),e}static fromRotationTranslationScale(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3],y=r+r,L=a+a,k=i+i,l=r*y,M=r*L,h=r*k,b=a*L,d=a*k,m=i*k,o=c*y,V=c*L,x=c*k,R=s[0],z=s[1],g=s[2];return e[0]=(1-(b+m))*R,e[1]=(M+x)*R,e[2]=(h-V)*R,e[3]=0,e[4]=(M-x)*z,e[5]=(1-(l+m))*z,e[6]=(d+o)*z,e[7]=0,e[8]=(h+V)*g,e[9]=(d-o)*g,e[10]=(1-(l+b))*g,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}static fromRotationTranslationScaleOrigin(e,t,n,s,r){let a=t[0],i=t[1],c=t[2],y=t[3],L=a+a,k=i+i,l=c+c,M=a*L,h=a*k,b=a*l,d=i*k,m=i*l,o=c*l,V=y*L,x=y*k,R=y*l,z=s[0],g=s[1],B=s[2],D=r[0],F=r[1],p=r[2],Y=(1-(d+o))*z,I=(h+R)*z,P=(b-x)*z,Q=(h-R)*g,K=(1-(M+o))*g,ee=(m+V)*g,te=(b+x)*B,Me=(m-V)*B,be=(1-(M+d))*B;return e[0]=Y,e[1]=I,e[2]=P,e[3]=0,e[4]=Q,e[5]=K,e[6]=ee,e[7]=0,e[8]=te,e[9]=Me,e[10]=be,e[11]=0,e[12]=n[0]+D-(Y*D+Q*F+te*p),e[13]=n[1]+F-(I*D+K*F+Me*p),e[14]=n[2]+p-(P*D+ee*F+be*p),e[15]=1,e}static fromQuat(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n+n,c=s+s,y=r+r,L=n*i,k=s*i,l=s*c,M=r*i,h=r*c,b=r*y,d=a*i,m=a*c,o=a*y;return e[0]=1-l-b,e[1]=k+o,e[2]=M-m,e[3]=0,e[4]=k-o,e[5]=1-L-b,e[6]=h+d,e[7]=0,e[8]=M+m,e[9]=h-d,e[10]=1-L-l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static frustumNO(e,t,n,s,r,a,i=1/0){let c=1/(n-t),y=1/(r-s);if(e[0]=a*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*y,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(r+s)*y,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let L=1/(a-i);e[10]=(i+a)*L,e[14]=2*i*a*L}else e[10]=-1,e[14]=-2*a;return e}static frustum(e,t,n,s,r,a,i=1/0){return e}static frustumZO(e,t,n,s,r,a,i=1/0){let c=1/(n-t),y=1/(r-s);if(e[0]=a*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*y,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(r+s)*y,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let L=1/(a-i);e[10]=i*L,e[14]=i*a*L}else e[10]=-1,e[14]=-a;return e}static perspectiveNO(e,t,n,s,r=1/0){let a=1/Math.tan(t/2);if(e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,r!=null&&r!==1/0){let i=1/(s-r);e[10]=(r+s)*i,e[14]=2*r*s*i}else e[10]=-1,e[14]=-2*s;return e}static perspective(e,t,n,s,r=1/0){return e}static perspectiveZO(e,t,n,s,r=1/0){let a=1/Math.tan(t/2);if(e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,r!=null&&r!==1/0){let i=1/(s-r);e[10]=r*i,e[14]=r*s*i}else e[10]=-1,e[14]=-s;return e}static perspectiveFromFieldOfView(e,t,n,s){let r=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),i=Math.tan(t.leftDegrees*Math.PI/180),c=Math.tan(t.rightDegrees*Math.PI/180),y=2/(i+c),L=2/(r+a);return e[0]=y,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=L,e[6]=0,e[7]=0,e[8]=-((i-c)*y*.5),e[9]=(r-a)*L*.5,e[10]=s/(n-s),e[11]=-1,e[12]=0,e[13]=0,e[14]=s*n/(n-s),e[15]=0,e}static orthoNO(e,t,n,s,r,a,i){let c=1/(t-n),y=1/(s-r),L=1/(a-i);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*L,e[11]=0,e[12]=(t+n)*c,e[13]=(r+s)*y,e[14]=(i+a)*L,e[15]=1,e}static ortho(e,t,n,s,r,a,i){return e}static orthoZO(e,t,n,s,r,a,i){let c=1/(t-n),y=1/(s-r),L=1/(a-i);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=L,e[11]=0,e[12]=(t+n)*c,e[13]=(r+s)*y,e[14]=a*L,e[15]=1,e}static lookAt(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=s[0],y=s[1],L=s[2],k=n[0],l=n[1],M=n[2];if(Math.abs(r-k)<1e-6&&Math.abs(a-l)<1e-6&&Math.abs(i-M)<1e-6)return S.identity(e);let h=r-k,b=a-l,d=i-M,m=1/Math.sqrt(h*h+b*b+d*d);h*=m,b*=m,d*=m;let o=y*d-L*b,V=L*h-c*d,x=c*b-y*h;m=Math.sqrt(o*o+V*V+x*x),m?(m=1/m,o*=m,V*=m,x*=m):(o=0,V=0,x=0);let R=b*x-d*V,z=d*o-h*x,g=h*V-b*o;return m=Math.sqrt(R*R+z*z+g*g),m?(m=1/m,R*=m,z*=m,g*=m):(R=0,z=0,g=0),e[0]=o,e[1]=R,e[2]=h,e[3]=0,e[4]=V,e[5]=z,e[6]=b,e[7]=0,e[8]=x,e[9]=g,e[10]=d,e[11]=0,e[12]=-(o*r+V*a+x*i),e[13]=-(R*r+z*a+g*i),e[14]=-(h*r+b*a+d*i),e[15]=1,e}static targetTo(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=s[0],y=s[1],L=s[2],k=r-n[0],l=a-n[1],M=i-n[2],h=k*k+l*l+M*M;h>0&&(h=1/Math.sqrt(h),k*=h,l*=h,M*=h);let b=y*M-L*l,d=L*k-c*M,m=c*l-y*k;return h=b*b+d*d+m*m,h>0&&(h=1/Math.sqrt(h),b*=h,d*=h,m*=h),e[0]=b,e[1]=d,e[2]=m,e[3]=0,e[4]=l*m-M*d,e[5]=M*b-k*m,e[6]=k*d-l*b,e[7]=0,e[8]=k,e[9]=l,e[10]=M,e[11]=0,e[12]=r,e[13]=a,e[14]=i,e[15]=1,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8]+e[9]*e[9]+e[10]*e[10]+e[11]*e[11]+e[12]*e[12]+e[13]*e[13]+e[14]*e[14]+e[15]*e[15])}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}static sub(e,t,n){return e}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e[6]=t[6]+n[6]*s,e[7]=t[7]+n[7]*s,e[8]=t[8]+n[8]*s,e[9]=t[9]+n[9]*s,e[10]=t[10]+n[10]*s,e[11]=t[11]+n[11]*s,e[12]=t[12]+n[12]*s,e[13]=t[13]+n[13]*s,e[14]=t[14]+n[14]*s,e[15]=t[15]+n[15]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=e[8],l=e[9],M=e[10],h=e[11],b=e[12],d=e[13],m=e[14],o=e[15],V=t[0],x=t[1],R=t[2],z=t[3],g=t[4],B=t[5],D=t[6],F=t[7],p=t[8],Y=t[9],I=t[10],P=t[11],Q=t[12],K=t[13],ee=t[14],te=t[15];return Math.abs(n-V)<=1e-6*Math.max(1,Math.abs(n),Math.abs(V))&&Math.abs(s-x)<=1e-6*Math.max(1,Math.abs(s),Math.abs(x))&&Math.abs(r-R)<=1e-6*Math.max(1,Math.abs(r),Math.abs(R))&&Math.abs(a-z)<=1e-6*Math.max(1,Math.abs(a),Math.abs(z))&&Math.abs(i-g)<=1e-6*Math.max(1,Math.abs(i),Math.abs(g))&&Math.abs(c-B)<=1e-6*Math.max(1,Math.abs(c),Math.abs(B))&&Math.abs(y-D)<=1e-6*Math.max(1,Math.abs(y),Math.abs(D))&&Math.abs(L-F)<=1e-6*Math.max(1,Math.abs(L),Math.abs(F))&&Math.abs(k-p)<=1e-6*Math.max(1,Math.abs(k),Math.abs(p))&&Math.abs(l-Y)<=1e-6*Math.max(1,Math.abs(l),Math.abs(Y))&&Math.abs(M-I)<=1e-6*Math.max(1,Math.abs(M),Math.abs(I))&&Math.abs(h-P)<=1e-6*Math.max(1,Math.abs(h),Math.abs(P))&&Math.abs(b-Q)<=1e-6*Math.max(1,Math.abs(b),Math.abs(Q))&&Math.abs(d-K)<=1e-6*Math.max(1,Math.abs(d),Math.abs(K))&&Math.abs(m-ee)<=1e-6*Math.max(1,Math.abs(m),Math.abs(ee))&&Math.abs(o-te)<=1e-6*Math.max(1,Math.abs(o),Math.abs(te))}static str(e){return`Mat4(${e.join(", ")})`}};ae=new WeakMap,$=new WeakMap,Z(S,ae,new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])),Z(S,$,new Float32Array(3));var G=S;G.prototype.mul=G.prototype.multiply;G.sub=G.subtract;G.mul=G.multiply;G.frustum=G.frustumNO;G.perspective=G.perspectiveNO;G.ortho=G.orthoNO;var T=class A extends Float32Array{constructor(...e){switch(e.length){case 3:super(e);break;case 2:super(e[0],e[1],3);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t]):super(t,0,3);break}default:super(3);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get b(){return this[2]}set b(e){this[2]=e}get magnitude(){let e=this[0],t=this[1],n=this[2];return Math.sqrt(e*e+t*t+n*n)}get mag(){return this.magnitude}get squaredMagnitude(){let e=this[0],t=this[1],n=this[2];return e*e+t*t+n*n}get sqrMag(){return this.squaredMagnitude}get str(){return A.str(this)}copy(e){return this.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this[2]+=e[2],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this[2]-=e[2],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this[2]*=e[2],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this[2]/=e[2],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this[2]+=e[2]*t,this}distance(e){return A.distance(this,e)}dist(e){return 0}squaredDistance(e){return A.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this[2]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this[2]=1/this[2],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this[2]=Math.abs(this[2]),this}dot(e){return this[0]*e[0]+this[1]*e[1]+this[2]*e[2]}normalize(){return A.normalize(this,this)}static get BYTE_LENGTH(){return 3*Float32Array.BYTES_PER_ELEMENT}static create(){return new A}static clone(e){return new A(e)}static magnitude(e){let t=e[0],n=e[1],s=e[2];return Math.sqrt(t*t+n*n+s*s)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static fromValues(e,t,n){return new A(e,t,n)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}static set(e,t,n,s){return e[0]=t,e[1]=n,e[2]=s,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}static sub(e,t,n){return[0,0,0]}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}static mul(e,t,n){return[0,0,0]}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e}static div(e,t,n){return[0,0,0]}static ceil(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}static floor(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e}static distance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2];return Math.sqrt(n*n+s*s+r*r)}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2];return n*n+s*s+r*r}static sqrDist(e,t){return 0}static squaredLength(e){let t=e[0],n=e[1],s=e[2];return t*t+n*n+s*s}static sqrLen(e,t){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e}static normalize(e,t){let n=t[0],s=t[1],r=t[2],a=n*n+s*s+r*r;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}static cross(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[0],c=n[1],y=n[2];return e[0]=r*y-a*c,e[1]=a*i-s*y,e[2]=s*c-r*i,e}static lerp(e,t,n,s){let r=t[0],a=t[1],i=t[2];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e[2]=i+s*(n[2]-i),e}static slerp(e,t,n,s){let r=Math.acos(Math.min(Math.max(A.dot(t,n),-1),1)),a=Math.sin(r),i=Math.sin((1-s)*r)/a,c=Math.sin(s*r)/a;return e[0]=i*t[0]+c*n[0],e[1]=i*t[1]+c*n[1],e[2]=i*t[2]+c*n[2],e}static hermite(e,t,n,s,r,a){let i=a*a,c=i*(2*a-3)+1,y=i*(a-2)+a,L=i*(a-1),k=i*(3-2*a);return e[0]=t[0]*c+n[0]*y+s[0]*L+r[0]*k,e[1]=t[1]*c+n[1]*y+s[1]*L+r[1]*k,e[2]=t[2]*c+n[2]*y+s[2]*L+r[2]*k,e}static bezier(e,t,n,s,r,a){let i=1-a,c=i*i,y=a*a,L=c*i,k=3*a*c,l=3*y*i,M=y*a;return e[0]=t[0]*L+n[0]*k+s[0]*l+r[0]*M,e[1]=t[1]*L+n[1]*k+s[1]*l+r[1]*M,e[2]=t[2]*L+n[2]*k+s[2]*l+r[2]*M,e}static transformMat4(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[3]*s+n[7]*r+n[11]*a+n[15]||1;return e[0]=(n[0]*s+n[4]*r+n[8]*a+n[12])/i,e[1]=(n[1]*s+n[5]*r+n[9]*a+n[13])/i,e[2]=(n[2]*s+n[6]*r+n[10]*a+n[14])/i,e}static transformMat3(e,t,n){let s=t[0],r=t[1],a=t[2];return e[0]=s*n[0]+r*n[3]+a*n[6],e[1]=s*n[1]+r*n[4]+a*n[7],e[2]=s*n[2]+r*n[5]+a*n[8],e}static transformQuat(e,t,n){let s=n[0],r=n[1],a=n[2],i=n[3]*2,c=t[0],y=t[1],L=t[2],k=r*L-a*y,l=a*c-s*L,M=s*y-r*c,h=(r*M-a*l)*2,b=(a*k-s*M)*2,d=(s*l-r*k)*2;return e[0]=c+k*i+h,e[1]=y+l*i+b,e[2]=L+M*i+d,e}static rotateX(e,t,n,s){let r=n[1],a=n[2],i=t[1]-r,c=t[2]-a;return e[0]=t[0],e[1]=i*Math.cos(s)-c*Math.sin(s)+r,e[2]=i*Math.sin(s)+c*Math.cos(s)+a,e}static rotateY(e,t,n,s){let r=n[0],a=n[2],i=t[0]-r,c=t[2]-a;return e[0]=c*Math.sin(s)+i*Math.cos(s)+r,e[1]=t[1],e[2]=c*Math.cos(s)-i*Math.sin(s)+a,e}static rotateZ(e,t,n,s){let r=n[0],a=n[1],i=t[0]-r,c=t[1]-a;return e[0]=i*Math.cos(s)-c*Math.sin(s)+r,e[1]=i*Math.sin(s)+c*Math.cos(s)+a,e[2]=n[2],e}static angle(e,t){let n=e[0],s=e[1],r=e[2],a=t[0],i=t[1],c=t[2],y=Math.sqrt((n*n+s*s+r*r)*(a*a+i*i+c*c)),L=y&&A.dot(e,t)/y;return Math.acos(Math.min(Math.max(L,-1),1))}static zero(e){return e[0]=0,e[1]=0,e[2]=0,e}static str(e){return`Vec3(${e.join(", ")})`}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=t[0],i=t[1],c=t[2];return Math.abs(n-a)<=1e-6*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(s-i)<=1e-6*Math.max(1,Math.abs(s),Math.abs(i))&&Math.abs(r-c)<=1e-6*Math.max(1,Math.abs(r),Math.abs(c))}};T.prototype.sub=T.prototype.subtract;T.prototype.mul=T.prototype.multiply;T.prototype.div=T.prototype.divide;T.prototype.dist=T.prototype.distance;T.prototype.sqrDist=T.prototype.squaredDistance;T.sub=T.subtract;T.mul=T.multiply;T.div=T.divide;T.dist=T.distance;T.sqrDist=T.squaredDistance;T.sqrLen=T.squaredLength;T.mag=T.magnitude;T.length=T.magnitude;T.len=T.magnitude;var q=class A extends Float32Array{constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t,t]):super(t,0,4);break}default:super(4);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get w(){return this[3]}set w(e){this[3]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get b(){return this[2]}set b(e){this[2]=e}get a(){return this[3]}set a(e){this[3]=e}get magnitude(){let e=this[0],t=this[1],n=this[2],s=this[3];return Math.sqrt(e*e+t*t+n*n+s*s)}get mag(){return this.magnitude}get str(){return A.str(this)}copy(e){return super.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this[2]+=e[2],this[3]+=e[3],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this[2]-=e[2],this[3]-=e[3],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this[2]*=e[2],this[3]*=e[3],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this[2]/=e[2],this[3]/=e[3],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this[3]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this[2]+=e[2]*t,this[3]+=e[3]*t,this}distance(e){return A.distance(this,e)}dist(e){return 0}squaredDistance(e){return A.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this[2]*=-1,this[3]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this[2]=1/this[2],this[3]=1/this[3],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this[2]=Math.abs(this[2]),this[3]=Math.abs(this[3]),this}dot(e){return this[0]*e[0]+this[1]*e[1]+this[2]*e[2]+this[3]*e[3]}normalize(){return A.normalize(this,this)}static get BYTE_LENGTH(){return 4*Float32Array.BYTES_PER_ELEMENT}static create(){return new A}static clone(e){return new A(e)}static fromValues(e,t,n,s){return new A(e,t,n,s)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static set(e,t,n,s,r){return e[0]=t,e[1]=n,e[2]=s,e[3]=r,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}static sub(e,t,n){return e}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e[3]=t[3]*n[3],e}static mul(e,t,n){return e}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e[3]=t[3]/n[3],e}static div(e,t,n){return e}static ceil(e,t){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}static floor(e,t){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}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e[3]=Math.min(t[3],n[3]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e[3]=Math.max(t[3],n[3]),e}static round(e,t){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}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e}static distance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2],a=t[3]-e[3];return Math.hypot(n,s,r,a)}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2],a=t[3]-e[3];return n*n+s*s+r*r+a*a}static sqrDist(e,t){return 0}static magnitude(e){let t=e[0],n=e[1],s=e[2],r=e[3];return Math.sqrt(t*t+n*n+s*s+r*r)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){let t=e[0],n=e[1],s=e[2],r=e[3];return t*t+n*n+s*s+r*r}static sqrLen(e){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e}static normalize(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*n+s*s+r*r+a*a;return i>0&&(i=1/Math.sqrt(i)),e[0]=n*i,e[1]=s*i,e[2]=r*i,e[3]=a*i,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}static cross(e,t,n,s){let r=n[0]*s[1]-n[1]*s[0],a=n[0]*s[2]-n[2]*s[0],i=n[0]*s[3]-n[3]*s[0],c=n[1]*s[2]-n[2]*s[1],y=n[1]*s[3]-n[3]*s[1],L=n[2]*s[3]-n[3]*s[2],k=t[0],l=t[1],M=t[2],h=t[3];return e[0]=l*L-M*y+h*c,e[1]=-(k*L)+M*i-h*a,e[2]=k*y-l*i+h*r,e[3]=-(k*c)+l*a-M*r,e}static lerp(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e[2]=i+s*(n[2]-i),e[3]=c+s*(n[3]-c),e}static transformMat4(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3];return e[0]=n[0]*s+n[4]*r+n[8]*a+n[12]*i,e[1]=n[1]*s+n[5]*r+n[9]*a+n[13]*i,e[2]=n[2]*s+n[6]*r+n[10]*a+n[14]*i,e[3]=n[3]*s+n[7]*r+n[11]*a+n[15]*i,e}static transformQuat(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[0],c=n[1],y=n[2],L=n[3],k=L*s+c*a-y*r,l=L*r+y*s-i*a,M=L*a+i*r-c*s,h=-i*s-c*r-y*a;return e[0]=k*L+h*-i+l*-y-M*-c,e[1]=l*L+h*-c+M*-i-k*-y,e[2]=M*L+h*-y+k*-c-l*-i,e[3]=t[3],e}static zero(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}static str(e){return`Vec4(${e.join(", ")})`}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=t[0],c=t[1],y=t[2],L=t[3];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(a-L)<=1e-6*Math.max(1,Math.abs(a),Math.abs(L))}};q.prototype.sub=q.prototype.subtract;q.prototype.mul=q.prototype.multiply;q.prototype.div=q.prototype.divide;q.prototype.dist=q.prototype.distance;q.prototype.sqrDist=q.prototype.squaredDistance;q.sub=q.subtract;q.mul=q.multiply;q.div=q.divide;q.dist=q.distance;q.sqrDist=q.squaredDistance;q.sqrLen=q.squaredLength;q.mag=q.magnitude;q.length=q.magnitude;q.len=q.magnitude;var ke,ie,ce,W,U,le,he,f=class f extends Float32Array{constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t,t]):super(t,0,4);break}default:super(4),this[3]=1;break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get w(){return this[3]}set w(e){this[3]=e}get magnitude(){let e=this[0],t=this[1],n=this[2],s=this[3];return Math.sqrt(e*e+t*t+n*n+s*s)}get mag(){return this.magnitude}get str(){return f.str(this)}copy(e){return super.set(e),this}identity(){return this[0]=0,this[1]=0,this[2]=0,this[3]=1,this}multiply(e){return f.multiply(this,this,e)}mul(e){return this}rotateX(e){return f.rotateX(this,this,e)}rotateY(e){return f.rotateY(this,this,e)}rotateZ(e){return f.rotateZ(this,this,e)}invert(){return f.invert(this,this)}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this[3]*=e,this}dot(e){return f.dot(this,e)}static get BYTE_LENGTH(){return 4*Float32Array.BYTES_PER_ELEMENT}static create(){return new f}static identity(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}static setAxisAngle(e,t,n){n*=.5;let s=Math.sin(n);return e[0]=s*t[0],e[1]=s*t[1],e[2]=s*t[2],e[3]=Math.cos(n),e}static getAxisAngle(e,t){let n=Math.acos(t[3])*2,s=Math.sin(n/2);return s>1e-6?(e[0]=t[0]/s,e[1]=t[1]/s,e[2]=t[2]/s):(e[0]=1,e[1]=0,e[2]=0),n}static getAngle(e,t){let n=f.dot(e,t);return Math.acos(2*n*n-1)}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*k+i*c+r*L-a*y,e[1]=r*k+i*y+a*c-s*L,e[2]=a*k+i*L+s*y-r*c,e[3]=i*k-s*c-r*y-a*L,e}static rotateX(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+i*c,e[1]=r*y+a*c,e[2]=a*y-r*c,e[3]=i*y-s*c,e}static rotateY(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y-a*c,e[1]=r*y+i*c,e[2]=a*y+s*c,e[3]=i*y-r*c,e}static rotateZ(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+r*c,e[1]=r*y-s*c,e[2]=a*y+i*c,e[3]=i*y-a*c,e}static calculateW(e,t){let n=t[0],s=t[1],r=t[2];return e[0]=n,e[1]=s,e[2]=r,e[3]=Math.sqrt(Math.abs(1-n*n-s*s-r*r)),e}static exp(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=Math.sqrt(n*n+s*s+r*r),c=Math.exp(a),y=i>0?c*Math.sin(i)/i:0;return e[0]=n*y,e[1]=s*y,e[2]=r*y,e[3]=c*Math.cos(i),e}static ln(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=Math.sqrt(n*n+s*s+r*r),c=i>0?Math.atan2(i,a)/i:0;return e[0]=n*c,e[1]=s*c,e[2]=r*c,e[3]=.5*Math.log(n*n+s*s+r*r+a*a),e}static pow(e,t,n){return f.ln(e,t),f.scale(e,e,n),f.exp(e,e),e}static slerp(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3],y=n[0],L=n[1],k=n[2],l=n[3],M,h,b=r*y+a*L+i*k+c*l;if(b<0&&(b=-b,y=-y,L=-L,k=-k,l=-l),1-b>1e-6){let d=Math.acos(b),m=Math.sin(d);M=Math.sin((1-s)*d)/m,h=Math.sin(s*d)/m}else M=1-s,h=s;return e[0]=M*r+h*y,e[1]=M*a+h*L,e[2]=M*i+h*k,e[3]=M*c+h*l,e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*n+s*s+r*r+a*a,c=i?1/i:0;return e[0]=-n*c,e[1]=-s*c,e[2]=-r*c,e[3]=a*c,e}static conjugate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}static fromMat3(e,t){let n=t[0]+t[4]+t[8],s;if(n>0)s=Math.sqrt(n+1),e[3]=.5*s,s=.5/s,e[0]=(t[5]-t[7])*s,e[1]=(t[6]-t[2])*s,e[2]=(t[1]-t[3])*s;else{let r=0;t[4]>t[0]&&(r=1),t[8]>t[r*3+r]&&(r=2);let a=(r+1)%3,i=(r+2)%3;s=Math.sqrt(t[r*3+r]-t[a*3+a]-t[i*3+i]+1),e[r]=.5*s,s=.5/s,e[3]=(t[a*3+i]-t[i*3+a])*s,e[a]=(t[a*3+r]+t[r*3+a])*s,e[i]=(t[i*3+r]+t[r*3+i])*s}return e}static fromEuler(e,t,n,s,r=E(f,ke)){let a=.5*Math.PI/180;t*=a,n*=a,s*=a;let i=Math.sin(t),c=Math.cos(t),y=Math.sin(n),L=Math.cos(n),k=Math.sin(s),l=Math.cos(s);switch(r){case"xyz":e[0]=i*L*l+c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l-i*y*k;break;case"xzy":e[0]=i*L*l-c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l+i*y*k;break;case"yxz":e[0]=i*L*l+c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l+i*y*k;break;case"yzx":e[0]=i*L*l+c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l-i*y*k;break;case"zxy":e[0]=i*L*l-c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l-i*y*k;break;case"zyx":e[0]=i*L*l-c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l+i*y*k;break;default:throw new Error(`Unknown angle order ${r}`)}return e}static str(e){return`Quat(${e.join(", ")})`}static clone(e){return new f(e)}static fromValues(e,t,n,s){return new f(e,t,n,s)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static set(e,t,n,s,r){return e}static add(e,t,n){return e}static mul(e,t,n){return e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}static lerp(e,t,n,s){return e}static magnitude(e){return 0}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){return 0}static sqrLen(e){return 0}static normalize(e,t){return e}static exactEquals(e,t){return!1}static equals(e,t){return!1}static rotationTo(e,t,n){let s=T.dot(t,n);return s<-.999999?(T.cross(E(f,U),E(f,le),t),T.mag(E(f,U))<1e-6&&T.cross(E(f,U),E(f,he),t),T.normalize(E(f,U),E(f,U)),f.setAxisAngle(e,E(f,U),Math.PI),e):s>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(T.cross(E(f,U),t,n),e[0]=E(f,U)[0],e[1]=E(f,U)[1],e[2]=E(f,U)[2],e[3]=1+s,f.normalize(e,e))}static sqlerp(e,t,n,s,r,a){return f.slerp(E(f,ie),t,r,a),f.slerp(E(f,ce),n,s,a),f.slerp(e,E(f,ie),E(f,ce),2*a*(1-a)),e}static setAxes(e,t,n,s){return E(f,W)[0]=n[0],E(f,W)[3]=n[1],E(f,W)[6]=n[2],E(f,W)[1]=s[0],E(f,W)[4]=s[1],E(f,W)[7]=s[2],E(f,W)[2]=-t[0],E(f,W)[5]=-t[1],E(f,W)[8]=-t[2],f.normalize(e,f.fromMat3(e,E(f,W)))}};ke=new WeakMap,ie=new WeakMap,ce=new WeakMap,W=new WeakMap,U=new WeakMap,le=new WeakMap,he=new WeakMap,Z(f,ke,"zyx"),Z(f,ie,new Float32Array(4)),Z(f,ce,new Float32Array(4)),Z(f,W,new Float32Array(9)),Z(f,U,new Float32Array(3)),Z(f,le,new Float32Array([1,0,0])),Z(f,he,new Float32Array([0,1,0]));var O=f;O.set=q.set;O.add=q.add;O.lerp=q.lerp;O.normalize=q.normalize;O.squaredLength=q.squaredLength;O.sqrLen=q.squaredLength;O.exactEquals=q.exactEquals;O.equals=q.equals;O.magnitude=q.magnitude;O.prototype.mul=O.prototype.multiply;O.mul=O.multiply;O.mag=O.magnitude;O.length=O.magnitude;O.len=O.magnitude;var ye,Le,j=class j extends Float32Array{constructor(...e){switch(e.length){case 8:super(e);break;case 2:super(e[0],e[1],8);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t,t,t,t,t,t]):super(t,0,8);break}default:super(8),this[3]=1;break}}get str(){return j.str(this)}copy(e){return super.set(e),this}static get BYTE_LENGTH(){return 8*Float32Array.BYTES_PER_ELEMENT}static create(){return new j}static clone(e){return new j(e)}static fromValues(e,t,n,s,r,a,i,c){return new j(e,t,n,s,r,a,i,c)}static fromRotationTranslationValues(e,t,n,s,r,a,i){let c=r*.5,y=a*.5,L=i*.5;return new j(e,t,n,s,c*s+y*n-L*t,y*s+L*e-c*n,L*s+c*t-y*e,-c*e-y*t-L*n)}static fromRotationTranslation(e,t,n){let s=n[0]*.5,r=n[1]*.5,a=n[2]*.5,i=t[0],c=t[1],y=t[2],L=t[3];return e[0]=i,e[1]=c,e[2]=y,e[3]=L,e[4]=s*L+r*y-a*c,e[5]=r*L+a*i-s*y,e[6]=a*L+s*c-r*i,e[7]=-s*i-r*c-a*y,e}static fromTranslation(e,t){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0]*.5,e[5]=t[1]*.5,e[6]=t[2]*.5,e[7]=0,e}static fromRotation(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=0,e[5]=0,e[6]=0,e[7]=0,e}static fromMat4(e,t){return G.getRotation(E(j,ye),t),G.getTranslation(E(j,Le),t),j.fromRotationTranslation(e,E(j,ye),E(j,Le))}static copy(e,t){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}static identity(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e}static set(e,t,n,s,r,a,i,c,y){return e[0]=t,e[1]=n,e[2]=s,e[3]=r,e[4]=a,e[5]=i,e[6]=c,e[7]=y,e}static getReal(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static getDual(e,t){return e[0]=t[4],e[1]=t[5],e[2]=t[6],e[3]=t[7],e}static setReal(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static setDual(e,t){return e[4]=t[0],e[5]=t[1],e[6]=t[2],e[7]=t[3],e}static getTranslation(e,t){let n=t[4],s=t[5],r=t[6],a=t[7],i=-t[0],c=-t[1],y=-t[2],L=t[3];return e[0]=(n*L+a*i+s*y-r*c)*2,e[1]=(s*L+a*c+r*i-n*y)*2,e[2]=(r*L+a*y+n*c-s*i)*2,e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0]*.5,y=n[1]*.5,L=n[2]*.5,k=t[4],l=t[5],M=t[6],h=t[7];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=i*c+r*L-a*y+k,e[5]=i*y+a*c-s*L+l,e[6]=i*L+s*y-r*c+M,e[7]=-s*c-r*y-a*L+h,e}static rotateX(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,M=y*i+k*r+L*s-c*a,h=L*i+k*a+c*r-y*s,b=k*i-c*s-y*r-L*a;return O.rotateX(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+b*s+M*a-h*r,e[5]=M*i+b*r+h*s-l*a,e[6]=h*i+b*a+l*r-M*s,e[7]=b*i-l*s-M*r-h*a,e}static rotateY(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,M=y*i+k*r+L*s-c*a,h=L*i+k*a+c*r-y*s,b=k*i-c*s-y*r-L*a;return O.rotateY(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+b*s+M*a-h*r,e[5]=M*i+b*r+h*s-l*a,e[6]=h*i+b*a+l*r-M*s,e[7]=b*i-l*s-M*r-h*a,e}static rotateZ(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,M=y*i+k*r+L*s-c*a,h=L*i+k*a+c*r-y*s,b=k*i-c*s-y*r-L*a;return O.rotateZ(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+b*s+M*a-h*r,e[5]=M*i+b*r+h*s-l*a,e[6]=h*i+b*a+l*r-M*s,e[7]=b*i-l*s-M*r-h*a,e}static rotateByQuatAppend(e,t,n){let s=n[0],r=n[1],a=n[2],i=n[3],c=t[0],y=t[1],L=t[2],k=t[3];return e[0]=c*i+k*s+y*a-L*r,e[1]=y*i+k*r+L*s-c*a,e[2]=L*i+k*a+c*r-y*s,e[3]=k*i-c*s-y*r-L*a,c=t[4],y=t[5],L=t[6],k=t[7],e[4]=c*i+k*s+y*a-L*r,e[5]=y*i+k*r+L*s-c*a,e[6]=L*i+k*a+c*r-y*s,e[7]=k*i-c*s-y*r-L*a,e}static rotateByQuatPrepend(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*k+i*c+r*L-a*y,e[1]=r*k+i*y+a*c-s*L,e[2]=a*k+i*L+s*y-r*c,e[3]=i*k-s*c-r*y-a*L,c=n[4],y=n[5],L=n[6],k=n[7],e[4]=s*k+i*c+r*L-a*y,e[5]=r*k+i*y+a*c-s*L,e[6]=a*k+i*L+s*y-r*c,e[7]=i*k-s*c-r*y-a*L,e}static rotateAroundAxis(e,t,n,s){if(Math.abs(s)<1e-6)return j.copy(e,t);let r=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);s*=.5;let a=Math.sin(s),i=a*n[0]/r,c=a*n[1]/r,y=a*n[2]/r,L=Math.cos(s),k=t[0],l=t[1],M=t[2],h=t[3];e[0]=k*L+h*i+l*y-M*c,e[1]=l*L+h*c+M*i-k*y,e[2]=M*L+h*y+k*c-l*i,e[3]=h*L-k*i-l*c-M*y;let b=t[4],d=t[5],m=t[6],o=t[7];return e[4]=b*L+o*i+d*y-m*c,e[5]=d*L+o*c+m*i-b*y,e[6]=m*L+o*y+b*c-d*i,e[7]=o*L-b*i-d*c-m*y,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[4],y=n[5],L=n[6],k=n[7],l=t[4],M=t[5],h=t[6],b=t[7],d=n[0],m=n[1],o=n[2],V=n[3];return e[0]=s*V+i*d+r*o-a*m,e[1]=r*V+i*m+a*d-s*o,e[2]=a*V+i*o+s*m-r*d,e[3]=i*V-s*d-r*m-a*o,e[4]=s*k+i*c+r*L-a*y+l*V+b*d+M*o-h*m,e[5]=r*k+i*y+a*c-s*L+M*V+b*m+h*d-l*o,e[6]=a*k+i*L+s*y-r*c+h*V+b*o+l*m-M*d,e[7]=i*k-s*c-r*y-a*L+b*V-l*d-M*m-h*o,e}static mul(e,t,n){return e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e}static dot(e,t){return 0}static lerp(e,t,n,s){let r=1-s;return j.dot(t,n)<0&&(s=-s),e[0]=t[0]*r+n[0]*s,e[1]=t[1]*r+n[1]*s,e[2]=t[2]*r+n[2]*s,e[3]=t[3]*r+n[3]*s,e[4]=t[4]*r+n[4]*s,e[5]=t[5]*r+n[5]*s,e[6]=t[6]*r+n[6]*s,e[7]=t[7]*r+n[7]*s,e}static invert(e,t){let n=j.squaredLength(t);return e[0]=-t[0]/n,e[1]=-t[1]/n,e[2]=-t[2]/n,e[3]=t[3]/n,e[4]=-t[4]/n,e[5]=-t[5]/n,e[6]=-t[6]/n,e[7]=t[7]/n,e}static conjugate(e,t){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}static magnitude(e){return 0}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){return 0}static sqrLen(e){return 0}static normalize(e,t){let n=j.squaredLength(t);if(n>0){n=Math.sqrt(n);let s=t[0]/n,r=t[1]/n,a=t[2]/n,i=t[3]/n,c=t[4],y=t[5],L=t[6],k=t[7],l=s*c+r*y+a*L+i*k;e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=(c-s*l)/n,e[5]=(y-r*l)/n,e[6]=(L-a*l)/n,e[7]=(k-i*l)/n}return e}static str(e){return`Quat2(${e.join(", ")})`}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=t[0],l=t[1],M=t[2],h=t[3],b=t[4],d=t[5],m=t[6],o=t[7];return Math.abs(n-k)<=1e-6*Math.max(1,Math.abs(n),Math.abs(k))&&Math.abs(s-l)<=1e-6*Math.max(1,Math.abs(s),Math.abs(l))&&Math.abs(r-M)<=1e-6*Math.max(1,Math.abs(r),Math.abs(M))&&Math.abs(a-h)<=1e-6*Math.max(1,Math.abs(a),Math.abs(h))&&Math.abs(i-b)<=1e-6*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(c-d)<=1e-6*Math.max(1,Math.abs(c),Math.abs(d))&&Math.abs(y-m)<=1e-6*Math.max(1,Math.abs(y),Math.abs(m))&&Math.abs(L-o)<=1e-6*Math.max(1,Math.abs(L),Math.abs(o))}};ye=new WeakMap,Le=new WeakMap,Z(j,ye,new Float32Array(4)),Z(j,Le,new Float32Array(3));var J=j;J.dot=O.dot;J.squaredLength=O.squaredLength;J.sqrLen=O.squaredLength;J.mag=O.magnitude;J.length=O.magnitude;J.len=O.magnitude;J.mul=J.multiply;var N=class A extends Float32Array{constructor(...e){switch(e.length){case 2:{let t=e[0];typeof t=="number"?super([t,e[1]]):super(t,e[1],2);break}case 1:{let t=e[0];typeof t=="number"?super([t,t]):super(t,0,2);break}default:super(2);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get magnitude(){return Math.hypot(this[0],this[1])}get mag(){return this.magnitude}get squaredMagnitude(){let e=this[0],t=this[1];return e*e+t*t}get sqrMag(){return this.squaredMagnitude}get str(){return A.str(this)}copy(e){return this.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this}distance(e){return A.distance(this,e)}dist(e){return 0}squaredDistance(e){return A.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this}dot(e){return this[0]*e[0]+this[1]*e[1]}normalize(){return A.normalize(this,this)}static get BYTE_LENGTH(){return 2*Float32Array.BYTES_PER_ELEMENT}static create(){return new A}static clone(e){return new A(e)}static fromValues(e,t){return new A(e,t)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e}static set(e,t,n){return e[0]=t,e[1]=n,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}static sub(e,t,n){return[0,0]}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e}static mul(e,t,n){return[0,0]}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e}static div(e,t,n){return[0,0]}static ceil(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}static floor(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e}static round(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e}static distance(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1])}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1];return n*n+s*s}static sqrDist(e,t){return 0}static magnitude(e){let t=e[0],n=e[1];return Math.sqrt(t*t+n*n)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){let t=e[0],n=e[1];return t*t+n*n}static sqrLen(e,t){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e}static normalize(e,t){let n=t[0],s=t[1],r=n*n+s*s;return r>0&&(r=1/Math.sqrt(r)),e[0]=t[0]*r,e[1]=t[1]*r,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]}static cross(e,t,n){let s=t[0]*n[1]-t[1]*n[0];return e[0]=e[1]=0,e[2]=s,e}static lerp(e,t,n,s){let r=t[0],a=t[1];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e}static transformMat2(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[2]*r,e[1]=n[1]*s+n[3]*r,e}static transformMat2d(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[2]*r+n[4],e[1]=n[1]*s+n[3]*r+n[5],e}static transformMat3(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[3]*r+n[6],e[1]=n[1]*s+n[4]*r+n[7],e}static transformMat4(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[4]*r+n[12],e[1]=n[1]*s+n[5]*r+n[13],e}static rotate(e,t,n,s){let r=t[0]-n[0],a=t[1]-n[1],i=Math.sin(s),c=Math.cos(s);return e[0]=r*c-a*i+n[0],e[1]=r*i+a*c+n[1],e}static angle(e,t){let n=e[0],s=e[1],r=t[0],a=t[1],i=Math.sqrt(n*n+s*s)*Math.sqrt(r*r+a*a),c=i&&(n*r+s*a)/i;return Math.acos(Math.min(Math.max(c,-1),1))}static zero(e){return e[0]=0,e[1]=0,e}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]}static equals(e,t){let n=e[0],s=e[1],r=t[0],a=t[1];return Math.abs(n-r)<=1e-6*Math.max(1,Math.abs(n),Math.abs(r))&&Math.abs(s-a)<=1e-6*Math.max(1,Math.abs(s),Math.abs(a))}static str(e){return`Vec2(${e.join(", ")})`}};N.prototype.sub=N.prototype.subtract;N.prototype.mul=N.prototype.multiply;N.prototype.div=N.prototype.divide;N.prototype.dist=N.prototype.distance;N.prototype.sqrDist=N.prototype.squaredDistance;N.sub=N.subtract;N.mul=N.multiply;N.div=N.divide;N.dist=N.distance;N.sqrDist=N.squaredDistance;N.sqrLen=N.squaredLength;N.mag=N.magnitude;N.length=N.magnitude;N.len=N.magnitude;var me=!1;function _e(){if(me)return;let A=["xx","xy","yx","yy","xxx","xxy","xyx","xyy","yxx","yxy","yyx","yyy","xxxx","xxxy","xxyx","xxyy","xyxx","xyxy","xyyx","xyyy","yxxx","yxxy","yxyx","yxyy","yyxx","yyxy","yyyx","yyyy","rr","rg","gr","gg","rrr","rrg","rgr","rgg","grr","grg","ggr","ggg","rrrr","rrrg","rrgr","rrgg","rgrr","rgrg","rggr","rggg","grrr","grrg","grgr","grgg","ggrr","ggrg","gggr","gggg"],e=["xz","yz","zx","zy","zz","xxz","xyz","xzx","xzy","xzz","yxz","yyz","yzx","yzy","yzz","zxx","zxy","zxz","zyx","zyy","zyz","zzx","zzy","zzz","xxxz","xxyz","xxzx","xxzy","xxzz","xyxz","xyyz","xyzx","xyzy","xyzz","xzxx","xzxy","xzxz","xzyx","xzyy","xzyz","xzzx","xzzy","xzzz","yxxz","yxyz","yxzx","yxzy","yxzz","yyxz","yyyz","yyzx","yyzy","yyzz","yzxx","yzxy","yzxz","yzyx","yzyy","yzyz","yzzx","yzzy","yzzz","zxxx","zxxy","zxxz","zxyx","zxyy","zxyz","zxzx","zxzy","zxzz","zyxx","zyxy","zyxz","zyyx","zyyy","zyyz","zyzx","zyzy","zyzz","zzxx","zzxy","zzxz","zzyx","zzyy","zzyz","zzzx","zzzy","zzzz","rb","gb","br","bg","bb","rrb","rgb","rbr","rbg","rbb","grb","ggb","gbr","gbg","gbb","brr","brg","brb","bgr","bgg","bgb","bbr","bbg","bbb","rrrb","rrgb","rrbr","rrbg","rrbb","rgrb","rggb","rgbr","rgbg","rgbb","rbrr","rbrg","rbrb","rbgr","rbgg","rbgb","rbbr","rbbg","rbbb","grrb","grgb","grbr","grbg","grbb","ggrb","gggb","ggbr","ggbg","ggbb","gbrr","gbrg","gbrb","gbgr","gbgg","gbgb","gbbr","gbbg","gbbb","brrr","brrg","brrb","brgr","brgg","brgb","brbr","brbg","brbb","bgrr","bgrg","bgrb","bggr","bggg","bggb","bgbr","bgbg","bgbb","bbrr","bbrg","bbrb","bbgr","bbgg","bbgb","bbbr","bbbg","bbbb"],t=["xw","yw","zw","wx","wy","wz","ww","xxw","xyw","xzw","xwx","xwy","xwz","xww","yxw","yyw","yzw","ywx","ywy","ywz","yww","zxw","zyw","zzw","zwx","zwy","zwz","zww","wxx","wxy","wxz","wxw","wyx","wyy","wyz","wyw","wzx","wzy","wzz","wzw","wwx","wwy","wwz","www","xxxw","xxyw","xxzw","xxwx","xxwy","xxwz","xxww","xyxw","xyyw","xyzw","xywx","xywy","xywz","xyww","xzxw","xzyw","xzzw","xzwx","xzwy","xzwz","xzww","xwxx","xwxy","xwxz","xwxw","xwyx","xwyy","xwyz","xwyw","xwzx","xwzy","xwzz","xwzw","xwwx","xwwy","xwwz","xwww","yxxw","yxyw","yxzw","yxwx","yxwy","yxwz","yxww","yyxw","yyyw","yyzw","yywx","yywy","yywz","yyww","yzxw","yzyw","yzzw","yzwx","yzwy","yzwz","yzww","ywxx","ywxy","ywxz","ywxw","ywyx","ywyy","ywyz","ywyw","ywzx","ywzy","ywzz","ywzw","ywwx","ywwy","ywwz","ywww","zxxw","zxyw","zxzw","zxwx","zxwy","zxwz","zxww","zyxw","zyyw","zyzw","zywx","zywy","zywz","zyww","zzxw","zzyw","zzzw","zzwx","zzwy","zzwz","zzww","zwxx","zwxy","zwxz","zwxw","zwyx","zwyy","zwyz","zwyw","zwzx","zwzy","zwzz","zwzw","zwwx","zwwy","zwwz","zwww","wxxx","wxxy","wxxz","wxxw","wxyx","wxyy","wxyz","wxyw","wxzx","wxzy","wxzz","wxzw","wxwx","wxwy","wxwz","wxww","wyxx","wyxy","wyxz","wyxw","wyyx","wyyy","wyyz","wyyw","wyzx","wyzy","wyzz","wyzw","wywx","wywy","wywz","wyww","wzxx","wzxy","wzxz","wzxw","wzyx","wzyy","wzyz","wzyw","wzzx","wzzy","wzzz","wzzw","wzwx","wzwy","wzwz","wzww","wwxx","wwxy","wwxz","wwxw","wwyx","wwyy","wwyz","wwyw","wwzx","wwzy","wwzz","wwzw","wwwx","wwwy","wwwz","wwww","ra","ga","ba","ar","ag","ab","aa","rra","rga","rba","rar","rag","rab","raa","gra","gga","gba","gar","gag","gab","gaa","bra","bga","bba","bar","bag","bab","baa","arr","arg","arb","ara","agr","agg","agb","aga","abr","abg","abb","aba","aar","aag","aab","aaa","rrra","rrga","rrba","rrar","rrag","rrab","rraa","rgra","rgga","rgba","rgar","rgag","rgab","rgaa","rbra","rbga","rbba","rbar","rbag","rbab","rbaa","rarr","rarg","rarb","rara","ragr","ragg","ragb","raga","rabr","rabg","rabb","raba","raar","raag","raab","raaa","grra","grga","grba","grar","grag","grab","graa","ggra","ggga","ggba","ggar","ggag","ggab","ggaa","gbra","gbga","gbba","gbar","gbag","gbab","gbaa","garr","garg","garb","gara","gagr","gagg","gagb","gaga","gabr","gabg","gabb","gaba","gaar","gaag","gaab","gaaa","brra","brga","brba","brar","brag","brab","braa","bgra","bgga","bgba","bgar","bgag","bgab","bgaa","bbra","bbga","bbba","bbar","bbag","bbab","bbaa","barr","barg","barb","bara","bagr","bagg","bagb","baga","babr","babg","babb","baba","baar","baag","baab","baaa","arrr","arrg","arrb","arra","argr","argg","argb","arga","arbr","arbg","arbb","arba","arar","arag","arab","araa","agrr","agrg","agrb","agra","aggr","aggg","aggb","agga","agbr","agbg","agbb","agba","agar","agag","agab","agaa","abrr","abrg","abrb","abra","abgr","abgg","abgb","abga","abbr","abbg","abbb","abba","abar","abag","abab","abaa","aarr","aarg","aarb","aara","aagr","aagg","aagb","aaga","aabr","aabg","aabb","aaba","aaar","aaag","aaab","aaaa"],n={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};function s(r){switch(r.length){case 2:return function(){return new N(this[n[r[0]]],this[n[r[1]]])};case 3:return function(){return new T(this[n[r[0]]],this[n[r[1]]],this[n[r[2]]])};case 4:return function(){return new q(this[n[r[0]]],this[n[r[1]]],this[n[r[2]]],this[n[r[3]]])}}throw new Error("Illegal swizzle length")}for(let r of A){let a=s(r);Object.defineProperty(N.prototype,r,{get:a}),Object.defineProperty(T.prototype,r,{get:a}),Object.defineProperty(q.prototype,r,{get:a})}for(let r of e){let a=s(r);Object.defineProperty(T.prototype,r,{get:a}),Object.defineProperty(q.prototype,r,{get:a})}for(let r of t){let a=s(r);Object.defineProperty(q.prototype,r,{get:a})}me=!0}var xe=Math.PI/180,Re=180/Math.PI;function tt(A){return A*Re}function nt(A){return A*xe}export{_e as EnableSwizzles,v as Mat2,_ as Mat2d,u as Mat3,G as Mat4,O as Quat,J as Quat2,N as Vec2,T as Vec3,q as Vec4,v as mat2,_ as mat2d,u as mat3,G as mat4,O as quat,J as quat2,tt as toDegree,nt as toRadian,N as vec2,T as vec3,q as vec4}; +//# sourceMappingURL=gl-matrix-f32.min.js.map diff --git a/dist-cdn/esm/2016/gl-matrix-f32.min.js.map b/dist-cdn/esm/2016/gl-matrix-f32.min.js.map new file mode 100644 index 00000000..8b46b0fe --- /dev/null +++ b/dist-cdn/esm/2016/gl-matrix-f32.min.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../../../src/_lib/f32/Mat2.ts", "../../../src/_lib/f32/Mat2d.ts", "../../../src/_lib/f32/Mat3.ts", "../../../src/_lib/f32/Mat4.ts", "../../../src/_lib/f32/Vec3.ts", "../../../src/_lib/f32/Vec4.ts", "../../../src/_lib/f32/Quat.ts", "../../../src/_lib/f32/Quat2.ts", "../../../src/_lib/f32/Vec2.ts", "../../../src/swizzle/index.ts", "../../../src/util/angleConversion.ts"], + "sourcesContent": ["import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x2 Matrix\r\n */\r\nexport class Mat2 extends Float32Array {\r\n static #IDENTITY_2X2 = new Float32Array([\r\n 1, 0,\r\n 0, 1\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n default:\r\n super(Mat2.#IDENTITY_2X2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2} into `this`.\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2.identity(this)\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n identity(): this {\r\n this.set(Mat2.#IDENTITY_2X2);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2} against another one\r\n * Equivalent to `Mat2.multiply(this, this, b);`\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat2}\r\n * Equivalent to `Mat2.transpose(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n transpose(): this {\r\n return Mat2.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat2}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n invert(): this {\r\n return Mat2.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2.scale(this, this, v);`\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2} by the given angle around the given axis\r\n * Equivalent to `Mat2.rotate(this, this, rad);`\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n rotate(rad: number): this {\r\n return Mat2.rotate(this, this, rad) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2}\r\n */\r\n static create(): Mat2 {\r\n return new Mat2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2}\r\n */\r\n static clone(a: Readonly): Mat2 {\r\n return new Mat2(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2Like, a: Readonly): Mat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2}\r\n */\r\n static fromValues(...values: number[]): Mat2 {\r\n return new Mat2(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2Like, ...values: number[]): Mat2Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2Like): Mat2Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat2Like, a: Readonly): Mat2Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache\r\n // some values\r\n if (out === a) {\r\n const a1 = a[1];\r\n out[1] = a[2];\r\n out[2] = a1;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[2];\r\n out[2] = a[1];\r\n out[3] = a[3];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2Like, a: Mat2Like): Mat2Like | null {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n // Calculate the determinant\r\n let det = a0 * a3 - a2 * a1;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = a3 * det;\r\n out[1] = -a1 * det;\r\n out[2] = -a2 * det;\r\n out[3] = a0 * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat2Like, a: Mat2Like): Mat2Like {\r\n // Caching this value is necessary if out == a\r\n const a0 = a[0];\r\n out[0] = a[3];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[2] * a[1];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n return out;\r\n }\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Rotates a {@link Mat2} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2Like, a: Readonly, rad: number): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2Like, a: Readonly, v: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2Like, rad: number): Mat2Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2Like, v: Readonly): Mat2Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2Like, a: Readonly, b: number): Mat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2Like, a: Readonly, b: Readonly, scale: number): Mat2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\r\n * @category Static\r\n *\r\n * @param L - the lower triangular matrix\r\n * @param D - the diagonal matrix\r\n * @param U - the upper triangular matrix\r\n * @param a - the input matrix to factorize\r\n */\r\n\r\n static LDU(L: Mat2Like, D: Readonly, U: Mat2Like, a: Readonly):\r\n [Mat2Like, Readonly, Mat2Like] {\r\n L[2] = a[2] / a[0];\r\n U[0] = a[0];\r\n U[1] = a[1];\r\n U[3] = a[3] - L[2] * U[1];\r\n return [L, D, U];\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat2.prototype.mul = Mat2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat2.mul = Mat2.multiply;\r\nMat2.sub = Mat2.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x3 Matrix\r\n */\r\nexport class Mat2d extends Float32Array {\r\n static #IDENTITY_2X3 = new Float32Array([\r\n 1, 0,\r\n 0, 1,\r\n 0, 0,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 6:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 6); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 6);\r\n }\r\n break;\r\n default:\r\n super(Mat2d.#IDENTITY_2X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2d.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2d.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2d} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2d.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat2d.#IDENTITY_2X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2d} against another one\r\n * Equivalent to `Mat2d.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2d.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Translate this {@link Mat2d} by the given vector\r\n * Equivalent to `Mat2d.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat2d.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2d} by the given angle around the given axis\r\n * Equivalent to `Mat2d.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat2d.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2d.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2d.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2d}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 6 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2d}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2d}\r\n */\r\n static create(): Mat2d {\r\n return new Mat2d();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2d} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2d}\r\n */\r\n static clone(a: Readonly): Mat2d {\r\n return new Mat2d(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2d} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2dLike, a: Readonly): Mat2dLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2d} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2d}\r\n */\r\n static fromValues(...values: number[]): Mat2d {\r\n return new Mat2d(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2d} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2dLike, ...values: number[]): Mat2dLike {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2d} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2dLike): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2dLike, a: Mat2dLike): Mat2dLike | null {\r\n const aa = a[0];\r\n const ab = a[1];\r\n const ac = a[2];\r\n const ad = a[3];\r\n const atx = a[4];\r\n const aty = a[5];\r\n\r\n let det = aa * ad - ab * ac;\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = ad * det;\r\n out[1] = -ab * det;\r\n out[2] = -ac * det;\r\n out[3] = aa * det;\r\n out[4] = (ac * aty - ad * atx) * det;\r\n out[5] = (ab * atx - aa * aty) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[1] * a[2];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2d}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n out[4] = a0 * b4 + a2 * b5 + a4;\r\n out[5] = a1 * b4 + a3 * b5 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat2d} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n out[4] = a0 * v0 + a2 * v1 + a4;\r\n out[5] = a1 * v0 + a3 * v1 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat2d} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2dLike, a: Readonly, rad: number): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n // TODO: Got to fromRotation\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = v[0];\r\n out[5] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2dLike, rad: number): Mat2dLike {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2d} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2dLike, a: Readonly, b: number): Mat2dLike {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2dLike, a: Readonly, b: Readonly, scale: number):\r\n Mat2dLike {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2d(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Static method alias assignments\r\nMat2d.mul = Mat2d.multiply;\r\nMat2d.sub = Mat2d.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Mat3Like, Mat4Like, Vec2Like, QuatLike } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 3x3 Matrix\r\n */\r\nexport class Mat3 extends Float32Array {\r\n static #IDENTITY_3X3 = new Float32Array([\r\n 1, 0, 0,\r\n 0, 1, 0,\r\n 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 9:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 9); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v,\r\n v, v, v,\r\n v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 9);\r\n }\r\n break;\r\n default:\r\n super(Mat3.#IDENTITY_3X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat3.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat3.#IDENTITY_3X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat3} against another one\r\n * Equivalent to `Mat3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat3.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat3}\r\n * Equivalent to `Mat3.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat3.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat3}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat3.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat3} by the given vector\r\n * Equivalent to `Mat3.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat3.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat3} by the given angle around the given axis\r\n * Equivalent to `Mat3.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat3.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat3.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat3.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 9 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat3}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat3}\r\n */\r\n static create(): Mat3 {\r\n return new Mat3();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat3} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat3}\r\n */\r\n static clone(a: Readonly): Mat3 {\r\n return new Mat3(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat3} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat3} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat3}\r\n */\r\n static fromValues(...values: number[]): Mat3 {\r\n return new Mat3(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat3} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat3Like, ...values: number[]): Mat3Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat3} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat3Like): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat3Like, a: Readonly): Mat3Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a12 = a[5];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a01;\r\n out[5] = a[7];\r\n out[6] = a02;\r\n out[7] = a12;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a[1];\r\n out[4] = a[4];\r\n out[5] = a[7];\r\n out[6] = a[2];\r\n out[7] = a[5];\r\n out[8] = a[8];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat3Like, a: Mat3Like): Mat3Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2];\r\n const a10 = a[3],\r\n a11 = a[4],\r\n a12 = a[5];\r\n const a20 = a[6],\r\n a21 = a[7],\r\n a22 = a[8];\r\n\r\n const b01 = a22 * a11 - a12 * a21;\r\n const b11 = -a22 * a10 + a12 * a20;\r\n const b21 = a21 * a10 - a11 * a20;\r\n\r\n // Calculate the determinant\r\n let det = a00 * b01 + a01 * b11 + a02 * b21;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = b01 * det;\r\n out[1] = (-a22 * a01 + a02 * a21) * det;\r\n out[2] = (a12 * a01 - a02 * a11) * det;\r\n out[3] = b11 * det;\r\n out[4] = (a22 * a00 - a02 * a20) * det;\r\n out[5] = (-a12 * a00 + a02 * a10) * det;\r\n out[6] = b21 * det;\r\n out[7] = (-a21 * a00 + a01 * a20) * det;\r\n out[8] = (a11 * a00 - a01 * a10) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat3Like, a: Mat3Like): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n out[0] = a11 * a22 - a12 * a21;\r\n out[1] = a02 * a21 - a01 * a22;\r\n out[2] = a01 * a12 - a02 * a11;\r\n out[3] = a12 * a20 - a10 * a22;\r\n out[4] = a00 * a22 - a02 * a20;\r\n out[5] = a02 * a10 - a00 * a12;\r\n out[6] = a10 * a21 - a11 * a20;\r\n out[7] = a01 * a20 - a00 * a21;\r\n out[8] = a00 * a11 - a01 * a10;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n return (\r\n a00 * (a22 * a11 - a12 * a21) +\r\n a01 * (-a22 * a10 + a12 * a20) +\r\n a02 * (a21 * a10 - a11 * a20)\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[3];\r\n b1 = b[4];\r\n b2 = b[5];\r\n out[3] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[4] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[5] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[6];\r\n b1 = b[7];\r\n b2 = b[8];\r\n out[6] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[7] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[8] = b0 * a02 + b1 * a12 + b2 * a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat3} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n\r\n out[3] = a10;\r\n out[4] = a11;\r\n out[5] = a12;\r\n\r\n out[6] = x * a00 + y * a10 + a20;\r\n out[7] = x * a01 + y * a11 + a21;\r\n out[8] = x * a02 + y * a12 + a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat3} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat3Like, a: Readonly, rad: number): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c * a00 + s * a10;\r\n out[1] = c * a01 + s * a11;\r\n out[2] = c * a02 + s * a12;\r\n\r\n out[3] = c * a10 - s * a00;\r\n out[4] = c * a11 - s * a01;\r\n out[5] = c * a12 - s * a02;\r\n\r\n out[6] = a20;\r\n out[7] = a21;\r\n out[8] = a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat3} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = x * a[0];\r\n out[1] = x * a[1];\r\n out[2] = x * a[2];\r\n\r\n out[3] = y * a[3];\r\n out[4] = y * a[4];\r\n out[5] = y * a[5];\r\n\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = v[0];\r\n out[7] = v[1];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.rotate(dest, dest, rad);\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat3Like, rad: number): Mat3Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n\r\n out[3] = -s;\r\n out[4] = c;\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n\r\n out[3] = 0;\r\n out[4] = v[1];\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat2d} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 2x3 matrix\r\n * @returns `out`\r\n */\r\n static fromMat2d(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = 0;\r\n\r\n out[3] = a[2];\r\n out[4] = a[3];\r\n out[5] = 0;\r\n\r\n out[6] = a[4];\r\n out[7] = a[5];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param q - {@link Quat} to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat3Like, q: Readonly): Mat3Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[3] = yx - wz;\r\n out[6] = zx + wy;\r\n\r\n out[1] = yx + wz;\r\n out[4] = 1 - xx - zz;\r\n out[7] = zy - wx;\r\n\r\n out[2] = zx - wy;\r\n out[5] = zy + wx;\r\n out[8] = 1 - xx - yy;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat4} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 4x4 matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[4];\r\n out[4] = a[5];\r\n out[5] = a[6];\r\n out[6] = a[8];\r\n out[7] = a[9];\r\n out[8] = a[10];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\r\n * @category Static\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat3Like, a: Readonly): Mat3Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n\r\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n\r\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat3Like, a: Readonly): Mat3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n\r\n out[3] = cy * az - cz * ay;\r\n out[4] = cz * ax - cx * az;\r\n out[5] = cx * ay - cy * ax;\r\n\r\n out[6] = ay * bz - az * by;\r\n out[7] = az * bx - ax * bz;\r\n out[8] = ax * by - ay * bx;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a 2D projection matrix with the given bounds\r\n * @category Static\r\n *\r\n * @param out mat3 frustum matrix will be written into\r\n * @param width Width of your gl context\r\n * @param height Height of gl context\r\n * @returns `out`\r\n */\r\n static projection(out: Mat3Like, width: number, height: number): Mat3Like {\r\n out[0] = 2 / width;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -2 / height;\r\n out[5] = 0;\r\n out[6] = -1;\r\n out[7] = 1;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8]\r\n );\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat3} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat3Like, a: Readonly, b: number): Mat3Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat3Like, a: Readonly, b: Readonly, scale: number): Mat3Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat3(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat3.prototype.mul = Mat3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat3.mul = Mat3.multiply;\r\nMat3.sub = Mat3.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 4x4 Matrix\r\n */\r\nexport class Mat4 extends Float32Array {\r\n static #IDENTITY_4X4 = new Float32Array([\r\n 1, 0, 0, 0,\r\n 0, 1, 0, 0,\r\n 0, 0, 1, 0,\r\n 0, 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Temporary variable to prevent repeated allocations in the algorithms within Mat4.\r\n * These are declared as TypedArrays to aid in tree-shaking.\r\n */\r\n static #TMP_VEC3 = new Float32Array(3);\r\n\r\n /**\r\n * Create a {@link Mat4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 16:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 16); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 16);\r\n }\r\n break;\r\n default:\r\n super(Mat4.#IDENTITY_4X4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat4.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat4.#IDENTITY_4X4);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat4} against another one\r\n * Equivalent to `Mat4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat4.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat4}\r\n * Equivalent to `Mat4.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat4.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat4}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat4.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat4} by the given vector\r\n * Equivalent to `Mat4.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat4.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the given axis\r\n * Equivalent to `Mat4.rotate(this, this, rad, axis);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `this`\r\n */\r\n rotate(rad: number, axis: Readonly): this {\r\n return Mat4.rotate(this, this, rad, axis) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat4.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat4.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the X axis\r\n * Equivalent to `Mat4.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Mat4.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Y axis\r\n * Equivalent to `Mat4.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Mat4.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Z axis\r\n * Equivalent to `Mat4.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Mat4.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveNO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveNO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveZO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveZO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoNO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoNO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoZO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoZO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 16 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat4}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat4}\r\n */\r\n static create(): Mat4 {\r\n return new Mat4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat4} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat4}\r\n */\r\n static clone(a: Readonly): Mat4 {\r\n return new Mat4(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat4} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat4Like, a: Readonly): Mat4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new mat4 with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat4}\r\n */\r\n static fromValues(...values: number[]): Mat4 {\r\n return new Mat4(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a mat4 to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat4Like, ...values: number[]): Mat4Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n out[9] = values[9];\r\n out[10] = values[10];\r\n out[11] = values[11];\r\n out[12] = values[12];\r\n out[13] = values[13];\r\n out[14] = values[14];\r\n out[15] = values[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat4} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat4Like): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat4Like, a: Readonly): Mat4Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a12 = a[6],\r\n a13 = a[7];\r\n const a23 = a[11];\r\n\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a01;\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a02;\r\n out[9] = a12;\r\n out[11] = a[14];\r\n out[12] = a03;\r\n out[13] = a13;\r\n out[14] = a23;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a[1];\r\n out[5] = a[5];\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a[2];\r\n out[9] = a[6];\r\n out[10] = a[10];\r\n out[11] = a[14];\r\n out[12] = a[3];\r\n out[13] = a[7];\r\n out[14] = a[11];\r\n out[15] = a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat4Like, a: Mat4Like): Mat4Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\r\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\r\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\r\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\r\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\r\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\r\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat4Like, a: Mat4Like): Mat4Like {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n out[0] = a11 * b11 - a12 * b10 + a13 * b09;\r\n out[1] = a02 * b10 - a01 * b11 - a03 * b09;\r\n out[2] = a31 * b05 - a32 * b04 + a33 * b03;\r\n out[3] = a22 * b04 - a21 * b05 - a23 * b03;\r\n out[4] = a12 * b08 - a10 * b11 - a13 * b07;\r\n out[5] = a00 * b11 - a02 * b08 + a03 * b07;\r\n out[6] = a32 * b02 - a30 * b05 - a33 * b01;\r\n out[7] = a20 * b05 - a22 * b02 + a23 * b01;\r\n out[8] = a10 * b10 - a11 * b08 + a13 * b06;\r\n out[9] = a01 * b08 - a00 * b10 - a03 * b06;\r\n out[10] = a30 * b04 - a31 * b02 + a33 * b00;\r\n out[11] = a21 * b02 - a20 * b04 - a23 * b00;\r\n out[12] = a11 * b07 - a10 * b09 - a12 * b06;\r\n out[13] = a00 * b09 - a01 * b07 + a02 * b06;\r\n out[14] = a31 * b01 - a30 * b03 - a32 * b00;\r\n out[15] = a20 * b03 - a21 * b01 + a22 * b00;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b0 = a00 * a11 - a01 * a10;\r\n const b1 = a00 * a12 - a02 * a10;\r\n const b2 = a01 * a12 - a02 * a11;\r\n const b3 = a20 * a31 - a21 * a30;\r\n const b4 = a20 * a32 - a22 * a30;\r\n const b5 = a21 * a32 - a22 * a31;\r\n const b6 = a00 * b5 - a01 * b4 + a02 * b3;\r\n const b7 = a10 * b5 - a11 * b4 + a12 * b3;\r\n const b8 = a20 * b2 - a21 * b1 + a22 * b0;\r\n const b9 = a30 * b2 - a31 * b1 + a32 * b0;\r\n\r\n // Calculate the determinant\r\n return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Mat4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n // Cache only the current line of the second matrix\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n let b3 = b[3];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[4];\r\n b1 = b[5];\r\n b2 = b[6];\r\n b3 = b[7];\r\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[8];\r\n b1 = b[9];\r\n b2 = b[10];\r\n b3 = b[11];\r\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[12];\r\n b1 = b[13];\r\n b2 = b[14];\r\n b3 = b[15];\r\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat4} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n if (a === out) {\r\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\r\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\r\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\r\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\r\n } else {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n out[3] = a03;\r\n out[4] = a10;\r\n out[5] = a11;\r\n out[6] = a12;\r\n out[7] = a13;\r\n out[8] = a20;\r\n out[9] = a21;\r\n out[10] = a22;\r\n out[11] = a23;\r\n\r\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\r\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\r\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\r\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec3} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n out[0] = a[0] * x;\r\n out[1] = a[1] * x;\r\n out[2] = a[2] * x;\r\n out[3] = a[3] * x;\r\n out[4] = a[4] * y;\r\n out[5] = a[5] * y;\r\n out[6] = a[6] * y;\r\n out[7] = a[7] * y;\r\n out[8] = a[8] * z;\r\n out[9] = a[9] * z;\r\n out[10] = a[10] * z;\r\n out[11] = a[11] * z;\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat4} by the given angle around the given axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if axis has a length of 0\r\n */\r\n static rotate(out: Mat4Like, a: Readonly, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n // Construct the elements of the rotation matrix\r\n const b00 = x * x * t + c;\r\n const b01 = y * x * t + z * s;\r\n const b02 = z * x * t - y * s;\r\n const b10 = x * y * t - z * s;\r\n const b11 = y * y * t + c;\r\n const b12 = z * y * t + x * s;\r\n const b20 = x * z * t + y * s;\r\n const b21 = y * z * t - x * s;\r\n const b22 = z * z * t + c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\r\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\r\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\r\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\r\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\r\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\r\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\r\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\r\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\r\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\r\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\r\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateX(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[4] = a10 * c + a20 * s;\r\n out[5] = a11 * c + a21 * s;\r\n out[6] = a12 * c + a22 * s;\r\n out[7] = a13 * c + a23 * s;\r\n out[8] = a20 * c - a10 * s;\r\n out[9] = a21 * c - a11 * s;\r\n out[10] = a22 * c - a12 * s;\r\n out[11] = a23 * c - a13 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateY(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c - a20 * s;\r\n out[1] = a01 * c - a21 * s;\r\n out[2] = a02 * c - a22 * s;\r\n out[3] = a03 * c - a23 * s;\r\n out[8] = a00 * s + a20 * c;\r\n out[9] = a01 * s + a21 * c;\r\n out[10] = a02 * s + a22 * c;\r\n out[11] = a03 * s + a23 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c + a10 * s;\r\n out[1] = a01 * c + a11 * s;\r\n out[2] = a02 * c + a12 * s;\r\n out[3] = a03 * c + a13 * s;\r\n out[4] = a10 * c - a00 * s;\r\n out[5] = a11 * c - a01 * s;\r\n out[6] = a12 * c - a02 * s;\r\n out[7] = a13 * c - a03 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = v[1];\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = v[2];\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotate(dest, dest, rad, axis);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if `axis` has a length of 0\r\n */\r\n static fromRotation(out: Mat4Like, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = x * x * t + c;\r\n out[1] = y * x * t + z * s;\r\n out[2] = z * x * t - y * s;\r\n out[3] = 0;\r\n out[4] = x * y * t - z * s;\r\n out[5] = y * y * t + c;\r\n out[6] = z * y * t + x * s;\r\n out[7] = 0;\r\n out[8] = x * z * t + y * s;\r\n out[9] = y * z * t - x * s;\r\n out[10] = z * z * t + c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the X axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateX(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromXRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = c;\r\n out[6] = s;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = -s;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Y axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateY(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromYRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = 0;\r\n out[2] = -s;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = s;\r\n out[9] = 0;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Z axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateZ(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromZRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -s;\r\n out[5] = c;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation and vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Mat4Like, q: Readonly, v: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - (yy + zz);\r\n out[1] = xy + wz;\r\n out[2] = xz - wy;\r\n out[3] = 0;\r\n out[4] = xy - wz;\r\n out[5] = 1 - (xx + zz);\r\n out[6] = yz + wx;\r\n out[7] = 0;\r\n out[8] = xz + wy;\r\n out[9] = yz - wx;\r\n out[10] = 1 - (xx + yy);\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Mat4} from a {@link Quat2}.\r\n * @category Static\r\n *\r\n * @param out - Matrix\r\n * @param a - Dual Quaternion\r\n * @returns `out`\r\n */\r\n static fromQuat2(out: Mat4Like, a: Quat2Like): Mat4Like {\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n\r\n const magnitude = bx * bx + by * by + bz * bz + bw * bw;\r\n\r\n // Only scale if it makes sense\r\n if (magnitude > 0) {\r\n Mat4.#TMP_VEC3[0] = ((ax * bw + aw * bx + ay * bz - az * by) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[1] = ((ay * bw + aw * by + az * bx - ax * bz) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[2] = ((az * bw + aw * bz + ax * by - ay * bx) * 2) / magnitude;\r\n } else {\r\n Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n }\r\n Mat4.fromRotationTranslation(out, a as QuatLike, Mat4.#TMP_VEC3);\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat4Like, a: Readonly): Mat4Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[3] = 0;\r\n\r\n out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[7] = 0;\r\n\r\n out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat4Like, a: Readonly): Mat4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n out[3] = 0;\r\n\r\n out[4] = cy * az - cz * ay;\r\n out[5] = cz * ax - cx * az;\r\n out[6] = cx * ay - cy * ax;\r\n out[7] = 0;\r\n\r\n out[8] = ay * bz - az * by;\r\n out[9] = az * bx - ax * bz;\r\n out[10] = ax * by - ay * bx;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the translation vector component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslation,\r\n * the returned vector will be the same as the translation vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive translation component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getTranslation(out: Vec3Like, mat: Readonly): Vec3Like {\r\n out[0] = mat[12];\r\n out[1] = mat[13];\r\n out[2] = mat[14];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the scaling factor component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslationScale\r\n * with a normalized Quaternion parameter, the returned vector will be\r\n * the same as the scaling vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive scaling factor component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getScaling(out: Vec3Like, mat: Readonly): Vec3Like {\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a quaternion representing the rotational component\r\n * of a transformation matrix. If a matrix is built with\r\n * fromRotationTranslation, the returned quaternion will be the\r\n * same as the quaternion originally supplied.\r\n * @category Static\r\n *\r\n * @param out - Quaternion to receive the rotation component\r\n * @param mat - Matrix to be decomposed (input)\r\n * @return `out`\r\n */\r\n static getRotation(out: QuatLike, mat: Readonly): QuatLike {\r\n Mat4.getScaling(Mat4.#TMP_VEC3, mat);\r\n\r\n const is1 = 1 / Mat4.#TMP_VEC3[0];\r\n const is2 = 1 / Mat4.#TMP_VEC3[1];\r\n const is3 = 1 / Mat4.#TMP_VEC3[2];\r\n\r\n const sm11 = mat[0] * is1;\r\n const sm12 = mat[1] * is2;\r\n const sm13 = mat[2] * is3;\r\n const sm21 = mat[4] * is1;\r\n const sm22 = mat[5] * is2;\r\n const sm23 = mat[6] * is3;\r\n const sm31 = mat[8] * is1;\r\n const sm32 = mat[9] * is2;\r\n const sm33 = mat[10] * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out[3] = 0.25 * S;\r\n out[0] = (sm23 - sm32) / S;\r\n out[1] = (sm31 - sm13) / S;\r\n out[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out[3] = (sm23 - sm32) / S;\r\n out[0] = 0.25 * S;\r\n out[1] = (sm12 + sm21) / S;\r\n out[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out[3] = (sm31 - sm13) / S;\r\n out[0] = (sm12 + sm21) / S;\r\n out[1] = 0.25 * S;\r\n out[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out[3] = (sm12 - sm21) / S;\r\n out[0] = (sm31 + sm13) / S;\r\n out[1] = (sm23 + sm32) / S;\r\n out[2] = 0.25 * S;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Decomposes a transformation matrix into its rotation, translation\r\n * and scale components. Returns only the rotation component\r\n * @category Static\r\n *\r\n * @param out_r - Quaternion to receive the rotation component\r\n * @param out_t - Vector to receive the translation vector\r\n * @param out_s - Vector to receive the scaling factor\r\n * @param mat - Matrix to be decomposed (input)\r\n * @returns `out_r`\r\n */\r\n static decompose(out_r: QuatLike, out_t: Vec3Like, out_s: Vec3Like, mat: Readonly): QuatLike {\r\n out_t[0] = mat[12];\r\n out_t[1] = mat[13];\r\n out_t[2] = mat[14];\r\n\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n const is1 = 1 / out_s[0];\r\n const is2 = 1 / out_s[1];\r\n const is3 = 1 / out_s[2];\r\n\r\n const sm11 = m11 * is1;\r\n const sm12 = m12 * is2;\r\n const sm13 = m13 * is3;\r\n const sm21 = m21 * is1;\r\n const sm22 = m22 * is2;\r\n const sm23 = m23 * is3;\r\n const sm31 = m31 * is1;\r\n const sm32 = m32 * is2;\r\n const sm33 = m33 * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out_r[3] = 0.25 * S;\r\n out_r[0] = (sm23 - sm32) / S;\r\n out_r[1] = (sm31 - sm13) / S;\r\n out_r[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out_r[3] = (sm23 - sm32) / S;\r\n out_r[0] = 0.25 * S;\r\n out_r[1] = (sm12 + sm21) / S;\r\n out_r[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out_r[3] = (sm31 - sm13) / S;\r\n out_r[0] = (sm12 + sm21) / S;\r\n out_r[1] = 0.25 * S;\r\n out_r[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out_r[3] = (sm12 - sm21) / S;\r\n out_r[0] = (sm31 + sm13) / S;\r\n out_r[1] = (sm23 + sm32) / S;\r\n out_r[2] = 0.25 * S;\r\n }\r\n\r\n return out_r;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScale(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n out[0] = (1 - (yy + zz)) * sx;\r\n out[1] = (xy + wz) * sx;\r\n out[2] = (xz - wy) * sx;\r\n out[3] = 0;\r\n out[4] = (xy - wz) * sy;\r\n out[5] = (1 - (xx + zz)) * sy;\r\n out[6] = (yz + wx) * sy;\r\n out[7] = 0;\r\n out[8] = (xz + wy) * sz;\r\n out[9] = (yz - wx) * sz;\r\n out[10] = (1 - (xx + yy)) * sz;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the\r\n * given origin. This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * mat4.translate(dest, origin);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n * mat4.translate(dest, negativeOrigin);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @param o - The origin vector around which to scale and rotate\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScaleOrigin(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly, o: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n const ox = o[0];\r\n const oy = o[1];\r\n const oz = o[2];\r\n\r\n const out0 = (1 - (yy + zz)) * sx;\r\n const out1 = (xy + wz) * sx;\r\n const out2 = (xz - wy) * sx;\r\n const out4 = (xy - wz) * sy;\r\n const out5 = (1 - (xx + zz)) * sy;\r\n const out6 = (yz + wx) * sy;\r\n const out8 = (xz + wy) * sz;\r\n const out9 = (yz - wx) * sz;\r\n const out10 = (1 - (xx + yy)) * sz;\r\n\r\n out[0] = out0;\r\n out[1] = out1;\r\n out[2] = out2;\r\n out[3] = 0;\r\n out[4] = out4;\r\n out[5] = out5;\r\n out[6] = out6;\r\n out[7] = 0;\r\n out[8] = out8;\r\n out[9] = out9;\r\n out[10] = out10;\r\n out[11] = 0;\r\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\r\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\r\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 4x4 matrix from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Quaternion to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat4Like, q: Readonly): Mat4Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[1] = yx + wz;\r\n out[2] = zx - wy;\r\n out[3] = 0;\r\n\r\n out[4] = yx - wz;\r\n out[5] = 1 - xx - zz;\r\n out[6] = zy + wx;\r\n out[7] = 0;\r\n\r\n out[8] = zx + wy;\r\n out[9] = zy - wx;\r\n out[10] = 1 - xx - yy;\r\n out[11] = 0;\r\n\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.frustumNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly\r\n */\r\n static frustum(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like { return out; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveNO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.perspectiveNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static perspective(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveZO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating\r\n * projection matrices to be used with the still experimental WebVR API.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n * @deprecated\r\n */\r\n static perspectiveFromFieldOfView(out: Mat4Like,\r\n fov: { upDegrees: number, downDegrees: number, leftDegrees: number, rightDegrees: number }, near: number,\r\n far: number): Mat4Like {\r\n\r\n const upTan = Math.tan((fov.upDegrees * Math.PI) / 180.0);\r\n const downTan = Math.tan((fov.downDegrees * Math.PI) / 180.0);\r\n const leftTan = Math.tan((fov.leftDegrees * Math.PI) / 180.0);\r\n const rightTan = Math.tan((fov.rightDegrees * Math.PI) / 180.0);\r\n const xScale = 2.0 / (leftTan + rightTan);\r\n const yScale = 2.0 / (upTan + downTan);\r\n\r\n out[0] = xScale;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n out[4] = 0.0;\r\n out[5] = yScale;\r\n out[6] = 0.0;\r\n out[7] = 0.0;\r\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\r\n out[9] = (upTan - downTan) * yScale * 0.5;\r\n out[10] = far / (near - far);\r\n out[11] = -1.0;\r\n out[12] = 0.0;\r\n out[13] = 0.0;\r\n out[14] = (far * near) / (near - far);\r\n out[15] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 2 * nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = (far + near) * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.orthoNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static ortho(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, far: number):\r\n Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = near * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that\r\n * actually makes an object look at another object, you should use targetTo instead.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param center - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static lookAt(out: Mat4Like, eye: Readonly, center: Readonly, up: Readonly): Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n const centerx = center[0];\r\n const centery = center[1];\r\n const centerz = center[2];\r\n\r\n if (\r\n Math.abs(eyex - centerx) < GLM_EPSILON &&\r\n Math.abs(eyey - centery) < GLM_EPSILON &&\r\n Math.abs(eyez - centerz) < GLM_EPSILON\r\n ) {\r\n return Mat4.identity(out);\r\n }\r\n\r\n let z0 = eyex - centerx;\r\n let z1 = eyey - centery;\r\n let z2 = eyez - centerz;\r\n\r\n let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\r\n if (!len) {\r\n x0 = 0;\r\n x1 = 0;\r\n x2 = 0;\r\n } else {\r\n len = 1 / len;\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n let y0 = z1 * x2 - z2 * x1;\r\n let y1 = z2 * x0 - z0 * x2;\r\n let y2 = z0 * x1 - z1 * x0;\r\n\r\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\r\n if (!len) {\r\n y0 = 0;\r\n y1 = 0;\r\n y2 = 0;\r\n } else {\r\n len = 1 / len;\r\n y0 *= len;\r\n y1 *= len;\r\n y2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = y0;\r\n out[2] = z0;\r\n out[3] = 0;\r\n out[4] = x1;\r\n out[5] = y1;\r\n out[6] = z1;\r\n out[7] = 0;\r\n out[8] = x2;\r\n out[9] = y2;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\r\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\r\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a matrix that makes something look at something else.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param target - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static targetTo(out: Mat4Like, eye: Readonly, target: Readonly, up: Readonly):\r\n Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n\r\n let z0 = eyex - target[0];\r\n let z1 = eyey - target[1];\r\n let z2 = eyez - target[2];\r\n\r\n let len = z0 * z0 + z1 * z1 + z2 * z2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n }\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n\r\n len = x0 * x0 + x1 * x1 + x2 * x2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = x1;\r\n out[2] = x2;\r\n out[3] = 0;\r\n out[4] = z1 * x2 - z2 * x1;\r\n out[5] = z2 * x0 - z0 * x2;\r\n out[6] = z0 * x1 - z1 * x0;\r\n out[7] = 0;\r\n out[8] = z0;\r\n out[9] = z1;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = eyex;\r\n out[13] = eyey;\r\n out[14] = eyez;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8] +\r\n a[9] * a[9] +\r\n a[10] * a[10] +\r\n a[11] * a[11] +\r\n a[12] * a[12] +\r\n a[13] * a[13] +\r\n a[14] * a[14] +\r\n a[15] * a[15]\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n out[9] = a[9] + b[9];\r\n out[10] = a[10] + b[10];\r\n out[11] = a[11] + b[11];\r\n out[12] = a[12] + b[12];\r\n out[13] = a[13] + b[13];\r\n out[14] = a[14] + b[14];\r\n out[15] = a[15] + b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n out[9] = a[9] - b[9];\r\n out[10] = a[10] - b[10];\r\n out[11] = a[11] - b[11];\r\n out[12] = a[12] - b[12];\r\n out[13] = a[13] - b[13];\r\n out[14] = a[14] - b[14];\r\n out[15] = a[15] - b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Multiply each element of the matrix by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat4Like, a: Readonly, b: number): Mat4Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n out[9] = a[9] * b;\r\n out[10] = a[10] * b;\r\n out[11] = a[11] * b;\r\n out[12] = a[12] * b;\r\n out[13] = a[13] * b;\r\n out[14] = a[14] * b;\r\n out[15] = a[15] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat4Like, a: Readonly, b: Readonly, scale: number): Mat4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n out[9] = a[9] + b[9] * scale;\r\n out[10] = a[10] + b[10] * scale;\r\n out[11] = a[11] + b[11] * scale;\r\n out[12] = a[12] + b[12] * scale;\r\n out[13] = a[13] + b[13] * scale;\r\n out[14] = a[14] + b[14] * scale;\r\n out[15] = a[15] + b[15] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8] &&\r\n a[9] === b[9] &&\r\n a[10] === b[10] &&\r\n a[11] === b[11] &&\r\n a[12] === b[12] &&\r\n a[13] === b[13] &&\r\n a[14] === b[14] &&\r\n a[15] === b[15]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n const a9 = a[9];\r\n const a10 = a[10];\r\n const a11 = a[11];\r\n const a12 = a[12];\r\n const a13 = a[13];\r\n const a14 = a[14];\r\n const a15 = a[15];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n const b9 = b[9];\r\n const b10 = b[10];\r\n const b11 = b[11];\r\n const b12 = b[12];\r\n const b13 = b[13];\r\n const b14 = b[14];\r\n const b15 = b[15];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) &&\r\n Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) &&\r\n Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) &&\r\n Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) &&\r\n Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) &&\r\n Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) &&\r\n Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) &&\r\n Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat4(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat4.prototype.mul = Mat4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat4.sub = Mat4.subtract;\r\nMat4.mul = Mat4.multiply;\r\nMat4.frustum = Mat4.frustumNO;\r\nMat4.perspective = Mat4.perspectiveNO;\r\nMat4.ortho = Mat4.orthoNO;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, Mat4Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 3 Dimensional Vector\r\n */\r\nexport class Vec3 extends Float32Array {\r\n /**\r\n * Create a {@link Vec3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 3:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 3); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 3);\r\n }\r\n break;\r\n }\r\n default:\r\n super(3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec3.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec3.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec3} to `this`.\r\n * Equivalent to `Vec3.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec3} from `this`.\r\n * Equivalent to `Vec3.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec3.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec3.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec3.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec3.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec3.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to its absolute value.\r\n * Equivalent to `Vec3.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec3}.\r\n * Equivalent to `Vec3.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec3.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec3.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 3 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty vec3\r\n * @category Static\r\n *\r\n * @returns a new 3D vector\r\n */\r\n static create(): Vec3 {\r\n return new Vec3();\r\n }\r\n\r\n /**\r\n * Creates a new vec3 initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 3D vector\r\n */\r\n static clone(a: Readonly): Vec3 {\r\n return new Vec3(a);\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Creates a new vec3 initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns a new 3D vector\r\n */\r\n static fromValues(x: number, y: number, z: number): Vec3 {\r\n return new Vec3(x, y, z);\r\n }\r\n\r\n /**\r\n * Copy the values from one vec3 to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns `out`\r\n */\r\n static set(out: Vec3Like, x: number, y: number, z: number): Vec3Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Multiplies two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; }\r\n\r\n /**\r\n * Divides two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Math.ceil the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * symmetric round the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n /*\r\n static round(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = glMatrix.round(a[0]);\r\n out[1] = glMatrix.round(a[1]);\r\n out[2] = glMatrix.round(a[2]);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Scales a vec3 by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec3Like, a: Readonly, scale: number): Vec3Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two vec3's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec3Like, a: Readonly, b: Readonly, scale: number) {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared length of a vec3\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec3Like, a: Readonly): Vec3Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n let len = x * x + y * y + z * z;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n out[2] = a[2] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2];\r\n const bx = b[0],\r\n by = b[1],\r\n bz = b[2];\r\n\r\n out[0] = ay * bz - az * by;\r\n out[1] = az * bx - ax * bz;\r\n out[2] = ax * by - ay * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const angle = Math.acos(Math.min(Math.max(Vec3.dot(a, b), -1), 1));\r\n const sinTotal = Math.sin(angle);\r\n\r\n const ratioA = Math.sin((1 - t) * angle) / sinTotal;\r\n const ratioB = Math.sin(t * angle) / sinTotal;\r\n out[0] = ratioA * a[0] + ratioB * b[0];\r\n out[1] = ratioA * a[1] + ratioB * b[1];\r\n out[2] = ratioA * a[2] + ratioB * b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a hermite interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static hermite(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const factorTimes2 = t * t;\r\n const factor1 = factorTimes2 * (2 * t - 3) + 1;\r\n const factor2 = factorTimes2 * (t - 2) + t;\r\n const factor3 = factorTimes2 * (t - 1);\r\n const factor4 = factorTimes2 * (3 - 2 * t);\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a bezier interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static bezier(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const inverseFactor = 1 - t;\r\n const inverseFactorTimesTwo = inverseFactor * inverseFactor;\r\n const factorTimes2 = t * t;\r\n const factor1 = inverseFactorTimesTwo * inverseFactor;\r\n const factor2 = 3 * t * inverseFactorTimesTwo;\r\n const factor3 = 3 * factorTimes2 * inverseFactor;\r\n const factor4 = factorTimes2 * t;\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec3Like, scale) {\r\n scale = scale === undefined ? 1.0 : scale;\r\n\r\n let r = glMatrix.RANDOM() * 2.0 * Math.PI;\r\n let z = glMatrix.RANDOM() * 2.0 - 1.0;\r\n let zScale = Math.sqrt(1.0 - z * z) * scale;\r\n\r\n out[0] = Math.cos(r) * zScale;\r\n out[1] = Math.sin(r) * zScale;\r\n out[2] = z * scale;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the vec3 with a mat4.\r\n * 4th vector component is implicitly '1'\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec3Like, a: Readonly, m: Readonly): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1.0;\r\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\r\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\r\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a mat3.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - the 3x3 matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat3(out: Vec3Like, a: Vec3Like, m: Mat3Like): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n out[0] = x * m[0] + y * m[3] + z * m[6];\r\n out[1] = x * m[1] + y * m[4] + z * m[7];\r\n out[2] = x * m[2] + y * m[5] + z * m[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a quat\r\n * Can also be used for dual quaternions. (Multiply it with the real part)\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec3Like, a: Readonly, q: Readonly): Vec3Like {\r\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const w2 = q[3] * 2;\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n // var qvec = [qx, qy, qz];\r\n // var uv = vec3.cross([], qvec, a);\r\n const uvx = (qy * z - qz * y);\r\n const uvy = (qz * x - qx * z);\r\n const uvz = (qx * y - qy * x);\r\n // var uuv = vec3.cross([], qvec, uv);\r\n // vec3.scale(uuv, uuv, 2);\r\n const uuvx = (qy * uvz - qz * uvy) * 2;\r\n const uuvy = (qz * uvx - qx * uvz) * 2;\r\n const uuvz = (qx * uvy - qy * uvx) * 2;\r\n // vec3.scale(uv, uv, 2 * w);\r\n // return vec3.add(out, a, vec3.add(out, uv, uuv));\r\n out[0] = x + (uvx * w2) + uuvx;\r\n out[1] = y + (uvy * w2) + uuvy;\r\n out[2] = z + (uvz * w2) + uuvz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the x-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateX(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const by = b[1];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const py = a[1] - by;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = a[0];\r\n out[1] = (py * Math.cos(rad) - pz * Math.sin(rad)) + by;\r\n out[2] = (py * Math.sin(rad) + pz * Math.cos(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the y-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateY(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (pz * Math.sin(rad) + px * Math.cos(rad)) + bx;\r\n out[1] = a[1];\r\n out[2] = (pz * Math.cos(rad) - px * Math.sin(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the z-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const by = b[1];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const py = a[1] - by;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (px * Math.cos(rad) - py * Math.sin(rad)) + bx;\r\n out[1] = (px * Math.sin(rad) + py * Math.cos(rad)) + by;\r\n out[2] = b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 3D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly) {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz));\r\n const cosine = mag && Vec3.dot(a, b) / mag;\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec3Like): Vec3Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec3(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec3.prototype.sub = Vec3.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.mul = Vec3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.div = Vec3.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.dist = Vec3.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.sqrDist = Vec3.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec3.sub = Vec3.subtract;\r\nVec3.mul = Vec3.multiply;\r\nVec3.div = Vec3.divide;\r\nVec3.dist = Vec3.distance;\r\nVec3.sqrDist = Vec3.squaredDistance;\r\nVec3.sqrLen = Vec3.squaredLength;\r\nVec3.mag = Vec3.magnitude;\r\nVec3.length = Vec3.magnitude;\r\nVec3.len = Vec3.magnitude;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Vec4Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 4 Dimensional Vector\r\n */\r\nexport class Vec4 extends Float32Array {\r\n /**\r\n * Create a {@link Vec4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the vector. Equivalent to `this[3];`\r\n * @category Vector Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The a component of the vector. Equivalent to `this[3];`\r\n * @category Color Components\r\n */\r\n get a(): number { return this[3]; }\r\n set a(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec4.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec4} to `this`.\r\n * Equivalent to `Vec4.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n this[3] += b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec4} from `this`.\r\n * Equivalent to `Vec4.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n this[3] -= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n this[3] *= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n this[3] /= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec4.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n this[3] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n this[3] += b[3] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec4.distance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec4.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec4.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n this[3] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec4.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n this[3] = 1.0 / this[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec4.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n this[3] = Math.abs(this[3]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec4}.\r\n * Equivalent to `Vec4.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec4.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec4.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec4}\r\n * @category Static\r\n *\r\n * @returns a new 4D vector\r\n */\r\n static create(): Vec4 {\r\n return new Vec4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 4D vector\r\n */\r\n static clone(a: Vec4Like): Vec4 {\r\n return new Vec4(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new 4D vector\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Vec4 {\r\n return new Vec4(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec4} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n static set(out: Vec4Like, x: number, y: number, z: number, w: number): Vec4Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n out[3] = a[3] * b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Divides two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n out[3] = a[3] / b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n out[3] = Math.ceil(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n out[3] = Math.floor(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n out[3] = Math.min(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n out[3] = Math.max(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n out[2] = Math.round(a[2]);\r\n out[3] = Math.round(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec4} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec4Like, a: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}'s after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec4Like, a: Readonly, b: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return Math.hypot(x, y, z, w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of `a`\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = -a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n out[3] = 1.0 / a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n out[3] = Math.abs(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec4Like, a: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n let len = x * x + y * y + z * z + w * w;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = x * len;\r\n out[1] = y * len;\r\n out[2] = z * len;\r\n out[3] = w * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Returns the cross-product of three vectors in a 4-dimensional space\r\n * @category Static\r\n *\r\n * @param out the receiving vector\r\n * @param u - the first vector\r\n * @param v - the second vector\r\n * @param w - the third vector\r\n * @returns result\r\n */\r\n static cross(out: Vec4Like, u: Readonly, v: Readonly, w: Readonly): Vec4Like {\r\n const a = v[0] * w[1] - v[1] * w[0];\r\n const b = v[0] * w[2] - v[2] * w[0];\r\n const c = v[0] * w[3] - v[3] * w[0];\r\n const d = v[1] * w[2] - v[2] * w[1];\r\n const e = v[1] * w[3] - v[3] * w[1];\r\n const f = v[2] * w[3] - v[3] * w[2];\r\n const g = u[0];\r\n const h = u[1];\r\n const i = u[2];\r\n const j = u[3];\r\n\r\n out[0] = h * f - i * e + j * d;\r\n out[1] = -(g * f) + i * c - j * b;\r\n out[2] = g * e - h * c + j * a;\r\n out[3] = -(g * d) + h * b - i * a;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec4Like, a: Readonly, b: Readonly, t: number): Vec4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n out[3] = aw + t * (b[3] - aw);\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec4Like, scale): Vec4Like {\r\n scale = scale || 1.0;\r\n\r\n // Marsaglia, George. Choosing a Point from the Surface of a\r\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\r\n // http://projecteuclid.org/euclid.aoms/1177692644;\r\n var v1, v2, v3, v4;\r\n var s1, s2;\r\n do {\r\n v1 = glMatrix.RANDOM() * 2 - 1;\r\n v2 = glMatrix.RANDOM() * 2 - 1;\r\n s1 = v1 * v1 + v2 * v2;\r\n } while (s1 >= 1);\r\n do {\r\n v3 = glMatrix.RANDOM() * 2 - 1;\r\n v4 = glMatrix.RANDOM() * 2 - 1;\r\n s2 = v3 * v3 + v4 * v4;\r\n } while (s2 >= 1);\r\n\r\n var d = Math.sqrt((1 - s1) / s2);\r\n out[0] = scale * v1;\r\n out[1] = scale * v2;\r\n out[2] = scale * v3 * d;\r\n out[3] = scale * v4 * d;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Mat4}.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec4Like, a: Readonly, m: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\r\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\r\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\r\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec4Like, a: Readonly, q: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n\r\n // calculate quat * vec\r\n const ix = qw * x + qy * z - qz * y;\r\n const iy = qw * y + qz * x - qx * z;\r\n const iz = qw * z + qx * y - qy * x;\r\n const iw = -qx * x - qy * y - qz * z;\r\n\r\n // calculate result * inverse quat\r\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\r\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\r\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec4Like): Vec4Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec4(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec4.prototype.sub = Vec4.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.mul = Vec4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.div = Vec4.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.dist = Vec4.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.sqrDist = Vec4.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec4.sub = Vec4.subtract;\r\nVec4.mul = Vec4.multiply;\r\nVec4.div = Vec4.divide;\r\nVec4.dist = Vec4.distance;\r\nVec4.sqrDist = Vec4.squaredDistance;\r\nVec4.sqrLen = Vec4.squaredLength;\r\nVec4.mag = Vec4.magnitude;\r\nVec4.length = Vec4.magnitude;\r\nVec4.len = Vec4.magnitude;\r\n", "import { Vec3 } from './Vec3.js';\r\nimport { Vec4 } from './Vec4.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Quaternion\r\n */\r\nexport class Quat extends Float32Array {\r\n static #DEFAULT_ANGLE_ORDER = 'zyx';\r\n\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT1 = new Float32Array(4);\r\n static #TMP_QUAT2 = new Float32Array(4);\r\n static #TMP_MAT3 = new Float32Array(9);\r\n\r\n static #TMP_VEC3 = new Float32Array(3);\r\n static #X_UNIT_VEC3 = new Float32Array([1, 0, 0]);\r\n static #Y_UNIT_VEC3 = new Float32Array([0, 1, 0]);\r\n\r\n /**\r\n * Create a {@link Quat}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the quaternion. Equivalent to `this[0];`\r\n * @category Quaternion Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the quaternion. Equivalent to `this[1];`\r\n * @category Quaternion Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the quaternion. Equivalent to `this[2];`\r\n * @category Quaternion Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the quaternion. Equivalent to `this[3];`\r\n * @category Quaternion Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Quat.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity quaternion\r\n * Equivalent to Quat.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this[0] = 0;\r\n this[1] = 0;\r\n this[2] = 0;\r\n this[3] = 1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies `this` by a {@link Quat}.\r\n * Equivalent to `Quat.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Quat.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Rotates `this` by the given angle about the X axis\r\n * Equivalent to `Quat.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Quat.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Y axis\r\n * Equivalent to `Quat.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Quat.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Z axis\r\n * Equivalent to `Quat.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Quat.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Inverts `this`\r\n * Equivalent to `Quat.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Quat.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales `this` by a scalar number\r\n * Equivalent to `Quat.scale(this, this, scale);`\r\n * @category Methods\r\n *\r\n * @param scale - amount to scale the vector by\r\n * @returns `this`\r\n */\r\n scale(scale: number): QuatLike {\r\n this[0] *= scale;\r\n this[1] *= scale;\r\n this[2] *= scale;\r\n this[3] *= scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of `this` and another {@link Quat}\r\n * Equivalent to `Quat.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - the second operand\r\n * @returns dot product of `this` and b\r\n */\r\n dot(b: Readonly): number {\r\n return Quat.dot(this, b);\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity quat\r\n * @category Static\r\n *\r\n * @returns a new quaternion\r\n */\r\n static create(): Quat {\r\n return new Quat();\r\n }\r\n\r\n /**\r\n * Set a quat to the identity quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a quat from the given angle and rotation axis,\r\n * then returns it.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param axis - the axis around which to rotate\r\n * @param rad - the angle in radians\r\n * @returns `out`\r\n **/\r\n static setAxisAngle(out: QuatLike, axis: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n out[0] = s * axis[0];\r\n out[1] = s * axis[1];\r\n out[2] = s * axis[2];\r\n out[3] = Math.cos(rad);\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the rotation axis and angle for a given\r\n * quaternion. If a quaternion is created with\r\n * setAxisAngle, this method will return the same\r\n * values as provided in the original parameter list\r\n * OR functionally equivalent values.\r\n * Example: The quaternion formed by axis [0, 0, 1] and\r\n * angle -90 is the same as the quaternion formed by\r\n * [0, 0, 1] and 270. This method favors the latter.\r\n * @category Static\r\n *\r\n * @param out_axis - Vector receiving the axis of rotation\r\n * @param q - Quaternion to be decomposed\r\n * @return Angle, in radians, of the rotation\r\n */\r\n static getAxisAngle(out_axis: Vec3Like, q: Readonly): number {\r\n const rad = Math.acos(q[3]) * 2.0;\r\n const s = Math.sin(rad / 2.0);\r\n if (s > GLM_EPSILON) {\r\n out_axis[0] = q[0] / s;\r\n out_axis[1] = q[1] / s;\r\n out_axis[2] = q[2] / s;\r\n } else {\r\n // If s is zero, return any axis (no rotation - axis does not matter)\r\n out_axis[0] = 1;\r\n out_axis[1] = 0;\r\n out_axis[2] = 0;\r\n }\r\n return rad;\r\n }\r\n\r\n /**\r\n * Gets the angular distance between two unit quaternions\r\n * @category Static\r\n *\r\n * @param {ReadonlyQuat} a Origin unit quaternion\r\n * @param {ReadonlyQuat} b Destination unit quaternion\r\n * @return {Number} Angle, in radians, between the two quaternions\r\n */\r\n static getAngle(a: Readonly, b: Readonly): number {\r\n const dotproduct = Quat.dot(a, b);\r\n\r\n return Math.acos(2 * dotproduct * dotproduct - 1);\r\n }\r\n\r\n /**\r\n * Multiplies two quaternions.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const bw = b[3];\r\n\r\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the X axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + aw * bx;\r\n out[1] = ay * bw + az * bx;\r\n out[2] = az * bw - ay * bx;\r\n out[3] = aw * bw - ax * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Y axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const by = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw - az * by;\r\n out[1] = ay * bw + aw * by;\r\n out[2] = az * bw + ax * by;\r\n out[3] = aw * bw - ay * by;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Z axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bz = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + ay * bz;\r\n out[1] = ay * bw - ax * bz;\r\n out[2] = az * bw + aw * bz;\r\n out[3] = aw * bw - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the W component of a quat from the X, Y, and Z components.\r\n * Assumes that quaternion is 1 unit in length.\r\n * Any existing W component will be ignored.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate W component of\r\n * @returns `out`\r\n */\r\n static calculateW(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the exponential of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static exp(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const et = Math.exp(w);\r\n const s = r > 0 ? (et * Math.sin(r)) / r : 0;\r\n\r\n out[0] = x * s;\r\n out[1] = y * s;\r\n out[2] = z * s;\r\n out[3] = et * Math.cos(r);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the natural logarithm of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static ln(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const t = r > 0 ? Math.atan2(r, w) / r : 0;\r\n\r\n out[0] = x * t;\r\n out[1] = y * t;\r\n out[2] = z * t;\r\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the scalar power of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @param b - amount to scale the quaternion by\r\n * @returns `out`\r\n */\r\n static pow(out: QuatLike, a: Readonly, b: number): QuatLike {\r\n Quat.ln(out, a);\r\n Quat.scale(out, out, b);\r\n Quat.exp(out, out);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike {\r\n // benchmarks:\r\n // http://jsperf.com/quaternion-slerp-implementations\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2],\r\n aw = a[3];\r\n let bx = b[0],\r\n by = b[1],\r\n bz = b[2],\r\n bw = b[3];\r\n\r\n let scale0: number;\r\n let scale1: number;\r\n\r\n // calc cosine\r\n let cosom = ax * bx + ay * by + az * bz + aw * bw;\r\n // adjust signs (if necessary)\r\n if (cosom < 0.0) {\r\n cosom = -cosom;\r\n bx = -bx;\r\n by = -by;\r\n bz = -bz;\r\n bw = -bw;\r\n }\r\n // calculate coefficients\r\n if (1.0 - cosom > GLM_EPSILON) {\r\n // standard case (slerp)\r\n const omega = Math.acos(cosom);\r\n const sinom = Math.sin(omega);\r\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\r\n scale1 = Math.sin(t * omega) / sinom;\r\n } else {\r\n // \"from\" and \"to\" quaternions are very close\r\n // ... so we can do a linear interpolation\r\n scale0 = 1.0 - t;\r\n scale1 = t;\r\n }\r\n // calculate final values\r\n out[0] = scale0 * ax + scale1 * bx;\r\n out[1] = scale0 * ay + scale1 * by;\r\n out[2] = scale0 * az + scale1 * bz;\r\n out[3] = scale0 * aw + scale1 * bw;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random unit quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n /* static random(out: QuatLike): QuatLike {\r\n // Implementation of http://planning.cs.uiuc.edu/node198.html\r\n // TODO: Calling random 3 times is probably not the fastest solution\r\n let u1 = glMatrix.RANDOM();\r\n let u2 = glMatrix.RANDOM();\r\n let u3 = glMatrix.RANDOM();\r\n\r\n let sqrt1MinusU1 = Math.sqrt(1 - u1);\r\n let sqrtU1 = Math.sqrt(u1);\r\n\r\n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\r\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\r\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\r\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Calculates the inverse of a quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: QuatLike, a: Readonly): QuatLike {\r\n const a0 = a[0],\r\n a1 = a[1],\r\n a2 = a[2],\r\n a3 = a[3];\r\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\r\n const invDot = dot ? 1.0 / dot : 0;\r\n\r\n // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\r\n\r\n out[0] = -a0 * invDot;\r\n out[1] = -a1 * invDot;\r\n out[2] = -a2 * invDot;\r\n out[3] = a3 * invDot;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a quat\r\n * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given 3x3 rotation matrix.\r\n *\r\n * NOTE: The resultant quaternion is not normalized, so you should be sure\r\n * to re-normalize the quaternion yourself where necessary.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param m - rotation matrix\r\n * @returns `out`\r\n */\r\n static fromMat3(out: QuatLike, m: Readonly): QuatLike {\r\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\r\n // article \"Quaternion Calculus and Fast Animation\".\r\n const fTrace = m[0] + m[4] + m[8];\r\n let fRoot: number;\r\n\r\n if (fTrace > 0.0) {\r\n // |w| > 1/2, may as well choose w > 1/2\r\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\r\n out[3] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot; // 1/(4w)\r\n out[0] = (m[5] - m[7]) * fRoot;\r\n out[1] = (m[6] - m[2]) * fRoot;\r\n out[2] = (m[1] - m[3]) * fRoot;\r\n } else {\r\n // |w| <= 1/2\r\n let i = 0;\r\n if (m[4] > m[0]) { i = 1; }\r\n if (m[8] > m[i * 3 + i]) { i = 2; }\r\n const j = (i + 1) % 3;\r\n const k = (i + 2) % 3;\r\n\r\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\r\n out[i] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot;\r\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\r\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\r\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given euler angle x, y, z.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - Angle to rotate around X axis in degrees.\r\n * @param y - Angle to rotate around Y axis in degrees.\r\n * @param z - Angle to rotate around Z axis in degrees.\r\n * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx.\r\n * @returns `out`\r\n */\r\n static fromEuler(out: QuatLike, x: number, y: number, z: number, order = Quat.#DEFAULT_ANGLE_ORDER): QuatLike {\r\n const halfToRad = (0.5 * Math.PI) / 180.0;\r\n x *= halfToRad;\r\n y *= halfToRad;\r\n z *= halfToRad;\r\n\r\n const sx = Math.sin(x);\r\n const cx = Math.cos(x);\r\n const sy = Math.sin(y);\r\n const cy = Math.cos(y);\r\n const sz = Math.sin(z);\r\n const cz = Math.cos(z);\r\n\r\n switch (order) {\r\n case 'xyz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'xzy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yxz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yzx':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zxy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zyx':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n default:\r\n throw new Error(`Unknown angle order ${order}`);\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a quatenion\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - quaternion to clone\r\n * @returns a new quaternion\r\n */\r\n static clone(a: Readonly): Quat {\r\n return new Quat(a);\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new quaternion\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Quat {\r\n return new Quat(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one quat to another\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the source quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static set(out: QuatLike, x: number, y: number, z: number, w: number): QuatLike { return out; }\r\n\r\n /**\r\n * Adds two {@link Quat}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static add(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Scales a quat by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param b - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: QuatLike, a: Readonly, scale: number): QuatLike {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two quat's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two quat's\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static lerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike { return out; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mag(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quaternion to normalize\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static normalize(out: QuatLike, a: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first quaternion.\r\n * @param b - The second quaternion.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static exactEquals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Returns whether the quaternions have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static equals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Sets a quaternion to represent the shortest rotation from one\r\n * vector to another.\r\n *\r\n * Both vectors are assumed to be unit length.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion.\r\n * @param a - the initial vector\r\n * @param b - the destination vector\r\n * @returns `out`\r\n */\r\n static rotationTo(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const dot = Vec3.dot(a, b);\r\n\r\n if (dot < -0.999999) {\r\n Vec3.cross(Quat.#TMP_VEC3, Quat.#X_UNIT_VEC3, a);\r\n if (Vec3.mag(Quat.#TMP_VEC3) < 0.000001) { Vec3.cross(Quat.#TMP_VEC3, Quat.#Y_UNIT_VEC3, a); }\r\n Vec3.normalize(Quat.#TMP_VEC3, Quat.#TMP_VEC3);\r\n Quat.setAxisAngle(out, Quat.#TMP_VEC3, Math.PI);\r\n return out;\r\n } else if (dot > 0.999999) {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n } else {\r\n Vec3.cross(Quat.#TMP_VEC3, a, b);\r\n out[0] = Quat.#TMP_VEC3[0];\r\n out[1] = Quat.#TMP_VEC3[1];\r\n out[2] = Quat.#TMP_VEC3[2];\r\n out[3] = 1 + dot;\r\n return Quat.normalize(out, out);\r\n }\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static sqlerp(out: QuatLike, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): QuatLike {\r\n Quat.slerp(Quat.#TMP_QUAT1, a, d, t);\r\n Quat.slerp(Quat.#TMP_QUAT2, b, c, t);\r\n Quat.slerp(out, Quat.#TMP_QUAT1, Quat.#TMP_QUAT2, 2 * t * (1 - t));\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets the specified quaternion with values corresponding to the given\r\n * axes. Each axis is a vec3 and is expected to be unit length and\r\n * perpendicular to all other specified axes.\r\n * @category Static\r\n *\r\n * @param out - The receiving quaternion\r\n * @param view - the vector representing the viewing direction\r\n * @param right - the vector representing the local `right` direction\r\n * @param up - the vector representing the local `up` direction\r\n * @returns `out`\r\n */\r\n static setAxes(out: QuatLike, view: Readonly, right: Readonly, up: Readonly): QuatLike {\r\n Quat.#TMP_MAT3[0] = right[0];\r\n Quat.#TMP_MAT3[3] = right[1];\r\n Quat.#TMP_MAT3[6] = right[2];\r\n\r\n Quat.#TMP_MAT3[1] = up[0];\r\n Quat.#TMP_MAT3[4] = up[1];\r\n Quat.#TMP_MAT3[7] = up[2];\r\n\r\n Quat.#TMP_MAT3[2] = -view[0];\r\n Quat.#TMP_MAT3[5] = -view[1];\r\n Quat.#TMP_MAT3[8] = -view[2];\r\n\r\n return Quat.normalize(out, Quat.fromMat3(out, Quat.#TMP_MAT3));\r\n }\r\n}\r\n\r\n// Methods which re-use the Vec4 implementation\r\nQuat.set = Vec4.set;\r\nQuat.add = Vec4.add;\r\nQuat.lerp = Vec4.lerp;\r\nQuat.normalize = Vec4.normalize;\r\nQuat.squaredLength = Vec4.squaredLength;\r\nQuat.sqrLen = Vec4.squaredLength;\r\nQuat.exactEquals = Vec4.exactEquals;\r\nQuat.equals = Vec4.equals;\r\nQuat.magnitude = Vec4.magnitude;\r\n\r\n// Instance method alias assignments\r\nQuat.prototype.mul = Quat.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nQuat.mul = Quat.multiply;\r\nQuat.mag = Quat.magnitude;\r\nQuat.length = Quat.magnitude;\r\nQuat.len = Quat.magnitude;\r\n", "import { Mat4 } from './Mat4.js';\r\nimport { Quat } from './Quat.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Dual Quaternion\r\n */\r\nexport class Quat2 extends Float32Array {\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat2.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT = new Float32Array(4);\r\n static #TMP_VEC3 = new Float32Array(3);\r\n\r\n /**\r\n * Create a {@link Quat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 8:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 8); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v, v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 8);\r\n }\r\n break;\r\n }\r\n default:\r\n super(8);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source dual quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 8 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity {@link Quat2}\r\n * @category Static\r\n *\r\n * @returns a new dual quaternion [real -> rotation, dual -> translation]\r\n */\r\n static create(): Quat2 {\r\n return new Quat2();\r\n }\r\n\r\n /**\r\n * Creates a {@link Quat2} quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to clone\r\n * @returns a new dual quaternion\r\n */\r\n static clone(a: Quat2Like): Quat2 {\r\n return new Quat2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns a new dual quaternion\r\n */\r\n static fromValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2 {\r\n return new Quat2(x1, y1, z1, w1, x2, y2, z2, w2);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} from the given values (quat and translation)\r\n * @category Static\r\n *\r\n * @param x1 - X component (rotation)\r\n * @param y1 - Y component (rotation)\r\n * @param z1 - Z component (rotation)\r\n * @param w1 - W component (rotation)\r\n * @param x2 - X component (translation)\r\n * @param y2 - Y component (translation)\r\n * @param z2 - Z component (translation)\r\n * @returns a new dual quaternion\r\n */\r\n static fromRotationTranslationValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number): Quat2 {\r\n const ax = x2 * 0.5;\r\n const ay = y2 * 0.5;\r\n const az = z2 * 0.5;\r\n\r\n return new Quat2(x1, y1, z1, w1,\r\n ax * w1 + ay * z1 - az * y1,\r\n ay * w1 + az * x1 - ax * z1,\r\n az * w1 + ax * y1 - ay * x1,\r\n -ax * x1 - ay * y1 - az * z1);\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion and a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Quat2Like, q: Readonly, t: Readonly): Quat2Like {\r\n const ax = t[0] * 0.5;\r\n const ay = t[1] * 0.5;\r\n const az = t[2] * 0.5;\r\n const bx = q[0];\r\n const by = q[1];\r\n const bz = q[2];\r\n const bw = q[3];\r\n out[0] = bx;\r\n out[1] = by;\r\n out[2] = bz;\r\n out[3] = bw;\r\n out[4] = ax * bw + ay * bz - az * by;\r\n out[5] = ay * bw + az * bx - ax * bz;\r\n out[6] = az * bw + ax * by - ay * bx;\r\n out[7] = -ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Quat2Like, t: Readonly): Quat2Like {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = t[0] * 0.5;\r\n out[5] = t[1] * 0.5;\r\n out[6] = t[2] * 0.5;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Quat2Like, q: Readonly): Quat2Like {\r\n out[0] = q[0];\r\n out[1] = q[1];\r\n out[2] = q[2];\r\n out[3] = q[3];\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param a - the matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Quat2Like, a: Readonly): Quat2Like {\r\n Mat4.getRotation(Quat2.#TMP_QUAT, a);\r\n Mat4.getTranslation(Quat2.#TMP_VEC3, a);\r\n return Quat2.fromRotationTranslation(out, Quat2.#TMP_QUAT, Quat2.#TMP_VEC3);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Quat2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the source dual quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Quat2} to the identity dual quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns `out`\r\n */\r\n static set(out: Quat2Like, x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2Like {\r\n out[0] = x1;\r\n out[1] = y1;\r\n out[2] = z1;\r\n out[3] = w1;\r\n out[4] = x2;\r\n out[5] = y2;\r\n out[6] = z2;\r\n out[7] = w2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the real part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - real part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getReal(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Gets the dual part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - dual part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getDual(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[4];\r\n out[1] = a[5];\r\n out[2] = a[6];\r\n out[3] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the real component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the real part\r\n * @return `out`\r\n */\r\n static setReal(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Set the dual component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the dual part\r\n * @return `out`\r\n */\r\n static setDual(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[4] = a[0];\r\n out[5] = a[1];\r\n out[6] = a[2];\r\n out[7] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the translation of a normalized {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving translation vector\r\n * @param a - Dual Quaternion to be decomposed\r\n * @return `out`\r\n */\r\n static getTranslation(out: Vec3Like, a: Readonly): Vec3Like {\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Translates a {@link Quat2} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Quat2Like, a: Readonly, v: Readonly): Quat2Like {\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n const bx1 = v[0] * 0.5;\r\n const by1 = v[1] * 0.5;\r\n const bz1 = v[2] * 0.5;\r\n const ax2 = a[4];\r\n const ay2 = a[5];\r\n const az2 = a[6];\r\n const aw2 = a[7];\r\n out[0] = ax1;\r\n out[1] = ay1;\r\n out[2] = az1;\r\n out[3] = aw1;\r\n out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2;\r\n out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2;\r\n out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2;\r\n out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateX(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateY(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateZ(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (a * q)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param q - quaternion to rotate by\r\n * @returns `out`\r\n */\r\n static rotateByQuatAppend(out: Quat2Like, a: Readonly, q: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let ax = a[0];\r\n let ay = a[1];\r\n let az = a[2];\r\n let aw = a[3];\r\n\r\n out[0] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[1] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[2] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[3] = aw * qw - ax * qx - ay * qy - az * qz;\r\n ax = a[4];\r\n ay = a[5];\r\n az = a[6];\r\n aw = a[7];\r\n out[4] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[5] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[6] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[7] = aw * qw - ax * qx - ay * qy - az * qz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (q * a)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param q - quaternion to rotate by\r\n * @param a - the dual quaternion to rotate\r\n * @returns `out`\r\n */\r\n static rotateByQuatPrepend(out: Quat2Like, q: Readonly, a: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let bx = a[0];\r\n let by = a[1];\r\n let bz = a[2];\r\n let bw = a[3];\r\n\r\n out[0] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[1] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[2] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[3] = qw * bw - qx * bx - qy * by - qz * bz;\r\n bx = a[4];\r\n by = a[5];\r\n bz = a[6];\r\n bw = a[7];\r\n out[4] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[5] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[6] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[7] = qw * bw - qx * bx - qy * by - qz * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around a given axis. Does the normalization automatically\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param axis - the axis to rotate around\r\n * @param rad - how far the rotation should be\r\n * @returns `out`\r\n */\r\n static rotateAroundAxis(out: Quat2Like, a: Readonly, axis: Readonly, rad: number): Quat2Like {\r\n // Special case for rad = 0\r\n if (Math.abs(rad) < GLM_EPSILON) {\r\n return Quat2.copy(out, a);\r\n }\r\n const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);\r\n\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n const bx = (s * axis[0]) / axisLength;\r\n const by = (s * axis[1]) / axisLength;\r\n const bz = (s * axis[2]) / axisLength;\r\n const bw = Math.cos(rad);\r\n\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n out[4] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[5] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[6] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[7] = aw * bw - ax * bx - ay * by - az * bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns {quat2} out\r\n */\r\n static multiply(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n const ax0 = a[0];\r\n const ay0 = a[1];\r\n const az0 = a[2];\r\n const aw0 = a[3];\r\n const bx1 = b[4];\r\n const by1 = b[5];\r\n const bz1 = b[6];\r\n const bw1 = b[7];\r\n const ax1 = a[4];\r\n const ay1 = a[5];\r\n const az1 = a[6];\r\n const aw1 = a[7];\r\n const bx0 = b[0];\r\n const by0 = b[1];\r\n const bz0 = b[2];\r\n const bw0 = b[3];\r\n out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0;\r\n out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0;\r\n out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0;\r\n out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0;\r\n out[4] =\r\n ax0 * bw1 +\r\n aw0 * bx1 +\r\n ay0 * bz1 -\r\n az0 * by1 +\r\n ax1 * bw0 +\r\n aw1 * bx0 +\r\n ay1 * bz0 -\r\n az1 * by0;\r\n out[5] =\r\n ay0 * bw1 +\r\n aw0 * by1 +\r\n az0 * bx1 -\r\n ax0 * bz1 +\r\n ay1 * bw0 +\r\n aw1 * by0 +\r\n az1 * bx0 -\r\n ax1 * bz0;\r\n out[6] =\r\n az0 * bw1 +\r\n aw0 * bz1 +\r\n ax0 * by1 -\r\n ay0 * bx1 +\r\n az1 * bw0 +\r\n aw1 * bz0 +\r\n ax1 * by0 -\r\n ay1 * bx0;\r\n out[7] =\r\n aw0 * bw1 -\r\n ax0 * bx1 -\r\n ay0 * by1 -\r\n az0 * bz1 +\r\n aw1 * bw0 -\r\n ax1 * bx0 -\r\n ay1 * by0 -\r\n az1 * bz0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like { return out; }\r\n\r\n /**\r\n * Scales a {@link Quat2} by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaterion\r\n * @param a - the dual quaternion to scale\r\n * @param b - scalar value to scale the dual quaterion by\r\n * @returns `out`\r\n */\r\n static scale(out: Quat2Like, a: Readonly, b: number): Quat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts)\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dot(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Quat2}s\r\n * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quat\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Quat2Like, a: Readonly, b: Readonly, t: number): Quat2Like {\r\n const mt = 1 - t;\r\n if (Quat2.dot(a, b) < 0) { t = -t; }\r\n\r\n out[0] = a[0] * mt + b[0] * t;\r\n out[1] = a[1] * mt + b[1] * t;\r\n out[2] = a[2] * mt + b[2] * t;\r\n out[3] = a[3] * mt + b[3] * t;\r\n out[4] = a[4] * mt + b[4] * t;\r\n out[5] = a[5] * mt + b[5] * t;\r\n out[6] = a[6] * mt + b[6] * t;\r\n out[7] = a[7] * mt + b[7] * t;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: Quat2Like, a: Readonly): Quat2Like {\r\n const sqlen = Quat2.squaredLength(a);\r\n out[0] = -a[0] / sqlen;\r\n out[1] = -a[1] / sqlen;\r\n out[2] = -a[2] / sqlen;\r\n out[3] = a[3] / sqlen;\r\n out[4] = -a[4] / sqlen;\r\n out[5] = -a[5] / sqlen;\r\n out[6] = -a[6] / sqlen;\r\n out[7] = a[7] / sqlen;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than\r\n * {@link Quat2.invert} and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n out[4] = -a[4];\r\n out[5] = -a[5];\r\n out[6] = -a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Quat2Like, a: Readonly): Quat2Like {\r\n let magnitude = Quat2.squaredLength(a);\r\n if (magnitude > 0) {\r\n magnitude = Math.sqrt(magnitude);\r\n\r\n const a0 = a[0] / magnitude;\r\n const a1 = a[1] / magnitude;\r\n const a2 = a[2] / magnitude;\r\n const a3 = a[3] / magnitude;\r\n\r\n const b0 = a[4];\r\n const b1 = a[5];\r\n const b2 = a[6];\r\n const b3 = a[7];\r\n\r\n const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3;\r\n\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n\r\n out[4] = (b0 - a0 * a_dot_b) / magnitude;\r\n out[5] = (b1 - a1 * a_dot_b) / magnitude;\r\n out[6] = (b2 - a2 * a_dot_b) / magnitude;\r\n out[7] = (b3 - a3 * a_dot_b) / magnitude;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat2(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7))\r\n );\r\n }\r\n}\r\n\r\n// Methods which re-use the Quat implementation\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.dot = Quat.dot;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.squaredLength = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.sqrLen = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.mag = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.length = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.len = Quat.magnitude;\r\n\r\n// Static method alias assignments\r\nQuat2.mul = Quat2.multiply;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Mat2dLike, Mat3Like, Mat4Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 2 Dimensional Vector\r\n */\r\nexport class Vec2 extends Float32Array {\r\n /**\r\n * Create a {@link Vec2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 2:{\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, values[1]!]);\r\n } else {\r\n super(v as ArrayBufferLike, values[1], 2);\r\n }\r\n break;\r\n }\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 2);\r\n }\r\n break;\r\n }\r\n default:\r\n super(2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec2.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n return Math.hypot(this[0], this[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec2.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n // Instead of zero(), use a.fill(0) for instances;\r\n\r\n /**\r\n * Adds a {@link Vec2} to `this`.\r\n * Equivalent to `Vec2.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec2} from `this`.\r\n * Equivalent to `Vec2.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec2.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec2.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec2.squaredDistance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec2.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec2.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec2.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec2}.\r\n * Equivalent to `Vec2.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec2.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec2.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 2 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec2}\r\n * @category Static\r\n *\r\n * @returns A new 2D vector\r\n */\r\n static create(): Vec2 {\r\n return new Vec2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - Vector to clone\r\n * @returns A new 2D vector\r\n */\r\n static clone(a: Readonly): Vec2 {\r\n return new Vec2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns A new 2D vector\r\n */\r\n static fromValues(x: number, y: number): Vec2 {\r\n return new Vec2(x, y);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - The source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns `out`\r\n */\r\n static set(out: Vec2Like, x: number, y: number): Vec2Like {\r\n out[0] = x;\r\n out[1] = y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Multiplies two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Divides two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec2} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to scale\r\n * @param b - Amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec2Like, a: Readonly, b: number): Vec2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two Vec2's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param scale - The amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec2Like, a: Readonly, b: Readonly, scale: number): Vec2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns distance between `a` and `b`\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n return Math.hypot(b[0] - a[0], b[1] - a[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Squared distance between `a` and `b`\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return Math.sqrt(x * x + y * y);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate squared length of\r\n * @returns Squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec2Like, a: Readonly) {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec2Like, a: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n let len = x * x + y * y;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Dot product of `a` and `b`\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two {@link Vec2}s\r\n * Note that the cross product must by definition produce a 3D vector.\r\n * For this reason there is also not instance equivalent for this function.\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n const z = a[0] * b[1] - a[1] * b[0];\r\n out[0] = out[1] = 0;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param t - Interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec2Like, a: Readonly, b: Readonly, t: number): Vec2Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y;\r\n out[1] = m[1] * x + m[3] * y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2d}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2d(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y + m[4];\r\n out[1] = m[1] * x + m[3] * y + m[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat3}\r\n * 3rd vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat3(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[3] * y + m[6];\r\n out[1] = m[1] * x + m[4] * y + m[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat4}\r\n * 3rd vector component is implicitly '0'\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat4(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[4] * y + m[12];\r\n out[1] = m[1] * x + m[5] * y + m[13];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 2D vector\r\n * @category Static\r\n *\r\n * @param out - The receiving {@link Vec2}\r\n * @param a - The {@link Vec2} point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotate(out: Vec2Like, a: Readonly, b: Readonly, rad: number): Vec2Like {\r\n // Translate point to the origin\r\n const p0 = a[0] - b[0];\r\n const p1 = a[1] - b[1];\r\n const sinC = Math.sin(rad);\r\n const cosC = Math.cos(rad);\r\n\r\n // perform rotation and translate to correct position\r\n out[0] = p0 * cosC - p1 * sinC + b[0];\r\n out[1] = p0 * sinC + p1 * cosC + b[1];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 2D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly): number {\r\n const x1 = a[0];\r\n const y1 = a[1];\r\n const x2 = b[0];\r\n const y2 = b[1];\r\n // mag is the product of the magnitudes of a and b\r\n const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2);\r\n // mag &&.. short circuits if mag == 0\r\n const cosine = mag && (x1 * x2 + y1 * y2) / mag;\r\n // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to zero\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec2Like): Vec2Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors components are ===, `false` otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors are approximately equal, `false` otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - Vector to represent as a string\r\n * @returns String representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec2.prototype.sub = Vec2.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.mul = Vec2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.div = Vec2.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.dist = Vec2.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.sqrDist = Vec2.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec2.sub = Vec2.subtract;\r\nVec2.mul = Vec2.multiply;\r\nVec2.div = Vec2.divide;\r\nVec2.dist = Vec2.distance;\r\nVec2.sqrDist = Vec2.squaredDistance;\r\nVec2.sqrLen = Vec2.squaredLength;\r\nVec2.mag = Vec2.magnitude;\r\nVec2.length = Vec2.magnitude;\r\nVec2.len = Vec2.magnitude;\r\n", "/**\r\n * To enable additional swizzle accessors for vector classes (32-bit) invoke the {@link EnableSwizzles} function from\r\n * the `gl-matrix/swizzle` sub-path export. To enable ambient module declarations for IDE / Typescript support please\r\n * see {@link gl-matrix/types/swizzle}.\r\n *\r\n * To enable swizzling for the 64-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle/f64}.\r\n *\r\n * @example\r\n * ```ts\r\n * import { Vec3 } from 'gl-matrix';\r\n * import { EnableSwizzles } from 'gl-matrix/swizzle';\r\n *\r\n * EnableSwizzles();\r\n *\r\n * const vec = new Vec3(0, 1, 2);\r\n * const vecSwizzled = vec.zyx; // Returns a new Vec3(2, 1, 0).\r\n * ```\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\nimport { Vec2, Vec3, Vec4 } from '#gl-matrix';\r\n\r\n/**\r\n * Internal `gl-matrix` variable tracking if swizzling is enabled (32-bit).\r\n */\r\nlet GLM_SWIZZLES_ENABLED_F32 = false;\r\n\r\n/**\r\n * Enables Swizzle operations on {@link gl-matrix.Vec2 | Vec2} / {@link gl-matrix.Vec3 | Vec3} /\r\n * {@link gl-matrix.Vec4 | Vec4} types from {@link gl-matrix | gl-matrix} (32-bit).\r\n *\r\n * Swizzle operations are performed by using the `.` operator in conjunction with any combination\r\n * of between two and four component names, either from the set `xyzw` or `rgbw` (though not intermixed).\r\n * They return a new vector with the same number of components as specified in the swizzle attribute.\r\n *\r\n * @example\r\n * ```js\r\n * import { Vec3, EnableSwizzles } from 'gl-matrix';\r\n *\r\n * EnableSwizzles();\r\n *\r\n * let v = new Vec3(0, 1, 2);\r\n *\r\n * v.yx; // returns new Vec2(1, 0)\r\n * v.xzy; // returns new Vec3(0, 2, 1)\r\n * v.zyxz; // returns new Vec4(2, 1, 0, 2)\r\n *\r\n * v.rgb; // returns new Vec3(0, 1, 2)\r\n * v.rbg; // returns new Vec3(0, 2, 1)\r\n * v.gg; // returns new Vec2(1, 1)\r\n * ```\r\n */\r\nexport function EnableSwizzles(): void {\r\n /* v8 ignore next 1 */\r\n if (GLM_SWIZZLES_ENABLED_F32) { return; }\r\n\r\n /* eslint-disable comma-spacing, max-len */\r\n\r\n // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should\r\n // not be modified by hand.\r\n // [Swizzle Autogen]\r\n\r\n const VEC2_SWIZZLES = ['xx','xy','yx','yy','xxx','xxy','xyx','xyy','yxx','yxy','yyx','yyy','xxxx','xxxy','xxyx','xxyy','xyxx','xyxy','xyyx','xyyy','yxxx','yxxy','yxyx','yxyy','yyxx','yyxy','yyyx','yyyy','rr','rg','gr','gg','rrr','rrg','rgr','rgg','grr','grg','ggr','ggg','rrrr','rrrg','rrgr','rrgg','rgrr','rgrg','rggr','rggg','grrr','grrg','grgr','grgg','ggrr','ggrg','gggr','gggg'];\r\n const VEC3_SWIZZLES = ['xz','yz','zx','zy','zz','xxz','xyz','xzx','xzy','xzz','yxz','yyz','yzx','yzy','yzz','zxx','zxy','zxz','zyx','zyy','zyz','zzx','zzy','zzz','xxxz','xxyz','xxzx','xxzy','xxzz','xyxz','xyyz','xyzx','xyzy','xyzz','xzxx','xzxy','xzxz','xzyx','xzyy','xzyz','xzzx','xzzy','xzzz','yxxz','yxyz','yxzx','yxzy','yxzz','yyxz','yyyz','yyzx','yyzy','yyzz','yzxx','yzxy','yzxz','yzyx','yzyy','yzyz','yzzx','yzzy','yzzz','zxxx','zxxy','zxxz','zxyx','zxyy','zxyz','zxzx','zxzy','zxzz','zyxx','zyxy','zyxz','zyyx','zyyy','zyyz','zyzx','zyzy','zyzz','zzxx','zzxy','zzxz','zzyx','zzyy','zzyz','zzzx','zzzy','zzzz','rb','gb','br','bg','bb','rrb','rgb','rbr','rbg','rbb','grb','ggb','gbr','gbg','gbb','brr','brg','brb','bgr','bgg','bgb','bbr','bbg','bbb','rrrb','rrgb','rrbr','rrbg','rrbb','rgrb','rggb','rgbr','rgbg','rgbb','rbrr','rbrg','rbrb','rbgr','rbgg','rbgb','rbbr','rbbg','rbbb','grrb','grgb','grbr','grbg','grbb','ggrb','gggb','ggbr','ggbg','ggbb','gbrr','gbrg','gbrb','gbgr','gbgg','gbgb','gbbr','gbbg','gbbb','brrr','brrg','brrb','brgr','brgg','brgb','brbr','brbg','brbb','bgrr','bgrg','bgrb','bggr','bggg','bggb','bgbr','bgbg','bgbb','bbrr','bbrg','bbrb','bbgr','bbgg','bbgb','bbbr','bbbg','bbbb'];\r\n const VEC4_SWIZZLES = ['xw','yw','zw','wx','wy','wz','ww','xxw','xyw','xzw','xwx','xwy','xwz','xww','yxw','yyw','yzw','ywx','ywy','ywz','yww','zxw','zyw','zzw','zwx','zwy','zwz','zww','wxx','wxy','wxz','wxw','wyx','wyy','wyz','wyw','wzx','wzy','wzz','wzw','wwx','wwy','wwz','www','xxxw','xxyw','xxzw','xxwx','xxwy','xxwz','xxww','xyxw','xyyw','xyzw','xywx','xywy','xywz','xyww','xzxw','xzyw','xzzw','xzwx','xzwy','xzwz','xzww','xwxx','xwxy','xwxz','xwxw','xwyx','xwyy','xwyz','xwyw','xwzx','xwzy','xwzz','xwzw','xwwx','xwwy','xwwz','xwww','yxxw','yxyw','yxzw','yxwx','yxwy','yxwz','yxww','yyxw','yyyw','yyzw','yywx','yywy','yywz','yyww','yzxw','yzyw','yzzw','yzwx','yzwy','yzwz','yzww','ywxx','ywxy','ywxz','ywxw','ywyx','ywyy','ywyz','ywyw','ywzx','ywzy','ywzz','ywzw','ywwx','ywwy','ywwz','ywww','zxxw','zxyw','zxzw','zxwx','zxwy','zxwz','zxww','zyxw','zyyw','zyzw','zywx','zywy','zywz','zyww','zzxw','zzyw','zzzw','zzwx','zzwy','zzwz','zzww','zwxx','zwxy','zwxz','zwxw','zwyx','zwyy','zwyz','zwyw','zwzx','zwzy','zwzz','zwzw','zwwx','zwwy','zwwz','zwww','wxxx','wxxy','wxxz','wxxw','wxyx','wxyy','wxyz','wxyw','wxzx','wxzy','wxzz','wxzw','wxwx','wxwy','wxwz','wxww','wyxx','wyxy','wyxz','wyxw','wyyx','wyyy','wyyz','wyyw','wyzx','wyzy','wyzz','wyzw','wywx','wywy','wywz','wyww','wzxx','wzxy','wzxz','wzxw','wzyx','wzyy','wzyz','wzyw','wzzx','wzzy','wzzz','wzzw','wzwx','wzwy','wzwz','wzww','wwxx','wwxy','wwxz','wwxw','wwyx','wwyy','wwyz','wwyw','wwzx','wwzy','wwzz','wwzw','wwwx','wwwy','wwwz','wwww','ra','ga','ba','ar','ag','ab','aa','rra','rga','rba','rar','rag','rab','raa','gra','gga','gba','gar','gag','gab','gaa','bra','bga','bba','bar','bag','bab','baa','arr','arg','arb','ara','agr','agg','agb','aga','abr','abg','abb','aba','aar','aag','aab','aaa','rrra','rrga','rrba','rrar','rrag','rrab','rraa','rgra','rgga','rgba','rgar','rgag','rgab','rgaa','rbra','rbga','rbba','rbar','rbag','rbab','rbaa','rarr','rarg','rarb','rara','ragr','ragg','ragb','raga','rabr','rabg','rabb','raba','raar','raag','raab','raaa','grra','grga','grba','grar','grag','grab','graa','ggra','ggga','ggba','ggar','ggag','ggab','ggaa','gbra','gbga','gbba','gbar','gbag','gbab','gbaa','garr','garg','garb','gara','gagr','gagg','gagb','gaga','gabr','gabg','gabb','gaba','gaar','gaag','gaab','gaaa','brra','brga','brba','brar','brag','brab','braa','bgra','bgga','bgba','bgar','bgag','bgab','bgaa','bbra','bbga','bbba','bbar','bbag','bbab','bbaa','barr','barg','barb','bara','bagr','bagg','bagb','baga','babr','babg','babb','baba','baar','baag','baab','baaa','arrr','arrg','arrb','arra','argr','argg','argb','arga','arbr','arbg','arbb','arba','arar','arag','arab','araa','agrr','agrg','agrb','agra','aggr','aggg','aggb','agga','agbr','agbg','agbb','agba','agar','agag','agab','agaa','abrr','abrg','abrb','abra','abgr','abgg','abgb','abga','abbr','abbg','abbb','abba','abar','abag','abab','abaa','aarr','aarg','aarb','aara','aagr','aagg','aagb','aaga','aabr','aabg','aabb','aaba','aaar','aaag','aaab','aaaa'];\r\n\r\n // [/Swizzle Autogen]\r\n\r\n /* eslint-enable comma-spacing, max-len */\r\n\r\n /**\r\n * Internal swizzle index table for `gl-matrix`.\r\n */\r\n const SWIZZLE_INDEX: Record = {\r\n x: 0, r: 0,\r\n y: 1, g: 1,\r\n z: 2, b: 2,\r\n w: 3, a: 3,\r\n };\r\n\r\n /**\r\n * Internal helper function to convert and return a `gl-matrix` vector by swizzle format.\r\n *\r\n * @param swizzle - Swizzle format to apply.\r\n * @returns {Vec2 | Vec3 | Vec4} New swizzled vector instance.\r\n */\r\n function getSwizzleImpl(swizzle: string): () => Vec2 | Vec3 | Vec4 {\r\n switch (swizzle.length) {\r\n case 2:\r\n return function(this: Float32Array) {\r\n return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]);\r\n };\r\n case 3:\r\n return function(this: Float32Array) {\r\n return new Vec3(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]]);\r\n };\r\n case 4:\r\n return function(this: Float32Array) {\r\n return new Vec4(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]], this[SWIZZLE_INDEX[swizzle[3]]]);\r\n };\r\n }\r\n\r\n throw new Error('Illegal swizzle length');\r\n }\r\n\r\n for (const swizzle of VEC2_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec2.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC3_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC4_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n GLM_SWIZZLES_ENABLED_F32 = true;\r\n}\r\n", "/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_DEG_TO_RAD: number = Math.PI / 180;\r\n\r\n/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_RAD_TO_DEG: number = 180 / Math.PI;\r\n\r\n/**\r\n * Convert `radians` to `degrees`.\r\n *\r\n * @param value - Angle in `radians`.\r\n * @returns Angle in `degrees`.\r\n */\r\nexport function toDegree(value: number): number {\r\n return value * GLM_RAD_TO_DEG;\r\n}\r\n\r\n/**\r\n * Convert `degrees` to `radians`.\r\n *\r\n * @param value - Angle in `degrees`.\r\n * @returns Angle in `radians`.\r\n */\r\nexport function toRadian(value: number): number {\r\n return value * GLM_DEG_TO_RAD;\r\n}\r\n"], + "mappings": ";;;;sQAAA,IAAAA,GAOaC,EAAN,MAAMA,UAAa,YAAa,CAWrC,eAAeC,EAAoE,CACjF,OAAQA,EAAO,OAAQ,CACrB,IAAK,GACH,MAAMA,CAAM,EAAG,MACjB,IAAK,GACH,MAAMA,EAAO,CAAC,EAAsBA,EAAO,CAAC,EAAG,CAAC,EAAG,MACrD,IAAK,GACH,IAAMC,EAAID,EAAO,CAAC,EACd,OAAOC,GAAM,SACf,MAAM,CACJA,EAAGA,EACHA,EAAGA,CAAC,CAAC,EAEP,MAAMA,EAAsB,EAAG,CAAC,EAElC,MACF,QACE,MAAMC,EAAAH,EAAKD,GAAa,EAAG,KAC/B,CACF,CAYA,IAAI,KAAc,CAChB,OAAOC,EAAK,IAAI,IAA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EAAG,KAAKF,EAAcE,EAAQ,CAAC,CAAC,CAAC,CAAC,CACpE,CACJ,CAEA,MAAM,IAAI,MAAM,wBAAwB,CAC1C,CAEA,QAAWA,KAAWL,EAAe,CACnC,IAAMS,EAAOL,EAAeC,CAAO,EACnC,OAAO,eAAeC,EAAK,UAAWD,EAAS,CAC7C,IAAKI,CACP,CAAC,EACD,OAAO,eAAeF,EAAK,UAAWF,EAAS,CAC7C,IAAKI,CACP,CAAC,EACD,OAAO,eAAeD,EAAK,UAAWH,EAAS,CAC7C,IAAKI,CACP,CAAC,CACH,CAEA,QAAWJ,KAAWJ,EAAe,CACnC,IAAMQ,EAAOL,EAAeC,CAAO,EACnC,OAAO,eAAeE,EAAK,UAAWF,EAAS,CAC7C,IAAKI,CACP,CAAC,EACD,OAAO,eAAeD,EAAK,UAAWH,EAAS,CAC7C,IAAKI,CACP,CAAC,CACH,CAEA,QAAWJ,KAAWH,EAAe,CACnC,IAAMO,EAAOL,EAAeC,CAAO,EACnC,OAAO,eAAeG,EAAK,UAAWH,EAAS,CAC7C,IAAKI,CACP,CAAC,CACH,CAEAX,GAA2B,EAC7B,CCxIA,IAAMY,GAAyB,KAAK,GAAK,IAKnCC,GAAyB,IAAM,KAAK,GAQnC,SAASC,GAASC,EAAuB,CAC9C,OAAOA,EAAQF,EACjB,CAQO,SAASG,GAASD,EAAuB,CAC9C,OAAOA,EAAQH,EACjB", + "names": ["_IDENTITY_2X2", "_Mat2", "values", "v", "__privateGet", "a", "b", "rad", "out", "a1", "a0", "a2", "a3", "det", "b0", "b1", "b2", "b3", "s", "c", "v0", "v1", "scale", "L", "D", "U", "__privateAdd", "Mat2", "_IDENTITY_2X3", "_Mat2d", "values", "v", "__privateGet", "a", "b", "rad", "out", "aa", "ab", "ac", "ad", "atx", "aty", "det", "a0", "a1", "a2", "a3", "a4", "a5", "b0", "b1", "b2", "b3", "b4", "b5", "v0", "v1", "s", "c", "scale", "__privateAdd", "Mat2d", "_IDENTITY_3X3", "_Mat3", "values", "v", "__privateGet", "a", "b", "rad", "out", "a01", "a02", "a12", "a00", "a10", "a11", "a20", "a21", "a22", "b01", "b11", "b21", "det", "b0", "b1", "b2", "x", "y", "s", "c", "q", "z", "w", "x2", "y2", "z2", "xx", "yx", "yy", "zx", "zy", "zz", "wx", "wy", "wz", "a03", "a13", "a23", "a30", "a31", "a32", "a33", "b00", "b02", "b03", "b04", "b05", "b06", "b07", "b08", "b09", "b10", "ax", "ay", "az", "bx", "by", "bz", "cx", "cy", "cz", "width", "height", "scale", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "b3", "b4", "b5", "b6", "b7", "b8", "__privateAdd", "Mat3", "_IDENTITY_4X4", "_TMP_VEC3", "_Mat4", "values", "v", "__privateGet", "a", "b", "rad", "axis", "fovy", "aspect", "near", "far", "left", "right", "bottom", "top", "out", "a01", "a02", "a03", "a12", "a13", "a23", "a00", "a10", "a11", "a20", "a21", "a22", "a30", "a31", "a32", "a33", "b00", "b01", "b02", "b03", "b04", "b05", "b06", "b07", "b08", "b09", "b10", "b11", "det", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "x", "y", "z", "len", "s", "c", "t", "b12", "b20", "b21", "b22", "q", "w", "x2", "y2", "z2", "xx", "xy", "xz", "yy", "yz", "zz", "wx", "wy", "wz", "bx", "by", "bz", "bw", "ax", "ay", "az", "aw", "magnitude", "cx", "cy", "cz", "mat", "m11", "m12", "m13", "m21", "m22", "m23", "m31", "m32", "m33", "is1", "is2", "is3", "sm11", "sm12", "sm13", "sm21", "sm22", "sm23", "sm31", "sm32", "sm33", "trace", "S", "out_r", "out_t", "out_s", "sx", "sy", "sz", "o", "ox", "oy", "oz", "out0", "out1", "out2", "out4", "out5", "out6", "out8", "out9", "out10", "yx", "zx", "zy", "rl", "tb", "nf", "f", "fov", "upTan", "downTan", "leftTan", "rightTan", "xScale", "yScale", "lr", "bt", "eye", "center", "up", "eyex", "eyey", "eyez", "upx", "upy", "upz", "centerx", "centery", "centerz", "z0", "z1", "x0", "x1", "y0", "y1", "target", "scale", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a14", "a15", "b13", "b14", "b15", "__privateAdd", "Mat4", "Vec3", "_Vec3", "values", "v", "value", "x", "y", "z", "a", "b", "scale", "out", "len", "ax", "ay", "az", "bx", "by", "bz", "t", "angle", "sinTotal", "ratioA", "ratioB", "c", "d", "factorTimes2", "factor1", "factor2", "factor3", "factor4", "inverseFactor", "inverseFactorTimesTwo", "m", "w", "q", "qx", "qy", "qz", "w2", "uvx", "uvy", "uvz", "uuvx", "uuvy", "uuvz", "rad", "py", "pz", "px", "mag", "cosine", "a0", "a1", "a2", "b0", "b1", "b2", "Vec4", "_Vec4", "values", "v", "value", "x", "y", "z", "w", "a", "b", "scale", "out", "len", "u", "c", "d", "e", "f", "g", "h", "i", "j", "t", "ax", "ay", "az", "aw", "m", "q", "qx", "qy", "qz", "qw", "ix", "iy", "iz", "iw", "a0", "a1", "a2", "a3", "b0", "b1", "b2", "b3", "_DEFAULT_ANGLE_ORDER", "_TMP_QUAT1", "_TMP_QUAT2", "_TMP_MAT3", "_TMP_VEC3", "_X_UNIT_VEC3", "_Y_UNIT_VEC3", "_Quat", "values", "v", "value", "x", "y", "z", "w", "a", "b", "rad", "scale", "out", "axis", "out_axis", "q", "dotproduct", "ax", "ay", "az", "aw", "bx", "by", "bz", "bw", "r", "et", "s", "t", "scale0", "scale1", "cosom", "omega", "sinom", "a0", "a1", "a2", "a3", "dot", "invDot", "m", "fTrace", "fRoot", "i", "j", "k", "order", "__privateGet", "halfToRad", "sx", "cx", "sy", "cy", "sz", "cz", "Vec3", "c", "d", "view", "right", "up", "__privateAdd", "Quat", "Vec4", "_TMP_QUAT", "_TMP_VEC3", "_Quat2", "values", "v", "a", "x1", "y1", "z1", "w1", "x2", "y2", "z2", "w2", "ax", "ay", "az", "out", "q", "t", "bx", "by", "bz", "bw", "Mat4", "__privateGet", "aw", "ax1", "ay1", "az1", "aw1", "bx1", "by1", "bz1", "ax2", "ay2", "az2", "aw2", "rad", "Quat", "qx", "qy", "qz", "qw", "axis", "axisLength", "s", "b", "ax0", "ay0", "az0", "aw0", "bw1", "bx0", "by0", "bz0", "bw0", "mt", "sqlen", "magnitude", "a0", "a1", "a2", "a3", "b0", "b1", "b2", "b3", "a_dot_b", "a4", "a5", "a6", "a7", "b4", "b5", "b6", "b7", "__privateAdd", "Quat2", "Vec2", "_Vec2", "values", "v", "value", "x", "y", "a", "b", "scale", "out", "len", "z", "t", "ax", "ay", "m", "rad", "p0", "p1", "sinC", "cosC", "x1", "y1", "x2", "y2", "mag", "cosine", "a0", "a1", "b0", "b1", "GLM_SWIZZLES_ENABLED_F32", "EnableSwizzles", "VEC2_SWIZZLES", "VEC3_SWIZZLES", "VEC4_SWIZZLES", "SWIZZLE_INDEX", "getSwizzleImpl", "swizzle", "Vec2", "Vec3", "Vec4", "impl", "GLM_DEG_TO_RAD", "GLM_RAD_TO_DEG", "toDegree", "value", "toRadian"] +} diff --git a/dist-cdn/esm/2016/gl-matrix-f64.js b/dist-cdn/esm/2016/gl-matrix-f64.js new file mode 100644 index 00000000..d52a3eb8 --- /dev/null +++ b/dist-cdn/esm/2016/gl-matrix-f64.js @@ -0,0 +1,9538 @@ +// gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library. +// @author Brandon Jones +// @author Colin MacKenzie IV +// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md) +var __typeError = (msg) => { + throw TypeError(msg); +}; +var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg); +var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); +var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); + +// src/common/index.ts +var GLM_EPSILON = 1e-6; + +// src/_lib/f64/Mat2.ts +var _IDENTITY_2X2; +var _Mat2 = class _Mat2 extends Float64Array { + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 4: + super(values); + break; + case 2: + super(values[0], values[1], 4); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v + ]); + } else { + super(v, 0, 4); + } + break; + default: + super(__privateGet(_Mat2, _IDENTITY_2X2)); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat2.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat2.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat2} into `this`. + * + * @param a the source vector + * @returns `this` + * @category Methods + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat2.identity(this) + * + * @returns `this` + * @category Methods + */ + identity() { + this.set(__privateGet(_Mat2, _IDENTITY_2X2)); + return this; + } + /** + * Multiplies this {@link Mat2} against another one + * Equivalent to `Mat2.multiply(this, this, b);` + * + * @param b - The second operand + * @returns `this` + * @category Methods + */ + multiply(b) { + return _Mat2.multiply(this, this, b); + } + /** + * Alias for {@link Mat2.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat2} + * Equivalent to `Mat2.transpose(this, this);` + * + * @returns `this` + * @category Methods + */ + transpose() { + return _Mat2.transpose(this, this); + } + /** + * Inverts this {@link Mat2} + * Equivalent to `Mat4.invert(this, this);` + * + * @returns `this` + * @category Methods + */ + invert() { + return _Mat2.invert(this, this); + } + /** + * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2.scale(this, this, v);` + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + * @category Methods + */ + scale(v) { + return _Mat2.scale(this, this, v); + } + /** + * Rotates this {@link Mat2} by the given angle around the given axis + * Equivalent to `Mat2.rotate(this, this, rad);` + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + * @category Methods + */ + rotate(rad) { + return _Mat2.rotate(this, this, rad); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2}. + */ + static get BYTE_LENGTH() { + return 4 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat2} + * @category Static + * + * @returns A new {@link Mat2} + */ + static create() { + return new _Mat2(); + } + /** + * Creates a new {@link Mat2} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2} + */ + static clone(a) { + return new _Mat2(a); + } + /** + * Copy the values from one {@link Mat2} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Create a new {@link Mat2} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2} + */ + static fromValues(...values) { + return new _Mat2(...values); + } + /** + * Set the components of a {@link Mat2} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + return out; + } + /** + * Set a {@link Mat2} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out, a) { + if (out === a) { + const a1 = a[1]; + out[1] = a[2]; + out[2] = a1; + } else { + out[0] = a[0]; + out[1] = a[2]; + out[2] = a[1]; + out[3] = a[3]; + } + return out; + } + /** + * Inverts a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + let det = a0 * a3 - a2 * a1; + if (!det) { + return null; + } + det = 1 / det; + out[0] = a3 * det; + out[1] = -a1 * det; + out[2] = -a2 * det; + out[3] = a0 * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out, a) { + const a0 = a[0]; + out[0] = a[3]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a0; + return out; + } + /** + * Calculates the determinant of a {@link Mat2} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + return a[0] * a[3] - a[2] * a[1]; + } + /** + * Adds two {@link Mat2}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + return out; + } + /** + * Alias for {@link Mat2.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat2}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + out[0] = a0 * b0 + a2 * b1; + out[1] = a1 * b0 + a3 * b1; + out[2] = a0 * b2 + a2 * b3; + out[3] = a1 * b2 + a3 * b3; + return out; + } + /** + * Alias for {@link Mat2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Rotates a {@link Mat2} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out, a, rad) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = a0 * c + a2 * s; + out[1] = a1 * c + a3 * s; + out[2] = a0 * -s + a2 * c; + out[3] = a1 * -s + a3 * c; + return out; + } + /** + * Scales the {@link Mat2} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0 * v0; + out[1] = a1 * v0; + out[2] = a2 * v1; + out[3] = a3 * v1; + return out; + } + /** + * Creates a {@link Mat2} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = -s; + out[3] = c; + return out; + } + /** + * Creates a {@link Mat2} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = v[1]; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat2} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]); + } + /** + * Multiply each element of a {@link Mat2} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + return out; + } + /** + * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + return out; + } + /** + * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix + * @category Static + * + * @param L - the lower triangular matrix + * @param D - the diagonal matrix + * @param U - the upper triangular matrix + * @param a - the input matrix to factorize + */ + static LDU(L, D, U, a) { + L[2] = a[2] / a[0]; + U[0] = a[0]; + U[1] = a[1]; + U[3] = a[3] - L[2] * U[1]; + return [L, D, U]; + } + /** + * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + /** + * Returns whether two {@link Mat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)); + } + /** + * Returns a string representation of a {@link Mat2} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat2(${a.join(", ")})`; + } +}; +_IDENTITY_2X2 = new WeakMap(); +__privateAdd(_Mat2, _IDENTITY_2X2, new Float64Array([ + 1, + 0, + 0, + 1 +])); +var Mat2 = _Mat2; +Mat2.prototype.mul = Mat2.prototype.multiply; +Mat2.mul = Mat2.multiply; +Mat2.sub = Mat2.subtract; + +// src/_lib/f64/Mat2d.ts +var _IDENTITY_2X3; +var _Mat2d = class _Mat2d extends Float64Array { + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 6: + super(values); + break; + case 2: + super(values[0], values[1], 6); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v, + v, + v + ]); + } else { + super(v, 0, 6); + } + break; + default: + super(__privateGet(_Mat2d, _IDENTITY_2X3)); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat2d.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat2d.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Mat2d} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat2d.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this.set(__privateGet(_Mat2d, _IDENTITY_2X3)); + return this; + } + /** + * Multiplies this {@link Mat2d} against another one + * Equivalent to `Mat2d.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b) { + return _Mat2d.multiply(this, this, b); + } + /** + * Alias for {@link Mat2d.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Translate this {@link Mat2d} by the given vector + * Equivalent to `Mat2d.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v) { + return _Mat2d.translate(this, this, v); + } + /** + * Rotates this {@link Mat2d} by the given angle around the given axis + * Equivalent to `Mat2d.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad) { + return _Mat2d.rotate(this, this, rad); + } + /** + * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2d.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v) { + return _Mat2d.scale(this, this, v); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2d}. + */ + static get BYTE_LENGTH() { + return 6 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat2d} + * @category Static + * + * @returns A new {@link Mat2d} + */ + static create() { + return new _Mat2d(); + } + /** + * Creates a new {@link Mat2d} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2d} + */ + static clone(a) { + return new _Mat2d(a); + } + /** + * Copy the values from one {@link Mat2d} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + return out; + } + /** + * Create a new {@link Mat2d} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2d} + */ + static fromValues(...values) { + return new _Mat2d(...values); + } + /** + * Set the components of a {@link Mat2d} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + return out; + } + /** + * Set a {@link Mat2d} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Inverts a {@link Mat2d} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const aa = a[0]; + const ab = a[1]; + const ac = a[2]; + const ad = a[3]; + const atx = a[4]; + const aty = a[5]; + let det = aa * ad - ab * ac; + if (!det) { + return null; + } + det = 1 / det; + out[0] = ad * det; + out[1] = -ab * det; + out[2] = -ac * det; + out[3] = aa * det; + out[4] = (ac * aty - ad * atx) * det; + out[5] = (ab * atx - aa * aty) * det; + return out; + } + /** + * Calculates the determinant of a {@link Mat2d} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + return a[0] * a[3] - a[1] * a[2]; + } + /** + * Adds two {@link Mat2d}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + return out; + } + /** + * Alias for {@link Mat2d.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat2d}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + out[0] = a0 * b0 + a2 * b1; + out[1] = a1 * b0 + a3 * b1; + out[2] = a0 * b2 + a2 * b3; + out[3] = a1 * b2 + a3 * b3; + out[4] = a0 * b4 + a2 * b5 + a4; + out[5] = a1 * b4 + a3 * b5 + a5; + return out; + } + /** + * Alias for {@link Mat2d.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat2d} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0; + out[1] = a1; + out[2] = a2; + out[3] = a3; + out[4] = a0 * v0 + a2 * v1 + a4; + out[5] = a1 * v0 + a3 * v1 + a5; + return out; + } + /** + * Rotates a {@link Mat2d} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out, a, rad) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = a0 * c + a2 * s; + out[1] = a1 * c + a3 * s; + out[2] = a0 * -s + a2 * c; + out[3] = a1 * -s + a3 * c; + out[4] = a4; + out[5] = a5; + return out; + } + /** + * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0 * v0; + out[1] = a1 * v0; + out[2] = a2 * v1; + out[3] = a3 * v1; + out[4] = a4; + out[5] = a5; + return out; + } + // TODO: Got to fromRotation + /** + * Creates a {@link Mat2d} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = v[0]; + out[5] = v[1]; + return out; + } + /** + * Creates a {@link Mat2d} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = -s; + out[3] = c; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Creates a {@link Mat2d} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = v[1]; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat2d} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1); + } + /** + * Multiply each element of a {@link Mat2d} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + return out; + } + /** + * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + return out; + } + /** + * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5]; + } + /** + * Returns whether two {@link Mat2d}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)); + } + /** + * Returns a string representation of a {@link Mat2d} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat2d(${a.join(", ")})`; + } +}; +_IDENTITY_2X3 = new WeakMap(); +__privateAdd(_Mat2d, _IDENTITY_2X3, new Float64Array([ + 1, + 0, + 0, + 1, + 0, + 0 +])); +var Mat2d = _Mat2d; +Mat2d.mul = Mat2d.multiply; +Mat2d.sub = Mat2d.subtract; + +// src/_lib/f64/Mat3.ts +var _IDENTITY_3X3; +var _Mat3 = class _Mat3 extends Float64Array { + /** + * Create a {@link Mat3}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 9: + super(values); + break; + case 2: + super(values[0], values[1], 9); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v, + v, + v, + v, + v, + v + ]); + } else { + super(v, 0, 9); + } + break; + default: + super(__privateGet(_Mat3, _IDENTITY_3X3)); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat3.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat3.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat3.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this.set(__privateGet(_Mat3, _IDENTITY_3X3)); + return this; + } + /** + * Multiplies this {@link Mat3} against another one + * Equivalent to `Mat3.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b) { + return _Mat3.multiply(this, this, b); + } + /** + * Alias for {@link Mat3.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat3} + * Equivalent to `Mat3.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose() { + return _Mat3.transpose(this, this); + } + /** + * Inverts this {@link Mat3} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + return _Mat3.invert(this, this); + } + /** + * Translate this {@link Mat3} by the given vector + * Equivalent to `Mat3.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v) { + return _Mat3.translate(this, this, v); + } + /** + * Rotates this {@link Mat3} by the given angle around the given axis + * Equivalent to `Mat3.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad) { + return _Mat3.rotate(this, this, rad); + } + /** + * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat3.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v) { + return _Mat3.scale(this, this, v); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat3}. + */ + static get BYTE_LENGTH() { + return 9 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat3} + * @category Static + * + * @returns A new {@link Mat3} + */ + static create() { + return new _Mat3(); + } + /** + * Creates a new {@link Mat3} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat3} + */ + static clone(a) { + return new _Mat3(a); + } + /** + * Copy the values from one {@link Mat3} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + return out; + } + /** + * Create a new {@link Mat3} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat3} + */ + static fromValues(...values) { + return new _Mat3(...values); + } + /** + * Set the components of a {@link Mat3} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + out[6] = values[6]; + out[7] = values[7]; + out[8] = values[8]; + return out; + } + /** + * Set a {@link Mat3} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out, a) { + if (out === a) { + const a01 = a[1], a02 = a[2], a12 = a[5]; + out[1] = a[3]; + out[2] = a[6]; + out[3] = a01; + out[5] = a[7]; + out[6] = a02; + out[7] = a12; + } else { + out[0] = a[0]; + out[1] = a[3]; + out[2] = a[6]; + out[3] = a[1]; + out[4] = a[4]; + out[5] = a[7]; + out[6] = a[2]; + out[7] = a[5]; + out[8] = a[8]; + } + return out; + } + /** + * Inverts a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const a00 = a[0], a01 = a[1], a02 = a[2]; + const a10 = a[3], a11 = a[4], a12 = a[5]; + const a20 = a[6], a21 = a[7], a22 = a[8]; + const b01 = a22 * a11 - a12 * a21; + const b11 = -a22 * a10 + a12 * a20; + const b21 = a21 * a10 - a11 * a20; + let det = a00 * b01 + a01 * b11 + a02 * b21; + if (!det) { + return null; + } + det = 1 / det; + out[0] = b01 * det; + out[1] = (-a22 * a01 + a02 * a21) * det; + out[2] = (a12 * a01 - a02 * a11) * det; + out[3] = b11 * det; + out[4] = (a22 * a00 - a02 * a20) * det; + out[5] = (-a12 * a00 + a02 * a10) * det; + out[6] = b21 * det; + out[7] = (-a21 * a00 + a01 * a20) * det; + out[8] = (a11 * a00 - a01 * a10) * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out, a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + out[0] = a11 * a22 - a12 * a21; + out[1] = a02 * a21 - a01 * a22; + out[2] = a01 * a12 - a02 * a11; + out[3] = a12 * a20 - a10 * a22; + out[4] = a00 * a22 - a02 * a20; + out[5] = a02 * a10 - a00 * a12; + out[6] = a10 * a21 - a11 * a20; + out[7] = a01 * a20 - a00 * a21; + out[8] = a00 * a11 - a01 * a10; + return out; + } + /** + * Calculates the determinant of a {@link Mat3} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20); + } + /** + * Adds two {@link Mat3}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + out[8] = a[8] + b[8]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + out[6] = a[6] - b[6]; + out[7] = a[7] - b[7]; + out[8] = a[8] - b[8]; + return out; + } + /** + * Alias for {@link Mat3.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat3}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + let b0 = b[0]; + let b1 = b[1]; + let b2 = b[2]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20; + out[1] = b0 * a01 + b1 * a11 + b2 * a21; + out[2] = b0 * a02 + b1 * a12 + b2 * a22; + b0 = b[3]; + b1 = b[4]; + b2 = b[5]; + out[3] = b0 * a00 + b1 * a10 + b2 * a20; + out[4] = b0 * a01 + b1 * a11 + b2 * a21; + out[5] = b0 * a02 + b1 * a12 + b2 * a22; + b0 = b[6]; + b1 = b[7]; + b2 = b[8]; + out[6] = b0 * a00 + b1 * a10 + b2 * a20; + out[7] = b0 * a01 + b1 * a11 + b2 * a21; + out[8] = b0 * a02 + b1 * a12 + b2 * a22; + return out; + } + /** + * Alias for {@link Mat3.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat3} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + const x = v[0]; + const y = v[1]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a10; + out[4] = a11; + out[5] = a12; + out[6] = x * a00 + y * a10 + a20; + out[7] = x * a01 + y * a11 + a21; + out[8] = x * a02 + y * a12 + a22; + return out; + } + /** + * Rotates a {@link Mat3} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out, a, rad) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c * a00 + s * a10; + out[1] = c * a01 + s * a11; + out[2] = c * a02 + s * a12; + out[3] = c * a10 - s * a00; + out[4] = c * a11 - s * a01; + out[5] = c * a12 - s * a02; + out[6] = a20; + out[7] = a21; + out[8] = a22; + return out; + } + /** + * Scales the {@link Mat3} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const x = v[0]; + const y = v[1]; + out[0] = x * a[0]; + out[1] = x * a[1]; + out[2] = x * a[2]; + out[3] = y * a[3]; + out[4] = y * a[4]; + out[5] = y * a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + return out; + } + /** + * Creates a {@link Mat3} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = v[0]; + out[7] = v[1]; + out[8] = 1; + return out; + } + /** + * Creates a {@link Mat3} from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat3.identity(dest); + * mat3.rotate(dest, dest, rad); + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = 0; + out[3] = -s; + out[4] = c; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Creates a {@link Mat3} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = v[1]; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Copies the upper-left 3x3 values of a {@link Mat2d} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 2x3 matrix + * @returns `out` + */ + static fromMat2d(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = 0; + out[3] = a[2]; + out[4] = a[3]; + out[5] = 0; + out[6] = a[4]; + out[7] = a[5]; + out[8] = 1; + return out; + } + /** + * Calculates a {@link Mat3} from the given quaternion + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param q - {@link Quat} to create matrix from + * @returns `out` + */ + static fromQuat(out, q) { + 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; + out[0] = 1 - yy - zz; + out[3] = yx - wz; + out[6] = zx + wy; + out[1] = yx + wz; + out[4] = 1 - xx - zz; + out[7] = zy - wx; + out[2] = zx - wy; + out[5] = zy + wx; + out[8] = 1 - xx - yy; + return out; + } + /** + * Copies the upper-left 3x3 values of a {@link Mat4} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 4x4 matrix + * @returns `out` + */ + static fromMat4(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[4]; + out[4] = a[5]; + out[5] = a[6]; + out[6] = a[8]; + out[7] = a[9]; + out[8] = a[10]; + return out; + } + /** + * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix + * @category Static + * + * @param {mat3} out mat3 receiving operation result + * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out, a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + return out; + } + /** + * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out, a) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const bx = a[4]; + const by = a[5]; + const bz = a[6]; + const cx = a[8]; + const cy = a[9]; + const cz = a[10]; + out[0] = by * cz - cz * cy; + out[1] = bz * cx - cx * cz; + out[2] = bx * cy - cy * cx; + out[3] = cy * az - cz * ay; + out[4] = cz * ax - cx * az; + out[5] = cx * ay - cy * ax; + out[6] = ay * bz - az * by; + out[7] = az * bx - ax * bz; + out[8] = ax * by - ay * bx; + return out; + } + /** + * Generates a 2D projection matrix with the given bounds + * @category Static + * + * @param out mat3 frustum matrix will be written into + * @param width Width of your gl context + * @param height Height of gl context + * @returns `out` + */ + static projection(out, width, height) { + out[0] = 2 / width; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = -2 / height; + out[5] = 0; + out[6] = -1; + out[7] = 1; + out[8] = 1; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat3} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt( + a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + ); + } + /** + * Multiply each element of a {@link Mat3} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + out[8] = a[8] * b; + return out; + } + /** + * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + out[6] = a[6] + b[6] * scale; + out[7] = a[7] + b[7] * scale; + out[8] = a[8] + b[8] * scale; + return out; + } + /** + * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8]; + } + /** + * Returns whether two {@link Mat3}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const a8 = a[8]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + const b8 = b[8]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)); + } + /** + * Returns a string representation of a {@link Mat3} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat3(${a.join(", ")})`; + } +}; +_IDENTITY_3X3 = new WeakMap(); +__privateAdd(_Mat3, _IDENTITY_3X3, new Float64Array([ + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1 +])); +var Mat3 = _Mat3; +Mat3.prototype.mul = Mat3.prototype.multiply; +Mat3.mul = Mat3.multiply; +Mat3.sub = Mat3.subtract; + +// src/_lib/f64/Mat4.ts +var _IDENTITY_4X4, _TMP_VEC3; +var _Mat4 = class _Mat4 extends Float64Array { + /** + * Create a {@link Mat4}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 16: + super(values); + break; + case 2: + super(values[0], values[1], 16); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v + ]); + } else { + super(v, 0, 16); + } + break; + default: + super(__privateGet(_Mat4, _IDENTITY_4X4)); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat4.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat4.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat4.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this.set(__privateGet(_Mat4, _IDENTITY_4X4)); + return this; + } + /** + * Multiplies this {@link Mat4} against another one + * Equivalent to `Mat4.multiply(this, this, b);` + * @category Methods + * + * @param b - The second operand + * @returns `this` + */ + multiply(b) { + return _Mat4.multiply(this, this, b); + } + /** + * Alias for {@link Mat4.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat4} + * Equivalent to `Mat4.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose() { + return _Mat4.transpose(this, this); + } + /** + * Inverts this {@link Mat4} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + return _Mat4.invert(this, this); + } + /** + * Translate this {@link Mat4} by the given vector + * Equivalent to `Mat4.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to translate by + * @returns `this` + */ + translate(v) { + return _Mat4.translate(this, this, v); + } + /** + * Rotates this {@link Mat4} by the given angle around the given axis + * Equivalent to `Mat4.rotate(this, this, rad, axis);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `this` + */ + rotate(rad, axis) { + return _Mat4.rotate(this, this, rad, axis); + } + /** + * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat4.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to scale the matrix by + * @returns `this` + */ + scale(v) { + return _Mat4.scale(this, this, v); + } + /** + * Rotates this {@link Mat4} by the given angle around the X axis + * Equivalent to `Mat4.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateX(rad) { + return _Mat4.rotateX(this, this, rad); + } + /** + * Rotates this {@link Mat4} by the given angle around the Y axis + * Equivalent to `Mat4.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateY(rad) { + return _Mat4.rotateY(this, this, rad); + } + /** + * Rotates this {@link Mat4} by the given angle around the Z axis + * Equivalent to `Mat4.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateZ(rad) { + return _Mat4.rotateZ(this, this, rad); + } + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveNO(fovy, aspect, near, far) { + return _Mat4.perspectiveNO(this, fovy, aspect, near, far); + } + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveZO(fovy, aspect, near, far) { + return _Mat4.perspectiveZO(this, fovy, aspect, near, far); + } + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoNO(left, right, bottom, top, near, far) { + return _Mat4.orthoNO(this, left, right, bottom, top, near, far); + } + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoZO(left, right, bottom, top, near, far) { + return _Mat4.orthoZO(this, left, right, bottom, top, near, far); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat4}. + */ + static get BYTE_LENGTH() { + return 16 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat4} + * @category Static + * + * @returns A new {@link Mat4} + */ + static create() { + return new _Mat4(); + } + /** + * Creates a new {@link Mat4} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat4} + */ + static clone(a) { + return new _Mat4(a); + } + /** + * Copy the values from one {@link Mat4} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + /** + * Create a new mat4 with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat4} + */ + static fromValues(...values) { + return new _Mat4(...values); + } + /** + * Set the components of a mat4 to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + out[6] = values[6]; + out[7] = values[7]; + out[8] = values[8]; + out[9] = values[9]; + out[10] = values[10]; + out[11] = values[11]; + out[12] = values[12]; + out[13] = values[13]; + out[14] = values[14]; + out[15] = values[15]; + return out; + } + /** + * Set a {@link Mat4} to the identity matrix + * @category Static + * + * @param out - The receiving Matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out, a) { + if (out === a) { + const a01 = a[1], a02 = a[2], a03 = a[3]; + const a12 = a[6], a13 = a[7]; + const a23 = a[11]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a01; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a02; + out[9] = a12; + out[11] = a[14]; + out[12] = a03; + out[13] = a13; + out[14] = a23; + } else { + out[0] = a[0]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a[1]; + out[5] = a[5]; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a[2]; + out[9] = a[6]; + out[10] = a[10]; + out[11] = a[14]; + out[12] = a[3]; + out[13] = a[7]; + out[14] = a[11]; + out[15] = a[15]; + } + return out; + } + /** + * Inverts a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out, a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + out[0] = a11 * b11 - a12 * b10 + a13 * b09; + out[1] = a02 * b10 - a01 * b11 - a03 * b09; + out[2] = a31 * b05 - a32 * b04 + a33 * b03; + out[3] = a22 * b04 - a21 * b05 - a23 * b03; + out[4] = a12 * b08 - a10 * b11 - a13 * b07; + out[5] = a00 * b11 - a02 * b08 + a03 * b07; + out[6] = a32 * b02 - a30 * b05 - a33 * b01; + out[7] = a20 * b05 - a22 * b02 + a23 * b01; + out[8] = a10 * b10 - a11 * b08 + a13 * b06; + out[9] = a01 * b08 - a00 * b10 - a03 * b06; + out[10] = a30 * b04 - a31 * b02 + a33 * b00; + out[11] = a21 * b02 - a20 * b04 - a23 * b00; + out[12] = a11 * b07 - a10 * b09 - a12 * b06; + out[13] = a00 * b09 - a01 * b07 + a02 * b06; + out[14] = a31 * b01 - a30 * b03 - a32 * b00; + out[15] = a20 * b03 - a21 * b01 + a22 * b00; + return out; + } + /** + * Calculates the determinant of a {@link Mat4} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b0 = a00 * a11 - a01 * a10; + const b1 = a00 * a12 - a02 * a10; + const b2 = a01 * a12 - a02 * a11; + const b3 = a20 * a31 - a21 * a30; + const b4 = a20 * a32 - a22 * a30; + const b5 = a21 * a32 - a22 * a31; + const b6 = a00 * b5 - a01 * b4 + a02 * b3; + const b7 = a10 * b5 - a11 * b4 + a12 * b3; + const b8 = a20 * b2 - a21 * b1 + a22 * b0; + const b9 = a30 * b2 - a31 * b1 + a32 * b0; + return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9; + } + /** + * Multiplies two {@link Mat4}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + let b0 = b[0]; + let b1 = b[1]; + let b2 = b[2]; + let b3 = b[3]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[4]; + b1 = b[5]; + b2 = b[6]; + b3 = b[7]; + out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[8]; + b1 = b[9]; + b2 = b[10]; + b3 = b[11]; + out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[12]; + b1 = b[13]; + b2 = b[14]; + b3 = b[15]; + out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + return out; + } + /** + * Alias for {@link Mat4.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat4} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const x = v[0]; + const y = v[1]; + const z = v[2]; + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a03; + out[4] = a10; + out[5] = a11; + out[6] = a12; + out[7] = a13; + out[8] = a20; + out[9] = a21; + out[10] = a22; + out[11] = a23; + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + return out; + } + /** + * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec3} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const x = v[0]; + const y = v[1]; + const z = v[2]; + out[0] = a[0] * x; + out[1] = a[1] * x; + out[2] = a[2] * x; + out[3] = a[3] * x; + out[4] = a[4] * y; + out[5] = a[5] * y; + out[6] = a[6] * y; + out[7] = a[7] * y; + out[8] = a[8] * z; + out[9] = a[9] * z; + out[10] = a[10] * z; + out[11] = a[11] * z; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + /** + * Rotates a {@link Mat4} by the given angle around the given axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if axis has a length of 0 + */ + static rotate(out, a, rad, axis) { + let x = axis[0]; + let y = axis[1]; + let z = axis[2]; + let len = Math.sqrt(x * x + y * y + z * z); + if (len < GLM_EPSILON) { + return null; + } + len = 1 / len; + x *= len; + y *= len; + z *= len; + const s = Math.sin(rad); + const c = Math.cos(rad); + const t = 1 - c; + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const b00 = x * x * t + c; + const b01 = y * x * t + z * s; + const b02 = z * x * t - y * s; + const b10 = x * y * t - z * s; + const b11 = y * y * t + c; + const b12 = z * y * t + x * s; + const b20 = x * z * t + y * s; + const b21 = y * z * t - x * s; + const b22 = z * z * t + c; + out[0] = a00 * b00 + a10 * b01 + a20 * b02; + out[1] = a01 * b00 + a11 * b01 + a21 * b02; + out[2] = a02 * b00 + a12 * b01 + a22 * b02; + out[3] = a03 * b00 + a13 * b01 + a23 * b02; + out[4] = a00 * b10 + a10 * b11 + a20 * b12; + out[5] = a01 * b10 + a11 * b11 + a21 * b12; + out[6] = a02 * b10 + a12 * b11 + a22 * b12; + out[7] = a03 * b10 + a13 * b11 + a23 * b12; + out[8] = a00 * b20 + a10 * b21 + a20 * b22; + out[9] = a01 * b20 + a11 * b21 + a21 * b22; + out[10] = a02 * b20 + a12 * b21 + a22 * b22; + out[11] = a03 * b20 + a13 * b21 + a23 * b22; + if (a !== out) { + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + return out; + } + /** + * Rotates a matrix by the given angle around the X axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateX(out, a, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + if (a !== out) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[4] = a10 * c + a20 * s; + out[5] = a11 * c + a21 * s; + out[6] = a12 * c + a22 * s; + out[7] = a13 * c + a23 * s; + out[8] = a20 * c - a10 * s; + out[9] = a21 * c - a11 * s; + out[10] = a22 * c - a12 * s; + out[11] = a23 * c - a13 * s; + return out; + } + /** + * Rotates a matrix by the given angle around the Y axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateY(out, a, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + if (a !== out) { + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[0] = a00 * c - a20 * s; + out[1] = a01 * c - a21 * s; + out[2] = a02 * c - a22 * s; + out[3] = a03 * c - a23 * s; + out[8] = a00 * s + a20 * c; + out[9] = a01 * s + a21 * c; + out[10] = a02 * s + a22 * c; + out[11] = a03 * s + a23 * c; + return out; + } + /** + * Rotates a matrix by the given angle around the Z axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateZ(out, a, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + if (a !== out) { + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[0] = a00 * c + a10 * s; + out[1] = a01 * c + a11 * s; + out[2] = a02 * c + a12 * s; + out[3] = a03 * c + a13 * s; + out[4] = a10 * c - a00 * s; + out[5] = a11 * c - a01 * s; + out[6] = a12 * c - a02 * s; + out[7] = a13 * c - a03 * s; + return out; + } + /** + * Creates a {@link Mat4} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Creates a {@link Mat4} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = v[1]; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = v[2]; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a {@link Mat4} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotate(dest, dest, rad, axis); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if `axis` has a length of 0 + */ + static fromRotation(out, rad, axis) { + let x = axis[0]; + let y = axis[1]; + let z = axis[2]; + let len = Math.sqrt(x * x + y * y + z * z); + if (len < GLM_EPSILON) { + return null; + } + len = 1 / len; + x *= len; + y *= len; + z *= len; + const s = Math.sin(rad); + const c = Math.cos(rad); + const t = 1 - c; + out[0] = x * x * t + c; + out[1] = y * x * t + z * s; + out[2] = z * x * t - y * s; + out[3] = 0; + out[4] = x * y * t - z * s; + out[5] = y * y * t + c; + out[6] = z * y * t + x * s; + out[7] = 0; + out[8] = x * z * t + y * s; + out[9] = y * z * t - x * s; + out[10] = z * z * t + c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateX(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromXRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = c; + out[6] = s; + out[7] = 0; + out[8] = 0; + out[9] = -s; + out[10] = c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateY(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromYRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = 0; + out[2] = -s; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = s; + out[9] = 0; + out[10] = c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateZ(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromZRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = 0; + out[3] = 0; + out[4] = -s; + out[5] = c; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @returns `out` + */ + static fromRotationTranslation(out, q, v) { + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Sets a {@link Mat4} from a {@link Quat2}. + * @category Static + * + * @param out - Matrix + * @param a - Dual Quaternion + * @returns `out` + */ + static fromQuat2(out, a) { + const bx = -a[0]; + const by = -a[1]; + const bz = -a[2]; + const bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const magnitude = bx * bx + by * by + bz * bz + bw * bw; + if (magnitude > 0) { + __privateGet(_Mat4, _TMP_VEC3)[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude; + __privateGet(_Mat4, _TMP_VEC3)[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude; + __privateGet(_Mat4, _TMP_VEC3)[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude; + } else { + __privateGet(_Mat4, _TMP_VEC3)[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; + __privateGet(_Mat4, _TMP_VEC3)[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; + __privateGet(_Mat4, _TMP_VEC3)[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + } + _Mat4.fromRotationTranslation(out, a, __privateGet(_Mat4, _TMP_VEC3)); + return out; + } + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out, a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[3] = 0; + out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[7] = 0; + out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out, a) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const bx = a[4]; + const by = a[5]; + const bz = a[6]; + const cx = a[8]; + const cy = a[9]; + const cz = a[10]; + out[0] = by * cz - cz * cy; + out[1] = bz * cx - cx * cz; + out[2] = bx * cy - cy * cx; + out[3] = 0; + out[4] = cy * az - cz * ay; + out[5] = cz * ax - cx * az; + out[6] = cx * ay - cy * ax; + out[7] = 0; + out[8] = ay * bz - az * by; + out[9] = az * bx - ax * bz; + out[10] = ax * by - ay * bx; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Returns the translation vector component of a transformation + * matrix. If a matrix is built with fromRotationTranslation, + * the returned vector will be the same as the translation vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive translation component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getTranslation(out, mat) { + out[0] = mat[12]; + out[1] = mat[13]; + out[2] = mat[14]; + return out; + } + /** + * Returns the scaling factor component of a transformation + * matrix. If a matrix is built with fromRotationTranslationScale + * with a normalized Quaternion parameter, the returned vector will be + * the same as the scaling vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive scaling factor component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getScaling(out, mat) { + const m11 = mat[0]; + const m12 = mat[1]; + const m13 = mat[2]; + const m21 = mat[4]; + const m22 = mat[5]; + const m23 = mat[6]; + const m31 = mat[8]; + const m32 = mat[9]; + const m33 = mat[10]; + out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + return out; + } + /** + * Returns a quaternion representing the rotational component + * of a transformation matrix. If a matrix is built with + * fromRotationTranslation, the returned quaternion will be the + * same as the quaternion originally supplied. + * @category Static + * + * @param out - Quaternion to receive the rotation component + * @param mat - Matrix to be decomposed (input) + * @return `out` + */ + static getRotation(out, mat) { + _Mat4.getScaling(__privateGet(_Mat4, _TMP_VEC3), mat); + const is1 = 1 / __privateGet(_Mat4, _TMP_VEC3)[0]; + const is2 = 1 / __privateGet(_Mat4, _TMP_VEC3)[1]; + const is3 = 1 / __privateGet(_Mat4, _TMP_VEC3)[2]; + const sm11 = mat[0] * is1; + const sm12 = mat[1] * is2; + const sm13 = mat[2] * is3; + const sm21 = mat[4] * is1; + const sm22 = mat[5] * is2; + const sm23 = mat[6] * is3; + const sm31 = mat[8] * is1; + const sm32 = mat[9] * is2; + const sm33 = mat[10] * is3; + const trace = sm11 + sm22 + sm33; + let S = 0; + if (trace > 0) { + S = Math.sqrt(trace + 1) * 2; + out[3] = 0.25 * S; + out[0] = (sm23 - sm32) / S; + out[1] = (sm31 - sm13) / S; + out[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2; + out[3] = (sm23 - sm32) / S; + out[0] = 0.25 * S; + out[1] = (sm12 + sm21) / S; + out[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2; + out[3] = (sm31 - sm13) / S; + out[0] = (sm12 + sm21) / S; + out[1] = 0.25 * S; + out[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2; + out[3] = (sm12 - sm21) / S; + out[0] = (sm31 + sm13) / S; + out[1] = (sm23 + sm32) / S; + out[2] = 0.25 * S; + } + return out; + } + /** + * Decomposes a transformation matrix into its rotation, translation + * and scale components. Returns only the rotation component + * @category Static + * + * @param out_r - Quaternion to receive the rotation component + * @param out_t - Vector to receive the translation vector + * @param out_s - Vector to receive the scaling factor + * @param mat - Matrix to be decomposed (input) + * @returns `out_r` + */ + static decompose(out_r, out_t, out_s, mat) { + out_t[0] = mat[12]; + out_t[1] = mat[13]; + out_t[2] = mat[14]; + const m11 = mat[0]; + const m12 = mat[1]; + const m13 = mat[2]; + const m21 = mat[4]; + const m22 = mat[5]; + const m23 = mat[6]; + const m31 = mat[8]; + const m32 = mat[9]; + const m33 = mat[10]; + out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + const is1 = 1 / out_s[0]; + const is2 = 1 / out_s[1]; + const is3 = 1 / out_s[2]; + const sm11 = m11 * is1; + const sm12 = m12 * is2; + const sm13 = m13 * is3; + const sm21 = m21 * is1; + const sm22 = m22 * is2; + const sm23 = m23 * is3; + const sm31 = m31 * is1; + const sm32 = m32 * is2; + const sm33 = m33 * is3; + const trace = sm11 + sm22 + sm33; + let S = 0; + if (trace > 0) { + S = Math.sqrt(trace + 1) * 2; + out_r[3] = 0.25 * S; + out_r[0] = (sm23 - sm32) / S; + out_r[1] = (sm31 - sm13) / S; + out_r[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2; + out_r[3] = (sm23 - sm32) / S; + out_r[0] = 0.25 * S; + out_r[1] = (sm12 + sm21) / S; + out_r[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2; + out_r[3] = (sm31 - sm13) / S; + out_r[0] = (sm12 + sm21) / S; + out_r[1] = 0.25 * S; + out_r[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2; + out_r[3] = (sm12 - sm21) / S; + out_r[0] = (sm31 + sm13) / S; + out_r[1] = (sm23 + sm32) / S; + out_r[2] = 0.25 * S; + } + return out_r; + } + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @returns `out` + */ + static fromRotationTranslationScale(out, q, v, s) { + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + const sx = s[0]; + const sy = s[1]; + const sz = s[2]; + out[0] = (1 - (yy + zz)) * sx; + out[1] = (xy + wz) * sx; + out[2] = (xz - wy) * sx; + out[3] = 0; + out[4] = (xy - wz) * sy; + out[5] = (1 - (xx + zz)) * sy; + out[6] = (yz + wx) * sy; + out[7] = 0; + out[8] = (xz + wy) * sz; + out[9] = (yz - wx) * sz; + out[10] = (1 - (xx + yy)) * sz; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the + * given origin. This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * mat4.translate(dest, origin); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * mat4.translate(dest, negativeOrigin); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @param o - The origin vector around which to scale and rotate + * @returns `out` + */ + static fromRotationTranslationScaleOrigin(out, q, v, s, o) { + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + const sx = s[0]; + const sy = s[1]; + const sz = s[2]; + const ox = o[0]; + const oy = o[1]; + const oz = o[2]; + const out0 = (1 - (yy + zz)) * sx; + const out1 = (xy + wz) * sx; + const out2 = (xz - wy) * sx; + const out4 = (xy - wz) * sy; + const out5 = (1 - (xx + zz)) * sy; + const out6 = (yz + wx) * sy; + const out8 = (xz + wy) * sz; + const out9 = (yz - wx) * sz; + const out10 = (1 - (xx + yy)) * sz; + out[0] = out0; + out[1] = out1; + out[2] = out2; + out[3] = 0; + out[4] = out4; + out[5] = out5; + out[6] = out6; + out[7] = 0; + out[8] = out8; + out[9] = out9; + out[10] = out10; + out[11] = 0; + out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz); + out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz); + out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); + out[15] = 1; + return out; + } + /** + * Calculates a 4x4 matrix from the given quaternion + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Quaternion to create matrix from + * @returns `out` + */ + static fromQuat(out, q) { + 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; + out[0] = 1 - yy - zz; + out[1] = yx + wz; + out[2] = zx - wy; + out[3] = 0; + out[4] = yx - wz; + out[5] = 1 - xx - zz; + out[6] = zy + wx; + out[7] = 0; + out[8] = zx + wy; + out[9] = zy - wx; + out[10] = 1 - xx - yy; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumNO(out, left, right, bottom, top, near, far = Infinity) { + const rl = 1 / (right - left); + const tb = 1 / (top - bottom); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + /** + * Alias for {@link Mat4.frustumNO} + * @category Static + * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly + */ + static frustum(out, left, right, bottom, top, near, far = Infinity) { + return out; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumZO(out, left, right, bottom, top, near, far = Infinity) { + const rl = 1 / (right - left); + const tb = 1 / (top - bottom); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = far * nf; + out[14] = far * near * nf; + } else { + out[10] = -1; + out[14] = -near; + } + return out; + } + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveNO(out, fovy, aspect, near, far = Infinity) { + const f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + /** + * Alias for {@link Mat4.perspectiveNO} + * @category Static + * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static perspective(out, fovy, aspect, near, far = Infinity) { + return out; + } + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveZO(out, fovy, aspect, near, far = Infinity) { + const f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = far * nf; + out[14] = far * near * nf; + } else { + out[10] = -1; + out[14] = -near; + } + return out; + } + /** + * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating + * projection matrices to be used with the still experimental WebVR API. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + * @deprecated + */ + static perspectiveFromFieldOfView(out, fov, near, far) { + const upTan = Math.tan(fov.upDegrees * Math.PI / 180); + const downTan = Math.tan(fov.downDegrees * Math.PI / 180); + const leftTan = Math.tan(fov.leftDegrees * Math.PI / 180); + const rightTan = Math.tan(fov.rightDegrees * Math.PI / 180); + const xScale = 2 / (leftTan + rightTan); + const yScale = 2 / (upTan + downTan); + out[0] = xScale; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = yScale; + out[6] = 0; + out[7] = 0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = (upTan - downTan) * yScale * 0.5; + out[10] = far / (near - far); + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = far * near / (near - far); + out[15] = 0; + return out; + } + /** + * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoNO(out, left, right, bottom, top, near, far) { + const lr = 1 / (left - right); + const bt = 1 / (bottom - top); + const nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; + } + /** + * Alias for {@link Mat4.orthoNO} + * @category Static + * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static ortho(out, left, right, bottom, top, near, far) { + return out; + } + /** + * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoZO(out, left, right, bottom, top, near, far) { + const lr = 1 / (left - right); + const bt = 1 / (bottom - top); + const nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = near * nf; + out[15] = 1; + return out; + } + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that + * actually makes an object look at another object, you should use targetTo instead. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param center - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static lookAt(out, eye, center, up) { + const eyex = eye[0]; + const eyey = eye[1]; + const eyez = eye[2]; + const upx = up[0]; + const upy = up[1]; + const upz = up[2]; + const centerx = center[0]; + const centery = center[1]; + const centerz = center[2]; + if (Math.abs(eyex - centerx) < GLM_EPSILON && Math.abs(eyey - centery) < GLM_EPSILON && Math.abs(eyez - centerz) < GLM_EPSILON) { + return _Mat4.identity(out); + } + let z0 = eyex - centerx; + let z1 = eyey - centery; + let z2 = eyez - centerz; + let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + z0 *= len; + z1 *= len; + z2 *= len; + let x0 = upy * z2 - upz * z1; + let x1 = upz * z0 - upx * z2; + let x2 = upx * z1 - upy * z0; + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + if (!len) { + x0 = 0; + x1 = 0; + x2 = 0; + } else { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + let y0 = z1 * x2 - z2 * x1; + let y1 = z2 * x0 - z0 * x2; + let y2 = z0 * x1 - z1 * x0; + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + if (!len) { + y0 = 0; + y1 = 0; + y2 = 0; + } else { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + out[0] = x0; + out[1] = y0; + out[2] = z0; + out[3] = 0; + out[4] = x1; + out[5] = y1; + out[6] = z1; + out[7] = 0; + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); + out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); + out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + return out; + } + /** + * Generates a matrix that makes something look at something else. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param target - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static targetTo(out, eye, target, up) { + const eyex = eye[0]; + const eyey = eye[1]; + const eyez = eye[2]; + const upx = up[0]; + const upy = up[1]; + const upz = up[2]; + let z0 = eyex - target[0]; + let z1 = eyey - target[1]; + let z2 = eyez - target[2]; + let len = z0 * z0 + z1 * z1 + z2 * z2; + if (len > 0) { + len = 1 / Math.sqrt(len); + z0 *= len; + z1 *= len; + z2 *= len; + } + let x0 = upy * z2 - upz * z1; + let x1 = upz * z0 - upx * z2; + let x2 = upx * z1 - upy * z0; + len = x0 * x0 + x1 * x1 + x2 * x2; + if (len > 0) { + len = 1 / Math.sqrt(len); + x0 *= len; + x1 *= len; + x2 *= len; + } + out[0] = x0; + out[1] = x1; + out[2] = x2; + out[3] = 0; + out[4] = z1 * x2 - z2 * x1; + out[5] = z2 * x0 - z0 * x2; + out[6] = z0 * x1 - z1 * x0; + out[7] = 0; + out[8] = z0; + out[9] = z1; + out[10] = z2; + out[11] = 0; + out[12] = eyex; + out[13] = eyey; + out[14] = eyez; + out[15] = 1; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat4} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt( + a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + a[9] * a[9] + a[10] * a[10] + a[11] * a[11] + a[12] * a[12] + a[13] * a[13] + a[14] * a[14] + a[15] * a[15] + ); + } + /** + * Adds two {@link Mat4}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + out[8] = a[8] + b[8]; + out[9] = a[9] + b[9]; + out[10] = a[10] + b[10]; + out[11] = a[11] + b[11]; + out[12] = a[12] + b[12]; + out[13] = a[13] + b[13]; + out[14] = a[14] + b[14]; + out[15] = a[15] + b[15]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + out[6] = a[6] - b[6]; + out[7] = a[7] - b[7]; + out[8] = a[8] - b[8]; + out[9] = a[9] - b[9]; + out[10] = a[10] - b[10]; + out[11] = a[11] - b[11]; + out[12] = a[12] - b[12]; + out[13] = a[13] - b[13]; + out[14] = a[14] - b[14]; + out[15] = a[15] - b[15]; + return out; + } + /** + * Alias for {@link Mat4.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiply each element of the matrix by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + out[8] = a[8] * b; + out[9] = a[9] * b; + out[10] = a[10] * b; + out[11] = a[11] * b; + out[12] = a[12] * b; + out[13] = a[13] * b; + out[14] = a[14] * b; + out[15] = a[15] * b; + return out; + } + /** + * Adds two mat4's after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + out[6] = a[6] + b[6] * scale; + out[7] = a[7] + b[7] * scale; + out[8] = a[8] + b[8] * scale; + out[9] = a[9] + b[9] * scale; + out[10] = a[10] + b[10] * scale; + out[11] = a[11] + b[11] * scale; + out[12] = a[12] + b[12] * scale; + out[13] = a[13] + b[13] * scale; + out[14] = a[14] + b[14] * scale; + out[15] = a[15] + b[15] * scale; + return out; + } + /** + * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15]; + } + /** + * Returns whether two {@link Mat4}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const a8 = a[8]; + const a9 = a[9]; + const a10 = a[10]; + const a11 = a[11]; + const a12 = a[12]; + const a13 = a[13]; + const a14 = a[14]; + const a15 = a[15]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + const b8 = b[8]; + const b9 = b[9]; + const b10 = b[10]; + const b11 = b[11]; + const b12 = b[12]; + const b13 = b[13]; + const b14 = b[14]; + const b15 = b[15]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15)); + } + /** + * Returns a string representation of a {@link Mat4} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat4(${a.join(", ")})`; + } +}; +_IDENTITY_4X4 = new WeakMap(); +_TMP_VEC3 = new WeakMap(); +__privateAdd(_Mat4, _IDENTITY_4X4, new Float64Array([ + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 +])); +/** + * Temporary variable to prevent repeated allocations in the algorithms within Mat4. + * These are declared as TypedArrays to aid in tree-shaking. + */ +__privateAdd(_Mat4, _TMP_VEC3, new Float64Array(3)); +var Mat4 = _Mat4; +Mat4.prototype.mul = Mat4.prototype.multiply; +Mat4.sub = Mat4.subtract; +Mat4.mul = Mat4.multiply; +Mat4.frustum = Mat4.frustumNO; +Mat4.perspective = Mat4.perspectiveNO; +Mat4.ortho = Mat4.orthoNO; + +// src/_lib/f64/Vec3.ts +var Vec3 = class _Vec3 extends Float64Array { + /** + * Create a {@link Vec3}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 3: + super(values); + break; + case 2: + super(values[0], values[1], 3); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v]); + } else { + super(v, 0, 3); + } + break; + } + default: + super(3); + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z() { + return this[2]; + } + set z(value) { + this[2] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r() { + return this[0]; + } + set r(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g() { + return this[1]; + } + set g(value) { + this[1] = value; + } + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b() { + return this[2]; + } + set b(value) { + this[2] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec3.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec3.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag() { + return this.squaredMagnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec3.str(this);` + * + * @category Accessors + */ + get str() { + return _Vec3.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Adds a {@link Vec3} to `this`. + * Equivalent to `Vec3.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b) { + this[0] += b[0]; + this[1] += b[1]; + this[2] += b[2]; + return this; + } + /** + * Subtracts a {@link Vec3} from `this`. + * Equivalent to `Vec3.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + this[2] -= b[2]; + return this; + } + /** + * Alias for {@link Vec3.subtract} + * @category Methods + */ + sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec3}. + * Equivalent to `Vec3.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + this[2] *= b[2]; + return this; + } + /** + * Alias for {@link Vec3.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec3}. + * Equivalent to `Vec3.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + this[2] /= b[2]; + return this; + } + /** + * Alias for {@link Vec3.divide} + * @category Methods + */ + div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec3.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b) { + this[0] *= b; + this[1] *= b; + this[2] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + this[2] += b[2] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b) { + return _Vec3.distance(this, b); + } + /** + * Alias for {@link Vec3.distance} + * @category Methods + */ + dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b) { + return _Vec3.squaredDistance(this, b); + } + /** + * Alias for {@link Vec3.squaredDistance} + * @category Methods + */ + sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec3.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate() { + this[0] *= -1; + this[1] *= -1; + this[2] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec3.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + this[2] = 1 / this[2]; + return this; + } + /** + * Sets each component of `this` to its absolute value. + * Equivalent to `Vec3.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + this[2] = Math.abs(this[2]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec3}. + * Equivalent to `Vec3.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b) { + return this[0] * b[0] + this[1] * b[1] + this[2] * b[2]; + } + /** + * Normalize `this`. + * Equivalent to `Vec3.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize() { + return _Vec3.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec3}. + */ + static get BYTE_LENGTH() { + return 3 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty vec3 + * @category Static + * + * @returns a new 3D vector + */ + static create() { + return new _Vec3(); + } + /** + * Creates a new vec3 initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 3D vector + */ + static clone(a) { + return new _Vec3(a); + } + /** + * Calculates the magnitude (length) of a {@link Vec3} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Creates a new vec3 initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns a new 3D vector + */ + static fromValues(x, y, z) { + return new _Vec3(x, y, z); + } + /** + * Copy the values from one vec3 to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + return out; + } + /** + * Set the components of a vec3 to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns `out` + */ + static set(out, x, y, z) { + out[0] = x; + out[1] = y; + out[2] = z; + return out; + } + /** + * Adds two {@link Vec3}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + return out; + } + /** + * Alias for {@link Vec3.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return [0, 0, 0]; + } + /** + * Multiplies two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + return out; + } + /** + * Alias for {@link Vec3.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return [0, 0, 0]; + } + /** + * Divides two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + out[2] = a[2] / b[2]; + return out; + } + /** + * Alias for {@link Vec3.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out, a, b) { + return [0, 0, 0]; + } + /** + * Math.ceil the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + out[2] = Math.ceil(a[2]); + return out; + } + /** + * Math.floor the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + out[2] = Math.floor(a[2]); + return out; + } + /** + * Returns the minimum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + return out; + } + /** + * Returns the maximum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + return out; + } + /** + * symmetric round the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + /* + static round(out: Vec3Like, a: Readonly): Vec3Like { + out[0] = glMatrix.round(a[0]); + out[1] = glMatrix.round(a[1]); + out[2] = glMatrix.round(a[2]); + return out; + }*/ + /** + * Scales a vec3 by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out, a, scale) { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + return out; + } + /** + * Adds two vec3's after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredDistance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a, b) { + return 0; + } + /** + * Calculates the squared length of a vec3 + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredLength} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrLen(a, b) { + return 0; + } + /** + * Negates the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + return out; + } + /** + * Returns the inverse of the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + out[2] = 1 / a[2]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec3} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + out[2] = Math.abs(a[2]); + return out; + } + /** + * Normalize a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out, a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + let len = x * x + y * y + z * z; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + out[2] = a[2] * len; + return out; + } + /** + * Calculates the dot product of two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; + } + /** + * Computes the cross product of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static cross(out, a, b) { + const ax = a[0], ay = a[1], az = a[2]; + const bx = b[0], by = b[1], bz = b[2]; + out[0] = ay * bz - az * by; + out[1] = az * bx - ax * bz; + out[2] = ax * by - ay * bx; + return out; + } + /** + * Performs a linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + return out; + } + /** + * Performs a spherical linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out, a, b, t) { + const angle = Math.acos(Math.min(Math.max(_Vec3.dot(a, b), -1), 1)); + const sinTotal = Math.sin(angle); + const ratioA = Math.sin((1 - t) * angle) / sinTotal; + const ratioB = Math.sin(t * angle) / sinTotal; + out[0] = ratioA * a[0] + ratioB * b[0]; + out[1] = ratioA * a[1] + ratioB * b[1]; + out[2] = ratioA * a[2] + ratioB * b[2]; + return out; + } + /** + * Performs a hermite interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static hermite(out, a, b, c, d, t) { + const factorTimes2 = t * t; + const factor1 = factorTimes2 * (2 * t - 3) + 1; + const factor2 = factorTimes2 * (t - 2) + t; + const factor3 = factorTimes2 * (t - 1); + const factor4 = factorTimes2 * (3 - 2 * t); + out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; + out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; + out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; + return out; + } + /** + * Performs a bezier interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static bezier(out, a, b, c, d, t) { + const inverseFactor = 1 - t; + const inverseFactorTimesTwo = inverseFactor * inverseFactor; + const factorTimes2 = t * t; + const factor1 = inverseFactorTimesTwo * inverseFactor; + const factor2 = 3 * t * inverseFactorTimesTwo; + const factor3 = 3 * factorTimes2 * inverseFactor; + const factor4 = factorTimes2 * t; + out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; + out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; + out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; + return out; + } + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned + * @returns `out` + */ + /* + static random(out: Vec3Like, scale) { + scale = scale === undefined ? 1.0 : scale; + + let r = glMatrix.RANDOM() * 2.0 * Math.PI; + let z = glMatrix.RANDOM() * 2.0 - 1.0; + let zScale = Math.sqrt(1.0 - z * z) * scale; + + out[0] = Math.cos(r) * zScale; + out[1] = Math.sin(r) * zScale; + out[2] = z * scale; + return out; + }*/ + /** + * Transforms the vec3 with a mat4. + * 4th vector component is implicitly '1' + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out, a, m) { + const x = a[0], y = a[1], z = a[2]; + const w = m[3] * x + m[7] * y + m[11] * z + m[15] || 1; + out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; + out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; + out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; + return out; + } + /** + * Transforms the vec3 with a mat3. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - the 3x3 matrix to transform with + * @returns `out` + */ + static transformMat3(out, a, m) { + const x = a[0], y = a[1], z = a[2]; + out[0] = x * m[0] + y * m[3] + z * m[6]; + out[1] = x * m[1] + y * m[4] + z * m[7]; + out[2] = x * m[2] + y * m[5] + z * m[8]; + return out; + } + /** + * Transforms the vec3 with a quat + * Can also be used for dual quaternions. (Multiply it with the real part) + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out, a, q) { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const w2 = q[3] * 2; + const x = a[0]; + const y = a[1]; + const z = a[2]; + const uvx = qy * z - qz * y; + const uvy = qz * x - qx * z; + const uvz = qx * y - qy * x; + const uuvx = (qy * uvz - qz * uvy) * 2; + const uuvy = (qz * uvx - qx * uvz) * 2; + const uuvz = (qx * uvy - qy * uvx) * 2; + out[0] = x + uvx * w2 + uuvx; + out[1] = y + uvy * w2 + uuvy; + out[2] = z + uvz * w2 + uuvz; + return out; + } + /** + * Rotate a 3D vector around the x-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateX(out, a, b, rad) { + const by = b[1]; + const bz = b[2]; + const py = a[1] - by; + const pz = a[2] - bz; + out[0] = a[0]; + out[1] = py * Math.cos(rad) - pz * Math.sin(rad) + by; + out[2] = py * Math.sin(rad) + pz * Math.cos(rad) + bz; + return out; + } + /** + * Rotate a 3D vector around the y-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateY(out, a, b, rad) { + const bx = b[0]; + const bz = b[2]; + const px = a[0] - bx; + const pz = a[2] - bz; + out[0] = pz * Math.sin(rad) + px * Math.cos(rad) + bx; + out[1] = a[1]; + out[2] = pz * Math.cos(rad) - px * Math.sin(rad) + bz; + return out; + } + /** + * Rotate a 3D vector around the z-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateZ(out, a, b, rad) { + const bx = b[0]; + const by = b[1]; + const px = a[0] - bx; + const py = a[1] - by; + out[0] = px * Math.cos(rad) - py * Math.sin(rad) + bx; + out[1] = px * Math.sin(rad) + py * Math.cos(rad) + by; + out[2] = b[2]; + return out; + } + /** + * Get the angle between two 3D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static 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 mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz)); + const cosine = mag && _Vec3.dot(a, b) / mag; + return Math.acos(Math.min(Math.max(cosine, -1), 1)); + } + /** + * Set the components of a vec3 to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + return out; + } + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Vec3(${a.join(", ")})`; + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)); + } +}; +Vec3.prototype.sub = Vec3.prototype.subtract; +Vec3.prototype.mul = Vec3.prototype.multiply; +Vec3.prototype.div = Vec3.prototype.divide; +Vec3.prototype.dist = Vec3.prototype.distance; +Vec3.prototype.sqrDist = Vec3.prototype.squaredDistance; +Vec3.sub = Vec3.subtract; +Vec3.mul = Vec3.multiply; +Vec3.div = Vec3.divide; +Vec3.dist = Vec3.distance; +Vec3.sqrDist = Vec3.squaredDistance; +Vec3.sqrLen = Vec3.squaredLength; +Vec3.mag = Vec3.magnitude; +Vec3.length = Vec3.magnitude; +Vec3.len = Vec3.magnitude; + +// src/_lib/f64/Vec4.ts +var Vec4 = class _Vec4 extends Float64Array { + /** + * Create a {@link Vec4}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 4: + super(values); + break; + case 2: + super(values[0], values[1], 4); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v, v]); + } else { + super(v, 0, 4); + } + break; + } + default: + super(4); + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z() { + return this[2]; + } + set z(value) { + this[2] = value; + } + /** + * The w component of the vector. Equivalent to `this[3];` + * @category Vector Components + */ + get w() { + return this[3]; + } + set w(value) { + this[3] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r() { + return this[0]; + } + set r(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g() { + return this[1]; + } + set g(value) { + this[1] = value; + } + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b() { + return this[2]; + } + set b(value) { + this[2] = value; + } + /** + * The a component of the vector. Equivalent to `this[3];` + * @category Color Components + */ + get a() { + return this[3]; + } + set a(value) { + this[3] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec4.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + const w = this[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Vec4.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec4.str(this);` + * + * @category Accessors + */ + get str() { + return _Vec4.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + super.set(a); + return this; + } + /** + * Adds a {@link Vec4} to `this`. + * Equivalent to `Vec4.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b) { + this[0] += b[0]; + this[1] += b[1]; + this[2] += b[2]; + this[3] += b[3]; + return this; + } + /** + * Subtracts a {@link Vec4} from `this`. + * Equivalent to `Vec4.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + this[2] -= b[2]; + this[3] -= b[3]; + return this; + } + /** + * Alias for {@link Vec4.subtract} + * @category Methods + */ + sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec4}. + * Equivalent to `Vec4.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + this[2] *= b[2]; + this[3] *= b[3]; + return this; + } + /** + * Alias for {@link Vec4.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec4}. + * Equivalent to `Vec4.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + this[2] /= b[2]; + this[3] /= b[3]; + return this; + } + /** + * Alias for {@link Vec4.divide} + * @category Methods + */ + div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec4.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b) { + this[0] *= b; + this[1] *= b; + this[2] *= b; + this[3] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + this[2] += b[2] * scale; + this[3] += b[3] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b) { + return _Vec4.distance(this, b); + } + /** + * Alias for {@link Vec4.distance} + * @category Methods + */ + dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b) { + return _Vec4.squaredDistance(this, b); + } + /** + * Alias for {@link Vec4.squaredDistance} + * @category Methods + */ + sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec4.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate() { + this[0] *= -1; + this[1] *= -1; + this[2] *= -1; + this[3] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec4.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + this[2] = 1 / this[2]; + this[3] = 1 / this[3]; + return this; + } + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec4.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + this[2] = Math.abs(this[2]); + this[3] = Math.abs(this[3]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec4}. + * Equivalent to `Vec4.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b) { + return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3]; + } + /** + * Normalize `this`. + * Equivalent to `Vec4.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize() { + return _Vec4.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec4}. + */ + static get BYTE_LENGTH() { + return 4 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty {@link Vec4} + * @category Static + * + * @returns a new 4D vector + */ + static create() { + return new _Vec4(); + } + /** + * Creates a new {@link Vec4} initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 4D vector + */ + static clone(a) { + return new _Vec4(a); + } + /** + * Creates a new {@link Vec4} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new 4D vector + */ + static fromValues(x, y, z, w) { + return new _Vec4(x, y, z, w); + } + /** + * Copy the values from one {@link Vec4} to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Vec4} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + static set(out, x, y, z, w) { + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = w; + return out; + } + /** + * Adds two {@link Vec4}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + return out; + } + /** + * Alias for {@link Vec4.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + out[3] = a[3] * b[3]; + return out; + } + /** + * Alias for {@link Vec4.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Divides two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + out[2] = a[2] / b[2]; + out[3] = a[3] / b[3]; + return out; + } + /** + * Alias for {@link Vec4.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out, a, b) { + return out; + } + /** + * Math.ceil the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + out[2] = Math.ceil(a[2]); + out[3] = Math.ceil(a[3]); + return out; + } + /** + * Math.floor the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + out[2] = Math.floor(a[2]); + out[3] = Math.floor(a[3]); + return out; + } + /** + * Returns the minimum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + out[3] = Math.min(a[3], b[3]); + return out; + } + /** + * Returns the maximum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + out[3] = Math.max(a[3], b[3]); + return out; + } + /** + * Math.round the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + static round(out, a) { + out[0] = Math.round(a[0]); + out[1] = Math.round(a[1]); + out[2] = Math.round(a[2]); + out[3] = Math.round(a[3]); + return out; + } + /** + * Scales a {@link Vec4} by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out, a, scale) { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + out[3] = a[3] * scale; + return out; + } + /** + * Adds two {@link Vec4}'s after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + const w = b[3] - a[3]; + return Math.hypot(x, y, z, w); + } + /** + * Alias for {@link Vec4.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + const w = b[3] - a[3]; + return x * x + y * y + z * z + w * w; + } + /** + * Alias for {@link Vec4.squaredDistance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a, b) { + return 0; + } + /** + * Calculates the magnitude (length) of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate length of + * @returns length of `a` + */ + static magnitude(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Vec4.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + return x * x + y * y + z * z + w * w; + } + /** + * Alias for {@link Vec4.squaredLength} + * @category Static + */ + static sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = -a[3]; + return out; + } + /** + * Returns the inverse of the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + out[2] = 1 / a[2]; + out[3] = 1 / a[3]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec4} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + out[2] = Math.abs(a[2]); + out[3] = Math.abs(a[3]); + return out; + } + /** + * Normalize a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out, a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + let len = x * x + y * y + z * z + w * w; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = x * len; + out[1] = y * len; + out[2] = z * len; + out[3] = w * len; + return out; + } + /** + * Calculates the dot product of two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + /** + * Returns the cross-product of three vectors in a 4-dimensional space + * @category Static + * + * @param out the receiving vector + * @param u - the first vector + * @param v - the second vector + * @param w - the third vector + * @returns result + */ + static cross(out, u, v, w) { + const a = v[0] * w[1] - v[1] * w[0]; + const b = v[0] * w[2] - v[2] * w[0]; + const c = v[0] * w[3] - v[3] * w[0]; + const d = v[1] * w[2] - v[2] * w[1]; + const e = v[1] * w[3] - v[3] * w[1]; + const f = v[2] * w[3] - v[3] * w[2]; + const g = u[0]; + const h = u[1]; + const i = u[2]; + const j = u[3]; + out[0] = h * f - i * e + j * d; + out[1] = -(g * f) + i * c - j * b; + out[2] = g * e - h * c + j * a; + out[3] = -(g * d) + h * b - i * a; + return out; + } + /** + * Performs a linear interpolation between two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + out[3] = aw + t * (b[3] - aw); + return out; + } + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns `out` + */ + /* + static random(out: Vec4Like, scale): Vec4Like { + scale = scale || 1.0; + + // Marsaglia, George. Choosing a Point from the Surface of a + // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646. + // http://projecteuclid.org/euclid.aoms/1177692644; + var v1, v2, v3, v4; + var s1, s2; + do { + v1 = glMatrix.RANDOM() * 2 - 1; + v2 = glMatrix.RANDOM() * 2 - 1; + s1 = v1 * v1 + v2 * v2; + } while (s1 >= 1); + do { + v3 = glMatrix.RANDOM() * 2 - 1; + v4 = glMatrix.RANDOM() * 2 - 1; + s2 = v3 * v3 + v4 * v4; + } while (s2 >= 1); + + var d = Math.sqrt((1 - s1) / s2); + out[0] = scale * v1; + out[1] = scale * v2; + out[2] = scale * v3 * d; + out[3] = scale * v4 * d; + return out; + }*/ + /** + * Transforms the {@link Vec4} with a {@link Mat4}. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out, a, m) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; + out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; + out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; + out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; + return out; + } + /** + * Transforms the {@link Vec4} with a {@link Quat} + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out, a, q) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + const ix = qw * x + qy * z - qz * y; + const iy = qw * y + qz * x - qx * z; + const iz = qw * z + qx * y - qy * x; + const iw = -qx * x - qy * y - qz * z; + out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy; + out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz; + out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Vec4} to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 0; + return out; + } + /** + * Returns a string representation of a {@link Vec4} + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Vec4(${a.join(", ")})`; + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)); + } +}; +Vec4.prototype.sub = Vec4.prototype.subtract; +Vec4.prototype.mul = Vec4.prototype.multiply; +Vec4.prototype.div = Vec4.prototype.divide; +Vec4.prototype.dist = Vec4.prototype.distance; +Vec4.prototype.sqrDist = Vec4.prototype.squaredDistance; +Vec4.sub = Vec4.subtract; +Vec4.mul = Vec4.multiply; +Vec4.div = Vec4.divide; +Vec4.dist = Vec4.distance; +Vec4.sqrDist = Vec4.squaredDistance; +Vec4.sqrLen = Vec4.squaredLength; +Vec4.mag = Vec4.magnitude; +Vec4.length = Vec4.magnitude; +Vec4.len = Vec4.magnitude; + +// src/_lib/f64/Quat.ts +var _DEFAULT_ANGLE_ORDER, _TMP_QUAT1, _TMP_QUAT2, _TMP_MAT3, _TMP_VEC32, _X_UNIT_VEC3, _Y_UNIT_VEC3; +var _Quat = class _Quat extends Float64Array { + /** + * Create a {@link Quat}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 4: + super(values); + break; + case 2: + super(values[0], values[1], 4); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v, v]); + } else { + super(v, 0, 4); + } + break; + } + default: + super(4); + this[3] = 1; + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the quaternion. Equivalent to `this[0];` + * @category Quaternion Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the quaternion. Equivalent to `this[1];` + * @category Quaternion Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + /** + * The z component of the quaternion. Equivalent to `this[2];` + * @category Quaternion Components + */ + get z() { + return this[2]; + } + set z(value) { + this[2] = value; + } + /** + * The w component of the quaternion. Equivalent to `this[3];` + * @category Quaternion Components + */ + get w() { + return this[3]; + } + set w(value) { + this[3] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Quat.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + const w = this[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Quat.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * A string representation of `this` + * Equivalent to `Quat.str(this);` + * + * @category Accessors + */ + get str() { + return _Quat.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Quat} into `this`. + * @category Methods + * + * @param a the source quaternion + * @returns `this` + */ + copy(a) { + super.set(a); + return this; + } + /** + * Set `this` to the identity quaternion + * Equivalent to Quat.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this[0] = 0; + this[1] = 0; + this[2] = 0; + this[3] = 1; + return this; + } + /** + * Multiplies `this` by a {@link Quat}. + * Equivalent to `Quat.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + return _Quat.multiply(this, this, b); + } + /** + * Alias for {@link Quat.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Rotates `this` by the given angle about the X axis + * Equivalent to `Quat.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateX(rad) { + return _Quat.rotateX(this, this, rad); + } + /** + * Rotates `this` by the given angle about the Y axis + * Equivalent to `Quat.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateY(rad) { + return _Quat.rotateY(this, this, rad); + } + /** + * Rotates `this` by the given angle about the Z axis + * Equivalent to `Quat.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateZ(rad) { + return _Quat.rotateZ(this, this, rad); + } + /** + * Inverts `this` + * Equivalent to `Quat.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + return _Quat.invert(this, this); + } + /** + * Scales `this` by a scalar number + * Equivalent to `Quat.scale(this, this, scale);` + * @category Methods + * + * @param scale - amount to scale the vector by + * @returns `this` + */ + scale(scale) { + this[0] *= scale; + this[1] *= scale; + this[2] *= scale; + this[3] *= scale; + return this; + } + /** + * Calculates the dot product of `this` and another {@link Quat} + * Equivalent to `Quat.dot(this, b);` + * @category Methods + * + * @param b - the second operand + * @returns dot product of `this` and b + */ + dot(b) { + return _Quat.dot(this, b); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat}. + */ + static get BYTE_LENGTH() { + return 4 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new identity quat + * @category Static + * + * @returns a new quaternion + */ + static create() { + return new _Quat(); + } + /** + * Set a quat to the identity quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + static identity(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * @category Static + * + * @param out - the receiving quaternion + * @param axis - the axis around which to rotate + * @param rad - the angle in radians + * @returns `out` + **/ + static setAxisAngle(out, axis, rad) { + rad *= 0.5; + const s = Math.sin(rad); + out[0] = s * axis[0]; + out[1] = s * axis[1]; + out[2] = s * axis[2]; + out[3] = Math.cos(rad); + return out; + } + /** + * Gets the rotation axis and angle for a given + * quaternion. If a quaternion is created with + * setAxisAngle, this method will return the same + * values as provided in the original parameter list + * OR functionally equivalent values. + * Example: The quaternion formed by axis [0, 0, 1] and + * angle -90 is the same as the quaternion formed by + * [0, 0, 1] and 270. This method favors the latter. + * @category Static + * + * @param out_axis - Vector receiving the axis of rotation + * @param q - Quaternion to be decomposed + * @return Angle, in radians, of the rotation + */ + static getAxisAngle(out_axis, q) { + const rad = Math.acos(q[3]) * 2; + const s = Math.sin(rad / 2); + if (s > GLM_EPSILON) { + out_axis[0] = q[0] / s; + out_axis[1] = q[1] / s; + out_axis[2] = q[2] / s; + } else { + out_axis[0] = 1; + out_axis[1] = 0; + out_axis[2] = 0; + } + return rad; + } + /** + * Gets the angular distance between two unit quaternions + * @category Static + * + * @param {ReadonlyQuat} a Origin unit quaternion + * @param {ReadonlyQuat} b Destination unit quaternion + * @return {Number} Angle, in radians, between the two quaternions + */ + static getAngle(a, b) { + const dotproduct = _Quat.dot(a, b); + return Math.acos(2 * dotproduct * dotproduct - 1); + } + /** + * Multiplies two quaternions. + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out, a, b) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bx = b[0]; + const by = b[1]; + const bz = b[2]; + const bw = b[3]; + out[0] = ax * bw + aw * bx + ay * bz - az * by; + out[1] = ay * bw + aw * by + az * bx - ax * bz; + out[2] = az * bw + aw * bz + ax * by - ay * bx; + out[3] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + /** + * Rotates a quaternion by the given angle about the X axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out, a, rad) { + rad *= 0.5; + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bx = Math.sin(rad); + const bw = Math.cos(rad); + out[0] = ax * bw + aw * bx; + out[1] = ay * bw + az * bx; + out[2] = az * bw - ay * bx; + out[3] = aw * bw - ax * bx; + return out; + } + /** + * Rotates a quaternion by the given angle about the Y axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out, a, rad) { + rad *= 0.5; + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const by = Math.sin(rad); + const bw = Math.cos(rad); + out[0] = ax * bw - az * by; + out[1] = ay * bw + aw * by; + out[2] = az * bw + ax * by; + out[3] = aw * bw - ay * by; + return out; + } + /** + * Rotates a quaternion by the given angle about the Z axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out, a, rad) { + rad *= 0.5; + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bz = Math.sin(rad); + const bw = Math.cos(rad); + out[0] = ax * bw + ay * bz; + out[1] = ay * bw - ax * bz; + out[2] = az * bw + aw * bz; + out[3] = aw * bw - az * bz; + return out; + } + /** + * Calculates the W component of a quat from the X, Y, and Z components. + * Assumes that quaternion is 1 unit in length. + * Any existing W component will be ignored. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate W component of + * @returns `out` + */ + static calculateW(out, a) { + const x = a[0], y = a[1], z = a[2]; + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = Math.sqrt(Math.abs(1 - x * x - y * y - z * z)); + return out; + } + /** + * Calculate the exponential of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static exp(out, a) { + const x = a[0], y = a[1], z = a[2], w = a[3]; + const r = Math.sqrt(x * x + y * y + z * z); + const et = Math.exp(w); + const s = r > 0 ? et * Math.sin(r) / r : 0; + out[0] = x * s; + out[1] = y * s; + out[2] = z * s; + out[3] = et * Math.cos(r); + return out; + } + /** + * Calculate the natural logarithm of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static ln(out, a) { + const x = a[0], y = a[1], z = a[2], w = a[3]; + const r = Math.sqrt(x * x + y * y + z * z); + const t = r > 0 ? Math.atan2(r, w) / r : 0; + out[0] = x * t; + out[1] = y * t; + out[2] = z * t; + out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w); + return out; + } + /** + * Calculate the scalar power of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @param b - amount to scale the quaternion by + * @returns `out` + */ + static pow(out, a, b) { + _Quat.ln(out, a); + _Quat.scale(out, out, b); + _Quat.exp(out, out); + return out; + } + /** + * Performs a spherical linear interpolation between two quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out, a, b, t) { + const ax = a[0], ay = a[1], az = a[2], aw = a[3]; + let bx = b[0], by = b[1], bz = b[2], bw = b[3]; + let scale0; + let scale1; + let cosom = ax * bx + ay * by + az * bz + aw * bw; + if (cosom < 0) { + cosom = -cosom; + bx = -bx; + by = -by; + bz = -bz; + bw = -bw; + } + if (1 - cosom > GLM_EPSILON) { + const omega = Math.acos(cosom); + const sinom = Math.sin(omega); + scale0 = Math.sin((1 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; + } else { + scale0 = 1 - t; + scale1 = t; + } + out[0] = scale0 * ax + scale1 * bx; + out[1] = scale0 * ay + scale1 * by; + out[2] = scale0 * az + scale1 * bz; + out[3] = scale0 * aw + scale1 * bw; + return out; + } + /** + * Generates a random unit quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + /* static random(out: QuatLike): QuatLike { + // Implementation of http://planning.cs.uiuc.edu/node198.html + // TODO: Calling random 3 times is probably not the fastest solution + let u1 = glMatrix.RANDOM(); + let u2 = glMatrix.RANDOM(); + let u3 = glMatrix.RANDOM(); + + let sqrt1MinusU1 = Math.sqrt(1 - u1); + let sqrtU1 = Math.sqrt(u1); + + out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2); + out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2); + out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3); + out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3); + return out; + }*/ + /** + * Calculates the inverse of a quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate inverse of + * @returns `out` + */ + static invert(out, a) { + const a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; + const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; + const invDot = dot ? 1 / dot : 0; + out[0] = -a0 * invDot; + out[1] = -a1 * invDot; + out[2] = -a2 * invDot; + out[3] = a3 * invDot; + return out; + } + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate conjugate of + * @returns `out` + */ + static conjugate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + return out; + } + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to re-normalize the quaternion yourself where necessary. + * @category Static + * + * @param out - the receiving quaternion + * @param m - rotation matrix + * @returns `out` + */ + static fromMat3(out, m) { + const fTrace = m[0] + m[4] + m[8]; + let fRoot; + if (fTrace > 0) { + fRoot = Math.sqrt(fTrace + 1); + out[3] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[0] = (m[5] - m[7]) * fRoot; + out[1] = (m[6] - m[2]) * fRoot; + out[2] = (m[1] - m[3]) * fRoot; + } else { + let i = 0; + if (m[4] > m[0]) { + i = 1; + } + if (m[8] > m[i * 3 + i]) { + i = 2; + } + const j = (i + 1) % 3; + const k = (i + 2) % 3; + fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1); + out[i] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot; + out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; + out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + } + return out; + } + /** + * Creates a quaternion from the given euler angle x, y, z. + * @category Static + * + * @param out - the receiving quaternion + * @param x - Angle to rotate around X axis in degrees. + * @param y - Angle to rotate around Y axis in degrees. + * @param z - Angle to rotate around Z axis in degrees. + * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx. + * @returns `out` + */ + static fromEuler(out, x, y, z, order = __privateGet(_Quat, _DEFAULT_ANGLE_ORDER)) { + const halfToRad = 0.5 * Math.PI / 180; + x *= halfToRad; + y *= halfToRad; + z *= halfToRad; + const sx = Math.sin(x); + const cx = Math.cos(x); + const sy = Math.sin(y); + const cy = Math.cos(y); + const sz = Math.sin(z); + const cz = Math.cos(z); + switch (order) { + case "xyz": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "xzy": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + case "yxz": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + case "yzx": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "zxy": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "zyx": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + default: + throw new Error(`Unknown angle order ${order}`); + } + return out; + } + /** + * Returns a string representation of a quatenion + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Quat(${a.join(", ")})`; + } + /** + * Creates a new quat initialized with values from an existing quaternion + * @category Static + * + * @param a - quaternion to clone + * @returns a new quaternion + */ + static clone(a) { + return new _Quat(a); + } + /** + * Creates a new quat initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new quaternion + */ + static fromValues(x, y, z, w) { + return new _Quat(x, y, z, w); + } + /** + * Copy the values from one quat to another + * @category Static + * + * @param out - the receiving quaternion + * @param a - the source quaternion + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Quat} to the given values + * @category Static + * + * @param out - the receiving quaternion + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static set(out, x, y, z, w) { + return out; + } + /** + * Adds two {@link Quat}'s + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static add(out, a, b) { + return out; + } + /** + * Alias for {@link Quat.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Scales a quat by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param b - amount to scale the vector by + * @returns `out` + */ + static scale(out, a, scale) { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + out[3] = a[3] * scale; + return out; + } + /** + * Calculates the dot product of two quat's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + /** + * Performs a linear interpolation between two quat's + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static lerp(out, a, b, t) { + return out; + } + /** + * Calculates the magnitude (length) of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate length of + * @returns length of `a` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static magnitude(a) { + return 0; + } + /** + * Alias for {@link Quat.magnitude} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mag(a) { + return 0; + } + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate squared length of + * @returns squared length of a + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static squaredLength(a) { + return 0; + } + /** + * Alias for {@link Quat.squaredLength} + * @category Static + */ + static sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Normalize a {@link Quat} + * @category Static + * + * @param out - the receiving quaternion + * @param a - quaternion to normalize + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static normalize(out, a) { + return out; + } + /** + * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first quaternion. + * @param b - The second quaternion. + * @returns True if the vectors are equal, false otherwise. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static exactEquals(a, b) { + return false; + } + /** + * Returns whether the quaternions have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static equals(a, b) { + return false; + } + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * @category Static + * + * @param out - the receiving quaternion. + * @param a - the initial vector + * @param b - the destination vector + * @returns `out` + */ + static rotationTo(out, a, b) { + const dot = Vec3.dot(a, b); + if (dot < -0.999999) { + Vec3.cross(__privateGet(_Quat, _TMP_VEC32), __privateGet(_Quat, _X_UNIT_VEC3), a); + if (Vec3.mag(__privateGet(_Quat, _TMP_VEC32)) < 1e-6) { + Vec3.cross(__privateGet(_Quat, _TMP_VEC32), __privateGet(_Quat, _Y_UNIT_VEC3), a); + } + Vec3.normalize(__privateGet(_Quat, _TMP_VEC32), __privateGet(_Quat, _TMP_VEC32)); + _Quat.setAxisAngle(out, __privateGet(_Quat, _TMP_VEC32), Math.PI); + return out; + } else if (dot > 0.999999) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } else { + Vec3.cross(__privateGet(_Quat, _TMP_VEC32), a, b); + out[0] = __privateGet(_Quat, _TMP_VEC32)[0]; + out[1] = __privateGet(_Quat, _TMP_VEC32)[1]; + out[2] = __privateGet(_Quat, _TMP_VEC32)[2]; + out[3] = 1 + dot; + return _Quat.normalize(out, out); + } + } + /** + * Performs a spherical linear interpolation with two control points + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static sqlerp(out, a, b, c, d, t) { + _Quat.slerp(__privateGet(_Quat, _TMP_QUAT1), a, d, t); + _Quat.slerp(__privateGet(_Quat, _TMP_QUAT2), b, c, t); + _Quat.slerp(out, __privateGet(_Quat, _TMP_QUAT1), __privateGet(_Quat, _TMP_QUAT2), 2 * t * (1 - t)); + return out; + } + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * @category Static + * + * @param out - The receiving quaternion + * @param view - the vector representing the viewing direction + * @param right - the vector representing the local `right` direction + * @param up - the vector representing the local `up` direction + * @returns `out` + */ + static setAxes(out, view, right, up) { + __privateGet(_Quat, _TMP_MAT3)[0] = right[0]; + __privateGet(_Quat, _TMP_MAT3)[3] = right[1]; + __privateGet(_Quat, _TMP_MAT3)[6] = right[2]; + __privateGet(_Quat, _TMP_MAT3)[1] = up[0]; + __privateGet(_Quat, _TMP_MAT3)[4] = up[1]; + __privateGet(_Quat, _TMP_MAT3)[7] = up[2]; + __privateGet(_Quat, _TMP_MAT3)[2] = -view[0]; + __privateGet(_Quat, _TMP_MAT3)[5] = -view[1]; + __privateGet(_Quat, _TMP_MAT3)[8] = -view[2]; + return _Quat.normalize(out, _Quat.fromMat3(out, __privateGet(_Quat, _TMP_MAT3))); + } +}; +_DEFAULT_ANGLE_ORDER = new WeakMap(); +_TMP_QUAT1 = new WeakMap(); +_TMP_QUAT2 = new WeakMap(); +_TMP_MAT3 = new WeakMap(); +_TMP_VEC32 = new WeakMap(); +_X_UNIT_VEC3 = new WeakMap(); +_Y_UNIT_VEC3 = new WeakMap(); +__privateAdd(_Quat, _DEFAULT_ANGLE_ORDER, "zyx"); +// Temporary variables to prevent repeated allocations in the algorithms within Quat. +// These are declared as TypedArrays to aid in tree-shaking. +__privateAdd(_Quat, _TMP_QUAT1, new Float64Array(4)); +__privateAdd(_Quat, _TMP_QUAT2, new Float64Array(4)); +__privateAdd(_Quat, _TMP_MAT3, new Float64Array(9)); +__privateAdd(_Quat, _TMP_VEC32, new Float64Array(3)); +__privateAdd(_Quat, _X_UNIT_VEC3, new Float64Array([1, 0, 0])); +__privateAdd(_Quat, _Y_UNIT_VEC3, new Float64Array([0, 1, 0])); +var Quat = _Quat; +Quat.set = Vec4.set; +Quat.add = Vec4.add; +Quat.lerp = Vec4.lerp; +Quat.normalize = Vec4.normalize; +Quat.squaredLength = Vec4.squaredLength; +Quat.sqrLen = Vec4.squaredLength; +Quat.exactEquals = Vec4.exactEquals; +Quat.equals = Vec4.equals; +Quat.magnitude = Vec4.magnitude; +Quat.prototype.mul = Quat.prototype.multiply; +Quat.mul = Quat.multiply; +Quat.mag = Quat.magnitude; +Quat.length = Quat.magnitude; +Quat.len = Quat.magnitude; + +// src/_lib/f64/Quat2.ts +var _TMP_QUAT, _TMP_VEC33; +var _Quat2 = class _Quat2 extends Float64Array { + /** + * Create a {@link Quat2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 8: + super(values); + break; + case 2: + super(values[0], values[1], 8); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v, v, v, v, v, v]); + } else { + super(v, 0, 8); + } + break; + } + default: + super(8); + this[3] = 1; + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Quat2.str(this);` + * + * @category Accessors + */ + get str() { + return _Quat2.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Quat2} into `this`. + * @category Methods + * + * @param a the source dual quaternion + * @returns `this` + */ + copy(a) { + super.set(a); + return this; + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat2}. + */ + static get BYTE_LENGTH() { + return 8 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new identity {@link Quat2} + * @category Static + * + * @returns a new dual quaternion [real -> rotation, dual -> translation] + */ + static create() { + return new _Quat2(); + } + /** + * Creates a {@link Quat2} quat initialized with values from an existing quaternion + * @category Static + * + * @param a - dual quaternion to clone + * @returns a new dual quaternion + */ + static clone(a) { + return new _Quat2(a); + } + /** + * Creates a new {@link Quat2} initialized with the given values + * @category Static + * + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns a new dual quaternion + */ + static fromValues(x1, y1, z1, w1, x2, y2, z2, w2) { + return new _Quat2(x1, y1, z1, w1, x2, y2, z2, w2); + } + /** + * Creates a new {@link Quat2} from the given values (quat and translation) + * @category Static + * + * @param x1 - X component (rotation) + * @param y1 - Y component (rotation) + * @param z1 - Z component (rotation) + * @param w1 - W component (rotation) + * @param x2 - X component (translation) + * @param y2 - Y component (translation) + * @param z2 - Z component (translation) + * @returns a new dual quaternion + */ + static fromRotationTranslationValues(x1, y1, z1, w1, x2, y2, z2) { + const ax = x2 * 0.5; + const ay = y2 * 0.5; + const az = z2 * 0.5; + return new _Quat2( + x1, + y1, + z1, + w1, + ax * w1 + ay * z1 - az * y1, + ay * w1 + az * x1 - ax * z1, + az * w1 + ax * y1 - ay * x1, + -ax * x1 - ay * y1 - az * z1 + ); + } + /** + * Sets a {@link Quat2} from a quaternion and a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @param t - translation vector + * @returns `out` + */ + static fromRotationTranslation(out, q, t) { + const ax = t[0] * 0.5; + const ay = t[1] * 0.5; + const az = t[2] * 0.5; + const bx = q[0]; + const by = q[1]; + const bz = q[2]; + const bw = q[3]; + out[0] = bx; + out[1] = by; + out[2] = bz; + out[3] = bw; + out[4] = ax * bw + ay * bz - az * by; + out[5] = ay * bw + az * bx - ax * bz; + out[6] = az * bw + ax * by - ay * bx; + out[7] = -ax * bx - ay * by - az * bz; + return out; + } + /** + * Sets a {@link Quat2} from a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param t - translation vector + * @returns `out` + */ + static fromTranslation(out, t) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = t[0] * 0.5; + out[5] = t[1] * 0.5; + out[6] = t[2] * 0.5; + out[7] = 0; + return out; + } + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @returns `out` + */ + static fromRotation(out, q) { + out[0] = q[0]; + out[1] = q[1]; + out[2] = q[2]; + out[3] = q[3]; + out[4] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + return out; + } + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param a - the matrix + * @returns `out` + */ + static fromMat4(out, a) { + Mat4.getRotation(__privateGet(_Quat2, _TMP_QUAT), a); + Mat4.getTranslation(__privateGet(_Quat2, _TMP_VEC33), a); + return _Quat2.fromRotationTranslation(out, __privateGet(_Quat2, _TMP_QUAT), __privateGet(_Quat2, _TMP_VEC33)); + } + /** + * Copy the values from one {@link Quat2} to another + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the source dual quaternion + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + return out; + } + /** + * Set a {@link Quat2} to the identity dual quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @returns `out` + */ + static identity(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + return out; + } + /** + * Set the components of a {@link Quat2} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns `out` + */ + static set(out, x1, y1, z1, w1, x2, y2, z2, w2) { + out[0] = x1; + out[1] = y1; + out[2] = z1; + out[3] = w1; + out[4] = x2; + out[5] = y2; + out[6] = z2; + out[7] = w2; + return out; + } + /** + * Gets the real part of a dual quat + * @category Static + * + * @param out - real part + * @param a - Dual Quaternion + * @return `out` + */ + static getReal(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Gets the dual part of a dual quat + * @category Static + * + * @param out - dual part + * @param a - Dual Quaternion + * @return `out` + */ + static getDual(out, a) { + out[0] = a[4]; + out[1] = a[5]; + out[2] = a[6]; + out[3] = a[7]; + return out; + } + /** + * Set the real component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the real part + * @return `out` + */ + static setReal(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the dual component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the dual part + * @return `out` + */ + static setDual(out, a) { + out[4] = a[0]; + out[5] = a[1]; + out[6] = a[2]; + out[7] = a[3]; + return out; + } + /** + * Gets the translation of a normalized {@link Quat2} + * @category Static + * + * @param out - the receiving translation vector + * @param a - Dual Quaternion to be decomposed + * @return `out` + */ + static getTranslation(out, a) { + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const bx = -a[0]; + const by = -a[1]; + const bz = -a[2]; + const bw = a[3]; + out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; + out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; + out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + return out; + } + /** + * Translates a {@link Quat2} by the given vector + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const ax1 = a[0]; + const ay1 = a[1]; + const az1 = a[2]; + const aw1 = a[3]; + const bx1 = v[0] * 0.5; + const by1 = v[1] * 0.5; + const bz1 = v[2] * 0.5; + const ax2 = a[4]; + const ay2 = a[5]; + const az2 = a[6]; + const aw2 = a[7]; + out[0] = ax1; + out[1] = ay1; + out[2] = az1; + out[3] = aw1; + out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2; + out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2; + out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2; + out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2; + return out; + } + /** + * Rotates a {@link Quat2} around the X axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out, a, rad) { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateX(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} around the Y axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out, a, rad) { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateY(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} around the Z axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out, a, rad) { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateZ(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} by a given quaternion (a * q) + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param q - quaternion to rotate by + * @returns `out` + */ + static rotateByQuatAppend(out, a, q) { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + let ax = a[0]; + let ay = a[1]; + let az = a[2]; + let aw = a[3]; + out[0] = ax * qw + aw * qx + ay * qz - az * qy; + out[1] = ay * qw + aw * qy + az * qx - ax * qz; + out[2] = az * qw + aw * qz + ax * qy - ay * qx; + out[3] = aw * qw - ax * qx - ay * qy - az * qz; + ax = a[4]; + ay = a[5]; + az = a[6]; + aw = a[7]; + out[4] = ax * qw + aw * qx + ay * qz - az * qy; + out[5] = ay * qw + aw * qy + az * qx - ax * qz; + out[6] = az * qw + aw * qz + ax * qy - ay * qx; + out[7] = aw * qw - ax * qx - ay * qy - az * qz; + return out; + } + /** + * Rotates a {@link Quat2} by a given quaternion (q * a) + * @category Static + * + * @param out - the receiving dual quaternion + * @param q - quaternion to rotate by + * @param a - the dual quaternion to rotate + * @returns `out` + */ + static rotateByQuatPrepend(out, q, a) { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + let bx = a[0]; + let by = a[1]; + let bz = a[2]; + let bw = a[3]; + out[0] = qx * bw + qw * bx + qy * bz - qz * by; + out[1] = qy * bw + qw * by + qz * bx - qx * bz; + out[2] = qz * bw + qw * bz + qx * by - qy * bx; + out[3] = qw * bw - qx * bx - qy * by - qz * bz; + bx = a[4]; + by = a[5]; + bz = a[6]; + bw = a[7]; + out[4] = qx * bw + qw * bx + qy * bz - qz * by; + out[5] = qy * bw + qw * by + qz * bx - qx * bz; + out[6] = qz * bw + qw * bz + qx * by - qy * bx; + out[7] = qw * bw - qx * bx - qy * by - qz * bz; + return out; + } + /** + * Rotates a {@link Quat2} around a given axis. Does the normalization automatically + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param axis - the axis to rotate around + * @param rad - how far the rotation should be + * @returns `out` + */ + static rotateAroundAxis(out, a, axis, rad) { + if (Math.abs(rad) < GLM_EPSILON) { + return _Quat2.copy(out, a); + } + const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]); + rad *= 0.5; + const s = Math.sin(rad); + const bx = s * axis[0] / axisLength; + const by = s * axis[1] / axisLength; + const bz = s * axis[2] / axisLength; + const bw = Math.cos(rad); + const ax1 = a[0]; + const ay1 = a[1]; + const az1 = a[2]; + const aw1 = a[3]; + out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + out[4] = ax * bw + aw * bx + ay * bz - az * by; + out[5] = ay * bw + aw * by + az * bx - ax * bz; + out[6] = az * bw + aw * bz + ax * by - ay * bx; + out[7] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + /** + * Adds two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + return out; + } + /** + * Multiplies two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns {quat2} out + */ + static multiply(out, a, b) { + const ax0 = a[0]; + const ay0 = a[1]; + const az0 = a[2]; + const aw0 = a[3]; + const bx1 = b[4]; + const by1 = b[5]; + const bz1 = b[6]; + const bw1 = b[7]; + const ax1 = a[4]; + const ay1 = a[5]; + const az1 = a[6]; + const aw1 = a[7]; + const bx0 = b[0]; + const by0 = b[1]; + const bz0 = b[2]; + const bw0 = b[3]; + out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0; + out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0; + out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0; + out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0; + out[4] = ax0 * bw1 + aw0 * bx1 + ay0 * bz1 - az0 * by1 + ax1 * bw0 + aw1 * bx0 + ay1 * bz0 - az1 * by0; + out[5] = ay0 * bw1 + aw0 * by1 + az0 * bx1 - ax0 * bz1 + ay1 * bw0 + aw1 * by0 + az1 * bx0 - ax1 * bz0; + out[6] = az0 * bw1 + aw0 * bz1 + ax0 * by1 - ay0 * bx1 + az1 * bw0 + aw1 * bz0 + ax1 * by0 - ay1 * bx0; + out[7] = aw0 * bw1 - ax0 * bx1 - ay0 * by1 - az0 * bz1 + aw1 * bw0 - ax1 * bx0 - ay1 * by0 - az1 * bz0; + return out; + } + /** + * Alias for {@link Quat2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Scales a {@link Quat2} by a scalar value + * @category Static + * + * @param out - the receiving dual quaterion + * @param a - the dual quaternion to scale + * @param b - scalar value to scale the dual quaterion by + * @returns `out` + */ + static scale(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + return out; + } + /** + * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts) + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dot(a, b) { + return 0; + } + /** + * Performs a linear interpolation between two {@link Quat2}s + * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`) + * @category Static + * + * @param out - the receiving dual quat + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const mt = 1 - t; + if (_Quat2.dot(a, b) < 0) { + t = -t; + } + out[0] = a[0] * mt + b[0] * t; + out[1] = a[1] * mt + b[1] * t; + out[2] = a[2] * mt + b[2] * t; + out[3] = a[3] * mt + b[3] * t; + out[4] = a[4] * mt + b[4] * t; + out[5] = a[5] * mt + b[5] * t; + out[6] = a[6] * mt + b[6] * t; + out[7] = a[7] * mt + b[7] * t; + return out; + } + /** + * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quat to calculate inverse of + * @returns `out` + */ + static invert(out, a) { + const sqlen = _Quat2.squaredLength(a); + out[0] = -a[0] / sqlen; + out[1] = -a[1] / sqlen; + out[2] = -a[2] / sqlen; + out[3] = a[3] / sqlen; + out[4] = -a[4] / sqlen; + out[5] = -a[5] / sqlen; + out[6] = -a[6] / sqlen; + out[7] = a[7] / sqlen; + return out; + } + /** + * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than + * {@link Quat2.invert} and produces the same result. + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to calculate conjugate of + * @returns `out` + */ + static conjugate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + out[4] = -a[4]; + out[5] = -a[5]; + out[6] = -a[6]; + out[7] = a[7]; + return out; + } + /** + * Calculates the magnitude (length) of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate length of + * @returns length of `a` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static magnitude(a) { + return 0; + } + /** + * Alias for {@link Quat2.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate squared length of + * @returns squared length of a + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static squaredLength(a) { + return 0; + } + /** + * Alias for {@link Quat2.squaredLength} + * @category Static + */ + static sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Normalize a {@link Quat2} + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to normalize + * @returns `out` + */ + static normalize(out, a) { + let magnitude = _Quat2.squaredLength(a); + if (magnitude > 0) { + magnitude = Math.sqrt(magnitude); + const a0 = a[0] / magnitude; + const a1 = a[1] / magnitude; + const a2 = a[2] / magnitude; + const a3 = a[3] / magnitude; + const b0 = a[4]; + const b1 = a[5]; + const b2 = a[6]; + const b3 = a[7]; + const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3; + out[0] = a0; + out[1] = a1; + out[2] = a2; + out[3] = a3; + out[4] = (b0 - a0 * a_dot_b) / magnitude; + out[5] = (b1 - a1 * a_dot_b) / magnitude; + out[6] = (b2 - a2 * a_dot_b) / magnitude; + out[7] = (b3 - a3 * a_dot_b) / magnitude; + } + return out; + } + /** + * Returns a string representation of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Quat2(${a.join(", ")})`; + } + /** + * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7]; + } + /** + * Returns whether the {@link Quat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)); + } +}; +_TMP_QUAT = new WeakMap(); +_TMP_VEC33 = new WeakMap(); +// Temporary variables to prevent repeated allocations in the algorithms within Quat2. +// These are declared as TypedArrays to aid in tree-shaking. +__privateAdd(_Quat2, _TMP_QUAT, new Float64Array(4)); +__privateAdd(_Quat2, _TMP_VEC33, new Float64Array(3)); +var Quat2 = _Quat2; +Quat2.dot = Quat.dot; +Quat2.squaredLength = Quat.squaredLength; +Quat2.sqrLen = Quat.squaredLength; +Quat2.mag = Quat.magnitude; +Quat2.length = Quat.magnitude; +Quat2.len = Quat.magnitude; +Quat2.mul = Quat2.multiply; + +// src/_lib/f64/Vec2.ts +var Vec2 = class _Vec2 extends Float64Array { + /** + * Create a {@link Vec2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 2: { + const v = values[0]; + if (typeof v === "number") { + super([v, values[1]]); + } else { + super(v, values[1], 2); + } + break; + } + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v]); + } else { + super(v, 0, 2); + } + break; + } + default: + super(2); + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r() { + return this[0]; + } + set r(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g() { + return this[1]; + } + set g(value) { + this[1] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec2.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + return Math.hypot(this[0], this[1]); + } + /** + * Alias for {@link Vec2.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec2.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude() { + const x = this[0]; + const y = this[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag() { + return this.squaredMagnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec2.str(this);` + * + * @category Accessors + */ + get str() { + return _Vec2.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec2} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + // Instead of zero(), use a.fill(0) for instances; + /** + * Adds a {@link Vec2} to `this`. + * Equivalent to `Vec2.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b) { + this[0] += b[0]; + this[1] += b[1]; + return this; + } + /** + * Subtracts a {@link Vec2} from `this`. + * Equivalent to `Vec2.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + return this; + } + /** + * Alias for {@link Vec2.subtract} + * @category Methods + */ + sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec2}. + * Equivalent to `Vec2.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + return this; + } + /** + * Alias for {@link Vec2.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec2}. + * Equivalent to `Vec2.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + return this; + } + /** + * Alias for {@link Vec2.divide} + * @category Methods + */ + div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec2.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b) { + this[0] *= b; + this[1] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b) { + return _Vec2.distance(this, b); + } + /** + * Alias for {@link Vec2.distance} + * @category Methods + */ + dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b) { + return _Vec2.squaredDistance(this, b); + } + /** + * Alias for {@link Vec2.squaredDistance} + * @category Methods + */ + sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec2.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate() { + this[0] *= -1; + this[1] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec2.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + return this; + } + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec2.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec2}. + * Equivalent to `Vec2.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b) { + return this[0] * b[0] + this[1] * b[1]; + } + /** + * Normalize `this`. + * Equivalent to `Vec2.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize() { + return _Vec2.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec2}. + */ + static get BYTE_LENGTH() { + return 2 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty {@link Vec2} + * @category Static + * + * @returns A new 2D vector + */ + static create() { + return new _Vec2(); + } + /** + * Creates a new {@link Vec2} initialized with values from an existing vector + * @category Static + * + * @param a - Vector to clone + * @returns A new 2D vector + */ + static clone(a) { + return new _Vec2(a); + } + /** + * Creates a new {@link Vec2} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @returns A new 2D vector + */ + static fromValues(x, y) { + return new _Vec2(x, y); + } + /** + * Copy the values from one {@link Vec2} to another + * @category Static + * + * @param out - the receiving vector + * @param a - The source vector + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + return out; + } + /** + * Set the components of a {@link Vec2} to the given values + * @category Static + * + * @param out - The receiving vector + * @param x - X component + * @param y - Y component + * @returns `out` + */ + static set(out, x, y) { + out[0] = x; + out[1] = y; + return out; + } + /** + * Adds two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + return out; + } + /** + * Alias for {@link Vec2.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return [0, 0]; + } + /** + * Multiplies two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + return out; + } + /** + * Alias for {@link Vec2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return [0, 0]; + } + /** + * Divides two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + return out; + } + /** + * Alias for {@link Vec2.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out, a, b) { + return [0, 0]; + } + /** + * Math.ceil the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to ceil + * @returns `out` + */ + static ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + return out; + } + /** + * Math.floor the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to floor + * @returns `out` + */ + static floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + return out; + } + /** + * Returns the minimum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + return out; + } + /** + * Returns the maximum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + return out; + } + /** + * Math.round the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to round + * @returns `out` + */ + static round(out, a) { + out[0] = Math.round(a[0]); + out[1] = Math.round(a[1]); + return out; + } + /** + * Scales a {@link Vec2} by a scalar number + * @category Static + * + * @param out - The receiving vector + * @param a - The vector to scale + * @param b - Amount to scale the vector by + * @returns `out` + */ + static scale(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + return out; + } + /** + * Adds two Vec2's after scaling the second operand by a scalar value + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param scale - The amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns distance between `a` and `b` + */ + static distance(a, b) { + return Math.hypot(b[0] - a[0], b[1] - a[1]); + } + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Squared distance between `a` and `b` + */ + static squaredDistance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a, b) { + return 0; + } + /** + * Calculates the magnitude (length) of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a) { + const x = a[0]; + const y = a[1]; + return Math.sqrt(x * x + y * y); + } + /** + * Alias for {@link Vec2.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate squared length of + * @returns Squared length of a + */ + static squaredLength(a) { + const x = a[0]; + const y = a[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.squaredLength} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrLen(a, b) { + return 0; + } + /** + * Negates the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to negate + * @returns `out` + */ + static negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + return out; + } + /** + * Returns the inverse of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to invert + * @returns `out` + */ + static inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + return out; + } + /** + * Normalize a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to normalize + * @returns `out` + */ + static normalize(out, a) { + const x = a[0]; + const y = a[1]; + let len = x * x + y * y; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + return out; + } + /** + * Calculates the dot product of two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Dot product of `a` and `b` + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1]; + } + /** + * Computes the cross product of two {@link Vec2}s + * Note that the cross product must by definition produce a 3D vector. + * For this reason there is also not instance equivalent for this function. + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static cross(out, a, b) { + const z = a[0] * b[1] - a[1] * b[0]; + out[0] = out[1] = 0; + out[2] = z; + return out; + } + /** + * Performs a linear interpolation between two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param t - Interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const ax = a[0]; + const ay = a[1]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat2} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[2] * y; + out[1] = m[1] * x + m[3] * y; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat2d} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2d(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[2] * y + m[4]; + out[1] = m[1] * x + m[3] * y + m[5]; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat3} + * 3rd vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat3(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[3] * y + m[6]; + out[1] = m[1] * x + m[4] * y + m[7]; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat4} + * 3rd vector component is implicitly '0' + * 4th vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat4(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[4] * y + m[12]; + out[1] = m[1] * x + m[5] * y + m[13]; + return out; + } + /** + * Rotate a 2D vector + * @category Static + * + * @param out - The receiving {@link Vec2} + * @param a - The {@link Vec2} point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotate(out, a, b, rad) { + const p0 = a[0] - b[0]; + const p1 = a[1] - b[1]; + const sinC = Math.sin(rad); + const cosC = Math.cos(rad); + out[0] = p0 * cosC - p1 * sinC + b[0]; + out[1] = p0 * sinC + p1 * cosC + b[1]; + return out; + } + /** + * Get the angle between two 2D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static angle(a, b) { + const x1 = a[0]; + const y1 = a[1]; + const x2 = b[0]; + const y2 = b[1]; + const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2); + const cosine = mag && (x1 * x2 + y1 * y2) / mag; + return Math.acos(Math.min(Math.max(cosine, -1), 1)); + } + /** + * Set the components of a {@link Vec2} to zero + * @category Static + * + * @param out - The receiving vector + * @returns `out` + */ + static zero(out) { + out[0] = 0; + out[1] = 0; + return out; + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors components are ===, `false` otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors are approximately equal, `false` otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const b0 = b[0]; + const b1 = b[1]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)); + } + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - Vector to represent as a string + * @returns String representation of the vector + */ + static str(a) { + return `Vec2(${a.join(", ")})`; + } +}; +Vec2.prototype.sub = Vec2.prototype.subtract; +Vec2.prototype.mul = Vec2.prototype.multiply; +Vec2.prototype.div = Vec2.prototype.divide; +Vec2.prototype.dist = Vec2.prototype.distance; +Vec2.prototype.sqrDist = Vec2.prototype.squaredDistance; +Vec2.sub = Vec2.subtract; +Vec2.mul = Vec2.multiply; +Vec2.div = Vec2.divide; +Vec2.dist = Vec2.distance; +Vec2.sqrDist = Vec2.squaredDistance; +Vec2.sqrLen = Vec2.squaredLength; +Vec2.mag = Vec2.magnitude; +Vec2.length = Vec2.magnitude; +Vec2.len = Vec2.magnitude; + +// src/swizzle/f64/index.ts +var GLM_SWIZZLES_ENABLED_F64 = false; +function EnableSwizzlesF64() { + if (GLM_SWIZZLES_ENABLED_F64) { + return; + } + const VEC2_SWIZZLES = ["xx", "xy", "yx", "yy", "xxx", "xxy", "xyx", "xyy", "yxx", "yxy", "yyx", "yyy", "xxxx", "xxxy", "xxyx", "xxyy", "xyxx", "xyxy", "xyyx", "xyyy", "yxxx", "yxxy", "yxyx", "yxyy", "yyxx", "yyxy", "yyyx", "yyyy", "rr", "rg", "gr", "gg", "rrr", "rrg", "rgr", "rgg", "grr", "grg", "ggr", "ggg", "rrrr", "rrrg", "rrgr", "rrgg", "rgrr", "rgrg", "rggr", "rggg", "grrr", "grrg", "grgr", "grgg", "ggrr", "ggrg", "gggr", "gggg"]; + const VEC3_SWIZZLES = ["xz", "yz", "zx", "zy", "zz", "xxz", "xyz", "xzx", "xzy", "xzz", "yxz", "yyz", "yzx", "yzy", "yzz", "zxx", "zxy", "zxz", "zyx", "zyy", "zyz", "zzx", "zzy", "zzz", "xxxz", "xxyz", "xxzx", "xxzy", "xxzz", "xyxz", "xyyz", "xyzx", "xyzy", "xyzz", "xzxx", "xzxy", "xzxz", "xzyx", "xzyy", "xzyz", "xzzx", "xzzy", "xzzz", "yxxz", "yxyz", "yxzx", "yxzy", "yxzz", "yyxz", "yyyz", "yyzx", "yyzy", "yyzz", "yzxx", "yzxy", "yzxz", "yzyx", "yzyy", "yzyz", "yzzx", "yzzy", "yzzz", "zxxx", "zxxy", "zxxz", "zxyx", "zxyy", "zxyz", "zxzx", "zxzy", "zxzz", "zyxx", "zyxy", "zyxz", "zyyx", "zyyy", "zyyz", "zyzx", "zyzy", "zyzz", "zzxx", "zzxy", "zzxz", "zzyx", "zzyy", "zzyz", "zzzx", "zzzy", "zzzz", "rb", "gb", "br", "bg", "bb", "rrb", "rgb", "rbr", "rbg", "rbb", "grb", "ggb", "gbr", "gbg", "gbb", "brr", "brg", "brb", "bgr", "bgg", "bgb", "bbr", "bbg", "bbb", "rrrb", "rrgb", "rrbr", "rrbg", "rrbb", "rgrb", "rggb", "rgbr", "rgbg", "rgbb", "rbrr", "rbrg", "rbrb", "rbgr", "rbgg", "rbgb", "rbbr", "rbbg", "rbbb", "grrb", "grgb", "grbr", "grbg", "grbb", "ggrb", "gggb", "ggbr", "ggbg", "ggbb", "gbrr", "gbrg", "gbrb", "gbgr", "gbgg", "gbgb", "gbbr", "gbbg", "gbbb", "brrr", "brrg", "brrb", "brgr", "brgg", "brgb", "brbr", "brbg", "brbb", "bgrr", "bgrg", "bgrb", "bggr", "bggg", "bggb", "bgbr", "bgbg", "bgbb", "bbrr", "bbrg", "bbrb", "bbgr", "bbgg", "bbgb", "bbbr", "bbbg", "bbbb"]; + const VEC4_SWIZZLES = ["xw", "yw", "zw", "wx", "wy", "wz", "ww", "xxw", "xyw", "xzw", "xwx", "xwy", "xwz", "xww", "yxw", "yyw", "yzw", "ywx", "ywy", "ywz", "yww", "zxw", "zyw", "zzw", "zwx", "zwy", "zwz", "zww", "wxx", "wxy", "wxz", "wxw", "wyx", "wyy", "wyz", "wyw", "wzx", "wzy", "wzz", "wzw", "wwx", "wwy", "wwz", "www", "xxxw", "xxyw", "xxzw", "xxwx", "xxwy", "xxwz", "xxww", "xyxw", "xyyw", "xyzw", "xywx", "xywy", "xywz", "xyww", "xzxw", "xzyw", "xzzw", "xzwx", "xzwy", "xzwz", "xzww", "xwxx", "xwxy", "xwxz", "xwxw", "xwyx", "xwyy", "xwyz", "xwyw", "xwzx", "xwzy", "xwzz", "xwzw", "xwwx", "xwwy", "xwwz", "xwww", "yxxw", "yxyw", "yxzw", "yxwx", "yxwy", "yxwz", "yxww", "yyxw", "yyyw", "yyzw", "yywx", "yywy", "yywz", "yyww", "yzxw", "yzyw", "yzzw", "yzwx", "yzwy", "yzwz", "yzww", "ywxx", "ywxy", "ywxz", "ywxw", "ywyx", "ywyy", "ywyz", "ywyw", "ywzx", "ywzy", "ywzz", "ywzw", "ywwx", "ywwy", "ywwz", "ywww", "zxxw", "zxyw", "zxzw", "zxwx", "zxwy", "zxwz", "zxww", "zyxw", "zyyw", "zyzw", "zywx", "zywy", "zywz", "zyww", "zzxw", "zzyw", "zzzw", "zzwx", "zzwy", "zzwz", "zzww", "zwxx", "zwxy", "zwxz", "zwxw", "zwyx", "zwyy", "zwyz", "zwyw", "zwzx", "zwzy", "zwzz", "zwzw", "zwwx", "zwwy", "zwwz", "zwww", "wxxx", "wxxy", "wxxz", "wxxw", "wxyx", "wxyy", "wxyz", "wxyw", "wxzx", "wxzy", "wxzz", "wxzw", "wxwx", "wxwy", "wxwz", "wxww", "wyxx", "wyxy", "wyxz", "wyxw", "wyyx", "wyyy", "wyyz", "wyyw", "wyzx", "wyzy", "wyzz", "wyzw", "wywx", "wywy", "wywz", "wyww", "wzxx", "wzxy", "wzxz", "wzxw", "wzyx", "wzyy", "wzyz", "wzyw", "wzzx", "wzzy", "wzzz", "wzzw", "wzwx", "wzwy", "wzwz", "wzww", "wwxx", "wwxy", "wwxz", "wwxw", "wwyx", "wwyy", "wwyz", "wwyw", "wwzx", "wwzy", "wwzz", "wwzw", "wwwx", "wwwy", "wwwz", "wwww", "ra", "ga", "ba", "ar", "ag", "ab", "aa", "rra", "rga", "rba", "rar", "rag", "rab", "raa", "gra", "gga", "gba", "gar", "gag", "gab", "gaa", "bra", "bga", "bba", "bar", "bag", "bab", "baa", "arr", "arg", "arb", "ara", "agr", "agg", "agb", "aga", "abr", "abg", "abb", "aba", "aar", "aag", "aab", "aaa", "rrra", "rrga", "rrba", "rrar", "rrag", "rrab", "rraa", "rgra", "rgga", "rgba", "rgar", "rgag", "rgab", "rgaa", "rbra", "rbga", "rbba", "rbar", "rbag", "rbab", "rbaa", "rarr", "rarg", "rarb", "rara", "ragr", "ragg", "ragb", "raga", "rabr", "rabg", "rabb", "raba", "raar", "raag", "raab", "raaa", "grra", "grga", "grba", "grar", "grag", "grab", "graa", "ggra", "ggga", "ggba", "ggar", "ggag", "ggab", "ggaa", "gbra", "gbga", "gbba", "gbar", "gbag", "gbab", "gbaa", "garr", "garg", "garb", "gara", "gagr", "gagg", "gagb", "gaga", "gabr", "gabg", "gabb", "gaba", "gaar", "gaag", "gaab", "gaaa", "brra", "brga", "brba", "brar", "brag", "brab", "braa", "bgra", "bgga", "bgba", "bgar", "bgag", "bgab", "bgaa", "bbra", "bbga", "bbba", "bbar", "bbag", "bbab", "bbaa", "barr", "barg", "barb", "bara", "bagr", "bagg", "bagb", "baga", "babr", "babg", "babb", "baba", "baar", "baag", "baab", "baaa", "arrr", "arrg", "arrb", "arra", "argr", "argg", "argb", "arga", "arbr", "arbg", "arbb", "arba", "arar", "arag", "arab", "araa", "agrr", "agrg", "agrb", "agra", "aggr", "aggg", "aggb", "agga", "agbr", "agbg", "agbb", "agba", "agar", "agag", "agab", "agaa", "abrr", "abrg", "abrb", "abra", "abgr", "abgg", "abgb", "abga", "abbr", "abbg", "abbb", "abba", "abar", "abag", "abab", "abaa", "aarr", "aarg", "aarb", "aara", "aagr", "aagg", "aagb", "aaga", "aabr", "aabg", "aabb", "aaba", "aaar", "aaag", "aaab", "aaaa"]; + const SWIZZLE_INDEX = { + x: 0, + r: 0, + y: 1, + g: 1, + z: 2, + b: 2, + w: 3, + a: 3 + }; + function getSwizzleImpl(swizzle) { + switch (swizzle.length) { + case 2: + return function() { + return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]); + }; + case 3: + return function() { + return new Vec3( + this[SWIZZLE_INDEX[swizzle[0]]], + this[SWIZZLE_INDEX[swizzle[1]]], + this[SWIZZLE_INDEX[swizzle[2]]] + ); + }; + case 4: + return function() { + return new Vec4( + this[SWIZZLE_INDEX[swizzle[0]]], + this[SWIZZLE_INDEX[swizzle[1]]], + this[SWIZZLE_INDEX[swizzle[2]]], + this[SWIZZLE_INDEX[swizzle[3]]] + ); + }; + } + throw new Error("Illegal swizzle length"); + } + for (const swizzle of VEC2_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec2.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec3.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + for (const swizzle of VEC3_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec3.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + for (const swizzle of VEC4_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + GLM_SWIZZLES_ENABLED_F64 = true; +} + +// src/util/angleConversion.ts +var GLM_DEG_TO_RAD = Math.PI / 180; +var GLM_RAD_TO_DEG = 180 / Math.PI; +function toDegree(value) { + return value * GLM_RAD_TO_DEG; +} +function toRadian(value) { + return value * GLM_DEG_TO_RAD; +} +export { + EnableSwizzlesF64, + Mat2, + Mat2d, + Mat3, + Mat4, + Quat, + Quat2, + Vec2, + Vec3, + Vec4, + toDegree, + toRadian +}; +//# sourceMappingURL=gl-matrix-f64.js.map diff --git a/dist-cdn/esm/2016/gl-matrix-f64.js.map b/dist-cdn/esm/2016/gl-matrix-f64.js.map new file mode 100644 index 00000000..b194b299 --- /dev/null +++ b/dist-cdn/esm/2016/gl-matrix-f64.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../../../src/common/index.ts", "../../../src/_lib/f64/Mat2.ts", "../../../src/_lib/f64/Mat2d.ts", "../../../src/_lib/f64/Mat3.ts", "../../../src/_lib/f64/Mat4.ts", "../../../src/_lib/f64/Vec3.ts", "../../../src/_lib/f64/Vec4.ts", "../../../src/_lib/f64/Quat.ts", "../../../src/_lib/f64/Quat2.ts", "../../../src/_lib/f64/Vec2.ts", "../../../src/swizzle/f64/index.ts", "../../../src/util/angleConversion.ts"], + "sourcesContent": ["/**\r\n * Provides common resources and constants shared across `gl-matrix`.\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\n/**\r\n * A small constant used to determine the acceptable error margin in floating-point calculations.\r\n */\r\nexport const GLM_EPSILON = 0.000001;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x2 Matrix\r\n */\r\nexport class Mat2 extends Float64Array {\r\n static #IDENTITY_2X2 = new Float64Array([\r\n 1, 0,\r\n 0, 1\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n default:\r\n super(Mat2.#IDENTITY_2X2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2} into `this`.\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2.identity(this)\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n identity(): this {\r\n this.set(Mat2.#IDENTITY_2X2);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2} against another one\r\n * Equivalent to `Mat2.multiply(this, this, b);`\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat2}\r\n * Equivalent to `Mat2.transpose(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n transpose(): this {\r\n return Mat2.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat2}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n invert(): this {\r\n return Mat2.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2.scale(this, this, v);`\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2} by the given angle around the given axis\r\n * Equivalent to `Mat2.rotate(this, this, rad);`\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n rotate(rad: number): this {\r\n return Mat2.rotate(this, this, rad) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2}\r\n */\r\n static create(): Mat2 {\r\n return new Mat2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2}\r\n */\r\n static clone(a: Readonly): Mat2 {\r\n return new Mat2(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2Like, a: Readonly): Mat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2}\r\n */\r\n static fromValues(...values: number[]): Mat2 {\r\n return new Mat2(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2Like, ...values: number[]): Mat2Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2Like): Mat2Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat2Like, a: Readonly): Mat2Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache\r\n // some values\r\n if (out === a) {\r\n const a1 = a[1];\r\n out[1] = a[2];\r\n out[2] = a1;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[2];\r\n out[2] = a[1];\r\n out[3] = a[3];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2Like, a: Mat2Like): Mat2Like | null {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n // Calculate the determinant\r\n let det = a0 * a3 - a2 * a1;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = a3 * det;\r\n out[1] = -a1 * det;\r\n out[2] = -a2 * det;\r\n out[3] = a0 * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat2Like, a: Mat2Like): Mat2Like {\r\n // Caching this value is necessary if out == a\r\n const a0 = a[0];\r\n out[0] = a[3];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[2] * a[1];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n return out;\r\n }\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Rotates a {@link Mat2} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2Like, a: Readonly, rad: number): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2Like, a: Readonly, v: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2Like, rad: number): Mat2Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2Like, v: Readonly): Mat2Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2Like, a: Readonly, b: number): Mat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2Like, a: Readonly, b: Readonly, scale: number): Mat2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\r\n * @category Static\r\n *\r\n * @param L - the lower triangular matrix\r\n * @param D - the diagonal matrix\r\n * @param U - the upper triangular matrix\r\n * @param a - the input matrix to factorize\r\n */\r\n\r\n static LDU(L: Mat2Like, D: Readonly, U: Mat2Like, a: Readonly):\r\n [Mat2Like, Readonly, Mat2Like] {\r\n L[2] = a[2] / a[0];\r\n U[0] = a[0];\r\n U[1] = a[1];\r\n U[3] = a[3] - L[2] * U[1];\r\n return [L, D, U];\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat2.prototype.mul = Mat2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat2.mul = Mat2.multiply;\r\nMat2.sub = Mat2.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x3 Matrix\r\n */\r\nexport class Mat2d extends Float64Array {\r\n static #IDENTITY_2X3 = new Float64Array([\r\n 1, 0,\r\n 0, 1,\r\n 0, 0,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 6:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 6); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 6);\r\n }\r\n break;\r\n default:\r\n super(Mat2d.#IDENTITY_2X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2d.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2d.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2d} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2d.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat2d.#IDENTITY_2X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2d} against another one\r\n * Equivalent to `Mat2d.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2d.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Translate this {@link Mat2d} by the given vector\r\n * Equivalent to `Mat2d.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat2d.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2d} by the given angle around the given axis\r\n * Equivalent to `Mat2d.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat2d.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2d.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2d.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2d}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 6 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2d}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2d}\r\n */\r\n static create(): Mat2d {\r\n return new Mat2d();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2d} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2d}\r\n */\r\n static clone(a: Readonly): Mat2d {\r\n return new Mat2d(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2d} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2dLike, a: Readonly): Mat2dLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2d} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2d}\r\n */\r\n static fromValues(...values: number[]): Mat2d {\r\n return new Mat2d(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2d} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2dLike, ...values: number[]): Mat2dLike {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2d} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2dLike): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2dLike, a: Mat2dLike): Mat2dLike | null {\r\n const aa = a[0];\r\n const ab = a[1];\r\n const ac = a[2];\r\n const ad = a[3];\r\n const atx = a[4];\r\n const aty = a[5];\r\n\r\n let det = aa * ad - ab * ac;\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = ad * det;\r\n out[1] = -ab * det;\r\n out[2] = -ac * det;\r\n out[3] = aa * det;\r\n out[4] = (ac * aty - ad * atx) * det;\r\n out[5] = (ab * atx - aa * aty) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[1] * a[2];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2d}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n out[4] = a0 * b4 + a2 * b5 + a4;\r\n out[5] = a1 * b4 + a3 * b5 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat2d} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n out[4] = a0 * v0 + a2 * v1 + a4;\r\n out[5] = a1 * v0 + a3 * v1 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat2d} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2dLike, a: Readonly, rad: number): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n // TODO: Got to fromRotation\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = v[0];\r\n out[5] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2dLike, rad: number): Mat2dLike {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2d} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2dLike, a: Readonly, b: number): Mat2dLike {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2dLike, a: Readonly, b: Readonly, scale: number):\r\n Mat2dLike {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2d(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Static method alias assignments\r\nMat2d.mul = Mat2d.multiply;\r\nMat2d.sub = Mat2d.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Mat3Like, Mat4Like, Vec2Like, QuatLike } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 3x3 Matrix\r\n */\r\nexport class Mat3 extends Float64Array {\r\n static #IDENTITY_3X3 = new Float64Array([\r\n 1, 0, 0,\r\n 0, 1, 0,\r\n 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 9:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 9); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v,\r\n v, v, v,\r\n v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 9);\r\n }\r\n break;\r\n default:\r\n super(Mat3.#IDENTITY_3X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat3.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat3.#IDENTITY_3X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat3} against another one\r\n * Equivalent to `Mat3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat3.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat3}\r\n * Equivalent to `Mat3.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat3.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat3}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat3.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat3} by the given vector\r\n * Equivalent to `Mat3.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat3.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat3} by the given angle around the given axis\r\n * Equivalent to `Mat3.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat3.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat3.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat3.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 9 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat3}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat3}\r\n */\r\n static create(): Mat3 {\r\n return new Mat3();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat3} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat3}\r\n */\r\n static clone(a: Readonly): Mat3 {\r\n return new Mat3(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat3} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat3} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat3}\r\n */\r\n static fromValues(...values: number[]): Mat3 {\r\n return new Mat3(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat3} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat3Like, ...values: number[]): Mat3Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat3} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat3Like): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat3Like, a: Readonly): Mat3Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a12 = a[5];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a01;\r\n out[5] = a[7];\r\n out[6] = a02;\r\n out[7] = a12;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a[1];\r\n out[4] = a[4];\r\n out[5] = a[7];\r\n out[6] = a[2];\r\n out[7] = a[5];\r\n out[8] = a[8];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat3Like, a: Mat3Like): Mat3Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2];\r\n const a10 = a[3],\r\n a11 = a[4],\r\n a12 = a[5];\r\n const a20 = a[6],\r\n a21 = a[7],\r\n a22 = a[8];\r\n\r\n const b01 = a22 * a11 - a12 * a21;\r\n const b11 = -a22 * a10 + a12 * a20;\r\n const b21 = a21 * a10 - a11 * a20;\r\n\r\n // Calculate the determinant\r\n let det = a00 * b01 + a01 * b11 + a02 * b21;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = b01 * det;\r\n out[1] = (-a22 * a01 + a02 * a21) * det;\r\n out[2] = (a12 * a01 - a02 * a11) * det;\r\n out[3] = b11 * det;\r\n out[4] = (a22 * a00 - a02 * a20) * det;\r\n out[5] = (-a12 * a00 + a02 * a10) * det;\r\n out[6] = b21 * det;\r\n out[7] = (-a21 * a00 + a01 * a20) * det;\r\n out[8] = (a11 * a00 - a01 * a10) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat3Like, a: Mat3Like): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n out[0] = a11 * a22 - a12 * a21;\r\n out[1] = a02 * a21 - a01 * a22;\r\n out[2] = a01 * a12 - a02 * a11;\r\n out[3] = a12 * a20 - a10 * a22;\r\n out[4] = a00 * a22 - a02 * a20;\r\n out[5] = a02 * a10 - a00 * a12;\r\n out[6] = a10 * a21 - a11 * a20;\r\n out[7] = a01 * a20 - a00 * a21;\r\n out[8] = a00 * a11 - a01 * a10;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n return (\r\n a00 * (a22 * a11 - a12 * a21) +\r\n a01 * (-a22 * a10 + a12 * a20) +\r\n a02 * (a21 * a10 - a11 * a20)\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[3];\r\n b1 = b[4];\r\n b2 = b[5];\r\n out[3] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[4] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[5] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[6];\r\n b1 = b[7];\r\n b2 = b[8];\r\n out[6] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[7] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[8] = b0 * a02 + b1 * a12 + b2 * a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat3} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n\r\n out[3] = a10;\r\n out[4] = a11;\r\n out[5] = a12;\r\n\r\n out[6] = x * a00 + y * a10 + a20;\r\n out[7] = x * a01 + y * a11 + a21;\r\n out[8] = x * a02 + y * a12 + a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat3} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat3Like, a: Readonly, rad: number): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c * a00 + s * a10;\r\n out[1] = c * a01 + s * a11;\r\n out[2] = c * a02 + s * a12;\r\n\r\n out[3] = c * a10 - s * a00;\r\n out[4] = c * a11 - s * a01;\r\n out[5] = c * a12 - s * a02;\r\n\r\n out[6] = a20;\r\n out[7] = a21;\r\n out[8] = a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat3} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = x * a[0];\r\n out[1] = x * a[1];\r\n out[2] = x * a[2];\r\n\r\n out[3] = y * a[3];\r\n out[4] = y * a[4];\r\n out[5] = y * a[5];\r\n\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = v[0];\r\n out[7] = v[1];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.rotate(dest, dest, rad);\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat3Like, rad: number): Mat3Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n\r\n out[3] = -s;\r\n out[4] = c;\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n\r\n out[3] = 0;\r\n out[4] = v[1];\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat2d} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 2x3 matrix\r\n * @returns `out`\r\n */\r\n static fromMat2d(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = 0;\r\n\r\n out[3] = a[2];\r\n out[4] = a[3];\r\n out[5] = 0;\r\n\r\n out[6] = a[4];\r\n out[7] = a[5];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param q - {@link Quat} to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat3Like, q: Readonly): Mat3Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[3] = yx - wz;\r\n out[6] = zx + wy;\r\n\r\n out[1] = yx + wz;\r\n out[4] = 1 - xx - zz;\r\n out[7] = zy - wx;\r\n\r\n out[2] = zx - wy;\r\n out[5] = zy + wx;\r\n out[8] = 1 - xx - yy;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat4} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 4x4 matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[4];\r\n out[4] = a[5];\r\n out[5] = a[6];\r\n out[6] = a[8];\r\n out[7] = a[9];\r\n out[8] = a[10];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\r\n * @category Static\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat3Like, a: Readonly): Mat3Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n\r\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n\r\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat3Like, a: Readonly): Mat3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n\r\n out[3] = cy * az - cz * ay;\r\n out[4] = cz * ax - cx * az;\r\n out[5] = cx * ay - cy * ax;\r\n\r\n out[6] = ay * bz - az * by;\r\n out[7] = az * bx - ax * bz;\r\n out[8] = ax * by - ay * bx;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a 2D projection matrix with the given bounds\r\n * @category Static\r\n *\r\n * @param out mat3 frustum matrix will be written into\r\n * @param width Width of your gl context\r\n * @param height Height of gl context\r\n * @returns `out`\r\n */\r\n static projection(out: Mat3Like, width: number, height: number): Mat3Like {\r\n out[0] = 2 / width;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -2 / height;\r\n out[5] = 0;\r\n out[6] = -1;\r\n out[7] = 1;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8]\r\n );\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat3} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat3Like, a: Readonly, b: number): Mat3Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat3Like, a: Readonly, b: Readonly, scale: number): Mat3Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat3(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat3.prototype.mul = Mat3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat3.mul = Mat3.multiply;\r\nMat3.sub = Mat3.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 4x4 Matrix\r\n */\r\nexport class Mat4 extends Float64Array {\r\n static #IDENTITY_4X4 = new Float64Array([\r\n 1, 0, 0, 0,\r\n 0, 1, 0, 0,\r\n 0, 0, 1, 0,\r\n 0, 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Temporary variable to prevent repeated allocations in the algorithms within Mat4.\r\n * These are declared as TypedArrays to aid in tree-shaking.\r\n */\r\n static #TMP_VEC3 = new Float64Array(3);\r\n\r\n /**\r\n * Create a {@link Mat4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 16:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 16); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 16);\r\n }\r\n break;\r\n default:\r\n super(Mat4.#IDENTITY_4X4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat4.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat4.#IDENTITY_4X4);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat4} against another one\r\n * Equivalent to `Mat4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat4.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat4}\r\n * Equivalent to `Mat4.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat4.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat4}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat4.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat4} by the given vector\r\n * Equivalent to `Mat4.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat4.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the given axis\r\n * Equivalent to `Mat4.rotate(this, this, rad, axis);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `this`\r\n */\r\n rotate(rad: number, axis: Readonly): this {\r\n return Mat4.rotate(this, this, rad, axis) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat4.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat4.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the X axis\r\n * Equivalent to `Mat4.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Mat4.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Y axis\r\n * Equivalent to `Mat4.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Mat4.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Z axis\r\n * Equivalent to `Mat4.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Mat4.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveNO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveNO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveZO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveZO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoNO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoNO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoZO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoZO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 16 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat4}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat4}\r\n */\r\n static create(): Mat4 {\r\n return new Mat4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat4} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat4}\r\n */\r\n static clone(a: Readonly): Mat4 {\r\n return new Mat4(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat4} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat4Like, a: Readonly): Mat4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new mat4 with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat4}\r\n */\r\n static fromValues(...values: number[]): Mat4 {\r\n return new Mat4(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a mat4 to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat4Like, ...values: number[]): Mat4Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n out[9] = values[9];\r\n out[10] = values[10];\r\n out[11] = values[11];\r\n out[12] = values[12];\r\n out[13] = values[13];\r\n out[14] = values[14];\r\n out[15] = values[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat4} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat4Like): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat4Like, a: Readonly): Mat4Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a12 = a[6],\r\n a13 = a[7];\r\n const a23 = a[11];\r\n\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a01;\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a02;\r\n out[9] = a12;\r\n out[11] = a[14];\r\n out[12] = a03;\r\n out[13] = a13;\r\n out[14] = a23;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a[1];\r\n out[5] = a[5];\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a[2];\r\n out[9] = a[6];\r\n out[10] = a[10];\r\n out[11] = a[14];\r\n out[12] = a[3];\r\n out[13] = a[7];\r\n out[14] = a[11];\r\n out[15] = a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat4Like, a: Mat4Like): Mat4Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\r\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\r\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\r\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\r\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\r\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\r\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat4Like, a: Mat4Like): Mat4Like {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n out[0] = a11 * b11 - a12 * b10 + a13 * b09;\r\n out[1] = a02 * b10 - a01 * b11 - a03 * b09;\r\n out[2] = a31 * b05 - a32 * b04 + a33 * b03;\r\n out[3] = a22 * b04 - a21 * b05 - a23 * b03;\r\n out[4] = a12 * b08 - a10 * b11 - a13 * b07;\r\n out[5] = a00 * b11 - a02 * b08 + a03 * b07;\r\n out[6] = a32 * b02 - a30 * b05 - a33 * b01;\r\n out[7] = a20 * b05 - a22 * b02 + a23 * b01;\r\n out[8] = a10 * b10 - a11 * b08 + a13 * b06;\r\n out[9] = a01 * b08 - a00 * b10 - a03 * b06;\r\n out[10] = a30 * b04 - a31 * b02 + a33 * b00;\r\n out[11] = a21 * b02 - a20 * b04 - a23 * b00;\r\n out[12] = a11 * b07 - a10 * b09 - a12 * b06;\r\n out[13] = a00 * b09 - a01 * b07 + a02 * b06;\r\n out[14] = a31 * b01 - a30 * b03 - a32 * b00;\r\n out[15] = a20 * b03 - a21 * b01 + a22 * b00;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b0 = a00 * a11 - a01 * a10;\r\n const b1 = a00 * a12 - a02 * a10;\r\n const b2 = a01 * a12 - a02 * a11;\r\n const b3 = a20 * a31 - a21 * a30;\r\n const b4 = a20 * a32 - a22 * a30;\r\n const b5 = a21 * a32 - a22 * a31;\r\n const b6 = a00 * b5 - a01 * b4 + a02 * b3;\r\n const b7 = a10 * b5 - a11 * b4 + a12 * b3;\r\n const b8 = a20 * b2 - a21 * b1 + a22 * b0;\r\n const b9 = a30 * b2 - a31 * b1 + a32 * b0;\r\n\r\n // Calculate the determinant\r\n return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Mat4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n // Cache only the current line of the second matrix\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n let b3 = b[3];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[4];\r\n b1 = b[5];\r\n b2 = b[6];\r\n b3 = b[7];\r\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[8];\r\n b1 = b[9];\r\n b2 = b[10];\r\n b3 = b[11];\r\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[12];\r\n b1 = b[13];\r\n b2 = b[14];\r\n b3 = b[15];\r\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat4} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n if (a === out) {\r\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\r\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\r\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\r\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\r\n } else {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n out[3] = a03;\r\n out[4] = a10;\r\n out[5] = a11;\r\n out[6] = a12;\r\n out[7] = a13;\r\n out[8] = a20;\r\n out[9] = a21;\r\n out[10] = a22;\r\n out[11] = a23;\r\n\r\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\r\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\r\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\r\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec3} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n out[0] = a[0] * x;\r\n out[1] = a[1] * x;\r\n out[2] = a[2] * x;\r\n out[3] = a[3] * x;\r\n out[4] = a[4] * y;\r\n out[5] = a[5] * y;\r\n out[6] = a[6] * y;\r\n out[7] = a[7] * y;\r\n out[8] = a[8] * z;\r\n out[9] = a[9] * z;\r\n out[10] = a[10] * z;\r\n out[11] = a[11] * z;\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat4} by the given angle around the given axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if axis has a length of 0\r\n */\r\n static rotate(out: Mat4Like, a: Readonly, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n // Construct the elements of the rotation matrix\r\n const b00 = x * x * t + c;\r\n const b01 = y * x * t + z * s;\r\n const b02 = z * x * t - y * s;\r\n const b10 = x * y * t - z * s;\r\n const b11 = y * y * t + c;\r\n const b12 = z * y * t + x * s;\r\n const b20 = x * z * t + y * s;\r\n const b21 = y * z * t - x * s;\r\n const b22 = z * z * t + c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\r\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\r\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\r\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\r\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\r\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\r\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\r\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\r\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\r\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\r\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\r\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateX(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[4] = a10 * c + a20 * s;\r\n out[5] = a11 * c + a21 * s;\r\n out[6] = a12 * c + a22 * s;\r\n out[7] = a13 * c + a23 * s;\r\n out[8] = a20 * c - a10 * s;\r\n out[9] = a21 * c - a11 * s;\r\n out[10] = a22 * c - a12 * s;\r\n out[11] = a23 * c - a13 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateY(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c - a20 * s;\r\n out[1] = a01 * c - a21 * s;\r\n out[2] = a02 * c - a22 * s;\r\n out[3] = a03 * c - a23 * s;\r\n out[8] = a00 * s + a20 * c;\r\n out[9] = a01 * s + a21 * c;\r\n out[10] = a02 * s + a22 * c;\r\n out[11] = a03 * s + a23 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c + a10 * s;\r\n out[1] = a01 * c + a11 * s;\r\n out[2] = a02 * c + a12 * s;\r\n out[3] = a03 * c + a13 * s;\r\n out[4] = a10 * c - a00 * s;\r\n out[5] = a11 * c - a01 * s;\r\n out[6] = a12 * c - a02 * s;\r\n out[7] = a13 * c - a03 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = v[1];\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = v[2];\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotate(dest, dest, rad, axis);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if `axis` has a length of 0\r\n */\r\n static fromRotation(out: Mat4Like, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = x * x * t + c;\r\n out[1] = y * x * t + z * s;\r\n out[2] = z * x * t - y * s;\r\n out[3] = 0;\r\n out[4] = x * y * t - z * s;\r\n out[5] = y * y * t + c;\r\n out[6] = z * y * t + x * s;\r\n out[7] = 0;\r\n out[8] = x * z * t + y * s;\r\n out[9] = y * z * t - x * s;\r\n out[10] = z * z * t + c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the X axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateX(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromXRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = c;\r\n out[6] = s;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = -s;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Y axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateY(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromYRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = 0;\r\n out[2] = -s;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = s;\r\n out[9] = 0;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Z axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateZ(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromZRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -s;\r\n out[5] = c;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation and vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Mat4Like, q: Readonly, v: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - (yy + zz);\r\n out[1] = xy + wz;\r\n out[2] = xz - wy;\r\n out[3] = 0;\r\n out[4] = xy - wz;\r\n out[5] = 1 - (xx + zz);\r\n out[6] = yz + wx;\r\n out[7] = 0;\r\n out[8] = xz + wy;\r\n out[9] = yz - wx;\r\n out[10] = 1 - (xx + yy);\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Mat4} from a {@link Quat2}.\r\n * @category Static\r\n *\r\n * @param out - Matrix\r\n * @param a - Dual Quaternion\r\n * @returns `out`\r\n */\r\n static fromQuat2(out: Mat4Like, a: Quat2Like): Mat4Like {\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n\r\n const magnitude = bx * bx + by * by + bz * bz + bw * bw;\r\n\r\n // Only scale if it makes sense\r\n if (magnitude > 0) {\r\n Mat4.#TMP_VEC3[0] = ((ax * bw + aw * bx + ay * bz - az * by) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[1] = ((ay * bw + aw * by + az * bx - ax * bz) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[2] = ((az * bw + aw * bz + ax * by - ay * bx) * 2) / magnitude;\r\n } else {\r\n Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n }\r\n Mat4.fromRotationTranslation(out, a as QuatLike, Mat4.#TMP_VEC3);\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat4Like, a: Readonly): Mat4Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[3] = 0;\r\n\r\n out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[7] = 0;\r\n\r\n out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat4Like, a: Readonly): Mat4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n out[3] = 0;\r\n\r\n out[4] = cy * az - cz * ay;\r\n out[5] = cz * ax - cx * az;\r\n out[6] = cx * ay - cy * ax;\r\n out[7] = 0;\r\n\r\n out[8] = ay * bz - az * by;\r\n out[9] = az * bx - ax * bz;\r\n out[10] = ax * by - ay * bx;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the translation vector component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslation,\r\n * the returned vector will be the same as the translation vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive translation component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getTranslation(out: Vec3Like, mat: Readonly): Vec3Like {\r\n out[0] = mat[12];\r\n out[1] = mat[13];\r\n out[2] = mat[14];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the scaling factor component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslationScale\r\n * with a normalized Quaternion parameter, the returned vector will be\r\n * the same as the scaling vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive scaling factor component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getScaling(out: Vec3Like, mat: Readonly): Vec3Like {\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a quaternion representing the rotational component\r\n * of a transformation matrix. If a matrix is built with\r\n * fromRotationTranslation, the returned quaternion will be the\r\n * same as the quaternion originally supplied.\r\n * @category Static\r\n *\r\n * @param out - Quaternion to receive the rotation component\r\n * @param mat - Matrix to be decomposed (input)\r\n * @return `out`\r\n */\r\n static getRotation(out: QuatLike, mat: Readonly): QuatLike {\r\n Mat4.getScaling(Mat4.#TMP_VEC3, mat);\r\n\r\n const is1 = 1 / Mat4.#TMP_VEC3[0];\r\n const is2 = 1 / Mat4.#TMP_VEC3[1];\r\n const is3 = 1 / Mat4.#TMP_VEC3[2];\r\n\r\n const sm11 = mat[0] * is1;\r\n const sm12 = mat[1] * is2;\r\n const sm13 = mat[2] * is3;\r\n const sm21 = mat[4] * is1;\r\n const sm22 = mat[5] * is2;\r\n const sm23 = mat[6] * is3;\r\n const sm31 = mat[8] * is1;\r\n const sm32 = mat[9] * is2;\r\n const sm33 = mat[10] * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out[3] = 0.25 * S;\r\n out[0] = (sm23 - sm32) / S;\r\n out[1] = (sm31 - sm13) / S;\r\n out[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out[3] = (sm23 - sm32) / S;\r\n out[0] = 0.25 * S;\r\n out[1] = (sm12 + sm21) / S;\r\n out[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out[3] = (sm31 - sm13) / S;\r\n out[0] = (sm12 + sm21) / S;\r\n out[1] = 0.25 * S;\r\n out[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out[3] = (sm12 - sm21) / S;\r\n out[0] = (sm31 + sm13) / S;\r\n out[1] = (sm23 + sm32) / S;\r\n out[2] = 0.25 * S;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Decomposes a transformation matrix into its rotation, translation\r\n * and scale components. Returns only the rotation component\r\n * @category Static\r\n *\r\n * @param out_r - Quaternion to receive the rotation component\r\n * @param out_t - Vector to receive the translation vector\r\n * @param out_s - Vector to receive the scaling factor\r\n * @param mat - Matrix to be decomposed (input)\r\n * @returns `out_r`\r\n */\r\n static decompose(out_r: QuatLike, out_t: Vec3Like, out_s: Vec3Like, mat: Readonly): QuatLike {\r\n out_t[0] = mat[12];\r\n out_t[1] = mat[13];\r\n out_t[2] = mat[14];\r\n\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n const is1 = 1 / out_s[0];\r\n const is2 = 1 / out_s[1];\r\n const is3 = 1 / out_s[2];\r\n\r\n const sm11 = m11 * is1;\r\n const sm12 = m12 * is2;\r\n const sm13 = m13 * is3;\r\n const sm21 = m21 * is1;\r\n const sm22 = m22 * is2;\r\n const sm23 = m23 * is3;\r\n const sm31 = m31 * is1;\r\n const sm32 = m32 * is2;\r\n const sm33 = m33 * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out_r[3] = 0.25 * S;\r\n out_r[0] = (sm23 - sm32) / S;\r\n out_r[1] = (sm31 - sm13) / S;\r\n out_r[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out_r[3] = (sm23 - sm32) / S;\r\n out_r[0] = 0.25 * S;\r\n out_r[1] = (sm12 + sm21) / S;\r\n out_r[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out_r[3] = (sm31 - sm13) / S;\r\n out_r[0] = (sm12 + sm21) / S;\r\n out_r[1] = 0.25 * S;\r\n out_r[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out_r[3] = (sm12 - sm21) / S;\r\n out_r[0] = (sm31 + sm13) / S;\r\n out_r[1] = (sm23 + sm32) / S;\r\n out_r[2] = 0.25 * S;\r\n }\r\n\r\n return out_r;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScale(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n out[0] = (1 - (yy + zz)) * sx;\r\n out[1] = (xy + wz) * sx;\r\n out[2] = (xz - wy) * sx;\r\n out[3] = 0;\r\n out[4] = (xy - wz) * sy;\r\n out[5] = (1 - (xx + zz)) * sy;\r\n out[6] = (yz + wx) * sy;\r\n out[7] = 0;\r\n out[8] = (xz + wy) * sz;\r\n out[9] = (yz - wx) * sz;\r\n out[10] = (1 - (xx + yy)) * sz;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the\r\n * given origin. This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * mat4.translate(dest, origin);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n * mat4.translate(dest, negativeOrigin);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @param o - The origin vector around which to scale and rotate\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScaleOrigin(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly, o: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n const ox = o[0];\r\n const oy = o[1];\r\n const oz = o[2];\r\n\r\n const out0 = (1 - (yy + zz)) * sx;\r\n const out1 = (xy + wz) * sx;\r\n const out2 = (xz - wy) * sx;\r\n const out4 = (xy - wz) * sy;\r\n const out5 = (1 - (xx + zz)) * sy;\r\n const out6 = (yz + wx) * sy;\r\n const out8 = (xz + wy) * sz;\r\n const out9 = (yz - wx) * sz;\r\n const out10 = (1 - (xx + yy)) * sz;\r\n\r\n out[0] = out0;\r\n out[1] = out1;\r\n out[2] = out2;\r\n out[3] = 0;\r\n out[4] = out4;\r\n out[5] = out5;\r\n out[6] = out6;\r\n out[7] = 0;\r\n out[8] = out8;\r\n out[9] = out9;\r\n out[10] = out10;\r\n out[11] = 0;\r\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\r\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\r\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 4x4 matrix from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Quaternion to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat4Like, q: Readonly): Mat4Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[1] = yx + wz;\r\n out[2] = zx - wy;\r\n out[3] = 0;\r\n\r\n out[4] = yx - wz;\r\n out[5] = 1 - xx - zz;\r\n out[6] = zy + wx;\r\n out[7] = 0;\r\n\r\n out[8] = zx + wy;\r\n out[9] = zy - wx;\r\n out[10] = 1 - xx - yy;\r\n out[11] = 0;\r\n\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.frustumNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly\r\n */\r\n static frustum(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like { return out; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveNO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.perspectiveNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static perspective(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveZO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating\r\n * projection matrices to be used with the still experimental WebVR API.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n * @deprecated\r\n */\r\n static perspectiveFromFieldOfView(out: Mat4Like,\r\n fov: { upDegrees: number, downDegrees: number, leftDegrees: number, rightDegrees: number }, near: number,\r\n far: number): Mat4Like {\r\n\r\n const upTan = Math.tan((fov.upDegrees * Math.PI) / 180.0);\r\n const downTan = Math.tan((fov.downDegrees * Math.PI) / 180.0);\r\n const leftTan = Math.tan((fov.leftDegrees * Math.PI) / 180.0);\r\n const rightTan = Math.tan((fov.rightDegrees * Math.PI) / 180.0);\r\n const xScale = 2.0 / (leftTan + rightTan);\r\n const yScale = 2.0 / (upTan + downTan);\r\n\r\n out[0] = xScale;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n out[4] = 0.0;\r\n out[5] = yScale;\r\n out[6] = 0.0;\r\n out[7] = 0.0;\r\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\r\n out[9] = (upTan - downTan) * yScale * 0.5;\r\n out[10] = far / (near - far);\r\n out[11] = -1.0;\r\n out[12] = 0.0;\r\n out[13] = 0.0;\r\n out[14] = (far * near) / (near - far);\r\n out[15] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 2 * nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = (far + near) * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.orthoNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static ortho(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, far: number):\r\n Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = near * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that\r\n * actually makes an object look at another object, you should use targetTo instead.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param center - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static lookAt(out: Mat4Like, eye: Readonly, center: Readonly, up: Readonly): Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n const centerx = center[0];\r\n const centery = center[1];\r\n const centerz = center[2];\r\n\r\n if (\r\n Math.abs(eyex - centerx) < GLM_EPSILON &&\r\n Math.abs(eyey - centery) < GLM_EPSILON &&\r\n Math.abs(eyez - centerz) < GLM_EPSILON\r\n ) {\r\n return Mat4.identity(out);\r\n }\r\n\r\n let z0 = eyex - centerx;\r\n let z1 = eyey - centery;\r\n let z2 = eyez - centerz;\r\n\r\n let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\r\n if (!len) {\r\n x0 = 0;\r\n x1 = 0;\r\n x2 = 0;\r\n } else {\r\n len = 1 / len;\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n let y0 = z1 * x2 - z2 * x1;\r\n let y1 = z2 * x0 - z0 * x2;\r\n let y2 = z0 * x1 - z1 * x0;\r\n\r\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\r\n if (!len) {\r\n y0 = 0;\r\n y1 = 0;\r\n y2 = 0;\r\n } else {\r\n len = 1 / len;\r\n y0 *= len;\r\n y1 *= len;\r\n y2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = y0;\r\n out[2] = z0;\r\n out[3] = 0;\r\n out[4] = x1;\r\n out[5] = y1;\r\n out[6] = z1;\r\n out[7] = 0;\r\n out[8] = x2;\r\n out[9] = y2;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\r\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\r\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a matrix that makes something look at something else.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param target - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static targetTo(out: Mat4Like, eye: Readonly, target: Readonly, up: Readonly):\r\n Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n\r\n let z0 = eyex - target[0];\r\n let z1 = eyey - target[1];\r\n let z2 = eyez - target[2];\r\n\r\n let len = z0 * z0 + z1 * z1 + z2 * z2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n }\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n\r\n len = x0 * x0 + x1 * x1 + x2 * x2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = x1;\r\n out[2] = x2;\r\n out[3] = 0;\r\n out[4] = z1 * x2 - z2 * x1;\r\n out[5] = z2 * x0 - z0 * x2;\r\n out[6] = z0 * x1 - z1 * x0;\r\n out[7] = 0;\r\n out[8] = z0;\r\n out[9] = z1;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = eyex;\r\n out[13] = eyey;\r\n out[14] = eyez;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8] +\r\n a[9] * a[9] +\r\n a[10] * a[10] +\r\n a[11] * a[11] +\r\n a[12] * a[12] +\r\n a[13] * a[13] +\r\n a[14] * a[14] +\r\n a[15] * a[15]\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n out[9] = a[9] + b[9];\r\n out[10] = a[10] + b[10];\r\n out[11] = a[11] + b[11];\r\n out[12] = a[12] + b[12];\r\n out[13] = a[13] + b[13];\r\n out[14] = a[14] + b[14];\r\n out[15] = a[15] + b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n out[9] = a[9] - b[9];\r\n out[10] = a[10] - b[10];\r\n out[11] = a[11] - b[11];\r\n out[12] = a[12] - b[12];\r\n out[13] = a[13] - b[13];\r\n out[14] = a[14] - b[14];\r\n out[15] = a[15] - b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Multiply each element of the matrix by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat4Like, a: Readonly, b: number): Mat4Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n out[9] = a[9] * b;\r\n out[10] = a[10] * b;\r\n out[11] = a[11] * b;\r\n out[12] = a[12] * b;\r\n out[13] = a[13] * b;\r\n out[14] = a[14] * b;\r\n out[15] = a[15] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat4Like, a: Readonly, b: Readonly, scale: number): Mat4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n out[9] = a[9] + b[9] * scale;\r\n out[10] = a[10] + b[10] * scale;\r\n out[11] = a[11] + b[11] * scale;\r\n out[12] = a[12] + b[12] * scale;\r\n out[13] = a[13] + b[13] * scale;\r\n out[14] = a[14] + b[14] * scale;\r\n out[15] = a[15] + b[15] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8] &&\r\n a[9] === b[9] &&\r\n a[10] === b[10] &&\r\n a[11] === b[11] &&\r\n a[12] === b[12] &&\r\n a[13] === b[13] &&\r\n a[14] === b[14] &&\r\n a[15] === b[15]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n const a9 = a[9];\r\n const a10 = a[10];\r\n const a11 = a[11];\r\n const a12 = a[12];\r\n const a13 = a[13];\r\n const a14 = a[14];\r\n const a15 = a[15];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n const b9 = b[9];\r\n const b10 = b[10];\r\n const b11 = b[11];\r\n const b12 = b[12];\r\n const b13 = b[13];\r\n const b14 = b[14];\r\n const b15 = b[15];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) &&\r\n Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) &&\r\n Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) &&\r\n Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) &&\r\n Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) &&\r\n Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) &&\r\n Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) &&\r\n Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat4(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat4.prototype.mul = Mat4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat4.sub = Mat4.subtract;\r\nMat4.mul = Mat4.multiply;\r\nMat4.frustum = Mat4.frustumNO;\r\nMat4.perspective = Mat4.perspectiveNO;\r\nMat4.ortho = Mat4.orthoNO;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, Mat4Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 3 Dimensional Vector\r\n */\r\nexport class Vec3 extends Float64Array {\r\n /**\r\n * Create a {@link Vec3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 3:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 3); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 3);\r\n }\r\n break;\r\n }\r\n default:\r\n super(3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec3.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec3.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec3} to `this`.\r\n * Equivalent to `Vec3.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec3} from `this`.\r\n * Equivalent to `Vec3.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec3.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec3.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec3.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec3.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec3.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to its absolute value.\r\n * Equivalent to `Vec3.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec3}.\r\n * Equivalent to `Vec3.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec3.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec3.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 3 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty vec3\r\n * @category Static\r\n *\r\n * @returns a new 3D vector\r\n */\r\n static create(): Vec3 {\r\n return new Vec3();\r\n }\r\n\r\n /**\r\n * Creates a new vec3 initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 3D vector\r\n */\r\n static clone(a: Readonly): Vec3 {\r\n return new Vec3(a);\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Creates a new vec3 initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns a new 3D vector\r\n */\r\n static fromValues(x: number, y: number, z: number): Vec3 {\r\n return new Vec3(x, y, z);\r\n }\r\n\r\n /**\r\n * Copy the values from one vec3 to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns `out`\r\n */\r\n static set(out: Vec3Like, x: number, y: number, z: number): Vec3Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Multiplies two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; }\r\n\r\n /**\r\n * Divides two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Math.ceil the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * symmetric round the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n /*\r\n static round(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = glMatrix.round(a[0]);\r\n out[1] = glMatrix.round(a[1]);\r\n out[2] = glMatrix.round(a[2]);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Scales a vec3 by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec3Like, a: Readonly, scale: number): Vec3Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two vec3's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec3Like, a: Readonly, b: Readonly, scale: number) {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared length of a vec3\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec3Like, a: Readonly): Vec3Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n let len = x * x + y * y + z * z;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n out[2] = a[2] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2];\r\n const bx = b[0],\r\n by = b[1],\r\n bz = b[2];\r\n\r\n out[0] = ay * bz - az * by;\r\n out[1] = az * bx - ax * bz;\r\n out[2] = ax * by - ay * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const angle = Math.acos(Math.min(Math.max(Vec3.dot(a, b), -1), 1));\r\n const sinTotal = Math.sin(angle);\r\n\r\n const ratioA = Math.sin((1 - t) * angle) / sinTotal;\r\n const ratioB = Math.sin(t * angle) / sinTotal;\r\n out[0] = ratioA * a[0] + ratioB * b[0];\r\n out[1] = ratioA * a[1] + ratioB * b[1];\r\n out[2] = ratioA * a[2] + ratioB * b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a hermite interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static hermite(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const factorTimes2 = t * t;\r\n const factor1 = factorTimes2 * (2 * t - 3) + 1;\r\n const factor2 = factorTimes2 * (t - 2) + t;\r\n const factor3 = factorTimes2 * (t - 1);\r\n const factor4 = factorTimes2 * (3 - 2 * t);\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a bezier interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static bezier(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const inverseFactor = 1 - t;\r\n const inverseFactorTimesTwo = inverseFactor * inverseFactor;\r\n const factorTimes2 = t * t;\r\n const factor1 = inverseFactorTimesTwo * inverseFactor;\r\n const factor2 = 3 * t * inverseFactorTimesTwo;\r\n const factor3 = 3 * factorTimes2 * inverseFactor;\r\n const factor4 = factorTimes2 * t;\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec3Like, scale) {\r\n scale = scale === undefined ? 1.0 : scale;\r\n\r\n let r = glMatrix.RANDOM() * 2.0 * Math.PI;\r\n let z = glMatrix.RANDOM() * 2.0 - 1.0;\r\n let zScale = Math.sqrt(1.0 - z * z) * scale;\r\n\r\n out[0] = Math.cos(r) * zScale;\r\n out[1] = Math.sin(r) * zScale;\r\n out[2] = z * scale;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the vec3 with a mat4.\r\n * 4th vector component is implicitly '1'\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec3Like, a: Readonly, m: Readonly): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1.0;\r\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\r\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\r\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a mat3.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - the 3x3 matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat3(out: Vec3Like, a: Vec3Like, m: Mat3Like): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n out[0] = x * m[0] + y * m[3] + z * m[6];\r\n out[1] = x * m[1] + y * m[4] + z * m[7];\r\n out[2] = x * m[2] + y * m[5] + z * m[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a quat\r\n * Can also be used for dual quaternions. (Multiply it with the real part)\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec3Like, a: Readonly, q: Readonly): Vec3Like {\r\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const w2 = q[3] * 2;\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n // var qvec = [qx, qy, qz];\r\n // var uv = vec3.cross([], qvec, a);\r\n const uvx = (qy * z - qz * y);\r\n const uvy = (qz * x - qx * z);\r\n const uvz = (qx * y - qy * x);\r\n // var uuv = vec3.cross([], qvec, uv);\r\n // vec3.scale(uuv, uuv, 2);\r\n const uuvx = (qy * uvz - qz * uvy) * 2;\r\n const uuvy = (qz * uvx - qx * uvz) * 2;\r\n const uuvz = (qx * uvy - qy * uvx) * 2;\r\n // vec3.scale(uv, uv, 2 * w);\r\n // return vec3.add(out, a, vec3.add(out, uv, uuv));\r\n out[0] = x + (uvx * w2) + uuvx;\r\n out[1] = y + (uvy * w2) + uuvy;\r\n out[2] = z + (uvz * w2) + uuvz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the x-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateX(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const by = b[1];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const py = a[1] - by;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = a[0];\r\n out[1] = (py * Math.cos(rad) - pz * Math.sin(rad)) + by;\r\n out[2] = (py * Math.sin(rad) + pz * Math.cos(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the y-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateY(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (pz * Math.sin(rad) + px * Math.cos(rad)) + bx;\r\n out[1] = a[1];\r\n out[2] = (pz * Math.cos(rad) - px * Math.sin(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the z-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const by = b[1];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const py = a[1] - by;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (px * Math.cos(rad) - py * Math.sin(rad)) + bx;\r\n out[1] = (px * Math.sin(rad) + py * Math.cos(rad)) + by;\r\n out[2] = b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 3D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly) {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz));\r\n const cosine = mag && Vec3.dot(a, b) / mag;\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec3Like): Vec3Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec3(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec3.prototype.sub = Vec3.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.mul = Vec3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.div = Vec3.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.dist = Vec3.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.sqrDist = Vec3.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec3.sub = Vec3.subtract;\r\nVec3.mul = Vec3.multiply;\r\nVec3.div = Vec3.divide;\r\nVec3.dist = Vec3.distance;\r\nVec3.sqrDist = Vec3.squaredDistance;\r\nVec3.sqrLen = Vec3.squaredLength;\r\nVec3.mag = Vec3.magnitude;\r\nVec3.length = Vec3.magnitude;\r\nVec3.len = Vec3.magnitude;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Vec4Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 4 Dimensional Vector\r\n */\r\nexport class Vec4 extends Float64Array {\r\n /**\r\n * Create a {@link Vec4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the vector. Equivalent to `this[3];`\r\n * @category Vector Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The a component of the vector. Equivalent to `this[3];`\r\n * @category Color Components\r\n */\r\n get a(): number { return this[3]; }\r\n set a(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec4.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec4} to `this`.\r\n * Equivalent to `Vec4.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n this[3] += b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec4} from `this`.\r\n * Equivalent to `Vec4.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n this[3] -= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n this[3] *= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n this[3] /= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec4.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n this[3] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n this[3] += b[3] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec4.distance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec4.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec4.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n this[3] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec4.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n this[3] = 1.0 / this[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec4.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n this[3] = Math.abs(this[3]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec4}.\r\n * Equivalent to `Vec4.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec4.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec4.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec4}\r\n * @category Static\r\n *\r\n * @returns a new 4D vector\r\n */\r\n static create(): Vec4 {\r\n return new Vec4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 4D vector\r\n */\r\n static clone(a: Vec4Like): Vec4 {\r\n return new Vec4(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new 4D vector\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Vec4 {\r\n return new Vec4(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec4} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n static set(out: Vec4Like, x: number, y: number, z: number, w: number): Vec4Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n out[3] = a[3] * b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Divides two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n out[3] = a[3] / b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n out[3] = Math.ceil(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n out[3] = Math.floor(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n out[3] = Math.min(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n out[3] = Math.max(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n out[2] = Math.round(a[2]);\r\n out[3] = Math.round(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec4} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec4Like, a: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}'s after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec4Like, a: Readonly, b: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return Math.hypot(x, y, z, w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of `a`\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = -a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n out[3] = 1.0 / a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n out[3] = Math.abs(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec4Like, a: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n let len = x * x + y * y + z * z + w * w;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = x * len;\r\n out[1] = y * len;\r\n out[2] = z * len;\r\n out[3] = w * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Returns the cross-product of three vectors in a 4-dimensional space\r\n * @category Static\r\n *\r\n * @param out the receiving vector\r\n * @param u - the first vector\r\n * @param v - the second vector\r\n * @param w - the third vector\r\n * @returns result\r\n */\r\n static cross(out: Vec4Like, u: Readonly, v: Readonly, w: Readonly): Vec4Like {\r\n const a = v[0] * w[1] - v[1] * w[0];\r\n const b = v[0] * w[2] - v[2] * w[0];\r\n const c = v[0] * w[3] - v[3] * w[0];\r\n const d = v[1] * w[2] - v[2] * w[1];\r\n const e = v[1] * w[3] - v[3] * w[1];\r\n const f = v[2] * w[3] - v[3] * w[2];\r\n const g = u[0];\r\n const h = u[1];\r\n const i = u[2];\r\n const j = u[3];\r\n\r\n out[0] = h * f - i * e + j * d;\r\n out[1] = -(g * f) + i * c - j * b;\r\n out[2] = g * e - h * c + j * a;\r\n out[3] = -(g * d) + h * b - i * a;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec4Like, a: Readonly, b: Readonly, t: number): Vec4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n out[3] = aw + t * (b[3] - aw);\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec4Like, scale): Vec4Like {\r\n scale = scale || 1.0;\r\n\r\n // Marsaglia, George. Choosing a Point from the Surface of a\r\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\r\n // http://projecteuclid.org/euclid.aoms/1177692644;\r\n var v1, v2, v3, v4;\r\n var s1, s2;\r\n do {\r\n v1 = glMatrix.RANDOM() * 2 - 1;\r\n v2 = glMatrix.RANDOM() * 2 - 1;\r\n s1 = v1 * v1 + v2 * v2;\r\n } while (s1 >= 1);\r\n do {\r\n v3 = glMatrix.RANDOM() * 2 - 1;\r\n v4 = glMatrix.RANDOM() * 2 - 1;\r\n s2 = v3 * v3 + v4 * v4;\r\n } while (s2 >= 1);\r\n\r\n var d = Math.sqrt((1 - s1) / s2);\r\n out[0] = scale * v1;\r\n out[1] = scale * v2;\r\n out[2] = scale * v3 * d;\r\n out[3] = scale * v4 * d;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Mat4}.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec4Like, a: Readonly, m: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\r\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\r\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\r\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec4Like, a: Readonly, q: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n\r\n // calculate quat * vec\r\n const ix = qw * x + qy * z - qz * y;\r\n const iy = qw * y + qz * x - qx * z;\r\n const iz = qw * z + qx * y - qy * x;\r\n const iw = -qx * x - qy * y - qz * z;\r\n\r\n // calculate result * inverse quat\r\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\r\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\r\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec4Like): Vec4Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec4(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec4.prototype.sub = Vec4.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.mul = Vec4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.div = Vec4.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.dist = Vec4.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.sqrDist = Vec4.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec4.sub = Vec4.subtract;\r\nVec4.mul = Vec4.multiply;\r\nVec4.div = Vec4.divide;\r\nVec4.dist = Vec4.distance;\r\nVec4.sqrDist = Vec4.squaredDistance;\r\nVec4.sqrLen = Vec4.squaredLength;\r\nVec4.mag = Vec4.magnitude;\r\nVec4.length = Vec4.magnitude;\r\nVec4.len = Vec4.magnitude;\r\n", "import { Vec3 } from './Vec3.js';\r\nimport { Vec4 } from './Vec4.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Quaternion\r\n */\r\nexport class Quat extends Float64Array {\r\n static #DEFAULT_ANGLE_ORDER = 'zyx';\r\n\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT1 = new Float64Array(4);\r\n static #TMP_QUAT2 = new Float64Array(4);\r\n static #TMP_MAT3 = new Float64Array(9);\r\n\r\n static #TMP_VEC3 = new Float64Array(3);\r\n static #X_UNIT_VEC3 = new Float64Array([1, 0, 0]);\r\n static #Y_UNIT_VEC3 = new Float64Array([0, 1, 0]);\r\n\r\n /**\r\n * Create a {@link Quat}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the quaternion. Equivalent to `this[0];`\r\n * @category Quaternion Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the quaternion. Equivalent to `this[1];`\r\n * @category Quaternion Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the quaternion. Equivalent to `this[2];`\r\n * @category Quaternion Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the quaternion. Equivalent to `this[3];`\r\n * @category Quaternion Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Quat.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity quaternion\r\n * Equivalent to Quat.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this[0] = 0;\r\n this[1] = 0;\r\n this[2] = 0;\r\n this[3] = 1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies `this` by a {@link Quat}.\r\n * Equivalent to `Quat.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Quat.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Rotates `this` by the given angle about the X axis\r\n * Equivalent to `Quat.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Quat.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Y axis\r\n * Equivalent to `Quat.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Quat.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Z axis\r\n * Equivalent to `Quat.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Quat.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Inverts `this`\r\n * Equivalent to `Quat.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Quat.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales `this` by a scalar number\r\n * Equivalent to `Quat.scale(this, this, scale);`\r\n * @category Methods\r\n *\r\n * @param scale - amount to scale the vector by\r\n * @returns `this`\r\n */\r\n scale(scale: number): QuatLike {\r\n this[0] *= scale;\r\n this[1] *= scale;\r\n this[2] *= scale;\r\n this[3] *= scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of `this` and another {@link Quat}\r\n * Equivalent to `Quat.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - the second operand\r\n * @returns dot product of `this` and b\r\n */\r\n dot(b: Readonly): number {\r\n return Quat.dot(this, b);\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity quat\r\n * @category Static\r\n *\r\n * @returns a new quaternion\r\n */\r\n static create(): Quat {\r\n return new Quat();\r\n }\r\n\r\n /**\r\n * Set a quat to the identity quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a quat from the given angle and rotation axis,\r\n * then returns it.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param axis - the axis around which to rotate\r\n * @param rad - the angle in radians\r\n * @returns `out`\r\n **/\r\n static setAxisAngle(out: QuatLike, axis: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n out[0] = s * axis[0];\r\n out[1] = s * axis[1];\r\n out[2] = s * axis[2];\r\n out[3] = Math.cos(rad);\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the rotation axis and angle for a given\r\n * quaternion. If a quaternion is created with\r\n * setAxisAngle, this method will return the same\r\n * values as provided in the original parameter list\r\n * OR functionally equivalent values.\r\n * Example: The quaternion formed by axis [0, 0, 1] and\r\n * angle -90 is the same as the quaternion formed by\r\n * [0, 0, 1] and 270. This method favors the latter.\r\n * @category Static\r\n *\r\n * @param out_axis - Vector receiving the axis of rotation\r\n * @param q - Quaternion to be decomposed\r\n * @return Angle, in radians, of the rotation\r\n */\r\n static getAxisAngle(out_axis: Vec3Like, q: Readonly): number {\r\n const rad = Math.acos(q[3]) * 2.0;\r\n const s = Math.sin(rad / 2.0);\r\n if (s > GLM_EPSILON) {\r\n out_axis[0] = q[0] / s;\r\n out_axis[1] = q[1] / s;\r\n out_axis[2] = q[2] / s;\r\n } else {\r\n // If s is zero, return any axis (no rotation - axis does not matter)\r\n out_axis[0] = 1;\r\n out_axis[1] = 0;\r\n out_axis[2] = 0;\r\n }\r\n return rad;\r\n }\r\n\r\n /**\r\n * Gets the angular distance between two unit quaternions\r\n * @category Static\r\n *\r\n * @param {ReadonlyQuat} a Origin unit quaternion\r\n * @param {ReadonlyQuat} b Destination unit quaternion\r\n * @return {Number} Angle, in radians, between the two quaternions\r\n */\r\n static getAngle(a: Readonly, b: Readonly): number {\r\n const dotproduct = Quat.dot(a, b);\r\n\r\n return Math.acos(2 * dotproduct * dotproduct - 1);\r\n }\r\n\r\n /**\r\n * Multiplies two quaternions.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const bw = b[3];\r\n\r\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the X axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + aw * bx;\r\n out[1] = ay * bw + az * bx;\r\n out[2] = az * bw - ay * bx;\r\n out[3] = aw * bw - ax * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Y axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const by = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw - az * by;\r\n out[1] = ay * bw + aw * by;\r\n out[2] = az * bw + ax * by;\r\n out[3] = aw * bw - ay * by;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Z axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bz = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + ay * bz;\r\n out[1] = ay * bw - ax * bz;\r\n out[2] = az * bw + aw * bz;\r\n out[3] = aw * bw - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the W component of a quat from the X, Y, and Z components.\r\n * Assumes that quaternion is 1 unit in length.\r\n * Any existing W component will be ignored.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate W component of\r\n * @returns `out`\r\n */\r\n static calculateW(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the exponential of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static exp(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const et = Math.exp(w);\r\n const s = r > 0 ? (et * Math.sin(r)) / r : 0;\r\n\r\n out[0] = x * s;\r\n out[1] = y * s;\r\n out[2] = z * s;\r\n out[3] = et * Math.cos(r);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the natural logarithm of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static ln(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const t = r > 0 ? Math.atan2(r, w) / r : 0;\r\n\r\n out[0] = x * t;\r\n out[1] = y * t;\r\n out[2] = z * t;\r\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the scalar power of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @param b - amount to scale the quaternion by\r\n * @returns `out`\r\n */\r\n static pow(out: QuatLike, a: Readonly, b: number): QuatLike {\r\n Quat.ln(out, a);\r\n Quat.scale(out, out, b);\r\n Quat.exp(out, out);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike {\r\n // benchmarks:\r\n // http://jsperf.com/quaternion-slerp-implementations\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2],\r\n aw = a[3];\r\n let bx = b[0],\r\n by = b[1],\r\n bz = b[2],\r\n bw = b[3];\r\n\r\n let scale0: number;\r\n let scale1: number;\r\n\r\n // calc cosine\r\n let cosom = ax * bx + ay * by + az * bz + aw * bw;\r\n // adjust signs (if necessary)\r\n if (cosom < 0.0) {\r\n cosom = -cosom;\r\n bx = -bx;\r\n by = -by;\r\n bz = -bz;\r\n bw = -bw;\r\n }\r\n // calculate coefficients\r\n if (1.0 - cosom > GLM_EPSILON) {\r\n // standard case (slerp)\r\n const omega = Math.acos(cosom);\r\n const sinom = Math.sin(omega);\r\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\r\n scale1 = Math.sin(t * omega) / sinom;\r\n } else {\r\n // \"from\" and \"to\" quaternions are very close\r\n // ... so we can do a linear interpolation\r\n scale0 = 1.0 - t;\r\n scale1 = t;\r\n }\r\n // calculate final values\r\n out[0] = scale0 * ax + scale1 * bx;\r\n out[1] = scale0 * ay + scale1 * by;\r\n out[2] = scale0 * az + scale1 * bz;\r\n out[3] = scale0 * aw + scale1 * bw;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random unit quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n /* static random(out: QuatLike): QuatLike {\r\n // Implementation of http://planning.cs.uiuc.edu/node198.html\r\n // TODO: Calling random 3 times is probably not the fastest solution\r\n let u1 = glMatrix.RANDOM();\r\n let u2 = glMatrix.RANDOM();\r\n let u3 = glMatrix.RANDOM();\r\n\r\n let sqrt1MinusU1 = Math.sqrt(1 - u1);\r\n let sqrtU1 = Math.sqrt(u1);\r\n\r\n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\r\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\r\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\r\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Calculates the inverse of a quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: QuatLike, a: Readonly): QuatLike {\r\n const a0 = a[0],\r\n a1 = a[1],\r\n a2 = a[2],\r\n a3 = a[3];\r\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\r\n const invDot = dot ? 1.0 / dot : 0;\r\n\r\n // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\r\n\r\n out[0] = -a0 * invDot;\r\n out[1] = -a1 * invDot;\r\n out[2] = -a2 * invDot;\r\n out[3] = a3 * invDot;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a quat\r\n * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given 3x3 rotation matrix.\r\n *\r\n * NOTE: The resultant quaternion is not normalized, so you should be sure\r\n * to re-normalize the quaternion yourself where necessary.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param m - rotation matrix\r\n * @returns `out`\r\n */\r\n static fromMat3(out: QuatLike, m: Readonly): QuatLike {\r\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\r\n // article \"Quaternion Calculus and Fast Animation\".\r\n const fTrace = m[0] + m[4] + m[8];\r\n let fRoot: number;\r\n\r\n if (fTrace > 0.0) {\r\n // |w| > 1/2, may as well choose w > 1/2\r\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\r\n out[3] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot; // 1/(4w)\r\n out[0] = (m[5] - m[7]) * fRoot;\r\n out[1] = (m[6] - m[2]) * fRoot;\r\n out[2] = (m[1] - m[3]) * fRoot;\r\n } else {\r\n // |w| <= 1/2\r\n let i = 0;\r\n if (m[4] > m[0]) { i = 1; }\r\n if (m[8] > m[i * 3 + i]) { i = 2; }\r\n const j = (i + 1) % 3;\r\n const k = (i + 2) % 3;\r\n\r\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\r\n out[i] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot;\r\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\r\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\r\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given euler angle x, y, z.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - Angle to rotate around X axis in degrees.\r\n * @param y - Angle to rotate around Y axis in degrees.\r\n * @param z - Angle to rotate around Z axis in degrees.\r\n * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx.\r\n * @returns `out`\r\n */\r\n static fromEuler(out: QuatLike, x: number, y: number, z: number, order = Quat.#DEFAULT_ANGLE_ORDER): QuatLike {\r\n const halfToRad = (0.5 * Math.PI) / 180.0;\r\n x *= halfToRad;\r\n y *= halfToRad;\r\n z *= halfToRad;\r\n\r\n const sx = Math.sin(x);\r\n const cx = Math.cos(x);\r\n const sy = Math.sin(y);\r\n const cy = Math.cos(y);\r\n const sz = Math.sin(z);\r\n const cz = Math.cos(z);\r\n\r\n switch (order) {\r\n case 'xyz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'xzy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yxz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yzx':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zxy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zyx':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n default:\r\n throw new Error(`Unknown angle order ${order}`);\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a quatenion\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - quaternion to clone\r\n * @returns a new quaternion\r\n */\r\n static clone(a: Readonly): Quat {\r\n return new Quat(a);\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new quaternion\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Quat {\r\n return new Quat(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one quat to another\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the source quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static set(out: QuatLike, x: number, y: number, z: number, w: number): QuatLike { return out; }\r\n\r\n /**\r\n * Adds two {@link Quat}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static add(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Scales a quat by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param b - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: QuatLike, a: Readonly, scale: number): QuatLike {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two quat's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two quat's\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static lerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike { return out; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mag(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quaternion to normalize\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static normalize(out: QuatLike, a: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first quaternion.\r\n * @param b - The second quaternion.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static exactEquals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Returns whether the quaternions have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static equals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Sets a quaternion to represent the shortest rotation from one\r\n * vector to another.\r\n *\r\n * Both vectors are assumed to be unit length.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion.\r\n * @param a - the initial vector\r\n * @param b - the destination vector\r\n * @returns `out`\r\n */\r\n static rotationTo(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const dot = Vec3.dot(a, b);\r\n\r\n if (dot < -0.999999) {\r\n Vec3.cross(Quat.#TMP_VEC3, Quat.#X_UNIT_VEC3, a);\r\n if (Vec3.mag(Quat.#TMP_VEC3) < 0.000001) { Vec3.cross(Quat.#TMP_VEC3, Quat.#Y_UNIT_VEC3, a); }\r\n Vec3.normalize(Quat.#TMP_VEC3, Quat.#TMP_VEC3);\r\n Quat.setAxisAngle(out, Quat.#TMP_VEC3, Math.PI);\r\n return out;\r\n } else if (dot > 0.999999) {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n } else {\r\n Vec3.cross(Quat.#TMP_VEC3, a, b);\r\n out[0] = Quat.#TMP_VEC3[0];\r\n out[1] = Quat.#TMP_VEC3[1];\r\n out[2] = Quat.#TMP_VEC3[2];\r\n out[3] = 1 + dot;\r\n return Quat.normalize(out, out);\r\n }\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static sqlerp(out: QuatLike, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): QuatLike {\r\n Quat.slerp(Quat.#TMP_QUAT1, a, d, t);\r\n Quat.slerp(Quat.#TMP_QUAT2, b, c, t);\r\n Quat.slerp(out, Quat.#TMP_QUAT1, Quat.#TMP_QUAT2, 2 * t * (1 - t));\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets the specified quaternion with values corresponding to the given\r\n * axes. Each axis is a vec3 and is expected to be unit length and\r\n * perpendicular to all other specified axes.\r\n * @category Static\r\n *\r\n * @param out - The receiving quaternion\r\n * @param view - the vector representing the viewing direction\r\n * @param right - the vector representing the local `right` direction\r\n * @param up - the vector representing the local `up` direction\r\n * @returns `out`\r\n */\r\n static setAxes(out: QuatLike, view: Readonly, right: Readonly, up: Readonly): QuatLike {\r\n Quat.#TMP_MAT3[0] = right[0];\r\n Quat.#TMP_MAT3[3] = right[1];\r\n Quat.#TMP_MAT3[6] = right[2];\r\n\r\n Quat.#TMP_MAT3[1] = up[0];\r\n Quat.#TMP_MAT3[4] = up[1];\r\n Quat.#TMP_MAT3[7] = up[2];\r\n\r\n Quat.#TMP_MAT3[2] = -view[0];\r\n Quat.#TMP_MAT3[5] = -view[1];\r\n Quat.#TMP_MAT3[8] = -view[2];\r\n\r\n return Quat.normalize(out, Quat.fromMat3(out, Quat.#TMP_MAT3));\r\n }\r\n}\r\n\r\n// Methods which re-use the Vec4 implementation\r\nQuat.set = Vec4.set;\r\nQuat.add = Vec4.add;\r\nQuat.lerp = Vec4.lerp;\r\nQuat.normalize = Vec4.normalize;\r\nQuat.squaredLength = Vec4.squaredLength;\r\nQuat.sqrLen = Vec4.squaredLength;\r\nQuat.exactEquals = Vec4.exactEquals;\r\nQuat.equals = Vec4.equals;\r\nQuat.magnitude = Vec4.magnitude;\r\n\r\n// Instance method alias assignments\r\nQuat.prototype.mul = Quat.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nQuat.mul = Quat.multiply;\r\nQuat.mag = Quat.magnitude;\r\nQuat.length = Quat.magnitude;\r\nQuat.len = Quat.magnitude;\r\n", "import { Mat4 } from './Mat4.js';\r\nimport { Quat } from './Quat.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Dual Quaternion\r\n */\r\nexport class Quat2 extends Float64Array {\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat2.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT = new Float64Array(4);\r\n static #TMP_VEC3 = new Float64Array(3);\r\n\r\n /**\r\n * Create a {@link Quat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 8:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 8); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v, v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 8);\r\n }\r\n break;\r\n }\r\n default:\r\n super(8);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source dual quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 8 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity {@link Quat2}\r\n * @category Static\r\n *\r\n * @returns a new dual quaternion [real -> rotation, dual -> translation]\r\n */\r\n static create(): Quat2 {\r\n return new Quat2();\r\n }\r\n\r\n /**\r\n * Creates a {@link Quat2} quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to clone\r\n * @returns a new dual quaternion\r\n */\r\n static clone(a: Quat2Like): Quat2 {\r\n return new Quat2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns a new dual quaternion\r\n */\r\n static fromValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2 {\r\n return new Quat2(x1, y1, z1, w1, x2, y2, z2, w2);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} from the given values (quat and translation)\r\n * @category Static\r\n *\r\n * @param x1 - X component (rotation)\r\n * @param y1 - Y component (rotation)\r\n * @param z1 - Z component (rotation)\r\n * @param w1 - W component (rotation)\r\n * @param x2 - X component (translation)\r\n * @param y2 - Y component (translation)\r\n * @param z2 - Z component (translation)\r\n * @returns a new dual quaternion\r\n */\r\n static fromRotationTranslationValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number): Quat2 {\r\n const ax = x2 * 0.5;\r\n const ay = y2 * 0.5;\r\n const az = z2 * 0.5;\r\n\r\n return new Quat2(x1, y1, z1, w1,\r\n ax * w1 + ay * z1 - az * y1,\r\n ay * w1 + az * x1 - ax * z1,\r\n az * w1 + ax * y1 - ay * x1,\r\n -ax * x1 - ay * y1 - az * z1);\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion and a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Quat2Like, q: Readonly, t: Readonly): Quat2Like {\r\n const ax = t[0] * 0.5;\r\n const ay = t[1] * 0.5;\r\n const az = t[2] * 0.5;\r\n const bx = q[0];\r\n const by = q[1];\r\n const bz = q[2];\r\n const bw = q[3];\r\n out[0] = bx;\r\n out[1] = by;\r\n out[2] = bz;\r\n out[3] = bw;\r\n out[4] = ax * bw + ay * bz - az * by;\r\n out[5] = ay * bw + az * bx - ax * bz;\r\n out[6] = az * bw + ax * by - ay * bx;\r\n out[7] = -ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Quat2Like, t: Readonly): Quat2Like {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = t[0] * 0.5;\r\n out[5] = t[1] * 0.5;\r\n out[6] = t[2] * 0.5;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Quat2Like, q: Readonly): Quat2Like {\r\n out[0] = q[0];\r\n out[1] = q[1];\r\n out[2] = q[2];\r\n out[3] = q[3];\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param a - the matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Quat2Like, a: Readonly): Quat2Like {\r\n Mat4.getRotation(Quat2.#TMP_QUAT, a);\r\n Mat4.getTranslation(Quat2.#TMP_VEC3, a);\r\n return Quat2.fromRotationTranslation(out, Quat2.#TMP_QUAT, Quat2.#TMP_VEC3);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Quat2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the source dual quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Quat2} to the identity dual quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns `out`\r\n */\r\n static set(out: Quat2Like, x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2Like {\r\n out[0] = x1;\r\n out[1] = y1;\r\n out[2] = z1;\r\n out[3] = w1;\r\n out[4] = x2;\r\n out[5] = y2;\r\n out[6] = z2;\r\n out[7] = w2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the real part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - real part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getReal(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Gets the dual part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - dual part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getDual(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[4];\r\n out[1] = a[5];\r\n out[2] = a[6];\r\n out[3] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the real component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the real part\r\n * @return `out`\r\n */\r\n static setReal(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Set the dual component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the dual part\r\n * @return `out`\r\n */\r\n static setDual(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[4] = a[0];\r\n out[5] = a[1];\r\n out[6] = a[2];\r\n out[7] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the translation of a normalized {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving translation vector\r\n * @param a - Dual Quaternion to be decomposed\r\n * @return `out`\r\n */\r\n static getTranslation(out: Vec3Like, a: Readonly): Vec3Like {\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Translates a {@link Quat2} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Quat2Like, a: Readonly, v: Readonly): Quat2Like {\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n const bx1 = v[0] * 0.5;\r\n const by1 = v[1] * 0.5;\r\n const bz1 = v[2] * 0.5;\r\n const ax2 = a[4];\r\n const ay2 = a[5];\r\n const az2 = a[6];\r\n const aw2 = a[7];\r\n out[0] = ax1;\r\n out[1] = ay1;\r\n out[2] = az1;\r\n out[3] = aw1;\r\n out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2;\r\n out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2;\r\n out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2;\r\n out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateX(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateY(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateZ(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (a * q)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param q - quaternion to rotate by\r\n * @returns `out`\r\n */\r\n static rotateByQuatAppend(out: Quat2Like, a: Readonly, q: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let ax = a[0];\r\n let ay = a[1];\r\n let az = a[2];\r\n let aw = a[3];\r\n\r\n out[0] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[1] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[2] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[3] = aw * qw - ax * qx - ay * qy - az * qz;\r\n ax = a[4];\r\n ay = a[5];\r\n az = a[6];\r\n aw = a[7];\r\n out[4] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[5] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[6] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[7] = aw * qw - ax * qx - ay * qy - az * qz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (q * a)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param q - quaternion to rotate by\r\n * @param a - the dual quaternion to rotate\r\n * @returns `out`\r\n */\r\n static rotateByQuatPrepend(out: Quat2Like, q: Readonly, a: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let bx = a[0];\r\n let by = a[1];\r\n let bz = a[2];\r\n let bw = a[3];\r\n\r\n out[0] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[1] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[2] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[3] = qw * bw - qx * bx - qy * by - qz * bz;\r\n bx = a[4];\r\n by = a[5];\r\n bz = a[6];\r\n bw = a[7];\r\n out[4] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[5] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[6] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[7] = qw * bw - qx * bx - qy * by - qz * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around a given axis. Does the normalization automatically\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param axis - the axis to rotate around\r\n * @param rad - how far the rotation should be\r\n * @returns `out`\r\n */\r\n static rotateAroundAxis(out: Quat2Like, a: Readonly, axis: Readonly, rad: number): Quat2Like {\r\n // Special case for rad = 0\r\n if (Math.abs(rad) < GLM_EPSILON) {\r\n return Quat2.copy(out, a);\r\n }\r\n const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);\r\n\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n const bx = (s * axis[0]) / axisLength;\r\n const by = (s * axis[1]) / axisLength;\r\n const bz = (s * axis[2]) / axisLength;\r\n const bw = Math.cos(rad);\r\n\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n out[4] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[5] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[6] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[7] = aw * bw - ax * bx - ay * by - az * bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns {quat2} out\r\n */\r\n static multiply(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n const ax0 = a[0];\r\n const ay0 = a[1];\r\n const az0 = a[2];\r\n const aw0 = a[3];\r\n const bx1 = b[4];\r\n const by1 = b[5];\r\n const bz1 = b[6];\r\n const bw1 = b[7];\r\n const ax1 = a[4];\r\n const ay1 = a[5];\r\n const az1 = a[6];\r\n const aw1 = a[7];\r\n const bx0 = b[0];\r\n const by0 = b[1];\r\n const bz0 = b[2];\r\n const bw0 = b[3];\r\n out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0;\r\n out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0;\r\n out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0;\r\n out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0;\r\n out[4] =\r\n ax0 * bw1 +\r\n aw0 * bx1 +\r\n ay0 * bz1 -\r\n az0 * by1 +\r\n ax1 * bw0 +\r\n aw1 * bx0 +\r\n ay1 * bz0 -\r\n az1 * by0;\r\n out[5] =\r\n ay0 * bw1 +\r\n aw0 * by1 +\r\n az0 * bx1 -\r\n ax0 * bz1 +\r\n ay1 * bw0 +\r\n aw1 * by0 +\r\n az1 * bx0 -\r\n ax1 * bz0;\r\n out[6] =\r\n az0 * bw1 +\r\n aw0 * bz1 +\r\n ax0 * by1 -\r\n ay0 * bx1 +\r\n az1 * bw0 +\r\n aw1 * bz0 +\r\n ax1 * by0 -\r\n ay1 * bx0;\r\n out[7] =\r\n aw0 * bw1 -\r\n ax0 * bx1 -\r\n ay0 * by1 -\r\n az0 * bz1 +\r\n aw1 * bw0 -\r\n ax1 * bx0 -\r\n ay1 * by0 -\r\n az1 * bz0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like { return out; }\r\n\r\n /**\r\n * Scales a {@link Quat2} by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaterion\r\n * @param a - the dual quaternion to scale\r\n * @param b - scalar value to scale the dual quaterion by\r\n * @returns `out`\r\n */\r\n static scale(out: Quat2Like, a: Readonly, b: number): Quat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts)\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dot(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Quat2}s\r\n * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quat\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Quat2Like, a: Readonly, b: Readonly, t: number): Quat2Like {\r\n const mt = 1 - t;\r\n if (Quat2.dot(a, b) < 0) { t = -t; }\r\n\r\n out[0] = a[0] * mt + b[0] * t;\r\n out[1] = a[1] * mt + b[1] * t;\r\n out[2] = a[2] * mt + b[2] * t;\r\n out[3] = a[3] * mt + b[3] * t;\r\n out[4] = a[4] * mt + b[4] * t;\r\n out[5] = a[5] * mt + b[5] * t;\r\n out[6] = a[6] * mt + b[6] * t;\r\n out[7] = a[7] * mt + b[7] * t;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: Quat2Like, a: Readonly): Quat2Like {\r\n const sqlen = Quat2.squaredLength(a);\r\n out[0] = -a[0] / sqlen;\r\n out[1] = -a[1] / sqlen;\r\n out[2] = -a[2] / sqlen;\r\n out[3] = a[3] / sqlen;\r\n out[4] = -a[4] / sqlen;\r\n out[5] = -a[5] / sqlen;\r\n out[6] = -a[6] / sqlen;\r\n out[7] = a[7] / sqlen;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than\r\n * {@link Quat2.invert} and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n out[4] = -a[4];\r\n out[5] = -a[5];\r\n out[6] = -a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Quat2Like, a: Readonly): Quat2Like {\r\n let magnitude = Quat2.squaredLength(a);\r\n if (magnitude > 0) {\r\n magnitude = Math.sqrt(magnitude);\r\n\r\n const a0 = a[0] / magnitude;\r\n const a1 = a[1] / magnitude;\r\n const a2 = a[2] / magnitude;\r\n const a3 = a[3] / magnitude;\r\n\r\n const b0 = a[4];\r\n const b1 = a[5];\r\n const b2 = a[6];\r\n const b3 = a[7];\r\n\r\n const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3;\r\n\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n\r\n out[4] = (b0 - a0 * a_dot_b) / magnitude;\r\n out[5] = (b1 - a1 * a_dot_b) / magnitude;\r\n out[6] = (b2 - a2 * a_dot_b) / magnitude;\r\n out[7] = (b3 - a3 * a_dot_b) / magnitude;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat2(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7))\r\n );\r\n }\r\n}\r\n\r\n// Methods which re-use the Quat implementation\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.dot = Quat.dot;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.squaredLength = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.sqrLen = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.mag = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.length = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.len = Quat.magnitude;\r\n\r\n// Static method alias assignments\r\nQuat2.mul = Quat2.multiply;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Mat2dLike, Mat3Like, Mat4Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 2 Dimensional Vector\r\n */\r\nexport class Vec2 extends Float64Array {\r\n /**\r\n * Create a {@link Vec2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 2:{\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, values[1]!]);\r\n } else {\r\n super(v as ArrayBufferLike, values[1], 2);\r\n }\r\n break;\r\n }\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 2);\r\n }\r\n break;\r\n }\r\n default:\r\n super(2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec2.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n return Math.hypot(this[0], this[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec2.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n // Instead of zero(), use a.fill(0) for instances;\r\n\r\n /**\r\n * Adds a {@link Vec2} to `this`.\r\n * Equivalent to `Vec2.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec2} from `this`.\r\n * Equivalent to `Vec2.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec2.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec2.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec2.squaredDistance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec2.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec2.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec2.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec2}.\r\n * Equivalent to `Vec2.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec2.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec2.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 2 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec2}\r\n * @category Static\r\n *\r\n * @returns A new 2D vector\r\n */\r\n static create(): Vec2 {\r\n return new Vec2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - Vector to clone\r\n * @returns A new 2D vector\r\n */\r\n static clone(a: Readonly): Vec2 {\r\n return new Vec2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns A new 2D vector\r\n */\r\n static fromValues(x: number, y: number): Vec2 {\r\n return new Vec2(x, y);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - The source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns `out`\r\n */\r\n static set(out: Vec2Like, x: number, y: number): Vec2Like {\r\n out[0] = x;\r\n out[1] = y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Multiplies two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Divides two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec2} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to scale\r\n * @param b - Amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec2Like, a: Readonly, b: number): Vec2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two Vec2's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param scale - The amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec2Like, a: Readonly, b: Readonly, scale: number): Vec2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns distance between `a` and `b`\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n return Math.hypot(b[0] - a[0], b[1] - a[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Squared distance between `a` and `b`\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return Math.sqrt(x * x + y * y);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate squared length of\r\n * @returns Squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec2Like, a: Readonly) {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec2Like, a: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n let len = x * x + y * y;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Dot product of `a` and `b`\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two {@link Vec2}s\r\n * Note that the cross product must by definition produce a 3D vector.\r\n * For this reason there is also not instance equivalent for this function.\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n const z = a[0] * b[1] - a[1] * b[0];\r\n out[0] = out[1] = 0;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param t - Interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec2Like, a: Readonly, b: Readonly, t: number): Vec2Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y;\r\n out[1] = m[1] * x + m[3] * y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2d}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2d(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y + m[4];\r\n out[1] = m[1] * x + m[3] * y + m[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat3}\r\n * 3rd vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat3(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[3] * y + m[6];\r\n out[1] = m[1] * x + m[4] * y + m[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat4}\r\n * 3rd vector component is implicitly '0'\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat4(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[4] * y + m[12];\r\n out[1] = m[1] * x + m[5] * y + m[13];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 2D vector\r\n * @category Static\r\n *\r\n * @param out - The receiving {@link Vec2}\r\n * @param a - The {@link Vec2} point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotate(out: Vec2Like, a: Readonly, b: Readonly, rad: number): Vec2Like {\r\n // Translate point to the origin\r\n const p0 = a[0] - b[0];\r\n const p1 = a[1] - b[1];\r\n const sinC = Math.sin(rad);\r\n const cosC = Math.cos(rad);\r\n\r\n // perform rotation and translate to correct position\r\n out[0] = p0 * cosC - p1 * sinC + b[0];\r\n out[1] = p0 * sinC + p1 * cosC + b[1];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 2D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly): number {\r\n const x1 = a[0];\r\n const y1 = a[1];\r\n const x2 = b[0];\r\n const y2 = b[1];\r\n // mag is the product of the magnitudes of a and b\r\n const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2);\r\n // mag &&.. short circuits if mag == 0\r\n const cosine = mag && (x1 * x2 + y1 * y2) / mag;\r\n // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to zero\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec2Like): Vec2Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors components are ===, `false` otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors are approximately equal, `false` otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - Vector to represent as a string\r\n * @returns String representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec2.prototype.sub = Vec2.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.mul = Vec2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.div = Vec2.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.dist = Vec2.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.sqrDist = Vec2.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec2.sub = Vec2.subtract;\r\nVec2.mul = Vec2.multiply;\r\nVec2.div = Vec2.divide;\r\nVec2.dist = Vec2.distance;\r\nVec2.sqrDist = Vec2.squaredDistance;\r\nVec2.sqrLen = Vec2.squaredLength;\r\nVec2.mag = Vec2.magnitude;\r\nVec2.length = Vec2.magnitude;\r\nVec2.len = Vec2.magnitude;\r\n", "/**\r\n * To enable additional swizzle accessors for vector classes (64-bit) invoke the {@link EnableSwizzlesF64} function from\r\n * the `gl-matrix/swizzle/f64` sub-path export. To enable ambient module declarations for IDE / Typescript support\r\n * please see {@link gl-matrix/types/swizzle/f64}.\r\n *\r\n * To enable swizzling for the 32-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle}.\r\n *\r\n * @example\r\n * ```ts\r\n * import { Vec3 } from 'gl-matrix/f64';\r\n * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64';\r\n *\r\n * EnableSwizzlesF64();\r\n *\r\n * const vec = new Vec3(0, 1, 2);\r\n * const vecSwizzled = vec.zyx; // Returns a new Vec3(2, 1, 0).\r\n * ```\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\nimport { Vec2, Vec3, Vec4 } from '#gl-matrix/f64';\r\n\r\n/**\r\n * Internal `gl-matrix` variable tracking if swizzling is enabled (64-bit).\r\n */\r\nlet GLM_SWIZZLES_ENABLED_F64 = false;\r\n\r\n/**\r\n * Enables Swizzle operations on {@link gl-matrix/f64.Vec2 | Vec2} / {@link gl-matrix/f64.Vec3 | Vec3} /\r\n * {@link gl-matrix/f64.Vec4 | Vec4} types from {@link gl-matrix/f64} (64-bit).\r\n *\r\n * Swizzle operations are performed by using the `.` operator in conjunction with any combination\r\n * of between two and four component names, either from the set `xyzw` or `rgbw` (though not intermixed).\r\n * They return a new vector with the same number of components as specified in the swizzle attribute.\r\n *\r\n * @example\r\n * ```js\r\n * import { Vec3 } from 'gl-matrix/f64';\r\n * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64';\r\n *\r\n * EnableSwizzlesF64();\r\n *\r\n * let v = new Vec3(0, 1, 2);\r\n *\r\n * v.yx; // returns new Vec2(1, 0)\r\n * v.xzy; // returns new Vec3(0, 2, 1)\r\n * v.zyxz; // returns new Vec4(2, 1, 0, 2)\r\n *\r\n * v.rgb; // returns new Vec3(0, 1, 2)\r\n * v.rbg; // returns new Vec3(0, 2, 1)\r\n * v.gg; // returns new Vec2(1, 1)\r\n * ```\r\n */\r\nexport function EnableSwizzlesF64(): void {\r\n /* v8 ignore next 1 */\r\n if (GLM_SWIZZLES_ENABLED_F64) { return; }\r\n\r\n /* eslint-disable comma-spacing, max-len */\r\n\r\n // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should\r\n // not be modified by hand.\r\n // [Swizzle Autogen]\r\n\r\n const VEC2_SWIZZLES = ['xx','xy','yx','yy','xxx','xxy','xyx','xyy','yxx','yxy','yyx','yyy','xxxx','xxxy','xxyx','xxyy','xyxx','xyxy','xyyx','xyyy','yxxx','yxxy','yxyx','yxyy','yyxx','yyxy','yyyx','yyyy','rr','rg','gr','gg','rrr','rrg','rgr','rgg','grr','grg','ggr','ggg','rrrr','rrrg','rrgr','rrgg','rgrr','rgrg','rggr','rggg','grrr','grrg','grgr','grgg','ggrr','ggrg','gggr','gggg'];\r\n const VEC3_SWIZZLES = ['xz','yz','zx','zy','zz','xxz','xyz','xzx','xzy','xzz','yxz','yyz','yzx','yzy','yzz','zxx','zxy','zxz','zyx','zyy','zyz','zzx','zzy','zzz','xxxz','xxyz','xxzx','xxzy','xxzz','xyxz','xyyz','xyzx','xyzy','xyzz','xzxx','xzxy','xzxz','xzyx','xzyy','xzyz','xzzx','xzzy','xzzz','yxxz','yxyz','yxzx','yxzy','yxzz','yyxz','yyyz','yyzx','yyzy','yyzz','yzxx','yzxy','yzxz','yzyx','yzyy','yzyz','yzzx','yzzy','yzzz','zxxx','zxxy','zxxz','zxyx','zxyy','zxyz','zxzx','zxzy','zxzz','zyxx','zyxy','zyxz','zyyx','zyyy','zyyz','zyzx','zyzy','zyzz','zzxx','zzxy','zzxz','zzyx','zzyy','zzyz','zzzx','zzzy','zzzz','rb','gb','br','bg','bb','rrb','rgb','rbr','rbg','rbb','grb','ggb','gbr','gbg','gbb','brr','brg','brb','bgr','bgg','bgb','bbr','bbg','bbb','rrrb','rrgb','rrbr','rrbg','rrbb','rgrb','rggb','rgbr','rgbg','rgbb','rbrr','rbrg','rbrb','rbgr','rbgg','rbgb','rbbr','rbbg','rbbb','grrb','grgb','grbr','grbg','grbb','ggrb','gggb','ggbr','ggbg','ggbb','gbrr','gbrg','gbrb','gbgr','gbgg','gbgb','gbbr','gbbg','gbbb','brrr','brrg','brrb','brgr','brgg','brgb','brbr','brbg','brbb','bgrr','bgrg','bgrb','bggr','bggg','bggb','bgbr','bgbg','bgbb','bbrr','bbrg','bbrb','bbgr','bbgg','bbgb','bbbr','bbbg','bbbb'];\r\n const VEC4_SWIZZLES = ['xw','yw','zw','wx','wy','wz','ww','xxw','xyw','xzw','xwx','xwy','xwz','xww','yxw','yyw','yzw','ywx','ywy','ywz','yww','zxw','zyw','zzw','zwx','zwy','zwz','zww','wxx','wxy','wxz','wxw','wyx','wyy','wyz','wyw','wzx','wzy','wzz','wzw','wwx','wwy','wwz','www','xxxw','xxyw','xxzw','xxwx','xxwy','xxwz','xxww','xyxw','xyyw','xyzw','xywx','xywy','xywz','xyww','xzxw','xzyw','xzzw','xzwx','xzwy','xzwz','xzww','xwxx','xwxy','xwxz','xwxw','xwyx','xwyy','xwyz','xwyw','xwzx','xwzy','xwzz','xwzw','xwwx','xwwy','xwwz','xwww','yxxw','yxyw','yxzw','yxwx','yxwy','yxwz','yxww','yyxw','yyyw','yyzw','yywx','yywy','yywz','yyww','yzxw','yzyw','yzzw','yzwx','yzwy','yzwz','yzww','ywxx','ywxy','ywxz','ywxw','ywyx','ywyy','ywyz','ywyw','ywzx','ywzy','ywzz','ywzw','ywwx','ywwy','ywwz','ywww','zxxw','zxyw','zxzw','zxwx','zxwy','zxwz','zxww','zyxw','zyyw','zyzw','zywx','zywy','zywz','zyww','zzxw','zzyw','zzzw','zzwx','zzwy','zzwz','zzww','zwxx','zwxy','zwxz','zwxw','zwyx','zwyy','zwyz','zwyw','zwzx','zwzy','zwzz','zwzw','zwwx','zwwy','zwwz','zwww','wxxx','wxxy','wxxz','wxxw','wxyx','wxyy','wxyz','wxyw','wxzx','wxzy','wxzz','wxzw','wxwx','wxwy','wxwz','wxww','wyxx','wyxy','wyxz','wyxw','wyyx','wyyy','wyyz','wyyw','wyzx','wyzy','wyzz','wyzw','wywx','wywy','wywz','wyww','wzxx','wzxy','wzxz','wzxw','wzyx','wzyy','wzyz','wzyw','wzzx','wzzy','wzzz','wzzw','wzwx','wzwy','wzwz','wzww','wwxx','wwxy','wwxz','wwxw','wwyx','wwyy','wwyz','wwyw','wwzx','wwzy','wwzz','wwzw','wwwx','wwwy','wwwz','wwww','ra','ga','ba','ar','ag','ab','aa','rra','rga','rba','rar','rag','rab','raa','gra','gga','gba','gar','gag','gab','gaa','bra','bga','bba','bar','bag','bab','baa','arr','arg','arb','ara','agr','agg','agb','aga','abr','abg','abb','aba','aar','aag','aab','aaa','rrra','rrga','rrba','rrar','rrag','rrab','rraa','rgra','rgga','rgba','rgar','rgag','rgab','rgaa','rbra','rbga','rbba','rbar','rbag','rbab','rbaa','rarr','rarg','rarb','rara','ragr','ragg','ragb','raga','rabr','rabg','rabb','raba','raar','raag','raab','raaa','grra','grga','grba','grar','grag','grab','graa','ggra','ggga','ggba','ggar','ggag','ggab','ggaa','gbra','gbga','gbba','gbar','gbag','gbab','gbaa','garr','garg','garb','gara','gagr','gagg','gagb','gaga','gabr','gabg','gabb','gaba','gaar','gaag','gaab','gaaa','brra','brga','brba','brar','brag','brab','braa','bgra','bgga','bgba','bgar','bgag','bgab','bgaa','bbra','bbga','bbba','bbar','bbag','bbab','bbaa','barr','barg','barb','bara','bagr','bagg','bagb','baga','babr','babg','babb','baba','baar','baag','baab','baaa','arrr','arrg','arrb','arra','argr','argg','argb','arga','arbr','arbg','arbb','arba','arar','arag','arab','araa','agrr','agrg','agrb','agra','aggr','aggg','aggb','agga','agbr','agbg','agbb','agba','agar','agag','agab','agaa','abrr','abrg','abrb','abra','abgr','abgg','abgb','abga','abbr','abbg','abbb','abba','abar','abag','abab','abaa','aarr','aarg','aarb','aara','aagr','aagg','aagb','aaga','aabr','aabg','aabb','aaba','aaar','aaag','aaab','aaaa'];\r\n\r\n // [/Swizzle Autogen]\r\n\r\n /* eslint-enable comma-spacing, max-len */\r\n\r\n /**\r\n * Internal swizzle index table for `gl-matrix`.\r\n */\r\n const SWIZZLE_INDEX: Record = {\r\n x: 0, r: 0,\r\n y: 1, g: 1,\r\n z: 2, b: 2,\r\n w: 3, a: 3,\r\n };\r\n\r\n /**\r\n * Internal helper function to convert and return a `gl-matrix` vector by swizzle format.\r\n *\r\n * @param swizzle - Swizzle format to apply.\r\n * @returns {Vec2 | Vec3 | Vec4} New swizzled vector instance.\r\n */\r\n function getSwizzleImpl(swizzle: string): () => Vec2 | Vec3 | Vec4 {\r\n switch (swizzle.length) {\r\n case 2:\r\n return function(this: Float64Array) {\r\n return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]);\r\n };\r\n case 3:\r\n return function(this: Float64Array) {\r\n return new Vec3(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]]);\r\n };\r\n case 4:\r\n return function(this: Float64Array) {\r\n return new Vec4(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]], this[SWIZZLE_INDEX[swizzle[3]]]);\r\n };\r\n }\r\n\r\n throw new Error('Illegal swizzle length');\r\n }\r\n\r\n for (const swizzle of VEC2_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec2.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC3_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC4_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n GLM_SWIZZLES_ENABLED_F64 = true;\r\n}\r\n", "/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_DEG_TO_RAD: number = Math.PI / 180;\r\n\r\n/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_RAD_TO_DEG: number = 180 / Math.PI;\r\n\r\n/**\r\n * Convert `radians` to `degrees`.\r\n *\r\n * @param value - Angle in `radians`.\r\n * @returns Angle in `degrees`.\r\n */\r\nexport function toDegree(value: number): number {\r\n return value * GLM_RAD_TO_DEG;\r\n}\r\n\r\n/**\r\n * Convert `degrees` to `radians`.\r\n *\r\n * @param value - Angle in `degrees`.\r\n * @returns Angle in `radians`.\r\n */\r\nexport function toRadian(value: number): number {\r\n return value * GLM_DEG_TO_RAD;\r\n}\r\n"], + "mappings": ";;;;;;;;;;;;AASO,IAAM,cAAc;;;ACT3B;AAOO,IAAM,QAAN,MAAM,cAAa,aAAa;AAA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,QAAQ;AACjB;", + "names": ["_TMP_VEC3", "_TMP_VEC3"] +} diff --git a/dist-cdn/esm/2016/gl-matrix-f64.min.js b/dist-cdn/esm/2016/gl-matrix-f64.min.js new file mode 100644 index 00000000..d1abd494 --- /dev/null +++ b/dist-cdn/esm/2016/gl-matrix-f64.min.js @@ -0,0 +1,6 @@ +// gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library. +// @author Brandon Jones +// @author Colin MacKenzie IV +// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md) +var de=A=>{throw TypeError(A)};var oe=(A,e,t)=>e.has(A)||de("Cannot "+t);var E=(A,e,t)=>(oe(A,e,"read from private field"),t?t.call(A):e.get(A)),Z=(A,e,t)=>e.has(A)?de("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(A):e.set(A,t);var ne,C=class C extends Float64Array{constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t]):super(t,0,4);break;default:super(E(C,ne));break}}get str(){return C.str(this)}copy(e){return this.set(e),this}identity(){return this.set(E(C,ne)),this}multiply(e){return C.multiply(this,this,e)}mul(e){return this}transpose(){return C.transpose(this,this)}invert(){return C.invert(this,this)}scale(e){return C.scale(this,this,e)}rotate(e){return C.rotate(this,this,e)}static get BYTE_LENGTH(){return 4*Float64Array.BYTES_PER_ELEMENT}static create(){return new C}static clone(e){return new C(e)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static fromValues(...e){return new C(...e)}static set(e,...t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}static transpose(e,t){if(e===t){let n=t[1];e[1]=t[2],e[2]=n}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*a-r*s;return i?(i=1/i,e[0]=a*i,e[1]=-s*i,e[2]=-r*i,e[3]=n*i,e):null}static adjoint(e,t){let n=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=n,e}static determinant(e){return e[0]*e[3]-e[2]*e[1]}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*c+a*y,e[1]=r*c+i*y,e[2]=s*L+a*k,e[3]=r*L+i*k,e}static mul(e,t,n){return e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+a*c,e[1]=r*y+i*c,e[2]=s*-c+a*y,e[3]=r*-c+i*y,e}static scale(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1];return e[0]=s*c,e[1]=r*c,e[2]=a*y,e[3]=i*y,e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=-n,e[3]=s,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3])}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e}static LDU(e,t,n,s){return e[2]=s[2]/s[0],n[0]=s[0],n[1]=s[1],n[3]=s[3]-e[2]*n[1],[e,t,n]}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=t[0],c=t[1],y=t[2],L=t[3];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(a-L)<=1e-6*Math.max(1,Math.abs(a),Math.abs(L))}static str(e){return`Mat2(${e.join(", ")})`}};ne=new WeakMap,Z(C,ne,new Float64Array([1,0,0,1]));var v=C;v.prototype.mul=v.prototype.multiply;v.mul=v.multiply;v.sub=v.subtract;var se,H=class H extends Float64Array{constructor(...e){switch(e.length){case 6:super(e);break;case 2:super(e[0],e[1],6);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t,t,t]):super(t,0,6);break;default:super(E(H,se));break}}get str(){return H.str(this)}copy(e){return this.set(e),this}identity(){return this.set(E(H,se)),this}multiply(e){return H.multiply(this,this,e)}mul(e){return this}translate(e){return H.translate(this,this,e)}rotate(e){return H.rotate(this,this,e)}scale(e){return H.scale(this,this,e)}static get BYTE_LENGTH(){return 6*Float64Array.BYTES_PER_ELEMENT}static create(){return new H}static clone(e){return new H(e)}static copy(e,t){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}static fromValues(...e){return new H(...e)}static set(e,...t){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}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=n*a-s*r;return y?(y=1/y,e[0]=a*y,e[1]=-s*y,e[2]=-r*y,e[3]=n*y,e[4]=(r*c-a*i)*y,e[5]=(s*i-n*c)*y,e):null}static determinant(e){return e[0]*e[3]-e[1]*e[2]}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1],l=n[2],M=n[3],h=n[4],b=n[5];return e[0]=s*L+a*k,e[1]=r*L+i*k,e[2]=s*l+a*M,e[3]=r*l+i*M,e[4]=s*h+a*b+c,e[5]=r*h+i*b+y,e}static mul(e,t,n){return e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=s*L+a*k+c,e[5]=r*L+i*k+y,e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=Math.sin(n),k=Math.cos(n);return e[0]=s*k+a*L,e[1]=r*k+i*L,e[2]=s*-L+a*k,e[3]=r*-L+i*k,e[4]=c,e[5]=y,e}static scale(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1];return e[0]=s*L,e[1]=r*L,e[2]=a*k,e[3]=i*k,e[4]=c,e[5]=y,e}static fromTranslation(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0],e[5]=t[1],e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=-n,e[3]=s,e[4]=0,e[5]=0,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e[4]=0,e[5]=0,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+1)}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=t[0],L=t[1],k=t[2],l=t[3],M=t[4],h=t[5];return Math.abs(n-y)<=1e-6*Math.max(1,Math.abs(n),Math.abs(y))&&Math.abs(s-L)<=1e-6*Math.max(1,Math.abs(s),Math.abs(L))&&Math.abs(r-k)<=1e-6*Math.max(1,Math.abs(r),Math.abs(k))&&Math.abs(a-l)<=1e-6*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(i-M)<=1e-6*Math.max(1,Math.abs(i),Math.abs(M))&&Math.abs(c-h)<=1e-6*Math.max(1,Math.abs(c),Math.abs(h))}static str(e){return`Mat2d(${e.join(", ")})`}};se=new WeakMap,Z(H,se,new Float64Array([1,0,0,1,0,0]));var _=H;_.mul=_.multiply;_.sub=_.subtract;var re,X=class X extends Float64Array{constructor(...e){switch(e.length){case 9:super(e);break;case 2:super(e[0],e[1],9);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t,t,t,t,t,t]):super(t,0,9);break;default:super(E(X,re));break}}get str(){return X.str(this)}copy(e){return this.set(e),this}identity(){return this.set(E(X,re)),this}multiply(e){return X.multiply(this,this,e)}mul(e){return this}transpose(){return X.transpose(this,this)}invert(){return X.invert(this,this)}translate(e){return X.translate(this,this,e)}rotate(e){return X.rotate(this,this,e)}scale(e){return X.scale(this,this,e)}static get BYTE_LENGTH(){return 9*Float64Array.BYTES_PER_ELEMENT}static create(){return new X}static clone(e){return new X(e)}static copy(e,t){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}static fromValues(...e){return new X(...e)}static set(e,...t){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}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static transpose(e,t){if(e===t){let n=t[1],s=t[2],r=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=s,e[7]=r}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=k*i-c*L,M=-k*a+c*y,h=L*a-i*y,b=n*l+s*M+r*h;return b?(b=1/b,e[0]=l*b,e[1]=(-k*s+r*L)*b,e[2]=(c*s-r*i)*b,e[3]=M*b,e[4]=(k*n-r*y)*b,e[5]=(-c*n+r*a)*b,e[6]=h*b,e[7]=(-L*n+s*y)*b,e[8]=(i*n-s*a)*b,e):null}static adjoint(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8];return e[0]=i*k-c*L,e[1]=r*L-s*k,e[2]=s*c-r*i,e[3]=c*y-a*k,e[4]=n*k-r*y,e[5]=r*a-n*c,e[6]=a*L-i*y,e[7]=s*y-n*L,e[8]=n*i-s*a,e}static determinant(e){let t=e[0],n=e[1],s=e[2],r=e[3],a=e[4],i=e[5],c=e[6],y=e[7],L=e[8];return t*(L*a-i*y)+n*(-L*r+i*c)+s*(y*r-a*c)}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=n[0],h=n[1],b=n[2];return e[0]=M*s+h*i+b*L,e[1]=M*r+h*c+b*k,e[2]=M*a+h*y+b*l,M=n[3],h=n[4],b=n[5],e[3]=M*s+h*i+b*L,e[4]=M*r+h*c+b*k,e[5]=M*a+h*y+b*l,M=n[6],h=n[7],b=n[8],e[6]=M*s+h*i+b*L,e[7]=M*r+h*c+b*k,e[8]=M*a+h*y+b*l,e}static mul(e,t,n){return e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=n[0],h=n[1];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=c,e[5]=y,e[6]=M*s+h*i+L,e[7]=M*r+h*c+k,e[8]=M*a+h*y+l,e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=Math.sin(n),h=Math.cos(n);return e[0]=h*s+M*i,e[1]=h*r+M*c,e[2]=h*a+M*y,e[3]=h*i-M*s,e[4]=h*c-M*r,e[5]=h*y-M*a,e[6]=L,e[7]=k,e[8]=l,e}static scale(e,t,n){let s=n[0],r=n[1];return e[0]=s*t[0],e[1]=s*t[1],e[2]=s*t[2],e[3]=r*t[3],e[4]=r*t[4],e[5]=r*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}static fromTranslation(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=0,e[3]=-n,e[4]=s,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static fromMat2d(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}static fromQuat(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n+n,c=s+s,y=r+r,L=n*i,k=s*i,l=s*c,M=r*i,h=r*c,b=r*y,d=a*i,m=a*c,o=a*y;return e[0]=1-l-b,e[3]=k-o,e[6]=M+m,e[1]=k+o,e[4]=1-L-b,e[7]=h-d,e[2]=M-m,e[5]=h+d,e[8]=1-L-l,e}static fromMat4(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}static normalFromMat4(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],M=t[10],h=t[11],b=t[12],d=t[13],m=t[14],o=t[15],V=n*c-s*i,x=n*y-r*i,R=n*L-a*i,z=s*y-r*c,g=s*L-a*c,B=r*L-a*y,D=k*d-l*b,F=k*m-M*b,p=k*o-h*b,Y=l*m-M*d,I=l*o-h*d,P=M*o-h*m,Q=V*P-x*I+R*Y+z*p-g*F+B*D;return Q?(Q=1/Q,e[0]=(c*P-y*I+L*Y)*Q,e[1]=(y*p-i*P-L*F)*Q,e[2]=(i*I-c*p+L*D)*Q,e[3]=(r*I-s*P-a*Y)*Q,e[4]=(n*P-r*p+a*F)*Q,e[5]=(s*p-n*I-a*D)*Q,e[6]=(d*B-m*g+o*z)*Q,e[7]=(m*R-b*B-o*x)*Q,e[8]=(b*g-d*R+o*V)*Q,e):null}static normalFromMat4Fast(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=i*k-k*L,e[1]=c*y-y*k,e[2]=a*L-L*y,e[3]=L*r-k*s,e[4]=k*n-y*r,e[5]=y*s-L*n,e[6]=s*c-r*i,e[7]=r*a-n*c,e[8]=n*i-s*a,e}static projection(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8])}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e[6]=t[6]+n[6]*s,e[7]=t[7]+n[7]*s,e[8]=t[8]+n[8]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=e[8],l=t[0],M=t[1],h=t[2],b=t[3],d=t[4],m=t[5],o=t[6],V=t[7],x=t[8];return Math.abs(n-l)<=1e-6*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(s-M)<=1e-6*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(r-h)<=1e-6*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(a-b)<=1e-6*Math.max(1,Math.abs(a),Math.abs(b))&&Math.abs(i-d)<=1e-6*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(c-m)<=1e-6*Math.max(1,Math.abs(c),Math.abs(m))&&Math.abs(y-o)<=1e-6*Math.max(1,Math.abs(y),Math.abs(o))&&Math.abs(L-V)<=1e-6*Math.max(1,Math.abs(L),Math.abs(V))&&Math.abs(k-x)<=1e-6*Math.max(1,Math.abs(k),Math.abs(x))}static str(e){return`Mat3(${e.join(", ")})`}};re=new WeakMap,Z(X,re,new Float64Array([1,0,0,0,1,0,0,0,1]));var u=X;u.prototype.mul=u.prototype.multiply;u.mul=u.multiply;u.sub=u.subtract;var ae,$,S=class S extends Float64Array{constructor(...e){switch(e.length){case 16:super(e);break;case 2:super(e[0],e[1],16);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t]):super(t,0,16);break;default:super(E(S,ae));break}}get str(){return S.str(this)}copy(e){return this.set(e),this}identity(){return this.set(E(S,ae)),this}multiply(e){return S.multiply(this,this,e)}mul(e){return this}transpose(){return S.transpose(this,this)}invert(){return S.invert(this,this)}translate(e){return S.translate(this,this,e)}rotate(e,t){return S.rotate(this,this,e,t)}scale(e){return S.scale(this,this,e)}rotateX(e){return S.rotateX(this,this,e)}rotateY(e){return S.rotateY(this,this,e)}rotateZ(e){return S.rotateZ(this,this,e)}perspectiveNO(e,t,n,s){return S.perspectiveNO(this,e,t,n,s)}perspectiveZO(e,t,n,s){return S.perspectiveZO(this,e,t,n,s)}orthoNO(e,t,n,s,r,a){return S.orthoNO(this,e,t,n,s,r,a)}orthoZO(e,t,n,s,r,a){return S.orthoZO(this,e,t,n,s,r,a)}static get BYTE_LENGTH(){return 16*Float64Array.BYTES_PER_ELEMENT}static create(){return new S}static clone(e){return new S(e)}static copy(e,t){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}static fromValues(...e){return new S(...e)}static set(e,...t){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}static identity(e){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}static transpose(e,t){if(e===t){let n=t[1],s=t[2],r=t[3],a=t[6],i=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=s,e[9]=a,e[11]=t[14],e[12]=r,e[13]=i,e[14]=c}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],M=t[10],h=t[11],b=t[12],d=t[13],m=t[14],o=t[15],V=n*c-s*i,x=n*y-r*i,R=n*L-a*i,z=s*y-r*c,g=s*L-a*c,B=r*L-a*y,D=k*d-l*b,F=k*m-M*b,p=k*o-h*b,Y=l*m-M*d,I=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m=e[15],o=t*i-n*a,V=t*c-s*a,x=n*c-s*i,R=L*b-k*h,z=L*d-l*h,g=k*d-l*b,B=t*g-n*z+s*R,D=a*g-i*z+c*R,F=L*x-k*V+l*o,p=h*x-b*V+d*o;return y*B-r*D+m*F-M*p}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=t[9],h=t[10],b=t[11],d=t[12],m=t[13],o=t[14],V=t[15],x=n[0],R=n[1],z=n[2],g=n[3];return e[0]=x*s+R*c+z*l+g*d,e[1]=x*r+R*y+z*M+g*m,e[2]=x*a+R*L+z*h+g*o,e[3]=x*i+R*k+z*b+g*V,x=n[4],R=n[5],z=n[6],g=n[7],e[4]=x*s+R*c+z*l+g*d,e[5]=x*r+R*y+z*M+g*m,e[6]=x*a+R*L+z*h+g*o,e[7]=x*i+R*k+z*b+g*V,x=n[8],R=n[9],z=n[10],g=n[11],e[8]=x*s+R*c+z*l+g*d,e[9]=x*r+R*y+z*M+g*m,e[10]=x*a+R*L+z*h+g*o,e[11]=x*i+R*k+z*b+g*V,x=n[12],R=n[13],z=n[14],g=n[15],e[12]=x*s+R*c+z*l+g*d,e[13]=x*r+R*y+z*M+g*m,e[14]=x*a+R*L+z*h+g*o,e[15]=x*i+R*k+z*b+g*V,e}static mul(e,t,n){return e}static translate(e,t,n){let s=n[0],r=n[1],a=n[2];if(t===e)e[12]=t[0]*s+t[4]*r+t[8]*a+t[12],e[13]=t[1]*s+t[5]*r+t[9]*a+t[13],e[14]=t[2]*s+t[6]*r+t[10]*a+t[14],e[15]=t[3]*s+t[7]*r+t[11]*a+t[15];else{let i=t[0],c=t[1],y=t[2],L=t[3],k=t[4],l=t[5],M=t[6],h=t[7],b=t[8],d=t[9],m=t[10],o=t[11];e[0]=i,e[1]=c,e[2]=y,e[3]=L,e[4]=k,e[5]=l,e[6]=M,e[7]=h,e[8]=b,e[9]=d,e[10]=m,e[11]=o,e[12]=i*s+k*r+b*a+t[12],e[13]=c*s+l*r+d*a+t[13],e[14]=y*s+M*r+m*a+t[14],e[15]=L*s+h*r+o*a+t[15]}return e}static scale(e,t,n){let s=n[0],r=n[1],a=n[2];return e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e[3]=t[3]*s,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}static rotate(e,t,n,s){let r=s[0],a=s[1],i=s[2],c=Math.sqrt(r*r+a*a+i*i);if(c<1e-6)return null;c=1/c,r*=c,a*=c,i*=c;let y=Math.sin(n),L=Math.cos(n),k=1-L,l=t[0],M=t[1],h=t[2],b=t[3],d=t[4],m=t[5],o=t[6],V=t[7],x=t[8],R=t[9],z=t[10],g=t[11],B=r*r*k+L,D=a*r*k+i*y,F=i*r*k-a*y,p=r*a*k-i*y,Y=a*a*k+L,I=i*a*k+r*y,P=r*i*k+a*y,Q=a*i*k-r*y,K=i*i*k+L;return e[0]=l*B+d*D+x*F,e[1]=M*B+m*D+R*F,e[2]=h*B+o*D+z*F,e[3]=b*B+V*D+g*F,e[4]=l*p+d*Y+x*I,e[5]=M*p+m*Y+R*I,e[6]=h*p+o*Y+z*I,e[7]=b*p+V*Y+g*I,e[8]=l*P+d*Q+x*K,e[9]=M*P+m*Q+R*K,e[10]=h*P+o*Q+z*K,e[11]=b*P+V*Q+g*K,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e}static rotateX(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[4],i=t[5],c=t[6],y=t[7],L=t[8],k=t[9],l=t[10],M=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*r+L*s,e[5]=i*r+k*s,e[6]=c*r+l*s,e[7]=y*r+M*s,e[8]=L*r-a*s,e[9]=k*r-i*s,e[10]=l*r-c*s,e[11]=M*r-y*s,e}static rotateY(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[0],i=t[1],c=t[2],y=t[3],L=t[8],k=t[9],l=t[10],M=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*r-L*s,e[1]=i*r-k*s,e[2]=c*r-l*s,e[3]=y*r-M*s,e[8]=a*s+L*r,e[9]=i*s+k*r,e[10]=c*s+l*r,e[11]=y*s+M*r,e}static rotateZ(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[0],i=t[1],c=t[2],y=t[3],L=t[4],k=t[5],l=t[6],M=t[7];return t!==e&&(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[0]=a*r+L*s,e[1]=i*r+k*s,e[2]=c*r+l*s,e[3]=y*r+M*s,e[4]=L*r-a*s,e[5]=k*r-i*s,e[6]=l*r-c*s,e[7]=M*r-y*s,e}static fromTranslation(e,t){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]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromRotation(e,t,n){let s=n[0],r=n[1],a=n[2],i=Math.sqrt(s*s+r*r+a*a);if(i<1e-6)return null;i=1/i,s*=i,r*=i,a*=i;let c=Math.sin(t),y=Math.cos(t),L=1-y;return e[0]=s*s*L+y,e[1]=r*s*L+a*c,e[2]=a*s*L-r*c,e[3]=0,e[4]=s*r*L-a*c,e[5]=r*r*L+y,e[6]=a*r*L+s*c,e[7]=0,e[8]=s*a*L+r*c,e[9]=r*a*L-s*c,e[10]=a*a*L+y,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromXRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=n,e[7]=0,e[8]=0,e[9]=-n,e[10]=s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromYRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromZRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=0,e[3]=0,e[4]=-n,e[5]=s,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}static fromRotationTranslation(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=s+s,y=r+r,L=a+a,k=s*c,l=s*y,M=s*L,h=r*y,b=r*L,d=a*L,m=i*c,o=i*y,V=i*L;return e[0]=1-(h+d),e[1]=l+V,e[2]=M-o,e[3]=0,e[4]=l-V,e[5]=1-(k+d),e[6]=b+m,e[7]=0,e[8]=M+o,e[9]=b-m,e[10]=1-(k+h),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}static fromQuat2(e,t){let n=-t[0],s=-t[1],r=-t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=n*n+s*s+r*r+a*a;return k>0?(E(S,$)[0]=(i*a+L*n+c*r-y*s)*2/k,E(S,$)[1]=(c*a+L*s+y*n-i*r)*2/k,E(S,$)[2]=(y*a+L*r+i*s-c*n)*2/k):(E(S,$)[0]=(i*a+L*n+c*r-y*s)*2,E(S,$)[1]=(c*a+L*s+y*n-i*r)*2,E(S,$)[2]=(y*a+L*r+i*s-c*n)*2),S.fromRotationTranslation(e,t,E(S,$)),e}static normalFromMat4(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],M=t[10],h=t[11],b=t[12],d=t[13],m=t[14],o=t[15],V=n*c-s*i,x=n*y-r*i,R=n*L-a*i,z=s*y-r*c,g=s*L-a*c,B=r*L-a*y,D=k*d-l*b,F=k*m-M*b,p=k*o-h*b,Y=l*m-M*d,I=l*o-h*d,P=M*o-h*m,Q=V*P-x*I+R*Y+z*p-g*F+B*D;return Q?(Q=1/Q,e[0]=(c*P-y*I+L*Y)*Q,e[1]=(y*p-i*P-L*F)*Q,e[2]=(i*I-c*p+L*D)*Q,e[3]=0,e[4]=(r*I-s*P-a*Y)*Q,e[5]=(n*P-r*p+a*F)*Q,e[6]=(s*p-n*I-a*D)*Q,e[7]=0,e[8]=(d*B-m*g+o*z)*Q,e[9]=(m*R-b*B-o*x)*Q,e[10]=(b*g-d*R+o*V)*Q,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):null}static normalFromMat4Fast(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=i*k-k*L,e[1]=c*y-y*k,e[2]=a*L-L*y,e[3]=0,e[4]=L*r-k*s,e[5]=k*n-y*r,e[6]=y*s-L*n,e[7]=0,e[8]=s*c-r*i,e[9]=r*a-n*c,e[10]=n*i-s*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static getTranslation(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}static getScaling(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=Math.sqrt(n*n+s*s+r*r),e[1]=Math.sqrt(a*a+i*i+c*c),e[2]=Math.sqrt(y*y+L*L+k*k),e}static getRotation(e,t){S.getScaling(E(S,$),t);let n=1/E(S,$)[0],s=1/E(S,$)[1],r=1/E(S,$)[2],a=t[0]*n,i=t[1]*s,c=t[2]*r,y=t[4]*n,L=t[5]*s,k=t[6]*r,l=t[8]*n,M=t[9]*s,h=t[10]*r,b=a+L+h,d=0;return b>0?(d=Math.sqrt(b+1)*2,e[3]=.25*d,e[0]=(k-M)/d,e[1]=(l-c)/d,e[2]=(i-y)/d):a>L&&a>h?(d=Math.sqrt(1+a-L-h)*2,e[3]=(k-M)/d,e[0]=.25*d,e[1]=(i+y)/d,e[2]=(l+c)/d):L>h?(d=Math.sqrt(1+L-a-h)*2,e[3]=(l-c)/d,e[0]=(i+y)/d,e[1]=.25*d,e[2]=(k+M)/d):(d=Math.sqrt(1+h-a-L)*2,e[3]=(i-y)/d,e[0]=(l+c)/d,e[1]=(k+M)/d,e[2]=.25*d),e}static decompose(e,t,n,s){t[0]=s[12],t[1]=s[13],t[2]=s[14];let r=s[0],a=s[1],i=s[2],c=s[4],y=s[5],L=s[6],k=s[8],l=s[9],M=s[10];n[0]=Math.sqrt(r*r+a*a+i*i),n[1]=Math.sqrt(c*c+y*y+L*L),n[2]=Math.sqrt(k*k+l*l+M*M);let h=1/n[0],b=1/n[1],d=1/n[2],m=r*h,o=a*b,V=i*d,x=c*h,R=y*b,z=L*d,g=k*h,B=l*b,D=M*d,F=m+R+D,p=0;return F>0?(p=Math.sqrt(F+1)*2,e[3]=.25*p,e[0]=(z-B)/p,e[1]=(g-V)/p,e[2]=(o-x)/p):m>R&&m>D?(p=Math.sqrt(1+m-R-D)*2,e[3]=(z-B)/p,e[0]=.25*p,e[1]=(o+x)/p,e[2]=(g+V)/p):R>D?(p=Math.sqrt(1+R-m-D)*2,e[3]=(g-V)/p,e[0]=(o+x)/p,e[1]=.25*p,e[2]=(z+B)/p):(p=Math.sqrt(1+D-m-R)*2,e[3]=(o-x)/p,e[0]=(g+V)/p,e[1]=(z+B)/p,e[2]=.25*p),e}static fromRotationTranslationScale(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3],y=r+r,L=a+a,k=i+i,l=r*y,M=r*L,h=r*k,b=a*L,d=a*k,m=i*k,o=c*y,V=c*L,x=c*k,R=s[0],z=s[1],g=s[2];return e[0]=(1-(b+m))*R,e[1]=(M+x)*R,e[2]=(h-V)*R,e[3]=0,e[4]=(M-x)*z,e[5]=(1-(l+m))*z,e[6]=(d+o)*z,e[7]=0,e[8]=(h+V)*g,e[9]=(d-o)*g,e[10]=(1-(l+b))*g,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}static fromRotationTranslationScaleOrigin(e,t,n,s,r){let a=t[0],i=t[1],c=t[2],y=t[3],L=a+a,k=i+i,l=c+c,M=a*L,h=a*k,b=a*l,d=i*k,m=i*l,o=c*l,V=y*L,x=y*k,R=y*l,z=s[0],g=s[1],B=s[2],D=r[0],F=r[1],p=r[2],Y=(1-(d+o))*z,I=(h+R)*z,P=(b-x)*z,Q=(h-R)*g,K=(1-(M+o))*g,ee=(m+V)*g,te=(b+x)*B,Me=(m-V)*B,be=(1-(M+d))*B;return e[0]=Y,e[1]=I,e[2]=P,e[3]=0,e[4]=Q,e[5]=K,e[6]=ee,e[7]=0,e[8]=te,e[9]=Me,e[10]=be,e[11]=0,e[12]=n[0]+D-(Y*D+Q*F+te*p),e[13]=n[1]+F-(I*D+K*F+Me*p),e[14]=n[2]+p-(P*D+ee*F+be*p),e[15]=1,e}static fromQuat(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n+n,c=s+s,y=r+r,L=n*i,k=s*i,l=s*c,M=r*i,h=r*c,b=r*y,d=a*i,m=a*c,o=a*y;return e[0]=1-l-b,e[1]=k+o,e[2]=M-m,e[3]=0,e[4]=k-o,e[5]=1-L-b,e[6]=h+d,e[7]=0,e[8]=M+m,e[9]=h-d,e[10]=1-L-l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static frustumNO(e,t,n,s,r,a,i=1/0){let c=1/(n-t),y=1/(r-s);if(e[0]=a*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*y,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(r+s)*y,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let L=1/(a-i);e[10]=(i+a)*L,e[14]=2*i*a*L}else e[10]=-1,e[14]=-2*a;return e}static frustum(e,t,n,s,r,a,i=1/0){return e}static frustumZO(e,t,n,s,r,a,i=1/0){let c=1/(n-t),y=1/(r-s);if(e[0]=a*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*y,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(r+s)*y,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let L=1/(a-i);e[10]=i*L,e[14]=i*a*L}else e[10]=-1,e[14]=-a;return e}static perspectiveNO(e,t,n,s,r=1/0){let a=1/Math.tan(t/2);if(e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,r!=null&&r!==1/0){let i=1/(s-r);e[10]=(r+s)*i,e[14]=2*r*s*i}else e[10]=-1,e[14]=-2*s;return e}static perspective(e,t,n,s,r=1/0){return e}static perspectiveZO(e,t,n,s,r=1/0){let a=1/Math.tan(t/2);if(e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,r!=null&&r!==1/0){let i=1/(s-r);e[10]=r*i,e[14]=r*s*i}else e[10]=-1,e[14]=-s;return e}static perspectiveFromFieldOfView(e,t,n,s){let r=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),i=Math.tan(t.leftDegrees*Math.PI/180),c=Math.tan(t.rightDegrees*Math.PI/180),y=2/(i+c),L=2/(r+a);return e[0]=y,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=L,e[6]=0,e[7]=0,e[8]=-((i-c)*y*.5),e[9]=(r-a)*L*.5,e[10]=s/(n-s),e[11]=-1,e[12]=0,e[13]=0,e[14]=s*n/(n-s),e[15]=0,e}static orthoNO(e,t,n,s,r,a,i){let c=1/(t-n),y=1/(s-r),L=1/(a-i);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*L,e[11]=0,e[12]=(t+n)*c,e[13]=(r+s)*y,e[14]=(i+a)*L,e[15]=1,e}static ortho(e,t,n,s,r,a,i){return e}static orthoZO(e,t,n,s,r,a,i){let c=1/(t-n),y=1/(s-r),L=1/(a-i);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=L,e[11]=0,e[12]=(t+n)*c,e[13]=(r+s)*y,e[14]=a*L,e[15]=1,e}static lookAt(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=s[0],y=s[1],L=s[2],k=n[0],l=n[1],M=n[2];if(Math.abs(r-k)<1e-6&&Math.abs(a-l)<1e-6&&Math.abs(i-M)<1e-6)return S.identity(e);let h=r-k,b=a-l,d=i-M,m=1/Math.sqrt(h*h+b*b+d*d);h*=m,b*=m,d*=m;let o=y*d-L*b,V=L*h-c*d,x=c*b-y*h;m=Math.sqrt(o*o+V*V+x*x),m?(m=1/m,o*=m,V*=m,x*=m):(o=0,V=0,x=0);let R=b*x-d*V,z=d*o-h*x,g=h*V-b*o;return m=Math.sqrt(R*R+z*z+g*g),m?(m=1/m,R*=m,z*=m,g*=m):(R=0,z=0,g=0),e[0]=o,e[1]=R,e[2]=h,e[3]=0,e[4]=V,e[5]=z,e[6]=b,e[7]=0,e[8]=x,e[9]=g,e[10]=d,e[11]=0,e[12]=-(o*r+V*a+x*i),e[13]=-(R*r+z*a+g*i),e[14]=-(h*r+b*a+d*i),e[15]=1,e}static targetTo(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=s[0],y=s[1],L=s[2],k=r-n[0],l=a-n[1],M=i-n[2],h=k*k+l*l+M*M;h>0&&(h=1/Math.sqrt(h),k*=h,l*=h,M*=h);let b=y*M-L*l,d=L*k-c*M,m=c*l-y*k;return h=b*b+d*d+m*m,h>0&&(h=1/Math.sqrt(h),b*=h,d*=h,m*=h),e[0]=b,e[1]=d,e[2]=m,e[3]=0,e[4]=l*m-M*d,e[5]=M*b-k*m,e[6]=k*d-l*b,e[7]=0,e[8]=k,e[9]=l,e[10]=M,e[11]=0,e[12]=r,e[13]=a,e[14]=i,e[15]=1,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8]+e[9]*e[9]+e[10]*e[10]+e[11]*e[11]+e[12]*e[12]+e[13]*e[13]+e[14]*e[14]+e[15]*e[15])}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}static sub(e,t,n){return e}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e[6]=t[6]+n[6]*s,e[7]=t[7]+n[7]*s,e[8]=t[8]+n[8]*s,e[9]=t[9]+n[9]*s,e[10]=t[10]+n[10]*s,e[11]=t[11]+n[11]*s,e[12]=t[12]+n[12]*s,e[13]=t[13]+n[13]*s,e[14]=t[14]+n[14]*s,e[15]=t[15]+n[15]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=e[8],l=e[9],M=e[10],h=e[11],b=e[12],d=e[13],m=e[14],o=e[15],V=t[0],x=t[1],R=t[2],z=t[3],g=t[4],B=t[5],D=t[6],F=t[7],p=t[8],Y=t[9],I=t[10],P=t[11],Q=t[12],K=t[13],ee=t[14],te=t[15];return Math.abs(n-V)<=1e-6*Math.max(1,Math.abs(n),Math.abs(V))&&Math.abs(s-x)<=1e-6*Math.max(1,Math.abs(s),Math.abs(x))&&Math.abs(r-R)<=1e-6*Math.max(1,Math.abs(r),Math.abs(R))&&Math.abs(a-z)<=1e-6*Math.max(1,Math.abs(a),Math.abs(z))&&Math.abs(i-g)<=1e-6*Math.max(1,Math.abs(i),Math.abs(g))&&Math.abs(c-B)<=1e-6*Math.max(1,Math.abs(c),Math.abs(B))&&Math.abs(y-D)<=1e-6*Math.max(1,Math.abs(y),Math.abs(D))&&Math.abs(L-F)<=1e-6*Math.max(1,Math.abs(L),Math.abs(F))&&Math.abs(k-p)<=1e-6*Math.max(1,Math.abs(k),Math.abs(p))&&Math.abs(l-Y)<=1e-6*Math.max(1,Math.abs(l),Math.abs(Y))&&Math.abs(M-I)<=1e-6*Math.max(1,Math.abs(M),Math.abs(I))&&Math.abs(h-P)<=1e-6*Math.max(1,Math.abs(h),Math.abs(P))&&Math.abs(b-Q)<=1e-6*Math.max(1,Math.abs(b),Math.abs(Q))&&Math.abs(d-K)<=1e-6*Math.max(1,Math.abs(d),Math.abs(K))&&Math.abs(m-ee)<=1e-6*Math.max(1,Math.abs(m),Math.abs(ee))&&Math.abs(o-te)<=1e-6*Math.max(1,Math.abs(o),Math.abs(te))}static str(e){return`Mat4(${e.join(", ")})`}};ae=new WeakMap,$=new WeakMap,Z(S,ae,new Float64Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])),Z(S,$,new Float64Array(3));var G=S;G.prototype.mul=G.prototype.multiply;G.sub=G.subtract;G.mul=G.multiply;G.frustum=G.frustumNO;G.perspective=G.perspectiveNO;G.ortho=G.orthoNO;var T=class A extends Float64Array{constructor(...e){switch(e.length){case 3:super(e);break;case 2:super(e[0],e[1],3);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t]):super(t,0,3);break}default:super(3);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get b(){return this[2]}set b(e){this[2]=e}get magnitude(){let e=this[0],t=this[1],n=this[2];return Math.sqrt(e*e+t*t+n*n)}get mag(){return this.magnitude}get squaredMagnitude(){let e=this[0],t=this[1],n=this[2];return e*e+t*t+n*n}get sqrMag(){return this.squaredMagnitude}get str(){return A.str(this)}copy(e){return this.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this[2]+=e[2],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this[2]-=e[2],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this[2]*=e[2],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this[2]/=e[2],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this[2]+=e[2]*t,this}distance(e){return A.distance(this,e)}dist(e){return 0}squaredDistance(e){return A.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this[2]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this[2]=1/this[2],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this[2]=Math.abs(this[2]),this}dot(e){return this[0]*e[0]+this[1]*e[1]+this[2]*e[2]}normalize(){return A.normalize(this,this)}static get BYTE_LENGTH(){return 3*Float64Array.BYTES_PER_ELEMENT}static create(){return new A}static clone(e){return new A(e)}static magnitude(e){let t=e[0],n=e[1],s=e[2];return Math.sqrt(t*t+n*n+s*s)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static fromValues(e,t,n){return new A(e,t,n)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}static set(e,t,n,s){return e[0]=t,e[1]=n,e[2]=s,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}static sub(e,t,n){return[0,0,0]}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}static mul(e,t,n){return[0,0,0]}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e}static div(e,t,n){return[0,0,0]}static ceil(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}static floor(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e}static distance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2];return Math.sqrt(n*n+s*s+r*r)}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2];return n*n+s*s+r*r}static sqrDist(e,t){return 0}static squaredLength(e){let t=e[0],n=e[1],s=e[2];return t*t+n*n+s*s}static sqrLen(e,t){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e}static normalize(e,t){let n=t[0],s=t[1],r=t[2],a=n*n+s*s+r*r;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}static cross(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[0],c=n[1],y=n[2];return e[0]=r*y-a*c,e[1]=a*i-s*y,e[2]=s*c-r*i,e}static lerp(e,t,n,s){let r=t[0],a=t[1],i=t[2];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e[2]=i+s*(n[2]-i),e}static slerp(e,t,n,s){let r=Math.acos(Math.min(Math.max(A.dot(t,n),-1),1)),a=Math.sin(r),i=Math.sin((1-s)*r)/a,c=Math.sin(s*r)/a;return e[0]=i*t[0]+c*n[0],e[1]=i*t[1]+c*n[1],e[2]=i*t[2]+c*n[2],e}static hermite(e,t,n,s,r,a){let i=a*a,c=i*(2*a-3)+1,y=i*(a-2)+a,L=i*(a-1),k=i*(3-2*a);return e[0]=t[0]*c+n[0]*y+s[0]*L+r[0]*k,e[1]=t[1]*c+n[1]*y+s[1]*L+r[1]*k,e[2]=t[2]*c+n[2]*y+s[2]*L+r[2]*k,e}static bezier(e,t,n,s,r,a){let i=1-a,c=i*i,y=a*a,L=c*i,k=3*a*c,l=3*y*i,M=y*a;return e[0]=t[0]*L+n[0]*k+s[0]*l+r[0]*M,e[1]=t[1]*L+n[1]*k+s[1]*l+r[1]*M,e[2]=t[2]*L+n[2]*k+s[2]*l+r[2]*M,e}static transformMat4(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[3]*s+n[7]*r+n[11]*a+n[15]||1;return e[0]=(n[0]*s+n[4]*r+n[8]*a+n[12])/i,e[1]=(n[1]*s+n[5]*r+n[9]*a+n[13])/i,e[2]=(n[2]*s+n[6]*r+n[10]*a+n[14])/i,e}static transformMat3(e,t,n){let s=t[0],r=t[1],a=t[2];return e[0]=s*n[0]+r*n[3]+a*n[6],e[1]=s*n[1]+r*n[4]+a*n[7],e[2]=s*n[2]+r*n[5]+a*n[8],e}static transformQuat(e,t,n){let s=n[0],r=n[1],a=n[2],i=n[3]*2,c=t[0],y=t[1],L=t[2],k=r*L-a*y,l=a*c-s*L,M=s*y-r*c,h=(r*M-a*l)*2,b=(a*k-s*M)*2,d=(s*l-r*k)*2;return e[0]=c+k*i+h,e[1]=y+l*i+b,e[2]=L+M*i+d,e}static rotateX(e,t,n,s){let r=n[1],a=n[2],i=t[1]-r,c=t[2]-a;return e[0]=t[0],e[1]=i*Math.cos(s)-c*Math.sin(s)+r,e[2]=i*Math.sin(s)+c*Math.cos(s)+a,e}static rotateY(e,t,n,s){let r=n[0],a=n[2],i=t[0]-r,c=t[2]-a;return e[0]=c*Math.sin(s)+i*Math.cos(s)+r,e[1]=t[1],e[2]=c*Math.cos(s)-i*Math.sin(s)+a,e}static rotateZ(e,t,n,s){let r=n[0],a=n[1],i=t[0]-r,c=t[1]-a;return e[0]=i*Math.cos(s)-c*Math.sin(s)+r,e[1]=i*Math.sin(s)+c*Math.cos(s)+a,e[2]=n[2],e}static angle(e,t){let n=e[0],s=e[1],r=e[2],a=t[0],i=t[1],c=t[2],y=Math.sqrt((n*n+s*s+r*r)*(a*a+i*i+c*c)),L=y&&A.dot(e,t)/y;return Math.acos(Math.min(Math.max(L,-1),1))}static zero(e){return e[0]=0,e[1]=0,e[2]=0,e}static str(e){return`Vec3(${e.join(", ")})`}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=t[0],i=t[1],c=t[2];return Math.abs(n-a)<=1e-6*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(s-i)<=1e-6*Math.max(1,Math.abs(s),Math.abs(i))&&Math.abs(r-c)<=1e-6*Math.max(1,Math.abs(r),Math.abs(c))}};T.prototype.sub=T.prototype.subtract;T.prototype.mul=T.prototype.multiply;T.prototype.div=T.prototype.divide;T.prototype.dist=T.prototype.distance;T.prototype.sqrDist=T.prototype.squaredDistance;T.sub=T.subtract;T.mul=T.multiply;T.div=T.divide;T.dist=T.distance;T.sqrDist=T.squaredDistance;T.sqrLen=T.squaredLength;T.mag=T.magnitude;T.length=T.magnitude;T.len=T.magnitude;var q=class A extends Float64Array{constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t,t]):super(t,0,4);break}default:super(4);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get w(){return this[3]}set w(e){this[3]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get b(){return this[2]}set b(e){this[2]=e}get a(){return this[3]}set a(e){this[3]=e}get magnitude(){let e=this[0],t=this[1],n=this[2],s=this[3];return Math.sqrt(e*e+t*t+n*n+s*s)}get mag(){return this.magnitude}get str(){return A.str(this)}copy(e){return super.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this[2]+=e[2],this[3]+=e[3],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this[2]-=e[2],this[3]-=e[3],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this[2]*=e[2],this[3]*=e[3],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this[2]/=e[2],this[3]/=e[3],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this[3]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this[2]+=e[2]*t,this[3]+=e[3]*t,this}distance(e){return A.distance(this,e)}dist(e){return 0}squaredDistance(e){return A.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this[2]*=-1,this[3]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this[2]=1/this[2],this[3]=1/this[3],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this[2]=Math.abs(this[2]),this[3]=Math.abs(this[3]),this}dot(e){return this[0]*e[0]+this[1]*e[1]+this[2]*e[2]+this[3]*e[3]}normalize(){return A.normalize(this,this)}static get BYTE_LENGTH(){return 4*Float64Array.BYTES_PER_ELEMENT}static create(){return new A}static clone(e){return new A(e)}static fromValues(e,t,n,s){return new A(e,t,n,s)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static set(e,t,n,s,r){return e[0]=t,e[1]=n,e[2]=s,e[3]=r,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}static sub(e,t,n){return e}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e[3]=t[3]*n[3],e}static mul(e,t,n){return e}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e[3]=t[3]/n[3],e}static div(e,t,n){return e}static ceil(e,t){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}static floor(e,t){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}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e[3]=Math.min(t[3],n[3]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e[3]=Math.max(t[3],n[3]),e}static round(e,t){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}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e}static distance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2],a=t[3]-e[3];return Math.hypot(n,s,r,a)}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2],a=t[3]-e[3];return n*n+s*s+r*r+a*a}static sqrDist(e,t){return 0}static magnitude(e){let t=e[0],n=e[1],s=e[2],r=e[3];return Math.sqrt(t*t+n*n+s*s+r*r)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){let t=e[0],n=e[1],s=e[2],r=e[3];return t*t+n*n+s*s+r*r}static sqrLen(e){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e}static normalize(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*n+s*s+r*r+a*a;return i>0&&(i=1/Math.sqrt(i)),e[0]=n*i,e[1]=s*i,e[2]=r*i,e[3]=a*i,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}static cross(e,t,n,s){let r=n[0]*s[1]-n[1]*s[0],a=n[0]*s[2]-n[2]*s[0],i=n[0]*s[3]-n[3]*s[0],c=n[1]*s[2]-n[2]*s[1],y=n[1]*s[3]-n[3]*s[1],L=n[2]*s[3]-n[3]*s[2],k=t[0],l=t[1],M=t[2],h=t[3];return e[0]=l*L-M*y+h*c,e[1]=-(k*L)+M*i-h*a,e[2]=k*y-l*i+h*r,e[3]=-(k*c)+l*a-M*r,e}static lerp(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e[2]=i+s*(n[2]-i),e[3]=c+s*(n[3]-c),e}static transformMat4(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3];return e[0]=n[0]*s+n[4]*r+n[8]*a+n[12]*i,e[1]=n[1]*s+n[5]*r+n[9]*a+n[13]*i,e[2]=n[2]*s+n[6]*r+n[10]*a+n[14]*i,e[3]=n[3]*s+n[7]*r+n[11]*a+n[15]*i,e}static transformQuat(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[0],c=n[1],y=n[2],L=n[3],k=L*s+c*a-y*r,l=L*r+y*s-i*a,M=L*a+i*r-c*s,h=-i*s-c*r-y*a;return e[0]=k*L+h*-i+l*-y-M*-c,e[1]=l*L+h*-c+M*-i-k*-y,e[2]=M*L+h*-y+k*-c-l*-i,e[3]=t[3],e}static zero(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}static str(e){return`Vec4(${e.join(", ")})`}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=t[0],c=t[1],y=t[2],L=t[3];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(a-L)<=1e-6*Math.max(1,Math.abs(a),Math.abs(L))}};q.prototype.sub=q.prototype.subtract;q.prototype.mul=q.prototype.multiply;q.prototype.div=q.prototype.divide;q.prototype.dist=q.prototype.distance;q.prototype.sqrDist=q.prototype.squaredDistance;q.sub=q.subtract;q.mul=q.multiply;q.div=q.divide;q.dist=q.distance;q.sqrDist=q.squaredDistance;q.sqrLen=q.squaredLength;q.mag=q.magnitude;q.length=q.magnitude;q.len=q.magnitude;var ke,ie,ce,W,U,le,he,f=class f extends Float64Array{constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t,t]):super(t,0,4);break}default:super(4),this[3]=1;break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get w(){return this[3]}set w(e){this[3]=e}get magnitude(){let e=this[0],t=this[1],n=this[2],s=this[3];return Math.sqrt(e*e+t*t+n*n+s*s)}get mag(){return this.magnitude}get str(){return f.str(this)}copy(e){return super.set(e),this}identity(){return this[0]=0,this[1]=0,this[2]=0,this[3]=1,this}multiply(e){return f.multiply(this,this,e)}mul(e){return this}rotateX(e){return f.rotateX(this,this,e)}rotateY(e){return f.rotateY(this,this,e)}rotateZ(e){return f.rotateZ(this,this,e)}invert(){return f.invert(this,this)}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this[3]*=e,this}dot(e){return f.dot(this,e)}static get BYTE_LENGTH(){return 4*Float64Array.BYTES_PER_ELEMENT}static create(){return new f}static identity(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}static setAxisAngle(e,t,n){n*=.5;let s=Math.sin(n);return e[0]=s*t[0],e[1]=s*t[1],e[2]=s*t[2],e[3]=Math.cos(n),e}static getAxisAngle(e,t){let n=Math.acos(t[3])*2,s=Math.sin(n/2);return s>1e-6?(e[0]=t[0]/s,e[1]=t[1]/s,e[2]=t[2]/s):(e[0]=1,e[1]=0,e[2]=0),n}static getAngle(e,t){let n=f.dot(e,t);return Math.acos(2*n*n-1)}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*k+i*c+r*L-a*y,e[1]=r*k+i*y+a*c-s*L,e[2]=a*k+i*L+s*y-r*c,e[3]=i*k-s*c-r*y-a*L,e}static rotateX(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+i*c,e[1]=r*y+a*c,e[2]=a*y-r*c,e[3]=i*y-s*c,e}static rotateY(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y-a*c,e[1]=r*y+i*c,e[2]=a*y+s*c,e[3]=i*y-r*c,e}static rotateZ(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+r*c,e[1]=r*y-s*c,e[2]=a*y+i*c,e[3]=i*y-a*c,e}static calculateW(e,t){let n=t[0],s=t[1],r=t[2];return e[0]=n,e[1]=s,e[2]=r,e[3]=Math.sqrt(Math.abs(1-n*n-s*s-r*r)),e}static exp(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=Math.sqrt(n*n+s*s+r*r),c=Math.exp(a),y=i>0?c*Math.sin(i)/i:0;return e[0]=n*y,e[1]=s*y,e[2]=r*y,e[3]=c*Math.cos(i),e}static ln(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=Math.sqrt(n*n+s*s+r*r),c=i>0?Math.atan2(i,a)/i:0;return e[0]=n*c,e[1]=s*c,e[2]=r*c,e[3]=.5*Math.log(n*n+s*s+r*r+a*a),e}static pow(e,t,n){return f.ln(e,t),f.scale(e,e,n),f.exp(e,e),e}static slerp(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3],y=n[0],L=n[1],k=n[2],l=n[3],M,h,b=r*y+a*L+i*k+c*l;if(b<0&&(b=-b,y=-y,L=-L,k=-k,l=-l),1-b>1e-6){let d=Math.acos(b),m=Math.sin(d);M=Math.sin((1-s)*d)/m,h=Math.sin(s*d)/m}else M=1-s,h=s;return e[0]=M*r+h*y,e[1]=M*a+h*L,e[2]=M*i+h*k,e[3]=M*c+h*l,e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*n+s*s+r*r+a*a,c=i?1/i:0;return e[0]=-n*c,e[1]=-s*c,e[2]=-r*c,e[3]=a*c,e}static conjugate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}static fromMat3(e,t){let n=t[0]+t[4]+t[8],s;if(n>0)s=Math.sqrt(n+1),e[3]=.5*s,s=.5/s,e[0]=(t[5]-t[7])*s,e[1]=(t[6]-t[2])*s,e[2]=(t[1]-t[3])*s;else{let r=0;t[4]>t[0]&&(r=1),t[8]>t[r*3+r]&&(r=2);let a=(r+1)%3,i=(r+2)%3;s=Math.sqrt(t[r*3+r]-t[a*3+a]-t[i*3+i]+1),e[r]=.5*s,s=.5/s,e[3]=(t[a*3+i]-t[i*3+a])*s,e[a]=(t[a*3+r]+t[r*3+a])*s,e[i]=(t[i*3+r]+t[r*3+i])*s}return e}static fromEuler(e,t,n,s,r=E(f,ke)){let a=.5*Math.PI/180;t*=a,n*=a,s*=a;let i=Math.sin(t),c=Math.cos(t),y=Math.sin(n),L=Math.cos(n),k=Math.sin(s),l=Math.cos(s);switch(r){case"xyz":e[0]=i*L*l+c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l-i*y*k;break;case"xzy":e[0]=i*L*l-c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l+i*y*k;break;case"yxz":e[0]=i*L*l+c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l+i*y*k;break;case"yzx":e[0]=i*L*l+c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l-i*y*k;break;case"zxy":e[0]=i*L*l-c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l-i*y*k;break;case"zyx":e[0]=i*L*l-c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l+i*y*k;break;default:throw new Error(`Unknown angle order ${r}`)}return e}static str(e){return`Quat(${e.join(", ")})`}static clone(e){return new f(e)}static fromValues(e,t,n,s){return new f(e,t,n,s)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static set(e,t,n,s,r){return e}static add(e,t,n){return e}static mul(e,t,n){return e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}static lerp(e,t,n,s){return e}static magnitude(e){return 0}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){return 0}static sqrLen(e){return 0}static normalize(e,t){return e}static exactEquals(e,t){return!1}static equals(e,t){return!1}static rotationTo(e,t,n){let s=T.dot(t,n);return s<-.999999?(T.cross(E(f,U),E(f,le),t),T.mag(E(f,U))<1e-6&&T.cross(E(f,U),E(f,he),t),T.normalize(E(f,U),E(f,U)),f.setAxisAngle(e,E(f,U),Math.PI),e):s>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(T.cross(E(f,U),t,n),e[0]=E(f,U)[0],e[1]=E(f,U)[1],e[2]=E(f,U)[2],e[3]=1+s,f.normalize(e,e))}static sqlerp(e,t,n,s,r,a){return f.slerp(E(f,ie),t,r,a),f.slerp(E(f,ce),n,s,a),f.slerp(e,E(f,ie),E(f,ce),2*a*(1-a)),e}static setAxes(e,t,n,s){return E(f,W)[0]=n[0],E(f,W)[3]=n[1],E(f,W)[6]=n[2],E(f,W)[1]=s[0],E(f,W)[4]=s[1],E(f,W)[7]=s[2],E(f,W)[2]=-t[0],E(f,W)[5]=-t[1],E(f,W)[8]=-t[2],f.normalize(e,f.fromMat3(e,E(f,W)))}};ke=new WeakMap,ie=new WeakMap,ce=new WeakMap,W=new WeakMap,U=new WeakMap,le=new WeakMap,he=new WeakMap,Z(f,ke,"zyx"),Z(f,ie,new Float64Array(4)),Z(f,ce,new Float64Array(4)),Z(f,W,new Float64Array(9)),Z(f,U,new Float64Array(3)),Z(f,le,new Float64Array([1,0,0])),Z(f,he,new Float64Array([0,1,0]));var O=f;O.set=q.set;O.add=q.add;O.lerp=q.lerp;O.normalize=q.normalize;O.squaredLength=q.squaredLength;O.sqrLen=q.squaredLength;O.exactEquals=q.exactEquals;O.equals=q.equals;O.magnitude=q.magnitude;O.prototype.mul=O.prototype.multiply;O.mul=O.multiply;O.mag=O.magnitude;O.length=O.magnitude;O.len=O.magnitude;var ye,Le,j=class j extends Float64Array{constructor(...e){switch(e.length){case 8:super(e);break;case 2:super(e[0],e[1],8);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t,t,t,t,t,t]):super(t,0,8);break}default:super(8),this[3]=1;break}}get str(){return j.str(this)}copy(e){return super.set(e),this}static get BYTE_LENGTH(){return 8*Float64Array.BYTES_PER_ELEMENT}static create(){return new j}static clone(e){return new j(e)}static fromValues(e,t,n,s,r,a,i,c){return new j(e,t,n,s,r,a,i,c)}static fromRotationTranslationValues(e,t,n,s,r,a,i){let c=r*.5,y=a*.5,L=i*.5;return new j(e,t,n,s,c*s+y*n-L*t,y*s+L*e-c*n,L*s+c*t-y*e,-c*e-y*t-L*n)}static fromRotationTranslation(e,t,n){let s=n[0]*.5,r=n[1]*.5,a=n[2]*.5,i=t[0],c=t[1],y=t[2],L=t[3];return e[0]=i,e[1]=c,e[2]=y,e[3]=L,e[4]=s*L+r*y-a*c,e[5]=r*L+a*i-s*y,e[6]=a*L+s*c-r*i,e[7]=-s*i-r*c-a*y,e}static fromTranslation(e,t){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0]*.5,e[5]=t[1]*.5,e[6]=t[2]*.5,e[7]=0,e}static fromRotation(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=0,e[5]=0,e[6]=0,e[7]=0,e}static fromMat4(e,t){return G.getRotation(E(j,ye),t),G.getTranslation(E(j,Le),t),j.fromRotationTranslation(e,E(j,ye),E(j,Le))}static copy(e,t){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}static identity(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e}static set(e,t,n,s,r,a,i,c,y){return e[0]=t,e[1]=n,e[2]=s,e[3]=r,e[4]=a,e[5]=i,e[6]=c,e[7]=y,e}static getReal(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static getDual(e,t){return e[0]=t[4],e[1]=t[5],e[2]=t[6],e[3]=t[7],e}static setReal(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static setDual(e,t){return e[4]=t[0],e[5]=t[1],e[6]=t[2],e[7]=t[3],e}static getTranslation(e,t){let n=t[4],s=t[5],r=t[6],a=t[7],i=-t[0],c=-t[1],y=-t[2],L=t[3];return e[0]=(n*L+a*i+s*y-r*c)*2,e[1]=(s*L+a*c+r*i-n*y)*2,e[2]=(r*L+a*y+n*c-s*i)*2,e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0]*.5,y=n[1]*.5,L=n[2]*.5,k=t[4],l=t[5],M=t[6],h=t[7];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=i*c+r*L-a*y+k,e[5]=i*y+a*c-s*L+l,e[6]=i*L+s*y-r*c+M,e[7]=-s*c-r*y-a*L+h,e}static rotateX(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,M=y*i+k*r+L*s-c*a,h=L*i+k*a+c*r-y*s,b=k*i-c*s-y*r-L*a;return O.rotateX(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+b*s+M*a-h*r,e[5]=M*i+b*r+h*s-l*a,e[6]=h*i+b*a+l*r-M*s,e[7]=b*i-l*s-M*r-h*a,e}static rotateY(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,M=y*i+k*r+L*s-c*a,h=L*i+k*a+c*r-y*s,b=k*i-c*s-y*r-L*a;return O.rotateY(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+b*s+M*a-h*r,e[5]=M*i+b*r+h*s-l*a,e[6]=h*i+b*a+l*r-M*s,e[7]=b*i-l*s-M*r-h*a,e}static rotateZ(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,M=y*i+k*r+L*s-c*a,h=L*i+k*a+c*r-y*s,b=k*i-c*s-y*r-L*a;return O.rotateZ(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+b*s+M*a-h*r,e[5]=M*i+b*r+h*s-l*a,e[6]=h*i+b*a+l*r-M*s,e[7]=b*i-l*s-M*r-h*a,e}static rotateByQuatAppend(e,t,n){let s=n[0],r=n[1],a=n[2],i=n[3],c=t[0],y=t[1],L=t[2],k=t[3];return e[0]=c*i+k*s+y*a-L*r,e[1]=y*i+k*r+L*s-c*a,e[2]=L*i+k*a+c*r-y*s,e[3]=k*i-c*s-y*r-L*a,c=t[4],y=t[5],L=t[6],k=t[7],e[4]=c*i+k*s+y*a-L*r,e[5]=y*i+k*r+L*s-c*a,e[6]=L*i+k*a+c*r-y*s,e[7]=k*i-c*s-y*r-L*a,e}static rotateByQuatPrepend(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*k+i*c+r*L-a*y,e[1]=r*k+i*y+a*c-s*L,e[2]=a*k+i*L+s*y-r*c,e[3]=i*k-s*c-r*y-a*L,c=n[4],y=n[5],L=n[6],k=n[7],e[4]=s*k+i*c+r*L-a*y,e[5]=r*k+i*y+a*c-s*L,e[6]=a*k+i*L+s*y-r*c,e[7]=i*k-s*c-r*y-a*L,e}static rotateAroundAxis(e,t,n,s){if(Math.abs(s)<1e-6)return j.copy(e,t);let r=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);s*=.5;let a=Math.sin(s),i=a*n[0]/r,c=a*n[1]/r,y=a*n[2]/r,L=Math.cos(s),k=t[0],l=t[1],M=t[2],h=t[3];e[0]=k*L+h*i+l*y-M*c,e[1]=l*L+h*c+M*i-k*y,e[2]=M*L+h*y+k*c-l*i,e[3]=h*L-k*i-l*c-M*y;let b=t[4],d=t[5],m=t[6],o=t[7];return e[4]=b*L+o*i+d*y-m*c,e[5]=d*L+o*c+m*i-b*y,e[6]=m*L+o*y+b*c-d*i,e[7]=o*L-b*i-d*c-m*y,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[4],y=n[5],L=n[6],k=n[7],l=t[4],M=t[5],h=t[6],b=t[7],d=n[0],m=n[1],o=n[2],V=n[3];return e[0]=s*V+i*d+r*o-a*m,e[1]=r*V+i*m+a*d-s*o,e[2]=a*V+i*o+s*m-r*d,e[3]=i*V-s*d-r*m-a*o,e[4]=s*k+i*c+r*L-a*y+l*V+b*d+M*o-h*m,e[5]=r*k+i*y+a*c-s*L+M*V+b*m+h*d-l*o,e[6]=a*k+i*L+s*y-r*c+h*V+b*o+l*m-M*d,e[7]=i*k-s*c-r*y-a*L+b*V-l*d-M*m-h*o,e}static mul(e,t,n){return e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e}static dot(e,t){return 0}static lerp(e,t,n,s){let r=1-s;return j.dot(t,n)<0&&(s=-s),e[0]=t[0]*r+n[0]*s,e[1]=t[1]*r+n[1]*s,e[2]=t[2]*r+n[2]*s,e[3]=t[3]*r+n[3]*s,e[4]=t[4]*r+n[4]*s,e[5]=t[5]*r+n[5]*s,e[6]=t[6]*r+n[6]*s,e[7]=t[7]*r+n[7]*s,e}static invert(e,t){let n=j.squaredLength(t);return e[0]=-t[0]/n,e[1]=-t[1]/n,e[2]=-t[2]/n,e[3]=t[3]/n,e[4]=-t[4]/n,e[5]=-t[5]/n,e[6]=-t[6]/n,e[7]=t[7]/n,e}static conjugate(e,t){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}static magnitude(e){return 0}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){return 0}static sqrLen(e){return 0}static normalize(e,t){let n=j.squaredLength(t);if(n>0){n=Math.sqrt(n);let s=t[0]/n,r=t[1]/n,a=t[2]/n,i=t[3]/n,c=t[4],y=t[5],L=t[6],k=t[7],l=s*c+r*y+a*L+i*k;e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=(c-s*l)/n,e[5]=(y-r*l)/n,e[6]=(L-a*l)/n,e[7]=(k-i*l)/n}return e}static str(e){return`Quat2(${e.join(", ")})`}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=t[0],l=t[1],M=t[2],h=t[3],b=t[4],d=t[5],m=t[6],o=t[7];return Math.abs(n-k)<=1e-6*Math.max(1,Math.abs(n),Math.abs(k))&&Math.abs(s-l)<=1e-6*Math.max(1,Math.abs(s),Math.abs(l))&&Math.abs(r-M)<=1e-6*Math.max(1,Math.abs(r),Math.abs(M))&&Math.abs(a-h)<=1e-6*Math.max(1,Math.abs(a),Math.abs(h))&&Math.abs(i-b)<=1e-6*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(c-d)<=1e-6*Math.max(1,Math.abs(c),Math.abs(d))&&Math.abs(y-m)<=1e-6*Math.max(1,Math.abs(y),Math.abs(m))&&Math.abs(L-o)<=1e-6*Math.max(1,Math.abs(L),Math.abs(o))}};ye=new WeakMap,Le=new WeakMap,Z(j,ye,new Float64Array(4)),Z(j,Le,new Float64Array(3));var J=j;J.dot=O.dot;J.squaredLength=O.squaredLength;J.sqrLen=O.squaredLength;J.mag=O.magnitude;J.length=O.magnitude;J.len=O.magnitude;J.mul=J.multiply;var N=class A extends Float64Array{constructor(...e){switch(e.length){case 2:{let t=e[0];typeof t=="number"?super([t,e[1]]):super(t,e[1],2);break}case 1:{let t=e[0];typeof t=="number"?super([t,t]):super(t,0,2);break}default:super(2);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get magnitude(){return Math.hypot(this[0],this[1])}get mag(){return this.magnitude}get squaredMagnitude(){let e=this[0],t=this[1];return e*e+t*t}get sqrMag(){return this.squaredMagnitude}get str(){return A.str(this)}copy(e){return this.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this}distance(e){return A.distance(this,e)}dist(e){return 0}squaredDistance(e){return A.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this}dot(e){return this[0]*e[0]+this[1]*e[1]}normalize(){return A.normalize(this,this)}static get BYTE_LENGTH(){return 2*Float64Array.BYTES_PER_ELEMENT}static create(){return new A}static clone(e){return new A(e)}static fromValues(e,t){return new A(e,t)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e}static set(e,t,n){return e[0]=t,e[1]=n,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}static sub(e,t,n){return[0,0]}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e}static mul(e,t,n){return[0,0]}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e}static div(e,t,n){return[0,0]}static ceil(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}static floor(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e}static round(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e}static distance(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1])}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1];return n*n+s*s}static sqrDist(e,t){return 0}static magnitude(e){let t=e[0],n=e[1];return Math.sqrt(t*t+n*n)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){let t=e[0],n=e[1];return t*t+n*n}static sqrLen(e,t){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e}static normalize(e,t){let n=t[0],s=t[1],r=n*n+s*s;return r>0&&(r=1/Math.sqrt(r)),e[0]=t[0]*r,e[1]=t[1]*r,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]}static cross(e,t,n){let s=t[0]*n[1]-t[1]*n[0];return e[0]=e[1]=0,e[2]=s,e}static lerp(e,t,n,s){let r=t[0],a=t[1];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e}static transformMat2(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[2]*r,e[1]=n[1]*s+n[3]*r,e}static transformMat2d(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[2]*r+n[4],e[1]=n[1]*s+n[3]*r+n[5],e}static transformMat3(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[3]*r+n[6],e[1]=n[1]*s+n[4]*r+n[7],e}static transformMat4(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[4]*r+n[12],e[1]=n[1]*s+n[5]*r+n[13],e}static rotate(e,t,n,s){let r=t[0]-n[0],a=t[1]-n[1],i=Math.sin(s),c=Math.cos(s);return e[0]=r*c-a*i+n[0],e[1]=r*i+a*c+n[1],e}static angle(e,t){let n=e[0],s=e[1],r=t[0],a=t[1],i=Math.sqrt(n*n+s*s)*Math.sqrt(r*r+a*a),c=i&&(n*r+s*a)/i;return Math.acos(Math.min(Math.max(c,-1),1))}static zero(e){return e[0]=0,e[1]=0,e}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]}static equals(e,t){let n=e[0],s=e[1],r=t[0],a=t[1];return Math.abs(n-r)<=1e-6*Math.max(1,Math.abs(n),Math.abs(r))&&Math.abs(s-a)<=1e-6*Math.max(1,Math.abs(s),Math.abs(a))}static str(e){return`Vec2(${e.join(", ")})`}};N.prototype.sub=N.prototype.subtract;N.prototype.mul=N.prototype.multiply;N.prototype.div=N.prototype.divide;N.prototype.dist=N.prototype.distance;N.prototype.sqrDist=N.prototype.squaredDistance;N.sub=N.subtract;N.mul=N.multiply;N.div=N.divide;N.dist=N.distance;N.sqrDist=N.squaredDistance;N.sqrLen=N.squaredLength;N.mag=N.magnitude;N.length=N.magnitude;N.len=N.magnitude;var me=!1;function ve(){if(me)return;let A=["xx","xy","yx","yy","xxx","xxy","xyx","xyy","yxx","yxy","yyx","yyy","xxxx","xxxy","xxyx","xxyy","xyxx","xyxy","xyyx","xyyy","yxxx","yxxy","yxyx","yxyy","yyxx","yyxy","yyyx","yyyy","rr","rg","gr","gg","rrr","rrg","rgr","rgg","grr","grg","ggr","ggg","rrrr","rrrg","rrgr","rrgg","rgrr","rgrg","rggr","rggg","grrr","grrg","grgr","grgg","ggrr","ggrg","gggr","gggg"],e=["xz","yz","zx","zy","zz","xxz","xyz","xzx","xzy","xzz","yxz","yyz","yzx","yzy","yzz","zxx","zxy","zxz","zyx","zyy","zyz","zzx","zzy","zzz","xxxz","xxyz","xxzx","xxzy","xxzz","xyxz","xyyz","xyzx","xyzy","xyzz","xzxx","xzxy","xzxz","xzyx","xzyy","xzyz","xzzx","xzzy","xzzz","yxxz","yxyz","yxzx","yxzy","yxzz","yyxz","yyyz","yyzx","yyzy","yyzz","yzxx","yzxy","yzxz","yzyx","yzyy","yzyz","yzzx","yzzy","yzzz","zxxx","zxxy","zxxz","zxyx","zxyy","zxyz","zxzx","zxzy","zxzz","zyxx","zyxy","zyxz","zyyx","zyyy","zyyz","zyzx","zyzy","zyzz","zzxx","zzxy","zzxz","zzyx","zzyy","zzyz","zzzx","zzzy","zzzz","rb","gb","br","bg","bb","rrb","rgb","rbr","rbg","rbb","grb","ggb","gbr","gbg","gbb","brr","brg","brb","bgr","bgg","bgb","bbr","bbg","bbb","rrrb","rrgb","rrbr","rrbg","rrbb","rgrb","rggb","rgbr","rgbg","rgbb","rbrr","rbrg","rbrb","rbgr","rbgg","rbgb","rbbr","rbbg","rbbb","grrb","grgb","grbr","grbg","grbb","ggrb","gggb","ggbr","ggbg","ggbb","gbrr","gbrg","gbrb","gbgr","gbgg","gbgb","gbbr","gbbg","gbbb","brrr","brrg","brrb","brgr","brgg","brgb","brbr","brbg","brbb","bgrr","bgrg","bgrb","bggr","bggg","bggb","bgbr","bgbg","bgbb","bbrr","bbrg","bbrb","bbgr","bbgg","bbgb","bbbr","bbbg","bbbb"],t=["xw","yw","zw","wx","wy","wz","ww","xxw","xyw","xzw","xwx","xwy","xwz","xww","yxw","yyw","yzw","ywx","ywy","ywz","yww","zxw","zyw","zzw","zwx","zwy","zwz","zww","wxx","wxy","wxz","wxw","wyx","wyy","wyz","wyw","wzx","wzy","wzz","wzw","wwx","wwy","wwz","www","xxxw","xxyw","xxzw","xxwx","xxwy","xxwz","xxww","xyxw","xyyw","xyzw","xywx","xywy","xywz","xyww","xzxw","xzyw","xzzw","xzwx","xzwy","xzwz","xzww","xwxx","xwxy","xwxz","xwxw","xwyx","xwyy","xwyz","xwyw","xwzx","xwzy","xwzz","xwzw","xwwx","xwwy","xwwz","xwww","yxxw","yxyw","yxzw","yxwx","yxwy","yxwz","yxww","yyxw","yyyw","yyzw","yywx","yywy","yywz","yyww","yzxw","yzyw","yzzw","yzwx","yzwy","yzwz","yzww","ywxx","ywxy","ywxz","ywxw","ywyx","ywyy","ywyz","ywyw","ywzx","ywzy","ywzz","ywzw","ywwx","ywwy","ywwz","ywww","zxxw","zxyw","zxzw","zxwx","zxwy","zxwz","zxww","zyxw","zyyw","zyzw","zywx","zywy","zywz","zyww","zzxw","zzyw","zzzw","zzwx","zzwy","zzwz","zzww","zwxx","zwxy","zwxz","zwxw","zwyx","zwyy","zwyz","zwyw","zwzx","zwzy","zwzz","zwzw","zwwx","zwwy","zwwz","zwww","wxxx","wxxy","wxxz","wxxw","wxyx","wxyy","wxyz","wxyw","wxzx","wxzy","wxzz","wxzw","wxwx","wxwy","wxwz","wxww","wyxx","wyxy","wyxz","wyxw","wyyx","wyyy","wyyz","wyyw","wyzx","wyzy","wyzz","wyzw","wywx","wywy","wywz","wyww","wzxx","wzxy","wzxz","wzxw","wzyx","wzyy","wzyz","wzyw","wzzx","wzzy","wzzz","wzzw","wzwx","wzwy","wzwz","wzww","wwxx","wwxy","wwxz","wwxw","wwyx","wwyy","wwyz","wwyw","wwzx","wwzy","wwzz","wwzw","wwwx","wwwy","wwwz","wwww","ra","ga","ba","ar","ag","ab","aa","rra","rga","rba","rar","rag","rab","raa","gra","gga","gba","gar","gag","gab","gaa","bra","bga","bba","bar","bag","bab","baa","arr","arg","arb","ara","agr","agg","agb","aga","abr","abg","abb","aba","aar","aag","aab","aaa","rrra","rrga","rrba","rrar","rrag","rrab","rraa","rgra","rgga","rgba","rgar","rgag","rgab","rgaa","rbra","rbga","rbba","rbar","rbag","rbab","rbaa","rarr","rarg","rarb","rara","ragr","ragg","ragb","raga","rabr","rabg","rabb","raba","raar","raag","raab","raaa","grra","grga","grba","grar","grag","grab","graa","ggra","ggga","ggba","ggar","ggag","ggab","ggaa","gbra","gbga","gbba","gbar","gbag","gbab","gbaa","garr","garg","garb","gara","gagr","gagg","gagb","gaga","gabr","gabg","gabb","gaba","gaar","gaag","gaab","gaaa","brra","brga","brba","brar","brag","brab","braa","bgra","bgga","bgba","bgar","bgag","bgab","bgaa","bbra","bbga","bbba","bbar","bbag","bbab","bbaa","barr","barg","barb","bara","bagr","bagg","bagb","baga","babr","babg","babb","baba","baar","baag","baab","baaa","arrr","arrg","arrb","arra","argr","argg","argb","arga","arbr","arbg","arbb","arba","arar","arag","arab","araa","agrr","agrg","agrb","agra","aggr","aggg","aggb","agga","agbr","agbg","agbb","agba","agar","agag","agab","agaa","abrr","abrg","abrb","abra","abgr","abgg","abgb","abga","abbr","abbg","abbb","abba","abar","abag","abab","abaa","aarr","aarg","aarb","aara","aagr","aagg","aagb","aaga","aabr","aabg","aabb","aaba","aaar","aaag","aaab","aaaa"],n={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};function s(r){switch(r.length){case 2:return function(){return new N(this[n[r[0]]],this[n[r[1]]])};case 3:return function(){return new T(this[n[r[0]]],this[n[r[1]]],this[n[r[2]]])};case 4:return function(){return new q(this[n[r[0]]],this[n[r[1]]],this[n[r[2]]],this[n[r[3]]])}}throw new Error("Illegal swizzle length")}for(let r of A){let a=s(r);Object.defineProperty(N.prototype,r,{get:a}),Object.defineProperty(T.prototype,r,{get:a}),Object.defineProperty(q.prototype,r,{get:a})}for(let r of e){let a=s(r);Object.defineProperty(T.prototype,r,{get:a}),Object.defineProperty(q.prototype,r,{get:a})}for(let r of t){let a=s(r);Object.defineProperty(q.prototype,r,{get:a})}me=!0}var xe=Math.PI/180,Re=180/Math.PI;function _e(A){return A*Re}function et(A){return A*xe}export{ve as EnableSwizzlesF64,v as Mat2,_ as Mat2d,u as Mat3,G as Mat4,O as Quat,J as Quat2,N as Vec2,T as Vec3,q as Vec4,_e as toDegree,et as toRadian}; +//# sourceMappingURL=gl-matrix-f64.min.js.map diff --git a/dist-cdn/esm/2016/gl-matrix-f64.min.js.map b/dist-cdn/esm/2016/gl-matrix-f64.min.js.map new file mode 100644 index 00000000..0aa36464 --- /dev/null +++ b/dist-cdn/esm/2016/gl-matrix-f64.min.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../../../src/_lib/f64/Mat2.ts", "../../../src/_lib/f64/Mat2d.ts", "../../../src/_lib/f64/Mat3.ts", "../../../src/_lib/f64/Mat4.ts", "../../../src/_lib/f64/Vec3.ts", "../../../src/_lib/f64/Vec4.ts", "../../../src/_lib/f64/Quat.ts", "../../../src/_lib/f64/Quat2.ts", "../../../src/_lib/f64/Vec2.ts", "../../../src/swizzle/f64/index.ts", "../../../src/util/angleConversion.ts"], + "sourcesContent": ["import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x2 Matrix\r\n */\r\nexport class Mat2 extends Float64Array {\r\n static #IDENTITY_2X2 = new Float64Array([\r\n 1, 0,\r\n 0, 1\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n default:\r\n super(Mat2.#IDENTITY_2X2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2} into `this`.\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2.identity(this)\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n identity(): this {\r\n this.set(Mat2.#IDENTITY_2X2);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2} against another one\r\n * Equivalent to `Mat2.multiply(this, this, b);`\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat2}\r\n * Equivalent to `Mat2.transpose(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n transpose(): this {\r\n return Mat2.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat2}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n invert(): this {\r\n return Mat2.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2.scale(this, this, v);`\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2} by the given angle around the given axis\r\n * Equivalent to `Mat2.rotate(this, this, rad);`\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n rotate(rad: number): this {\r\n return Mat2.rotate(this, this, rad) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2}\r\n */\r\n static create(): Mat2 {\r\n return new Mat2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2}\r\n */\r\n static clone(a: Readonly): Mat2 {\r\n return new Mat2(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2Like, a: Readonly): Mat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2}\r\n */\r\n static fromValues(...values: number[]): Mat2 {\r\n return new Mat2(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2Like, ...values: number[]): Mat2Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2Like): Mat2Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat2Like, a: Readonly): Mat2Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache\r\n // some values\r\n if (out === a) {\r\n const a1 = a[1];\r\n out[1] = a[2];\r\n out[2] = a1;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[2];\r\n out[2] = a[1];\r\n out[3] = a[3];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2Like, a: Mat2Like): Mat2Like | null {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n // Calculate the determinant\r\n let det = a0 * a3 - a2 * a1;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = a3 * det;\r\n out[1] = -a1 * det;\r\n out[2] = -a2 * det;\r\n out[3] = a0 * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat2Like, a: Mat2Like): Mat2Like {\r\n // Caching this value is necessary if out == a\r\n const a0 = a[0];\r\n out[0] = a[3];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[2] * a[1];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n return out;\r\n }\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Rotates a {@link Mat2} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2Like, a: Readonly, rad: number): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2Like, a: Readonly, v: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2Like, rad: number): Mat2Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2Like, v: Readonly): Mat2Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2Like, a: Readonly, b: number): Mat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2Like, a: Readonly, b: Readonly, scale: number): Mat2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\r\n * @category Static\r\n *\r\n * @param L - the lower triangular matrix\r\n * @param D - the diagonal matrix\r\n * @param U - the upper triangular matrix\r\n * @param a - the input matrix to factorize\r\n */\r\n\r\n static LDU(L: Mat2Like, D: Readonly, U: Mat2Like, a: Readonly):\r\n [Mat2Like, Readonly, Mat2Like] {\r\n L[2] = a[2] / a[0];\r\n U[0] = a[0];\r\n U[1] = a[1];\r\n U[3] = a[3] - L[2] * U[1];\r\n return [L, D, U];\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat2.prototype.mul = Mat2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat2.mul = Mat2.multiply;\r\nMat2.sub = Mat2.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x3 Matrix\r\n */\r\nexport class Mat2d extends Float64Array {\r\n static #IDENTITY_2X3 = new Float64Array([\r\n 1, 0,\r\n 0, 1,\r\n 0, 0,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 6:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 6); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 6);\r\n }\r\n break;\r\n default:\r\n super(Mat2d.#IDENTITY_2X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2d.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2d.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2d} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2d.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat2d.#IDENTITY_2X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2d} against another one\r\n * Equivalent to `Mat2d.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2d.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Translate this {@link Mat2d} by the given vector\r\n * Equivalent to `Mat2d.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat2d.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2d} by the given angle around the given axis\r\n * Equivalent to `Mat2d.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat2d.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2d.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2d.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2d}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 6 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2d}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2d}\r\n */\r\n static create(): Mat2d {\r\n return new Mat2d();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2d} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2d}\r\n */\r\n static clone(a: Readonly): Mat2d {\r\n return new Mat2d(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2d} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2dLike, a: Readonly): Mat2dLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2d} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2d}\r\n */\r\n static fromValues(...values: number[]): Mat2d {\r\n return new Mat2d(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2d} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2dLike, ...values: number[]): Mat2dLike {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2d} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2dLike): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2dLike, a: Mat2dLike): Mat2dLike | null {\r\n const aa = a[0];\r\n const ab = a[1];\r\n const ac = a[2];\r\n const ad = a[3];\r\n const atx = a[4];\r\n const aty = a[5];\r\n\r\n let det = aa * ad - ab * ac;\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = ad * det;\r\n out[1] = -ab * det;\r\n out[2] = -ac * det;\r\n out[3] = aa * det;\r\n out[4] = (ac * aty - ad * atx) * det;\r\n out[5] = (ab * atx - aa * aty) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[1] * a[2];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2d}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n out[4] = a0 * b4 + a2 * b5 + a4;\r\n out[5] = a1 * b4 + a3 * b5 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat2d} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n out[4] = a0 * v0 + a2 * v1 + a4;\r\n out[5] = a1 * v0 + a3 * v1 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat2d} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2dLike, a: Readonly, rad: number): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n // TODO: Got to fromRotation\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = v[0];\r\n out[5] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2dLike, rad: number): Mat2dLike {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2d} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2dLike, a: Readonly, b: number): Mat2dLike {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2dLike, a: Readonly, b: Readonly, scale: number):\r\n Mat2dLike {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2d(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Static method alias assignments\r\nMat2d.mul = Mat2d.multiply;\r\nMat2d.sub = Mat2d.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Mat3Like, Mat4Like, Vec2Like, QuatLike } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 3x3 Matrix\r\n */\r\nexport class Mat3 extends Float64Array {\r\n static #IDENTITY_3X3 = new Float64Array([\r\n 1, 0, 0,\r\n 0, 1, 0,\r\n 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 9:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 9); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v,\r\n v, v, v,\r\n v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 9);\r\n }\r\n break;\r\n default:\r\n super(Mat3.#IDENTITY_3X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat3.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat3.#IDENTITY_3X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat3} against another one\r\n * Equivalent to `Mat3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat3.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat3}\r\n * Equivalent to `Mat3.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat3.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat3}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat3.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat3} by the given vector\r\n * Equivalent to `Mat3.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat3.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat3} by the given angle around the given axis\r\n * Equivalent to `Mat3.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat3.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat3.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat3.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 9 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat3}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat3}\r\n */\r\n static create(): Mat3 {\r\n return new Mat3();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat3} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat3}\r\n */\r\n static clone(a: Readonly): Mat3 {\r\n return new Mat3(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat3} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat3} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat3}\r\n */\r\n static fromValues(...values: number[]): Mat3 {\r\n return new Mat3(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat3} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat3Like, ...values: number[]): Mat3Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat3} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat3Like): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat3Like, a: Readonly): Mat3Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a12 = a[5];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a01;\r\n out[5] = a[7];\r\n out[6] = a02;\r\n out[7] = a12;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a[1];\r\n out[4] = a[4];\r\n out[5] = a[7];\r\n out[6] = a[2];\r\n out[7] = a[5];\r\n out[8] = a[8];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat3Like, a: Mat3Like): Mat3Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2];\r\n const a10 = a[3],\r\n a11 = a[4],\r\n a12 = a[5];\r\n const a20 = a[6],\r\n a21 = a[7],\r\n a22 = a[8];\r\n\r\n const b01 = a22 * a11 - a12 * a21;\r\n const b11 = -a22 * a10 + a12 * a20;\r\n const b21 = a21 * a10 - a11 * a20;\r\n\r\n // Calculate the determinant\r\n let det = a00 * b01 + a01 * b11 + a02 * b21;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = b01 * det;\r\n out[1] = (-a22 * a01 + a02 * a21) * det;\r\n out[2] = (a12 * a01 - a02 * a11) * det;\r\n out[3] = b11 * det;\r\n out[4] = (a22 * a00 - a02 * a20) * det;\r\n out[5] = (-a12 * a00 + a02 * a10) * det;\r\n out[6] = b21 * det;\r\n out[7] = (-a21 * a00 + a01 * a20) * det;\r\n out[8] = (a11 * a00 - a01 * a10) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat3Like, a: Mat3Like): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n out[0] = a11 * a22 - a12 * a21;\r\n out[1] = a02 * a21 - a01 * a22;\r\n out[2] = a01 * a12 - a02 * a11;\r\n out[3] = a12 * a20 - a10 * a22;\r\n out[4] = a00 * a22 - a02 * a20;\r\n out[5] = a02 * a10 - a00 * a12;\r\n out[6] = a10 * a21 - a11 * a20;\r\n out[7] = a01 * a20 - a00 * a21;\r\n out[8] = a00 * a11 - a01 * a10;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n return (\r\n a00 * (a22 * a11 - a12 * a21) +\r\n a01 * (-a22 * a10 + a12 * a20) +\r\n a02 * (a21 * a10 - a11 * a20)\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[3];\r\n b1 = b[4];\r\n b2 = b[5];\r\n out[3] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[4] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[5] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[6];\r\n b1 = b[7];\r\n b2 = b[8];\r\n out[6] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[7] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[8] = b0 * a02 + b1 * a12 + b2 * a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat3} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n\r\n out[3] = a10;\r\n out[4] = a11;\r\n out[5] = a12;\r\n\r\n out[6] = x * a00 + y * a10 + a20;\r\n out[7] = x * a01 + y * a11 + a21;\r\n out[8] = x * a02 + y * a12 + a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat3} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat3Like, a: Readonly, rad: number): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c * a00 + s * a10;\r\n out[1] = c * a01 + s * a11;\r\n out[2] = c * a02 + s * a12;\r\n\r\n out[3] = c * a10 - s * a00;\r\n out[4] = c * a11 - s * a01;\r\n out[5] = c * a12 - s * a02;\r\n\r\n out[6] = a20;\r\n out[7] = a21;\r\n out[8] = a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat3} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = x * a[0];\r\n out[1] = x * a[1];\r\n out[2] = x * a[2];\r\n\r\n out[3] = y * a[3];\r\n out[4] = y * a[4];\r\n out[5] = y * a[5];\r\n\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = v[0];\r\n out[7] = v[1];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.rotate(dest, dest, rad);\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat3Like, rad: number): Mat3Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n\r\n out[3] = -s;\r\n out[4] = c;\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n\r\n out[3] = 0;\r\n out[4] = v[1];\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat2d} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 2x3 matrix\r\n * @returns `out`\r\n */\r\n static fromMat2d(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = 0;\r\n\r\n out[3] = a[2];\r\n out[4] = a[3];\r\n out[5] = 0;\r\n\r\n out[6] = a[4];\r\n out[7] = a[5];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param q - {@link Quat} to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat3Like, q: Readonly): Mat3Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[3] = yx - wz;\r\n out[6] = zx + wy;\r\n\r\n out[1] = yx + wz;\r\n out[4] = 1 - xx - zz;\r\n out[7] = zy - wx;\r\n\r\n out[2] = zx - wy;\r\n out[5] = zy + wx;\r\n out[8] = 1 - xx - yy;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat4} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 4x4 matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[4];\r\n out[4] = a[5];\r\n out[5] = a[6];\r\n out[6] = a[8];\r\n out[7] = a[9];\r\n out[8] = a[10];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\r\n * @category Static\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat3Like, a: Readonly): Mat3Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n\r\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n\r\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat3Like, a: Readonly): Mat3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n\r\n out[3] = cy * az - cz * ay;\r\n out[4] = cz * ax - cx * az;\r\n out[5] = cx * ay - cy * ax;\r\n\r\n out[6] = ay * bz - az * by;\r\n out[7] = az * bx - ax * bz;\r\n out[8] = ax * by - ay * bx;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a 2D projection matrix with the given bounds\r\n * @category Static\r\n *\r\n * @param out mat3 frustum matrix will be written into\r\n * @param width Width of your gl context\r\n * @param height Height of gl context\r\n * @returns `out`\r\n */\r\n static projection(out: Mat3Like, width: number, height: number): Mat3Like {\r\n out[0] = 2 / width;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -2 / height;\r\n out[5] = 0;\r\n out[6] = -1;\r\n out[7] = 1;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8]\r\n );\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat3} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat3Like, a: Readonly, b: number): Mat3Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat3Like, a: Readonly, b: Readonly, scale: number): Mat3Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat3(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat3.prototype.mul = Mat3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat3.mul = Mat3.multiply;\r\nMat3.sub = Mat3.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 4x4 Matrix\r\n */\r\nexport class Mat4 extends Float64Array {\r\n static #IDENTITY_4X4 = new Float64Array([\r\n 1, 0, 0, 0,\r\n 0, 1, 0, 0,\r\n 0, 0, 1, 0,\r\n 0, 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Temporary variable to prevent repeated allocations in the algorithms within Mat4.\r\n * These are declared as TypedArrays to aid in tree-shaking.\r\n */\r\n static #TMP_VEC3 = new Float64Array(3);\r\n\r\n /**\r\n * Create a {@link Mat4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 16:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 16); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 16);\r\n }\r\n break;\r\n default:\r\n super(Mat4.#IDENTITY_4X4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat4.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat4.#IDENTITY_4X4);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat4} against another one\r\n * Equivalent to `Mat4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat4.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat4}\r\n * Equivalent to `Mat4.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat4.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat4}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat4.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat4} by the given vector\r\n * Equivalent to `Mat4.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat4.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the given axis\r\n * Equivalent to `Mat4.rotate(this, this, rad, axis);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `this`\r\n */\r\n rotate(rad: number, axis: Readonly): this {\r\n return Mat4.rotate(this, this, rad, axis) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat4.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat4.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the X axis\r\n * Equivalent to `Mat4.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Mat4.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Y axis\r\n * Equivalent to `Mat4.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Mat4.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Z axis\r\n * Equivalent to `Mat4.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Mat4.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveNO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveNO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveZO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveZO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoNO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoNO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoZO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoZO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 16 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat4}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat4}\r\n */\r\n static create(): Mat4 {\r\n return new Mat4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat4} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat4}\r\n */\r\n static clone(a: Readonly): Mat4 {\r\n return new Mat4(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat4} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat4Like, a: Readonly): Mat4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new mat4 with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat4}\r\n */\r\n static fromValues(...values: number[]): Mat4 {\r\n return new Mat4(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a mat4 to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat4Like, ...values: number[]): Mat4Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n out[9] = values[9];\r\n out[10] = values[10];\r\n out[11] = values[11];\r\n out[12] = values[12];\r\n out[13] = values[13];\r\n out[14] = values[14];\r\n out[15] = values[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat4} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat4Like): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat4Like, a: Readonly): Mat4Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a12 = a[6],\r\n a13 = a[7];\r\n const a23 = a[11];\r\n\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a01;\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a02;\r\n out[9] = a12;\r\n out[11] = a[14];\r\n out[12] = a03;\r\n out[13] = a13;\r\n out[14] = a23;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a[1];\r\n out[5] = a[5];\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a[2];\r\n out[9] = a[6];\r\n out[10] = a[10];\r\n out[11] = a[14];\r\n out[12] = a[3];\r\n out[13] = a[7];\r\n out[14] = a[11];\r\n out[15] = a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat4Like, a: Mat4Like): Mat4Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\r\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\r\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\r\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\r\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\r\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\r\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat4Like, a: Mat4Like): Mat4Like {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n out[0] = a11 * b11 - a12 * b10 + a13 * b09;\r\n out[1] = a02 * b10 - a01 * b11 - a03 * b09;\r\n out[2] = a31 * b05 - a32 * b04 + a33 * b03;\r\n out[3] = a22 * b04 - a21 * b05 - a23 * b03;\r\n out[4] = a12 * b08 - a10 * b11 - a13 * b07;\r\n out[5] = a00 * b11 - a02 * b08 + a03 * b07;\r\n out[6] = a32 * b02 - a30 * b05 - a33 * b01;\r\n out[7] = a20 * b05 - a22 * b02 + a23 * b01;\r\n out[8] = a10 * b10 - a11 * b08 + a13 * b06;\r\n out[9] = a01 * b08 - a00 * b10 - a03 * b06;\r\n out[10] = a30 * b04 - a31 * b02 + a33 * b00;\r\n out[11] = a21 * b02 - a20 * b04 - a23 * b00;\r\n out[12] = a11 * b07 - a10 * b09 - a12 * b06;\r\n out[13] = a00 * b09 - a01 * b07 + a02 * b06;\r\n out[14] = a31 * b01 - a30 * b03 - a32 * b00;\r\n out[15] = a20 * b03 - a21 * b01 + a22 * b00;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b0 = a00 * a11 - a01 * a10;\r\n const b1 = a00 * a12 - a02 * a10;\r\n const b2 = a01 * a12 - a02 * a11;\r\n const b3 = a20 * a31 - a21 * a30;\r\n const b4 = a20 * a32 - a22 * a30;\r\n const b5 = a21 * a32 - a22 * a31;\r\n const b6 = a00 * b5 - a01 * b4 + a02 * b3;\r\n const b7 = a10 * b5 - a11 * b4 + a12 * b3;\r\n const b8 = a20 * b2 - a21 * b1 + a22 * b0;\r\n const b9 = a30 * b2 - a31 * b1 + a32 * b0;\r\n\r\n // Calculate the determinant\r\n return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Mat4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n // Cache only the current line of the second matrix\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n let b3 = b[3];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[4];\r\n b1 = b[5];\r\n b2 = b[6];\r\n b3 = b[7];\r\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[8];\r\n b1 = b[9];\r\n b2 = b[10];\r\n b3 = b[11];\r\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[12];\r\n b1 = b[13];\r\n b2 = b[14];\r\n b3 = b[15];\r\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat4} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n if (a === out) {\r\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\r\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\r\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\r\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\r\n } else {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n out[3] = a03;\r\n out[4] = a10;\r\n out[5] = a11;\r\n out[6] = a12;\r\n out[7] = a13;\r\n out[8] = a20;\r\n out[9] = a21;\r\n out[10] = a22;\r\n out[11] = a23;\r\n\r\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\r\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\r\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\r\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec3} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n out[0] = a[0] * x;\r\n out[1] = a[1] * x;\r\n out[2] = a[2] * x;\r\n out[3] = a[3] * x;\r\n out[4] = a[4] * y;\r\n out[5] = a[5] * y;\r\n out[6] = a[6] * y;\r\n out[7] = a[7] * y;\r\n out[8] = a[8] * z;\r\n out[9] = a[9] * z;\r\n out[10] = a[10] * z;\r\n out[11] = a[11] * z;\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat4} by the given angle around the given axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if axis has a length of 0\r\n */\r\n static rotate(out: Mat4Like, a: Readonly, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n // Construct the elements of the rotation matrix\r\n const b00 = x * x * t + c;\r\n const b01 = y * x * t + z * s;\r\n const b02 = z * x * t - y * s;\r\n const b10 = x * y * t - z * s;\r\n const b11 = y * y * t + c;\r\n const b12 = z * y * t + x * s;\r\n const b20 = x * z * t + y * s;\r\n const b21 = y * z * t - x * s;\r\n const b22 = z * z * t + c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\r\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\r\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\r\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\r\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\r\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\r\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\r\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\r\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\r\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\r\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\r\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateX(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[4] = a10 * c + a20 * s;\r\n out[5] = a11 * c + a21 * s;\r\n out[6] = a12 * c + a22 * s;\r\n out[7] = a13 * c + a23 * s;\r\n out[8] = a20 * c - a10 * s;\r\n out[9] = a21 * c - a11 * s;\r\n out[10] = a22 * c - a12 * s;\r\n out[11] = a23 * c - a13 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateY(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c - a20 * s;\r\n out[1] = a01 * c - a21 * s;\r\n out[2] = a02 * c - a22 * s;\r\n out[3] = a03 * c - a23 * s;\r\n out[8] = a00 * s + a20 * c;\r\n out[9] = a01 * s + a21 * c;\r\n out[10] = a02 * s + a22 * c;\r\n out[11] = a03 * s + a23 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c + a10 * s;\r\n out[1] = a01 * c + a11 * s;\r\n out[2] = a02 * c + a12 * s;\r\n out[3] = a03 * c + a13 * s;\r\n out[4] = a10 * c - a00 * s;\r\n out[5] = a11 * c - a01 * s;\r\n out[6] = a12 * c - a02 * s;\r\n out[7] = a13 * c - a03 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = v[1];\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = v[2];\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotate(dest, dest, rad, axis);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if `axis` has a length of 0\r\n */\r\n static fromRotation(out: Mat4Like, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = x * x * t + c;\r\n out[1] = y * x * t + z * s;\r\n out[2] = z * x * t - y * s;\r\n out[3] = 0;\r\n out[4] = x * y * t - z * s;\r\n out[5] = y * y * t + c;\r\n out[6] = z * y * t + x * s;\r\n out[7] = 0;\r\n out[8] = x * z * t + y * s;\r\n out[9] = y * z * t - x * s;\r\n out[10] = z * z * t + c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the X axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateX(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromXRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = c;\r\n out[6] = s;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = -s;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Y axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateY(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromYRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = 0;\r\n out[2] = -s;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = s;\r\n out[9] = 0;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Z axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateZ(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromZRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -s;\r\n out[5] = c;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation and vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Mat4Like, q: Readonly, v: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - (yy + zz);\r\n out[1] = xy + wz;\r\n out[2] = xz - wy;\r\n out[3] = 0;\r\n out[4] = xy - wz;\r\n out[5] = 1 - (xx + zz);\r\n out[6] = yz + wx;\r\n out[7] = 0;\r\n out[8] = xz + wy;\r\n out[9] = yz - wx;\r\n out[10] = 1 - (xx + yy);\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Mat4} from a {@link Quat2}.\r\n * @category Static\r\n *\r\n * @param out - Matrix\r\n * @param a - Dual Quaternion\r\n * @returns `out`\r\n */\r\n static fromQuat2(out: Mat4Like, a: Quat2Like): Mat4Like {\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n\r\n const magnitude = bx * bx + by * by + bz * bz + bw * bw;\r\n\r\n // Only scale if it makes sense\r\n if (magnitude > 0) {\r\n Mat4.#TMP_VEC3[0] = ((ax * bw + aw * bx + ay * bz - az * by) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[1] = ((ay * bw + aw * by + az * bx - ax * bz) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[2] = ((az * bw + aw * bz + ax * by - ay * bx) * 2) / magnitude;\r\n } else {\r\n Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n }\r\n Mat4.fromRotationTranslation(out, a as QuatLike, Mat4.#TMP_VEC3);\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat4Like, a: Readonly): Mat4Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[3] = 0;\r\n\r\n out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[7] = 0;\r\n\r\n out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat4Like, a: Readonly): Mat4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n out[3] = 0;\r\n\r\n out[4] = cy * az - cz * ay;\r\n out[5] = cz * ax - cx * az;\r\n out[6] = cx * ay - cy * ax;\r\n out[7] = 0;\r\n\r\n out[8] = ay * bz - az * by;\r\n out[9] = az * bx - ax * bz;\r\n out[10] = ax * by - ay * bx;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the translation vector component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslation,\r\n * the returned vector will be the same as the translation vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive translation component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getTranslation(out: Vec3Like, mat: Readonly): Vec3Like {\r\n out[0] = mat[12];\r\n out[1] = mat[13];\r\n out[2] = mat[14];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the scaling factor component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslationScale\r\n * with a normalized Quaternion parameter, the returned vector will be\r\n * the same as the scaling vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive scaling factor component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getScaling(out: Vec3Like, mat: Readonly): Vec3Like {\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a quaternion representing the rotational component\r\n * of a transformation matrix. If a matrix is built with\r\n * fromRotationTranslation, the returned quaternion will be the\r\n * same as the quaternion originally supplied.\r\n * @category Static\r\n *\r\n * @param out - Quaternion to receive the rotation component\r\n * @param mat - Matrix to be decomposed (input)\r\n * @return `out`\r\n */\r\n static getRotation(out: QuatLike, mat: Readonly): QuatLike {\r\n Mat4.getScaling(Mat4.#TMP_VEC3, mat);\r\n\r\n const is1 = 1 / Mat4.#TMP_VEC3[0];\r\n const is2 = 1 / Mat4.#TMP_VEC3[1];\r\n const is3 = 1 / Mat4.#TMP_VEC3[2];\r\n\r\n const sm11 = mat[0] * is1;\r\n const sm12 = mat[1] * is2;\r\n const sm13 = mat[2] * is3;\r\n const sm21 = mat[4] * is1;\r\n const sm22 = mat[5] * is2;\r\n const sm23 = mat[6] * is3;\r\n const sm31 = mat[8] * is1;\r\n const sm32 = mat[9] * is2;\r\n const sm33 = mat[10] * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out[3] = 0.25 * S;\r\n out[0] = (sm23 - sm32) / S;\r\n out[1] = (sm31 - sm13) / S;\r\n out[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out[3] = (sm23 - sm32) / S;\r\n out[0] = 0.25 * S;\r\n out[1] = (sm12 + sm21) / S;\r\n out[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out[3] = (sm31 - sm13) / S;\r\n out[0] = (sm12 + sm21) / S;\r\n out[1] = 0.25 * S;\r\n out[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out[3] = (sm12 - sm21) / S;\r\n out[0] = (sm31 + sm13) / S;\r\n out[1] = (sm23 + sm32) / S;\r\n out[2] = 0.25 * S;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Decomposes a transformation matrix into its rotation, translation\r\n * and scale components. Returns only the rotation component\r\n * @category Static\r\n *\r\n * @param out_r - Quaternion to receive the rotation component\r\n * @param out_t - Vector to receive the translation vector\r\n * @param out_s - Vector to receive the scaling factor\r\n * @param mat - Matrix to be decomposed (input)\r\n * @returns `out_r`\r\n */\r\n static decompose(out_r: QuatLike, out_t: Vec3Like, out_s: Vec3Like, mat: Readonly): QuatLike {\r\n out_t[0] = mat[12];\r\n out_t[1] = mat[13];\r\n out_t[2] = mat[14];\r\n\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n const is1 = 1 / out_s[0];\r\n const is2 = 1 / out_s[1];\r\n const is3 = 1 / out_s[2];\r\n\r\n const sm11 = m11 * is1;\r\n const sm12 = m12 * is2;\r\n const sm13 = m13 * is3;\r\n const sm21 = m21 * is1;\r\n const sm22 = m22 * is2;\r\n const sm23 = m23 * is3;\r\n const sm31 = m31 * is1;\r\n const sm32 = m32 * is2;\r\n const sm33 = m33 * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out_r[3] = 0.25 * S;\r\n out_r[0] = (sm23 - sm32) / S;\r\n out_r[1] = (sm31 - sm13) / S;\r\n out_r[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out_r[3] = (sm23 - sm32) / S;\r\n out_r[0] = 0.25 * S;\r\n out_r[1] = (sm12 + sm21) / S;\r\n out_r[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out_r[3] = (sm31 - sm13) / S;\r\n out_r[0] = (sm12 + sm21) / S;\r\n out_r[1] = 0.25 * S;\r\n out_r[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out_r[3] = (sm12 - sm21) / S;\r\n out_r[0] = (sm31 + sm13) / S;\r\n out_r[1] = (sm23 + sm32) / S;\r\n out_r[2] = 0.25 * S;\r\n }\r\n\r\n return out_r;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScale(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n out[0] = (1 - (yy + zz)) * sx;\r\n out[1] = (xy + wz) * sx;\r\n out[2] = (xz - wy) * sx;\r\n out[3] = 0;\r\n out[4] = (xy - wz) * sy;\r\n out[5] = (1 - (xx + zz)) * sy;\r\n out[6] = (yz + wx) * sy;\r\n out[7] = 0;\r\n out[8] = (xz + wy) * sz;\r\n out[9] = (yz - wx) * sz;\r\n out[10] = (1 - (xx + yy)) * sz;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the\r\n * given origin. This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * mat4.translate(dest, origin);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n * mat4.translate(dest, negativeOrigin);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @param o - The origin vector around which to scale and rotate\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScaleOrigin(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly, o: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n const ox = o[0];\r\n const oy = o[1];\r\n const oz = o[2];\r\n\r\n const out0 = (1 - (yy + zz)) * sx;\r\n const out1 = (xy + wz) * sx;\r\n const out2 = (xz - wy) * sx;\r\n const out4 = (xy - wz) * sy;\r\n const out5 = (1 - (xx + zz)) * sy;\r\n const out6 = (yz + wx) * sy;\r\n const out8 = (xz + wy) * sz;\r\n const out9 = (yz - wx) * sz;\r\n const out10 = (1 - (xx + yy)) * sz;\r\n\r\n out[0] = out0;\r\n out[1] = out1;\r\n out[2] = out2;\r\n out[3] = 0;\r\n out[4] = out4;\r\n out[5] = out5;\r\n out[6] = out6;\r\n out[7] = 0;\r\n out[8] = out8;\r\n out[9] = out9;\r\n out[10] = out10;\r\n out[11] = 0;\r\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\r\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\r\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 4x4 matrix from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Quaternion to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat4Like, q: Readonly): Mat4Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[1] = yx + wz;\r\n out[2] = zx - wy;\r\n out[3] = 0;\r\n\r\n out[4] = yx - wz;\r\n out[5] = 1 - xx - zz;\r\n out[6] = zy + wx;\r\n out[7] = 0;\r\n\r\n out[8] = zx + wy;\r\n out[9] = zy - wx;\r\n out[10] = 1 - xx - yy;\r\n out[11] = 0;\r\n\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.frustumNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly\r\n */\r\n static frustum(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like { return out; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveNO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.perspectiveNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static perspective(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveZO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating\r\n * projection matrices to be used with the still experimental WebVR API.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n * @deprecated\r\n */\r\n static perspectiveFromFieldOfView(out: Mat4Like,\r\n fov: { upDegrees: number, downDegrees: number, leftDegrees: number, rightDegrees: number }, near: number,\r\n far: number): Mat4Like {\r\n\r\n const upTan = Math.tan((fov.upDegrees * Math.PI) / 180.0);\r\n const downTan = Math.tan((fov.downDegrees * Math.PI) / 180.0);\r\n const leftTan = Math.tan((fov.leftDegrees * Math.PI) / 180.0);\r\n const rightTan = Math.tan((fov.rightDegrees * Math.PI) / 180.0);\r\n const xScale = 2.0 / (leftTan + rightTan);\r\n const yScale = 2.0 / (upTan + downTan);\r\n\r\n out[0] = xScale;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n out[4] = 0.0;\r\n out[5] = yScale;\r\n out[6] = 0.0;\r\n out[7] = 0.0;\r\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\r\n out[9] = (upTan - downTan) * yScale * 0.5;\r\n out[10] = far / (near - far);\r\n out[11] = -1.0;\r\n out[12] = 0.0;\r\n out[13] = 0.0;\r\n out[14] = (far * near) / (near - far);\r\n out[15] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 2 * nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = (far + near) * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.orthoNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static ortho(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, far: number):\r\n Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = near * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that\r\n * actually makes an object look at another object, you should use targetTo instead.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param center - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static lookAt(out: Mat4Like, eye: Readonly, center: Readonly, up: Readonly): Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n const centerx = center[0];\r\n const centery = center[1];\r\n const centerz = center[2];\r\n\r\n if (\r\n Math.abs(eyex - centerx) < GLM_EPSILON &&\r\n Math.abs(eyey - centery) < GLM_EPSILON &&\r\n Math.abs(eyez - centerz) < GLM_EPSILON\r\n ) {\r\n return Mat4.identity(out);\r\n }\r\n\r\n let z0 = eyex - centerx;\r\n let z1 = eyey - centery;\r\n let z2 = eyez - centerz;\r\n\r\n let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\r\n if (!len) {\r\n x0 = 0;\r\n x1 = 0;\r\n x2 = 0;\r\n } else {\r\n len = 1 / len;\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n let y0 = z1 * x2 - z2 * x1;\r\n let y1 = z2 * x0 - z0 * x2;\r\n let y2 = z0 * x1 - z1 * x0;\r\n\r\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\r\n if (!len) {\r\n y0 = 0;\r\n y1 = 0;\r\n y2 = 0;\r\n } else {\r\n len = 1 / len;\r\n y0 *= len;\r\n y1 *= len;\r\n y2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = y0;\r\n out[2] = z0;\r\n out[3] = 0;\r\n out[4] = x1;\r\n out[5] = y1;\r\n out[6] = z1;\r\n out[7] = 0;\r\n out[8] = x2;\r\n out[9] = y2;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\r\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\r\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a matrix that makes something look at something else.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param target - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static targetTo(out: Mat4Like, eye: Readonly, target: Readonly, up: Readonly):\r\n Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n\r\n let z0 = eyex - target[0];\r\n let z1 = eyey - target[1];\r\n let z2 = eyez - target[2];\r\n\r\n let len = z0 * z0 + z1 * z1 + z2 * z2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n }\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n\r\n len = x0 * x0 + x1 * x1 + x2 * x2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = x1;\r\n out[2] = x2;\r\n out[3] = 0;\r\n out[4] = z1 * x2 - z2 * x1;\r\n out[5] = z2 * x0 - z0 * x2;\r\n out[6] = z0 * x1 - z1 * x0;\r\n out[7] = 0;\r\n out[8] = z0;\r\n out[9] = z1;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = eyex;\r\n out[13] = eyey;\r\n out[14] = eyez;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8] +\r\n a[9] * a[9] +\r\n a[10] * a[10] +\r\n a[11] * a[11] +\r\n a[12] * a[12] +\r\n a[13] * a[13] +\r\n a[14] * a[14] +\r\n a[15] * a[15]\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n out[9] = a[9] + b[9];\r\n out[10] = a[10] + b[10];\r\n out[11] = a[11] + b[11];\r\n out[12] = a[12] + b[12];\r\n out[13] = a[13] + b[13];\r\n out[14] = a[14] + b[14];\r\n out[15] = a[15] + b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n out[9] = a[9] - b[9];\r\n out[10] = a[10] - b[10];\r\n out[11] = a[11] - b[11];\r\n out[12] = a[12] - b[12];\r\n out[13] = a[13] - b[13];\r\n out[14] = a[14] - b[14];\r\n out[15] = a[15] - b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Multiply each element of the matrix by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat4Like, a: Readonly, b: number): Mat4Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n out[9] = a[9] * b;\r\n out[10] = a[10] * b;\r\n out[11] = a[11] * b;\r\n out[12] = a[12] * b;\r\n out[13] = a[13] * b;\r\n out[14] = a[14] * b;\r\n out[15] = a[15] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat4Like, a: Readonly, b: Readonly, scale: number): Mat4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n out[9] = a[9] + b[9] * scale;\r\n out[10] = a[10] + b[10] * scale;\r\n out[11] = a[11] + b[11] * scale;\r\n out[12] = a[12] + b[12] * scale;\r\n out[13] = a[13] + b[13] * scale;\r\n out[14] = a[14] + b[14] * scale;\r\n out[15] = a[15] + b[15] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8] &&\r\n a[9] === b[9] &&\r\n a[10] === b[10] &&\r\n a[11] === b[11] &&\r\n a[12] === b[12] &&\r\n a[13] === b[13] &&\r\n a[14] === b[14] &&\r\n a[15] === b[15]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n const a9 = a[9];\r\n const a10 = a[10];\r\n const a11 = a[11];\r\n const a12 = a[12];\r\n const a13 = a[13];\r\n const a14 = a[14];\r\n const a15 = a[15];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n const b9 = b[9];\r\n const b10 = b[10];\r\n const b11 = b[11];\r\n const b12 = b[12];\r\n const b13 = b[13];\r\n const b14 = b[14];\r\n const b15 = b[15];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) &&\r\n Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) &&\r\n Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) &&\r\n Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) &&\r\n Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) &&\r\n Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) &&\r\n Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) &&\r\n Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat4(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat4.prototype.mul = Mat4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat4.sub = Mat4.subtract;\r\nMat4.mul = Mat4.multiply;\r\nMat4.frustum = Mat4.frustumNO;\r\nMat4.perspective = Mat4.perspectiveNO;\r\nMat4.ortho = Mat4.orthoNO;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, Mat4Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 3 Dimensional Vector\r\n */\r\nexport class Vec3 extends Float64Array {\r\n /**\r\n * Create a {@link Vec3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 3:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 3); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 3);\r\n }\r\n break;\r\n }\r\n default:\r\n super(3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec3.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec3.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec3} to `this`.\r\n * Equivalent to `Vec3.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec3} from `this`.\r\n * Equivalent to `Vec3.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec3.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec3.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec3.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec3.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec3.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to its absolute value.\r\n * Equivalent to `Vec3.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec3}.\r\n * Equivalent to `Vec3.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec3.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec3.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 3 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty vec3\r\n * @category Static\r\n *\r\n * @returns a new 3D vector\r\n */\r\n static create(): Vec3 {\r\n return new Vec3();\r\n }\r\n\r\n /**\r\n * Creates a new vec3 initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 3D vector\r\n */\r\n static clone(a: Readonly): Vec3 {\r\n return new Vec3(a);\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Creates a new vec3 initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns a new 3D vector\r\n */\r\n static fromValues(x: number, y: number, z: number): Vec3 {\r\n return new Vec3(x, y, z);\r\n }\r\n\r\n /**\r\n * Copy the values from one vec3 to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns `out`\r\n */\r\n static set(out: Vec3Like, x: number, y: number, z: number): Vec3Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Multiplies two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; }\r\n\r\n /**\r\n * Divides two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Math.ceil the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * symmetric round the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n /*\r\n static round(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = glMatrix.round(a[0]);\r\n out[1] = glMatrix.round(a[1]);\r\n out[2] = glMatrix.round(a[2]);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Scales a vec3 by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec3Like, a: Readonly, scale: number): Vec3Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two vec3's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec3Like, a: Readonly, b: Readonly, scale: number) {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared length of a vec3\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec3Like, a: Readonly): Vec3Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n let len = x * x + y * y + z * z;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n out[2] = a[2] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2];\r\n const bx = b[0],\r\n by = b[1],\r\n bz = b[2];\r\n\r\n out[0] = ay * bz - az * by;\r\n out[1] = az * bx - ax * bz;\r\n out[2] = ax * by - ay * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const angle = Math.acos(Math.min(Math.max(Vec3.dot(a, b), -1), 1));\r\n const sinTotal = Math.sin(angle);\r\n\r\n const ratioA = Math.sin((1 - t) * angle) / sinTotal;\r\n const ratioB = Math.sin(t * angle) / sinTotal;\r\n out[0] = ratioA * a[0] + ratioB * b[0];\r\n out[1] = ratioA * a[1] + ratioB * b[1];\r\n out[2] = ratioA * a[2] + ratioB * b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a hermite interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static hermite(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const factorTimes2 = t * t;\r\n const factor1 = factorTimes2 * (2 * t - 3) + 1;\r\n const factor2 = factorTimes2 * (t - 2) + t;\r\n const factor3 = factorTimes2 * (t - 1);\r\n const factor4 = factorTimes2 * (3 - 2 * t);\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a bezier interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static bezier(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const inverseFactor = 1 - t;\r\n const inverseFactorTimesTwo = inverseFactor * inverseFactor;\r\n const factorTimes2 = t * t;\r\n const factor1 = inverseFactorTimesTwo * inverseFactor;\r\n const factor2 = 3 * t * inverseFactorTimesTwo;\r\n const factor3 = 3 * factorTimes2 * inverseFactor;\r\n const factor4 = factorTimes2 * t;\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec3Like, scale) {\r\n scale = scale === undefined ? 1.0 : scale;\r\n\r\n let r = glMatrix.RANDOM() * 2.0 * Math.PI;\r\n let z = glMatrix.RANDOM() * 2.0 - 1.0;\r\n let zScale = Math.sqrt(1.0 - z * z) * scale;\r\n\r\n out[0] = Math.cos(r) * zScale;\r\n out[1] = Math.sin(r) * zScale;\r\n out[2] = z * scale;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the vec3 with a mat4.\r\n * 4th vector component is implicitly '1'\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec3Like, a: Readonly, m: Readonly): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1.0;\r\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\r\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\r\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a mat3.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - the 3x3 matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat3(out: Vec3Like, a: Vec3Like, m: Mat3Like): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n out[0] = x * m[0] + y * m[3] + z * m[6];\r\n out[1] = x * m[1] + y * m[4] + z * m[7];\r\n out[2] = x * m[2] + y * m[5] + z * m[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a quat\r\n * Can also be used for dual quaternions. (Multiply it with the real part)\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec3Like, a: Readonly, q: Readonly): Vec3Like {\r\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const w2 = q[3] * 2;\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n // var qvec = [qx, qy, qz];\r\n // var uv = vec3.cross([], qvec, a);\r\n const uvx = (qy * z - qz * y);\r\n const uvy = (qz * x - qx * z);\r\n const uvz = (qx * y - qy * x);\r\n // var uuv = vec3.cross([], qvec, uv);\r\n // vec3.scale(uuv, uuv, 2);\r\n const uuvx = (qy * uvz - qz * uvy) * 2;\r\n const uuvy = (qz * uvx - qx * uvz) * 2;\r\n const uuvz = (qx * uvy - qy * uvx) * 2;\r\n // vec3.scale(uv, uv, 2 * w);\r\n // return vec3.add(out, a, vec3.add(out, uv, uuv));\r\n out[0] = x + (uvx * w2) + uuvx;\r\n out[1] = y + (uvy * w2) + uuvy;\r\n out[2] = z + (uvz * w2) + uuvz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the x-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateX(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const by = b[1];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const py = a[1] - by;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = a[0];\r\n out[1] = (py * Math.cos(rad) - pz * Math.sin(rad)) + by;\r\n out[2] = (py * Math.sin(rad) + pz * Math.cos(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the y-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateY(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (pz * Math.sin(rad) + px * Math.cos(rad)) + bx;\r\n out[1] = a[1];\r\n out[2] = (pz * Math.cos(rad) - px * Math.sin(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the z-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const by = b[1];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const py = a[1] - by;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (px * Math.cos(rad) - py * Math.sin(rad)) + bx;\r\n out[1] = (px * Math.sin(rad) + py * Math.cos(rad)) + by;\r\n out[2] = b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 3D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly) {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz));\r\n const cosine = mag && Vec3.dot(a, b) / mag;\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec3Like): Vec3Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec3(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec3.prototype.sub = Vec3.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.mul = Vec3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.div = Vec3.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.dist = Vec3.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.sqrDist = Vec3.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec3.sub = Vec3.subtract;\r\nVec3.mul = Vec3.multiply;\r\nVec3.div = Vec3.divide;\r\nVec3.dist = Vec3.distance;\r\nVec3.sqrDist = Vec3.squaredDistance;\r\nVec3.sqrLen = Vec3.squaredLength;\r\nVec3.mag = Vec3.magnitude;\r\nVec3.length = Vec3.magnitude;\r\nVec3.len = Vec3.magnitude;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Vec4Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 4 Dimensional Vector\r\n */\r\nexport class Vec4 extends Float64Array {\r\n /**\r\n * Create a {@link Vec4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the vector. Equivalent to `this[3];`\r\n * @category Vector Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The a component of the vector. Equivalent to `this[3];`\r\n * @category Color Components\r\n */\r\n get a(): number { return this[3]; }\r\n set a(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec4.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec4} to `this`.\r\n * Equivalent to `Vec4.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n this[3] += b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec4} from `this`.\r\n * Equivalent to `Vec4.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n this[3] -= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n this[3] *= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n this[3] /= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec4.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n this[3] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n this[3] += b[3] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec4.distance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec4.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec4.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n this[3] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec4.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n this[3] = 1.0 / this[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec4.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n this[3] = Math.abs(this[3]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec4}.\r\n * Equivalent to `Vec4.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec4.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec4.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec4}\r\n * @category Static\r\n *\r\n * @returns a new 4D vector\r\n */\r\n static create(): Vec4 {\r\n return new Vec4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 4D vector\r\n */\r\n static clone(a: Vec4Like): Vec4 {\r\n return new Vec4(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new 4D vector\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Vec4 {\r\n return new Vec4(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec4} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n static set(out: Vec4Like, x: number, y: number, z: number, w: number): Vec4Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n out[3] = a[3] * b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Divides two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n out[3] = a[3] / b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n out[3] = Math.ceil(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n out[3] = Math.floor(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n out[3] = Math.min(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n out[3] = Math.max(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n out[2] = Math.round(a[2]);\r\n out[3] = Math.round(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec4} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec4Like, a: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}'s after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec4Like, a: Readonly, b: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return Math.hypot(x, y, z, w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of `a`\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = -a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n out[3] = 1.0 / a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n out[3] = Math.abs(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec4Like, a: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n let len = x * x + y * y + z * z + w * w;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = x * len;\r\n out[1] = y * len;\r\n out[2] = z * len;\r\n out[3] = w * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Returns the cross-product of three vectors in a 4-dimensional space\r\n * @category Static\r\n *\r\n * @param out the receiving vector\r\n * @param u - the first vector\r\n * @param v - the second vector\r\n * @param w - the third vector\r\n * @returns result\r\n */\r\n static cross(out: Vec4Like, u: Readonly, v: Readonly, w: Readonly): Vec4Like {\r\n const a = v[0] * w[1] - v[1] * w[0];\r\n const b = v[0] * w[2] - v[2] * w[0];\r\n const c = v[0] * w[3] - v[3] * w[0];\r\n const d = v[1] * w[2] - v[2] * w[1];\r\n const e = v[1] * w[3] - v[3] * w[1];\r\n const f = v[2] * w[3] - v[3] * w[2];\r\n const g = u[0];\r\n const h = u[1];\r\n const i = u[2];\r\n const j = u[3];\r\n\r\n out[0] = h * f - i * e + j * d;\r\n out[1] = -(g * f) + i * c - j * b;\r\n out[2] = g * e - h * c + j * a;\r\n out[3] = -(g * d) + h * b - i * a;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec4Like, a: Readonly, b: Readonly, t: number): Vec4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n out[3] = aw + t * (b[3] - aw);\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec4Like, scale): Vec4Like {\r\n scale = scale || 1.0;\r\n\r\n // Marsaglia, George. Choosing a Point from the Surface of a\r\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\r\n // http://projecteuclid.org/euclid.aoms/1177692644;\r\n var v1, v2, v3, v4;\r\n var s1, s2;\r\n do {\r\n v1 = glMatrix.RANDOM() * 2 - 1;\r\n v2 = glMatrix.RANDOM() * 2 - 1;\r\n s1 = v1 * v1 + v2 * v2;\r\n } while (s1 >= 1);\r\n do {\r\n v3 = glMatrix.RANDOM() * 2 - 1;\r\n v4 = glMatrix.RANDOM() * 2 - 1;\r\n s2 = v3 * v3 + v4 * v4;\r\n } while (s2 >= 1);\r\n\r\n var d = Math.sqrt((1 - s1) / s2);\r\n out[0] = scale * v1;\r\n out[1] = scale * v2;\r\n out[2] = scale * v3 * d;\r\n out[3] = scale * v4 * d;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Mat4}.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec4Like, a: Readonly, m: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\r\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\r\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\r\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec4Like, a: Readonly, q: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n\r\n // calculate quat * vec\r\n const ix = qw * x + qy * z - qz * y;\r\n const iy = qw * y + qz * x - qx * z;\r\n const iz = qw * z + qx * y - qy * x;\r\n const iw = -qx * x - qy * y - qz * z;\r\n\r\n // calculate result * inverse quat\r\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\r\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\r\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec4Like): Vec4Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec4(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec4.prototype.sub = Vec4.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.mul = Vec4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.div = Vec4.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.dist = Vec4.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.sqrDist = Vec4.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec4.sub = Vec4.subtract;\r\nVec4.mul = Vec4.multiply;\r\nVec4.div = Vec4.divide;\r\nVec4.dist = Vec4.distance;\r\nVec4.sqrDist = Vec4.squaredDistance;\r\nVec4.sqrLen = Vec4.squaredLength;\r\nVec4.mag = Vec4.magnitude;\r\nVec4.length = Vec4.magnitude;\r\nVec4.len = Vec4.magnitude;\r\n", "import { Vec3 } from './Vec3.js';\r\nimport { Vec4 } from './Vec4.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Quaternion\r\n */\r\nexport class Quat extends Float64Array {\r\n static #DEFAULT_ANGLE_ORDER = 'zyx';\r\n\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT1 = new Float64Array(4);\r\n static #TMP_QUAT2 = new Float64Array(4);\r\n static #TMP_MAT3 = new Float64Array(9);\r\n\r\n static #TMP_VEC3 = new Float64Array(3);\r\n static #X_UNIT_VEC3 = new Float64Array([1, 0, 0]);\r\n static #Y_UNIT_VEC3 = new Float64Array([0, 1, 0]);\r\n\r\n /**\r\n * Create a {@link Quat}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the quaternion. Equivalent to `this[0];`\r\n * @category Quaternion Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the quaternion. Equivalent to `this[1];`\r\n * @category Quaternion Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the quaternion. Equivalent to `this[2];`\r\n * @category Quaternion Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the quaternion. Equivalent to `this[3];`\r\n * @category Quaternion Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Quat.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity quaternion\r\n * Equivalent to Quat.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this[0] = 0;\r\n this[1] = 0;\r\n this[2] = 0;\r\n this[3] = 1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies `this` by a {@link Quat}.\r\n * Equivalent to `Quat.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Quat.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Rotates `this` by the given angle about the X axis\r\n * Equivalent to `Quat.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Quat.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Y axis\r\n * Equivalent to `Quat.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Quat.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Z axis\r\n * Equivalent to `Quat.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Quat.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Inverts `this`\r\n * Equivalent to `Quat.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Quat.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales `this` by a scalar number\r\n * Equivalent to `Quat.scale(this, this, scale);`\r\n * @category Methods\r\n *\r\n * @param scale - amount to scale the vector by\r\n * @returns `this`\r\n */\r\n scale(scale: number): QuatLike {\r\n this[0] *= scale;\r\n this[1] *= scale;\r\n this[2] *= scale;\r\n this[3] *= scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of `this` and another {@link Quat}\r\n * Equivalent to `Quat.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - the second operand\r\n * @returns dot product of `this` and b\r\n */\r\n dot(b: Readonly): number {\r\n return Quat.dot(this, b);\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity quat\r\n * @category Static\r\n *\r\n * @returns a new quaternion\r\n */\r\n static create(): Quat {\r\n return new Quat();\r\n }\r\n\r\n /**\r\n * Set a quat to the identity quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a quat from the given angle and rotation axis,\r\n * then returns it.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param axis - the axis around which to rotate\r\n * @param rad - the angle in radians\r\n * @returns `out`\r\n **/\r\n static setAxisAngle(out: QuatLike, axis: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n out[0] = s * axis[0];\r\n out[1] = s * axis[1];\r\n out[2] = s * axis[2];\r\n out[3] = Math.cos(rad);\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the rotation axis and angle for a given\r\n * quaternion. If a quaternion is created with\r\n * setAxisAngle, this method will return the same\r\n * values as provided in the original parameter list\r\n * OR functionally equivalent values.\r\n * Example: The quaternion formed by axis [0, 0, 1] and\r\n * angle -90 is the same as the quaternion formed by\r\n * [0, 0, 1] and 270. This method favors the latter.\r\n * @category Static\r\n *\r\n * @param out_axis - Vector receiving the axis of rotation\r\n * @param q - Quaternion to be decomposed\r\n * @return Angle, in radians, of the rotation\r\n */\r\n static getAxisAngle(out_axis: Vec3Like, q: Readonly): number {\r\n const rad = Math.acos(q[3]) * 2.0;\r\n const s = Math.sin(rad / 2.0);\r\n if (s > GLM_EPSILON) {\r\n out_axis[0] = q[0] / s;\r\n out_axis[1] = q[1] / s;\r\n out_axis[2] = q[2] / s;\r\n } else {\r\n // If s is zero, return any axis (no rotation - axis does not matter)\r\n out_axis[0] = 1;\r\n out_axis[1] = 0;\r\n out_axis[2] = 0;\r\n }\r\n return rad;\r\n }\r\n\r\n /**\r\n * Gets the angular distance between two unit quaternions\r\n * @category Static\r\n *\r\n * @param {ReadonlyQuat} a Origin unit quaternion\r\n * @param {ReadonlyQuat} b Destination unit quaternion\r\n * @return {Number} Angle, in radians, between the two quaternions\r\n */\r\n static getAngle(a: Readonly, b: Readonly): number {\r\n const dotproduct = Quat.dot(a, b);\r\n\r\n return Math.acos(2 * dotproduct * dotproduct - 1);\r\n }\r\n\r\n /**\r\n * Multiplies two quaternions.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const bw = b[3];\r\n\r\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the X axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + aw * bx;\r\n out[1] = ay * bw + az * bx;\r\n out[2] = az * bw - ay * bx;\r\n out[3] = aw * bw - ax * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Y axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const by = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw - az * by;\r\n out[1] = ay * bw + aw * by;\r\n out[2] = az * bw + ax * by;\r\n out[3] = aw * bw - ay * by;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Z axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bz = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + ay * bz;\r\n out[1] = ay * bw - ax * bz;\r\n out[2] = az * bw + aw * bz;\r\n out[3] = aw * bw - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the W component of a quat from the X, Y, and Z components.\r\n * Assumes that quaternion is 1 unit in length.\r\n * Any existing W component will be ignored.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate W component of\r\n * @returns `out`\r\n */\r\n static calculateW(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the exponential of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static exp(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const et = Math.exp(w);\r\n const s = r > 0 ? (et * Math.sin(r)) / r : 0;\r\n\r\n out[0] = x * s;\r\n out[1] = y * s;\r\n out[2] = z * s;\r\n out[3] = et * Math.cos(r);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the natural logarithm of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static ln(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const t = r > 0 ? Math.atan2(r, w) / r : 0;\r\n\r\n out[0] = x * t;\r\n out[1] = y * t;\r\n out[2] = z * t;\r\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the scalar power of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @param b - amount to scale the quaternion by\r\n * @returns `out`\r\n */\r\n static pow(out: QuatLike, a: Readonly, b: number): QuatLike {\r\n Quat.ln(out, a);\r\n Quat.scale(out, out, b);\r\n Quat.exp(out, out);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike {\r\n // benchmarks:\r\n // http://jsperf.com/quaternion-slerp-implementations\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2],\r\n aw = a[3];\r\n let bx = b[0],\r\n by = b[1],\r\n bz = b[2],\r\n bw = b[3];\r\n\r\n let scale0: number;\r\n let scale1: number;\r\n\r\n // calc cosine\r\n let cosom = ax * bx + ay * by + az * bz + aw * bw;\r\n // adjust signs (if necessary)\r\n if (cosom < 0.0) {\r\n cosom = -cosom;\r\n bx = -bx;\r\n by = -by;\r\n bz = -bz;\r\n bw = -bw;\r\n }\r\n // calculate coefficients\r\n if (1.0 - cosom > GLM_EPSILON) {\r\n // standard case (slerp)\r\n const omega = Math.acos(cosom);\r\n const sinom = Math.sin(omega);\r\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\r\n scale1 = Math.sin(t * omega) / sinom;\r\n } else {\r\n // \"from\" and \"to\" quaternions are very close\r\n // ... so we can do a linear interpolation\r\n scale0 = 1.0 - t;\r\n scale1 = t;\r\n }\r\n // calculate final values\r\n out[0] = scale0 * ax + scale1 * bx;\r\n out[1] = scale0 * ay + scale1 * by;\r\n out[2] = scale0 * az + scale1 * bz;\r\n out[3] = scale0 * aw + scale1 * bw;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random unit quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n /* static random(out: QuatLike): QuatLike {\r\n // Implementation of http://planning.cs.uiuc.edu/node198.html\r\n // TODO: Calling random 3 times is probably not the fastest solution\r\n let u1 = glMatrix.RANDOM();\r\n let u2 = glMatrix.RANDOM();\r\n let u3 = glMatrix.RANDOM();\r\n\r\n let sqrt1MinusU1 = Math.sqrt(1 - u1);\r\n let sqrtU1 = Math.sqrt(u1);\r\n\r\n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\r\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\r\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\r\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Calculates the inverse of a quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: QuatLike, a: Readonly): QuatLike {\r\n const a0 = a[0],\r\n a1 = a[1],\r\n a2 = a[2],\r\n a3 = a[3];\r\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\r\n const invDot = dot ? 1.0 / dot : 0;\r\n\r\n // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\r\n\r\n out[0] = -a0 * invDot;\r\n out[1] = -a1 * invDot;\r\n out[2] = -a2 * invDot;\r\n out[3] = a3 * invDot;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a quat\r\n * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given 3x3 rotation matrix.\r\n *\r\n * NOTE: The resultant quaternion is not normalized, so you should be sure\r\n * to re-normalize the quaternion yourself where necessary.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param m - rotation matrix\r\n * @returns `out`\r\n */\r\n static fromMat3(out: QuatLike, m: Readonly): QuatLike {\r\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\r\n // article \"Quaternion Calculus and Fast Animation\".\r\n const fTrace = m[0] + m[4] + m[8];\r\n let fRoot: number;\r\n\r\n if (fTrace > 0.0) {\r\n // |w| > 1/2, may as well choose w > 1/2\r\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\r\n out[3] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot; // 1/(4w)\r\n out[0] = (m[5] - m[7]) * fRoot;\r\n out[1] = (m[6] - m[2]) * fRoot;\r\n out[2] = (m[1] - m[3]) * fRoot;\r\n } else {\r\n // |w| <= 1/2\r\n let i = 0;\r\n if (m[4] > m[0]) { i = 1; }\r\n if (m[8] > m[i * 3 + i]) { i = 2; }\r\n const j = (i + 1) % 3;\r\n const k = (i + 2) % 3;\r\n\r\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\r\n out[i] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot;\r\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\r\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\r\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given euler angle x, y, z.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - Angle to rotate around X axis in degrees.\r\n * @param y - Angle to rotate around Y axis in degrees.\r\n * @param z - Angle to rotate around Z axis in degrees.\r\n * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx.\r\n * @returns `out`\r\n */\r\n static fromEuler(out: QuatLike, x: number, y: number, z: number, order = Quat.#DEFAULT_ANGLE_ORDER): QuatLike {\r\n const halfToRad = (0.5 * Math.PI) / 180.0;\r\n x *= halfToRad;\r\n y *= halfToRad;\r\n z *= halfToRad;\r\n\r\n const sx = Math.sin(x);\r\n const cx = Math.cos(x);\r\n const sy = Math.sin(y);\r\n const cy = Math.cos(y);\r\n const sz = Math.sin(z);\r\n const cz = Math.cos(z);\r\n\r\n switch (order) {\r\n case 'xyz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'xzy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yxz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yzx':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zxy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zyx':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n default:\r\n throw new Error(`Unknown angle order ${order}`);\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a quatenion\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - quaternion to clone\r\n * @returns a new quaternion\r\n */\r\n static clone(a: Readonly): Quat {\r\n return new Quat(a);\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new quaternion\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Quat {\r\n return new Quat(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one quat to another\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the source quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static set(out: QuatLike, x: number, y: number, z: number, w: number): QuatLike { return out; }\r\n\r\n /**\r\n * Adds two {@link Quat}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static add(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Scales a quat by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param b - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: QuatLike, a: Readonly, scale: number): QuatLike {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two quat's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two quat's\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static lerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike { return out; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mag(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quaternion to normalize\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static normalize(out: QuatLike, a: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first quaternion.\r\n * @param b - The second quaternion.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static exactEquals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Returns whether the quaternions have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static equals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Sets a quaternion to represent the shortest rotation from one\r\n * vector to another.\r\n *\r\n * Both vectors are assumed to be unit length.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion.\r\n * @param a - the initial vector\r\n * @param b - the destination vector\r\n * @returns `out`\r\n */\r\n static rotationTo(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const dot = Vec3.dot(a, b);\r\n\r\n if (dot < -0.999999) {\r\n Vec3.cross(Quat.#TMP_VEC3, Quat.#X_UNIT_VEC3, a);\r\n if (Vec3.mag(Quat.#TMP_VEC3) < 0.000001) { Vec3.cross(Quat.#TMP_VEC3, Quat.#Y_UNIT_VEC3, a); }\r\n Vec3.normalize(Quat.#TMP_VEC3, Quat.#TMP_VEC3);\r\n Quat.setAxisAngle(out, Quat.#TMP_VEC3, Math.PI);\r\n return out;\r\n } else if (dot > 0.999999) {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n } else {\r\n Vec3.cross(Quat.#TMP_VEC3, a, b);\r\n out[0] = Quat.#TMP_VEC3[0];\r\n out[1] = Quat.#TMP_VEC3[1];\r\n out[2] = Quat.#TMP_VEC3[2];\r\n out[3] = 1 + dot;\r\n return Quat.normalize(out, out);\r\n }\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static sqlerp(out: QuatLike, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): QuatLike {\r\n Quat.slerp(Quat.#TMP_QUAT1, a, d, t);\r\n Quat.slerp(Quat.#TMP_QUAT2, b, c, t);\r\n Quat.slerp(out, Quat.#TMP_QUAT1, Quat.#TMP_QUAT2, 2 * t * (1 - t));\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets the specified quaternion with values corresponding to the given\r\n * axes. Each axis is a vec3 and is expected to be unit length and\r\n * perpendicular to all other specified axes.\r\n * @category Static\r\n *\r\n * @param out - The receiving quaternion\r\n * @param view - the vector representing the viewing direction\r\n * @param right - the vector representing the local `right` direction\r\n * @param up - the vector representing the local `up` direction\r\n * @returns `out`\r\n */\r\n static setAxes(out: QuatLike, view: Readonly, right: Readonly, up: Readonly): QuatLike {\r\n Quat.#TMP_MAT3[0] = right[0];\r\n Quat.#TMP_MAT3[3] = right[1];\r\n Quat.#TMP_MAT3[6] = right[2];\r\n\r\n Quat.#TMP_MAT3[1] = up[0];\r\n Quat.#TMP_MAT3[4] = up[1];\r\n Quat.#TMP_MAT3[7] = up[2];\r\n\r\n Quat.#TMP_MAT3[2] = -view[0];\r\n Quat.#TMP_MAT3[5] = -view[1];\r\n Quat.#TMP_MAT3[8] = -view[2];\r\n\r\n return Quat.normalize(out, Quat.fromMat3(out, Quat.#TMP_MAT3));\r\n }\r\n}\r\n\r\n// Methods which re-use the Vec4 implementation\r\nQuat.set = Vec4.set;\r\nQuat.add = Vec4.add;\r\nQuat.lerp = Vec4.lerp;\r\nQuat.normalize = Vec4.normalize;\r\nQuat.squaredLength = Vec4.squaredLength;\r\nQuat.sqrLen = Vec4.squaredLength;\r\nQuat.exactEquals = Vec4.exactEquals;\r\nQuat.equals = Vec4.equals;\r\nQuat.magnitude = Vec4.magnitude;\r\n\r\n// Instance method alias assignments\r\nQuat.prototype.mul = Quat.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nQuat.mul = Quat.multiply;\r\nQuat.mag = Quat.magnitude;\r\nQuat.length = Quat.magnitude;\r\nQuat.len = Quat.magnitude;\r\n", "import { Mat4 } from './Mat4.js';\r\nimport { Quat } from './Quat.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Dual Quaternion\r\n */\r\nexport class Quat2 extends Float64Array {\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat2.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT = new Float64Array(4);\r\n static #TMP_VEC3 = new Float64Array(3);\r\n\r\n /**\r\n * Create a {@link Quat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 8:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 8); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v, v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 8);\r\n }\r\n break;\r\n }\r\n default:\r\n super(8);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source dual quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 8 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity {@link Quat2}\r\n * @category Static\r\n *\r\n * @returns a new dual quaternion [real -> rotation, dual -> translation]\r\n */\r\n static create(): Quat2 {\r\n return new Quat2();\r\n }\r\n\r\n /**\r\n * Creates a {@link Quat2} quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to clone\r\n * @returns a new dual quaternion\r\n */\r\n static clone(a: Quat2Like): Quat2 {\r\n return new Quat2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns a new dual quaternion\r\n */\r\n static fromValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2 {\r\n return new Quat2(x1, y1, z1, w1, x2, y2, z2, w2);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} from the given values (quat and translation)\r\n * @category Static\r\n *\r\n * @param x1 - X component (rotation)\r\n * @param y1 - Y component (rotation)\r\n * @param z1 - Z component (rotation)\r\n * @param w1 - W component (rotation)\r\n * @param x2 - X component (translation)\r\n * @param y2 - Y component (translation)\r\n * @param z2 - Z component (translation)\r\n * @returns a new dual quaternion\r\n */\r\n static fromRotationTranslationValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number): Quat2 {\r\n const ax = x2 * 0.5;\r\n const ay = y2 * 0.5;\r\n const az = z2 * 0.5;\r\n\r\n return new Quat2(x1, y1, z1, w1,\r\n ax * w1 + ay * z1 - az * y1,\r\n ay * w1 + az * x1 - ax * z1,\r\n az * w1 + ax * y1 - ay * x1,\r\n -ax * x1 - ay * y1 - az * z1);\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion and a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Quat2Like, q: Readonly, t: Readonly): Quat2Like {\r\n const ax = t[0] * 0.5;\r\n const ay = t[1] * 0.5;\r\n const az = t[2] * 0.5;\r\n const bx = q[0];\r\n const by = q[1];\r\n const bz = q[2];\r\n const bw = q[3];\r\n out[0] = bx;\r\n out[1] = by;\r\n out[2] = bz;\r\n out[3] = bw;\r\n out[4] = ax * bw + ay * bz - az * by;\r\n out[5] = ay * bw + az * bx - ax * bz;\r\n out[6] = az * bw + ax * by - ay * bx;\r\n out[7] = -ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Quat2Like, t: Readonly): Quat2Like {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = t[0] * 0.5;\r\n out[5] = t[1] * 0.5;\r\n out[6] = t[2] * 0.5;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Quat2Like, q: Readonly): Quat2Like {\r\n out[0] = q[0];\r\n out[1] = q[1];\r\n out[2] = q[2];\r\n out[3] = q[3];\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param a - the matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Quat2Like, a: Readonly): Quat2Like {\r\n Mat4.getRotation(Quat2.#TMP_QUAT, a);\r\n Mat4.getTranslation(Quat2.#TMP_VEC3, a);\r\n return Quat2.fromRotationTranslation(out, Quat2.#TMP_QUAT, Quat2.#TMP_VEC3);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Quat2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the source dual quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Quat2} to the identity dual quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns `out`\r\n */\r\n static set(out: Quat2Like, x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2Like {\r\n out[0] = x1;\r\n out[1] = y1;\r\n out[2] = z1;\r\n out[3] = w1;\r\n out[4] = x2;\r\n out[5] = y2;\r\n out[6] = z2;\r\n out[7] = w2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the real part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - real part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getReal(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Gets the dual part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - dual part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getDual(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[4];\r\n out[1] = a[5];\r\n out[2] = a[6];\r\n out[3] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the real component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the real part\r\n * @return `out`\r\n */\r\n static setReal(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Set the dual component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the dual part\r\n * @return `out`\r\n */\r\n static setDual(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[4] = a[0];\r\n out[5] = a[1];\r\n out[6] = a[2];\r\n out[7] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the translation of a normalized {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving translation vector\r\n * @param a - Dual Quaternion to be decomposed\r\n * @return `out`\r\n */\r\n static getTranslation(out: Vec3Like, a: Readonly): Vec3Like {\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Translates a {@link Quat2} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Quat2Like, a: Readonly, v: Readonly): Quat2Like {\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n const bx1 = v[0] * 0.5;\r\n const by1 = v[1] * 0.5;\r\n const bz1 = v[2] * 0.5;\r\n const ax2 = a[4];\r\n const ay2 = a[5];\r\n const az2 = a[6];\r\n const aw2 = a[7];\r\n out[0] = ax1;\r\n out[1] = ay1;\r\n out[2] = az1;\r\n out[3] = aw1;\r\n out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2;\r\n out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2;\r\n out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2;\r\n out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateX(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateY(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateZ(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (a * q)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param q - quaternion to rotate by\r\n * @returns `out`\r\n */\r\n static rotateByQuatAppend(out: Quat2Like, a: Readonly, q: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let ax = a[0];\r\n let ay = a[1];\r\n let az = a[2];\r\n let aw = a[3];\r\n\r\n out[0] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[1] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[2] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[3] = aw * qw - ax * qx - ay * qy - az * qz;\r\n ax = a[4];\r\n ay = a[5];\r\n az = a[6];\r\n aw = a[7];\r\n out[4] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[5] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[6] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[7] = aw * qw - ax * qx - ay * qy - az * qz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (q * a)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param q - quaternion to rotate by\r\n * @param a - the dual quaternion to rotate\r\n * @returns `out`\r\n */\r\n static rotateByQuatPrepend(out: Quat2Like, q: Readonly, a: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let bx = a[0];\r\n let by = a[1];\r\n let bz = a[2];\r\n let bw = a[3];\r\n\r\n out[0] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[1] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[2] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[3] = qw * bw - qx * bx - qy * by - qz * bz;\r\n bx = a[4];\r\n by = a[5];\r\n bz = a[6];\r\n bw = a[7];\r\n out[4] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[5] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[6] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[7] = qw * bw - qx * bx - qy * by - qz * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around a given axis. Does the normalization automatically\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param axis - the axis to rotate around\r\n * @param rad - how far the rotation should be\r\n * @returns `out`\r\n */\r\n static rotateAroundAxis(out: Quat2Like, a: Readonly, axis: Readonly, rad: number): Quat2Like {\r\n // Special case for rad = 0\r\n if (Math.abs(rad) < GLM_EPSILON) {\r\n return Quat2.copy(out, a);\r\n }\r\n const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);\r\n\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n const bx = (s * axis[0]) / axisLength;\r\n const by = (s * axis[1]) / axisLength;\r\n const bz = (s * axis[2]) / axisLength;\r\n const bw = Math.cos(rad);\r\n\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n out[4] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[5] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[6] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[7] = aw * bw - ax * bx - ay * by - az * bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns {quat2} out\r\n */\r\n static multiply(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n const ax0 = a[0];\r\n const ay0 = a[1];\r\n const az0 = a[2];\r\n const aw0 = a[3];\r\n const bx1 = b[4];\r\n const by1 = b[5];\r\n const bz1 = b[6];\r\n const bw1 = b[7];\r\n const ax1 = a[4];\r\n const ay1 = a[5];\r\n const az1 = a[6];\r\n const aw1 = a[7];\r\n const bx0 = b[0];\r\n const by0 = b[1];\r\n const bz0 = b[2];\r\n const bw0 = b[3];\r\n out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0;\r\n out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0;\r\n out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0;\r\n out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0;\r\n out[4] =\r\n ax0 * bw1 +\r\n aw0 * bx1 +\r\n ay0 * bz1 -\r\n az0 * by1 +\r\n ax1 * bw0 +\r\n aw1 * bx0 +\r\n ay1 * bz0 -\r\n az1 * by0;\r\n out[5] =\r\n ay0 * bw1 +\r\n aw0 * by1 +\r\n az0 * bx1 -\r\n ax0 * bz1 +\r\n ay1 * bw0 +\r\n aw1 * by0 +\r\n az1 * bx0 -\r\n ax1 * bz0;\r\n out[6] =\r\n az0 * bw1 +\r\n aw0 * bz1 +\r\n ax0 * by1 -\r\n ay0 * bx1 +\r\n az1 * bw0 +\r\n aw1 * bz0 +\r\n ax1 * by0 -\r\n ay1 * bx0;\r\n out[7] =\r\n aw0 * bw1 -\r\n ax0 * bx1 -\r\n ay0 * by1 -\r\n az0 * bz1 +\r\n aw1 * bw0 -\r\n ax1 * bx0 -\r\n ay1 * by0 -\r\n az1 * bz0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like { return out; }\r\n\r\n /**\r\n * Scales a {@link Quat2} by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaterion\r\n * @param a - the dual quaternion to scale\r\n * @param b - scalar value to scale the dual quaterion by\r\n * @returns `out`\r\n */\r\n static scale(out: Quat2Like, a: Readonly, b: number): Quat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts)\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dot(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Quat2}s\r\n * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quat\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Quat2Like, a: Readonly, b: Readonly, t: number): Quat2Like {\r\n const mt = 1 - t;\r\n if (Quat2.dot(a, b) < 0) { t = -t; }\r\n\r\n out[0] = a[0] * mt + b[0] * t;\r\n out[1] = a[1] * mt + b[1] * t;\r\n out[2] = a[2] * mt + b[2] * t;\r\n out[3] = a[3] * mt + b[3] * t;\r\n out[4] = a[4] * mt + b[4] * t;\r\n out[5] = a[5] * mt + b[5] * t;\r\n out[6] = a[6] * mt + b[6] * t;\r\n out[7] = a[7] * mt + b[7] * t;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: Quat2Like, a: Readonly): Quat2Like {\r\n const sqlen = Quat2.squaredLength(a);\r\n out[0] = -a[0] / sqlen;\r\n out[1] = -a[1] / sqlen;\r\n out[2] = -a[2] / sqlen;\r\n out[3] = a[3] / sqlen;\r\n out[4] = -a[4] / sqlen;\r\n out[5] = -a[5] / sqlen;\r\n out[6] = -a[6] / sqlen;\r\n out[7] = a[7] / sqlen;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than\r\n * {@link Quat2.invert} and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n out[4] = -a[4];\r\n out[5] = -a[5];\r\n out[6] = -a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Quat2Like, a: Readonly): Quat2Like {\r\n let magnitude = Quat2.squaredLength(a);\r\n if (magnitude > 0) {\r\n magnitude = Math.sqrt(magnitude);\r\n\r\n const a0 = a[0] / magnitude;\r\n const a1 = a[1] / magnitude;\r\n const a2 = a[2] / magnitude;\r\n const a3 = a[3] / magnitude;\r\n\r\n const b0 = a[4];\r\n const b1 = a[5];\r\n const b2 = a[6];\r\n const b3 = a[7];\r\n\r\n const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3;\r\n\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n\r\n out[4] = (b0 - a0 * a_dot_b) / magnitude;\r\n out[5] = (b1 - a1 * a_dot_b) / magnitude;\r\n out[6] = (b2 - a2 * a_dot_b) / magnitude;\r\n out[7] = (b3 - a3 * a_dot_b) / magnitude;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat2(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7))\r\n );\r\n }\r\n}\r\n\r\n// Methods which re-use the Quat implementation\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.dot = Quat.dot;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.squaredLength = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.sqrLen = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.mag = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.length = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.len = Quat.magnitude;\r\n\r\n// Static method alias assignments\r\nQuat2.mul = Quat2.multiply;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Mat2dLike, Mat3Like, Mat4Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 2 Dimensional Vector\r\n */\r\nexport class Vec2 extends Float64Array {\r\n /**\r\n * Create a {@link Vec2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 2:{\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, values[1]!]);\r\n } else {\r\n super(v as ArrayBufferLike, values[1], 2);\r\n }\r\n break;\r\n }\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 2);\r\n }\r\n break;\r\n }\r\n default:\r\n super(2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec2.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n return Math.hypot(this[0], this[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec2.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n // Instead of zero(), use a.fill(0) for instances;\r\n\r\n /**\r\n * Adds a {@link Vec2} to `this`.\r\n * Equivalent to `Vec2.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec2} from `this`.\r\n * Equivalent to `Vec2.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec2.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec2.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec2.squaredDistance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec2.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec2.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec2.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec2}.\r\n * Equivalent to `Vec2.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec2.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec2.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 2 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec2}\r\n * @category Static\r\n *\r\n * @returns A new 2D vector\r\n */\r\n static create(): Vec2 {\r\n return new Vec2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - Vector to clone\r\n * @returns A new 2D vector\r\n */\r\n static clone(a: Readonly): Vec2 {\r\n return new Vec2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns A new 2D vector\r\n */\r\n static fromValues(x: number, y: number): Vec2 {\r\n return new Vec2(x, y);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - The source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns `out`\r\n */\r\n static set(out: Vec2Like, x: number, y: number): Vec2Like {\r\n out[0] = x;\r\n out[1] = y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Multiplies two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Divides two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec2} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to scale\r\n * @param b - Amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec2Like, a: Readonly, b: number): Vec2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two Vec2's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param scale - The amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec2Like, a: Readonly, b: Readonly, scale: number): Vec2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns distance between `a` and `b`\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n return Math.hypot(b[0] - a[0], b[1] - a[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Squared distance between `a` and `b`\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return Math.sqrt(x * x + y * y);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate squared length of\r\n * @returns Squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec2Like, a: Readonly) {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec2Like, a: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n let len = x * x + y * y;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Dot product of `a` and `b`\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two {@link Vec2}s\r\n * Note that the cross product must by definition produce a 3D vector.\r\n * For this reason there is also not instance equivalent for this function.\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n const z = a[0] * b[1] - a[1] * b[0];\r\n out[0] = out[1] = 0;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param t - Interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec2Like, a: Readonly, b: Readonly, t: number): Vec2Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y;\r\n out[1] = m[1] * x + m[3] * y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2d}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2d(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y + m[4];\r\n out[1] = m[1] * x + m[3] * y + m[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat3}\r\n * 3rd vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat3(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[3] * y + m[6];\r\n out[1] = m[1] * x + m[4] * y + m[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat4}\r\n * 3rd vector component is implicitly '0'\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat4(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[4] * y + m[12];\r\n out[1] = m[1] * x + m[5] * y + m[13];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 2D vector\r\n * @category Static\r\n *\r\n * @param out - The receiving {@link Vec2}\r\n * @param a - The {@link Vec2} point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotate(out: Vec2Like, a: Readonly, b: Readonly, rad: number): Vec2Like {\r\n // Translate point to the origin\r\n const p0 = a[0] - b[0];\r\n const p1 = a[1] - b[1];\r\n const sinC = Math.sin(rad);\r\n const cosC = Math.cos(rad);\r\n\r\n // perform rotation and translate to correct position\r\n out[0] = p0 * cosC - p1 * sinC + b[0];\r\n out[1] = p0 * sinC + p1 * cosC + b[1];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 2D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly): number {\r\n const x1 = a[0];\r\n const y1 = a[1];\r\n const x2 = b[0];\r\n const y2 = b[1];\r\n // mag is the product of the magnitudes of a and b\r\n const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2);\r\n // mag &&.. short circuits if mag == 0\r\n const cosine = mag && (x1 * x2 + y1 * y2) / mag;\r\n // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to zero\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec2Like): Vec2Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors components are ===, `false` otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors are approximately equal, `false` otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - Vector to represent as a string\r\n * @returns String representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec2.prototype.sub = Vec2.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.mul = Vec2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.div = Vec2.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.dist = Vec2.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.sqrDist = Vec2.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec2.sub = Vec2.subtract;\r\nVec2.mul = Vec2.multiply;\r\nVec2.div = Vec2.divide;\r\nVec2.dist = Vec2.distance;\r\nVec2.sqrDist = Vec2.squaredDistance;\r\nVec2.sqrLen = Vec2.squaredLength;\r\nVec2.mag = Vec2.magnitude;\r\nVec2.length = Vec2.magnitude;\r\nVec2.len = Vec2.magnitude;\r\n", "/**\r\n * To enable additional swizzle accessors for vector classes (64-bit) invoke the {@link EnableSwizzlesF64} function from\r\n * the `gl-matrix/swizzle/f64` sub-path export. To enable ambient module declarations for IDE / Typescript support\r\n * please see {@link gl-matrix/types/swizzle/f64}.\r\n *\r\n * To enable swizzling for the 32-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle}.\r\n *\r\n * @example\r\n * ```ts\r\n * import { Vec3 } from 'gl-matrix/f64';\r\n * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64';\r\n *\r\n * EnableSwizzlesF64();\r\n *\r\n * const vec = new Vec3(0, 1, 2);\r\n * const vecSwizzled = vec.zyx; // Returns a new Vec3(2, 1, 0).\r\n * ```\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\nimport { Vec2, Vec3, Vec4 } from '#gl-matrix/f64';\r\n\r\n/**\r\n * Internal `gl-matrix` variable tracking if swizzling is enabled (64-bit).\r\n */\r\nlet GLM_SWIZZLES_ENABLED_F64 = false;\r\n\r\n/**\r\n * Enables Swizzle operations on {@link gl-matrix/f64.Vec2 | Vec2} / {@link gl-matrix/f64.Vec3 | Vec3} /\r\n * {@link gl-matrix/f64.Vec4 | Vec4} types from {@link gl-matrix/f64} (64-bit).\r\n *\r\n * Swizzle operations are performed by using the `.` operator in conjunction with any combination\r\n * of between two and four component names, either from the set `xyzw` or `rgbw` (though not intermixed).\r\n * They return a new vector with the same number of components as specified in the swizzle attribute.\r\n *\r\n * @example\r\n * ```js\r\n * import { Vec3 } from 'gl-matrix/f64';\r\n * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64';\r\n *\r\n * EnableSwizzlesF64();\r\n *\r\n * let v = new Vec3(0, 1, 2);\r\n *\r\n * v.yx; // returns new Vec2(1, 0)\r\n * v.xzy; // returns new Vec3(0, 2, 1)\r\n * v.zyxz; // returns new Vec4(2, 1, 0, 2)\r\n *\r\n * v.rgb; // returns new Vec3(0, 1, 2)\r\n * v.rbg; // returns new Vec3(0, 2, 1)\r\n * v.gg; // returns new Vec2(1, 1)\r\n * ```\r\n */\r\nexport function EnableSwizzlesF64(): void {\r\n /* v8 ignore next 1 */\r\n if (GLM_SWIZZLES_ENABLED_F64) { return; }\r\n\r\n /* eslint-disable comma-spacing, max-len */\r\n\r\n // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should\r\n // not be modified by hand.\r\n // [Swizzle Autogen]\r\n\r\n const VEC2_SWIZZLES = ['xx','xy','yx','yy','xxx','xxy','xyx','xyy','yxx','yxy','yyx','yyy','xxxx','xxxy','xxyx','xxyy','xyxx','xyxy','xyyx','xyyy','yxxx','yxxy','yxyx','yxyy','yyxx','yyxy','yyyx','yyyy','rr','rg','gr','gg','rrr','rrg','rgr','rgg','grr','grg','ggr','ggg','rrrr','rrrg','rrgr','rrgg','rgrr','rgrg','rggr','rggg','grrr','grrg','grgr','grgg','ggrr','ggrg','gggr','gggg'];\r\n const VEC3_SWIZZLES = ['xz','yz','zx','zy','zz','xxz','xyz','xzx','xzy','xzz','yxz','yyz','yzx','yzy','yzz','zxx','zxy','zxz','zyx','zyy','zyz','zzx','zzy','zzz','xxxz','xxyz','xxzx','xxzy','xxzz','xyxz','xyyz','xyzx','xyzy','xyzz','xzxx','xzxy','xzxz','xzyx','xzyy','xzyz','xzzx','xzzy','xzzz','yxxz','yxyz','yxzx','yxzy','yxzz','yyxz','yyyz','yyzx','yyzy','yyzz','yzxx','yzxy','yzxz','yzyx','yzyy','yzyz','yzzx','yzzy','yzzz','zxxx','zxxy','zxxz','zxyx','zxyy','zxyz','zxzx','zxzy','zxzz','zyxx','zyxy','zyxz','zyyx','zyyy','zyyz','zyzx','zyzy','zyzz','zzxx','zzxy','zzxz','zzyx','zzyy','zzyz','zzzx','zzzy','zzzz','rb','gb','br','bg','bb','rrb','rgb','rbr','rbg','rbb','grb','ggb','gbr','gbg','gbb','brr','brg','brb','bgr','bgg','bgb','bbr','bbg','bbb','rrrb','rrgb','rrbr','rrbg','rrbb','rgrb','rggb','rgbr','rgbg','rgbb','rbrr','rbrg','rbrb','rbgr','rbgg','rbgb','rbbr','rbbg','rbbb','grrb','grgb','grbr','grbg','grbb','ggrb','gggb','ggbr','ggbg','ggbb','gbrr','gbrg','gbrb','gbgr','gbgg','gbgb','gbbr','gbbg','gbbb','brrr','brrg','brrb','brgr','brgg','brgb','brbr','brbg','brbb','bgrr','bgrg','bgrb','bggr','bggg','bggb','bgbr','bgbg','bgbb','bbrr','bbrg','bbrb','bbgr','bbgg','bbgb','bbbr','bbbg','bbbb'];\r\n const VEC4_SWIZZLES = ['xw','yw','zw','wx','wy','wz','ww','xxw','xyw','xzw','xwx','xwy','xwz','xww','yxw','yyw','yzw','ywx','ywy','ywz','yww','zxw','zyw','zzw','zwx','zwy','zwz','zww','wxx','wxy','wxz','wxw','wyx','wyy','wyz','wyw','wzx','wzy','wzz','wzw','wwx','wwy','wwz','www','xxxw','xxyw','xxzw','xxwx','xxwy','xxwz','xxww','xyxw','xyyw','xyzw','xywx','xywy','xywz','xyww','xzxw','xzyw','xzzw','xzwx','xzwy','xzwz','xzww','xwxx','xwxy','xwxz','xwxw','xwyx','xwyy','xwyz','xwyw','xwzx','xwzy','xwzz','xwzw','xwwx','xwwy','xwwz','xwww','yxxw','yxyw','yxzw','yxwx','yxwy','yxwz','yxww','yyxw','yyyw','yyzw','yywx','yywy','yywz','yyww','yzxw','yzyw','yzzw','yzwx','yzwy','yzwz','yzww','ywxx','ywxy','ywxz','ywxw','ywyx','ywyy','ywyz','ywyw','ywzx','ywzy','ywzz','ywzw','ywwx','ywwy','ywwz','ywww','zxxw','zxyw','zxzw','zxwx','zxwy','zxwz','zxww','zyxw','zyyw','zyzw','zywx','zywy','zywz','zyww','zzxw','zzyw','zzzw','zzwx','zzwy','zzwz','zzww','zwxx','zwxy','zwxz','zwxw','zwyx','zwyy','zwyz','zwyw','zwzx','zwzy','zwzz','zwzw','zwwx','zwwy','zwwz','zwww','wxxx','wxxy','wxxz','wxxw','wxyx','wxyy','wxyz','wxyw','wxzx','wxzy','wxzz','wxzw','wxwx','wxwy','wxwz','wxww','wyxx','wyxy','wyxz','wyxw','wyyx','wyyy','wyyz','wyyw','wyzx','wyzy','wyzz','wyzw','wywx','wywy','wywz','wyww','wzxx','wzxy','wzxz','wzxw','wzyx','wzyy','wzyz','wzyw','wzzx','wzzy','wzzz','wzzw','wzwx','wzwy','wzwz','wzww','wwxx','wwxy','wwxz','wwxw','wwyx','wwyy','wwyz','wwyw','wwzx','wwzy','wwzz','wwzw','wwwx','wwwy','wwwz','wwww','ra','ga','ba','ar','ag','ab','aa','rra','rga','rba','rar','rag','rab','raa','gra','gga','gba','gar','gag','gab','gaa','bra','bga','bba','bar','bag','bab','baa','arr','arg','arb','ara','agr','agg','agb','aga','abr','abg','abb','aba','aar','aag','aab','aaa','rrra','rrga','rrba','rrar','rrag','rrab','rraa','rgra','rgga','rgba','rgar','rgag','rgab','rgaa','rbra','rbga','rbba','rbar','rbag','rbab','rbaa','rarr','rarg','rarb','rara','ragr','ragg','ragb','raga','rabr','rabg','rabb','raba','raar','raag','raab','raaa','grra','grga','grba','grar','grag','grab','graa','ggra','ggga','ggba','ggar','ggag','ggab','ggaa','gbra','gbga','gbba','gbar','gbag','gbab','gbaa','garr','garg','garb','gara','gagr','gagg','gagb','gaga','gabr','gabg','gabb','gaba','gaar','gaag','gaab','gaaa','brra','brga','brba','brar','brag','brab','braa','bgra','bgga','bgba','bgar','bgag','bgab','bgaa','bbra','bbga','bbba','bbar','bbag','bbab','bbaa','barr','barg','barb','bara','bagr','bagg','bagb','baga','babr','babg','babb','baba','baar','baag','baab','baaa','arrr','arrg','arrb','arra','argr','argg','argb','arga','arbr','arbg','arbb','arba','arar','arag','arab','araa','agrr','agrg','agrb','agra','aggr','aggg','aggb','agga','agbr','agbg','agbb','agba','agar','agag','agab','agaa','abrr','abrg','abrb','abra','abgr','abgg','abgb','abga','abbr','abbg','abbb','abba','abar','abag','abab','abaa','aarr','aarg','aarb','aara','aagr','aagg','aagb','aaga','aabr','aabg','aabb','aaba','aaar','aaag','aaab','aaaa'];\r\n\r\n // [/Swizzle Autogen]\r\n\r\n /* eslint-enable comma-spacing, max-len */\r\n\r\n /**\r\n * Internal swizzle index table for `gl-matrix`.\r\n */\r\n const SWIZZLE_INDEX: Record = {\r\n x: 0, r: 0,\r\n y: 1, g: 1,\r\n z: 2, b: 2,\r\n w: 3, a: 3,\r\n };\r\n\r\n /**\r\n * Internal helper function to convert and return a `gl-matrix` vector by swizzle format.\r\n *\r\n * @param swizzle - Swizzle format to apply.\r\n * @returns {Vec2 | Vec3 | Vec4} New swizzled vector instance.\r\n */\r\n function getSwizzleImpl(swizzle: string): () => Vec2 | Vec3 | Vec4 {\r\n switch (swizzle.length) {\r\n case 2:\r\n return function(this: Float64Array) {\r\n return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]);\r\n };\r\n case 3:\r\n return function(this: Float64Array) {\r\n return new Vec3(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]]);\r\n };\r\n case 4:\r\n return function(this: Float64Array) {\r\n return new Vec4(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]], this[SWIZZLE_INDEX[swizzle[3]]]);\r\n };\r\n }\r\n\r\n throw new Error('Illegal swizzle length');\r\n }\r\n\r\n for (const swizzle of VEC2_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec2.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC3_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC4_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n GLM_SWIZZLES_ENABLED_F64 = true;\r\n}\r\n", "/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_DEG_TO_RAD: number = Math.PI / 180;\r\n\r\n/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_RAD_TO_DEG: number = 180 / Math.PI;\r\n\r\n/**\r\n * Convert `radians` to `degrees`.\r\n *\r\n * @param value - Angle in `radians`.\r\n * @returns Angle in `degrees`.\r\n */\r\nexport function toDegree(value: number): number {\r\n return value * GLM_RAD_TO_DEG;\r\n}\r\n\r\n/**\r\n * Convert `degrees` to `radians`.\r\n *\r\n * @param value - Angle in `degrees`.\r\n * @returns Angle in `radians`.\r\n */\r\nexport function toRadian(value: number): number {\r\n return value * GLM_DEG_TO_RAD;\r\n}\r\n"], + "mappings": ";;;;sQAAA,IAAAA,GAOaC,EAAN,MAAMA,UAAa,YAAa,CAWrC,eAAeC,EAAoE,CACjF,OAAQA,EAAO,OAAQ,CACrB,IAAK,GACH,MAAMA,CAAM,EAAG,MACjB,IAAK,GACH,MAAMA,EAAO,CAAC,EAAsBA,EAAO,CAAC,EAAG,CAAC,EAAG,MACrD,IAAK,GACH,IAAMC,EAAID,EAAO,CAAC,EACd,OAAOC,GAAM,SACf,MAAM,CACJA,EAAGA,EACHA,EAAGA,CAAC,CAAC,EAEP,MAAMA,EAAsB,EAAG,CAAC,EAElC,MACF,QACE,MAAMC,EAAAH,EAAKD,GAAa,EAAG,KAC/B,CACF,CAYA,IAAI,KAAc,CAChB,OAAOC,EAAK,IAAI,IAAI,CACtB,CAaA,KAAKI,EAA6B,CAChC,YAAK,IAAIA,CAAC,EACH,IACT,CASA,UAAiB,CACf,YAAK,IAAID,EAAAH,EAAKD,GAAa,EACpB,IACT,CAUA,SAASM,EAA6B,CACpC,OAAOL,EAAK,SAAS,KAAM,KAAM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eC,EAAK,UAAWD,EAAS,CAC7C,IAAKI,CACP,CAAC,EACD,OAAO,eAAeF,EAAK,UAAWF,EAAS,CAC7C,IAAKI,CACP,CAAC,EACD,OAAO,eAAeD,EAAK,UAAWH,EAAS,CAC7C,IAAKI,CACP,CAAC,CACH,CAEA,QAAWJ,KAAWJ,EAAe,CACnC,IAAMQ,EAAOL,EAAeC,CAAO,EACnC,OAAO,eAAeE,EAAK,UAAWF,EAAS,CAC7C,IAAKI,CACP,CAAC,EACD,OAAO,eAAeD,EAAK,UAAWH,EAAS,CAC7C,IAAKI,CACP,CAAC,CACH,CAEA,QAAWJ,KAAWH,EAAe,CACnC,IAAMO,EAAOL,EAAeC,CAAO,EACnC,OAAO,eAAeG,EAAK,UAAWH,EAAS,CAC7C,IAAKI,CACP,CAAC,CACH,CAEAX,GAA2B,EAC7B,CCzIA,IAAMY,GAAyB,KAAK,GAAK,IAKnCC,GAAyB,IAAM,KAAK,GAQnC,SAASC,GAASC,EAAuB,CAC9C,OAAOA,EAAQF,EACjB,CAQO,SAASG,GAASD,EAAuB,CAC9C,OAAOA,EAAQH,EACjB", + "names": ["_IDENTITY_2X2", "_Mat2", "values", "v", "__privateGet", "a", "b", "rad", "out", "a1", "a0", "a2", "a3", "det", "b0", "b1", "b2", "b3", "s", "c", "v0", "v1", "scale", "L", "D", "U", "__privateAdd", "Mat2", "_IDENTITY_2X3", "_Mat2d", "values", "v", "__privateGet", "a", "b", "rad", "out", "aa", "ab", "ac", "ad", "atx", "aty", "det", "a0", "a1", "a2", "a3", "a4", "a5", "b0", "b1", "b2", "b3", "b4", "b5", "v0", "v1", "s", "c", "scale", "__privateAdd", "Mat2d", "_IDENTITY_3X3", "_Mat3", "values", "v", "__privateGet", "a", "b", "rad", "out", "a01", "a02", "a12", "a00", "a10", "a11", "a20", "a21", "a22", "b01", "b11", "b21", "det", "b0", "b1", "b2", "x", "y", "s", "c", "q", "z", "w", "x2", "y2", "z2", "xx", "yx", "yy", "zx", "zy", "zz", "wx", "wy", "wz", "a03", "a13", "a23", "a30", "a31", "a32", "a33", "b00", "b02", "b03", "b04", "b05", "b06", "b07", "b08", "b09", "b10", "ax", "ay", "az", "bx", "by", "bz", "cx", "cy", "cz", "width", "height", "scale", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "b3", "b4", "b5", "b6", "b7", "b8", "__privateAdd", "Mat3", "_IDENTITY_4X4", "_TMP_VEC3", "_Mat4", "values", "v", "__privateGet", "a", "b", "rad", "axis", "fovy", "aspect", "near", "far", "left", "right", "bottom", "top", "out", "a01", "a02", "a03", "a12", "a13", "a23", "a00", "a10", "a11", "a20", "a21", "a22", "a30", "a31", "a32", "a33", "b00", "b01", "b02", "b03", "b04", "b05", "b06", "b07", "b08", "b09", "b10", "b11", "det", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "x", "y", "z", "len", "s", "c", "t", "b12", "b20", "b21", "b22", "q", "w", "x2", "y2", "z2", "xx", "xy", "xz", "yy", "yz", "zz", "wx", "wy", "wz", "bx", "by", "bz", "bw", "ax", "ay", "az", "aw", "magnitude", "cx", "cy", "cz", "mat", "m11", "m12", "m13", "m21", "m22", "m23", "m31", "m32", "m33", "is1", "is2", "is3", "sm11", "sm12", "sm13", "sm21", "sm22", "sm23", "sm31", "sm32", "sm33", "trace", "S", "out_r", "out_t", "out_s", "sx", "sy", "sz", "o", "ox", "oy", "oz", "out0", "out1", "out2", "out4", "out5", "out6", "out8", "out9", "out10", "yx", "zx", "zy", "rl", "tb", "nf", "f", "fov", "upTan", "downTan", "leftTan", "rightTan", "xScale", "yScale", "lr", "bt", "eye", "center", "up", "eyex", "eyey", "eyez", "upx", "upy", "upz", "centerx", "centery", "centerz", "z0", "z1", "x0", "x1", "y0", "y1", "target", "scale", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a14", "a15", "b13", "b14", "b15", "__privateAdd", "Mat4", "Vec3", "_Vec3", "values", "v", "value", "x", "y", "z", "a", "b", "scale", "out", "len", "ax", "ay", "az", "bx", "by", "bz", "t", "angle", "sinTotal", "ratioA", "ratioB", "c", "d", "factorTimes2", "factor1", "factor2", "factor3", "factor4", "inverseFactor", "inverseFactorTimesTwo", "m", "w", "q", "qx", "qy", "qz", "w2", "uvx", "uvy", "uvz", "uuvx", "uuvy", "uuvz", "rad", "py", "pz", "px", "mag", "cosine", "a0", "a1", "a2", "b0", "b1", "b2", "Vec4", "_Vec4", "values", "v", "value", "x", "y", "z", "w", "a", "b", "scale", "out", "len", "u", "c", "d", "e", "f", "g", "h", "i", "j", "t", "ax", "ay", "az", "aw", "m", "q", "qx", "qy", "qz", "qw", "ix", "iy", "iz", "iw", "a0", "a1", "a2", "a3", "b0", "b1", "b2", "b3", "_DEFAULT_ANGLE_ORDER", "_TMP_QUAT1", "_TMP_QUAT2", "_TMP_MAT3", "_TMP_VEC3", "_X_UNIT_VEC3", "_Y_UNIT_VEC3", "_Quat", "values", "v", "value", "x", "y", "z", "w", "a", "b", "rad", "scale", "out", "axis", "out_axis", "q", "dotproduct", "ax", "ay", "az", "aw", "bx", "by", "bz", "bw", "r", "et", "s", "t", "scale0", "scale1", "cosom", "omega", "sinom", "a0", "a1", "a2", "a3", "dot", "invDot", "m", "fTrace", "fRoot", "i", "j", "k", "order", "__privateGet", "halfToRad", "sx", "cx", "sy", "cy", "sz", "cz", "Vec3", "c", "d", "view", "right", "up", "__privateAdd", "Quat", "Vec4", "_TMP_QUAT", "_TMP_VEC3", "_Quat2", "values", "v", "a", "x1", "y1", "z1", "w1", "x2", "y2", "z2", "w2", "ax", "ay", "az", "out", "q", "t", "bx", "by", "bz", "bw", "Mat4", "__privateGet", "aw", "ax1", "ay1", "az1", "aw1", "bx1", "by1", "bz1", "ax2", "ay2", "az2", "aw2", "rad", "Quat", "qx", "qy", "qz", "qw", "axis", "axisLength", "s", "b", "ax0", "ay0", "az0", "aw0", "bw1", "bx0", "by0", "bz0", "bw0", "mt", "sqlen", "magnitude", "a0", "a1", "a2", "a3", "b0", "b1", "b2", "b3", "a_dot_b", "a4", "a5", "a6", "a7", "b4", "b5", "b6", "b7", "__privateAdd", "Quat2", "Vec2", "_Vec2", "values", "v", "value", "x", "y", "a", "b", "scale", "out", "len", "z", "t", "ax", "ay", "m", "rad", "p0", "p1", "sinC", "cosC", "x1", "y1", "x2", "y2", "mag", "cosine", "a0", "a1", "b0", "b1", "GLM_SWIZZLES_ENABLED_F64", "EnableSwizzlesF64", "VEC2_SWIZZLES", "VEC3_SWIZZLES", "VEC4_SWIZZLES", "SWIZZLE_INDEX", "getSwizzleImpl", "swizzle", "Vec2", "Vec3", "Vec4", "impl", "GLM_DEG_TO_RAD", "GLM_RAD_TO_DEG", "toDegree", "value", "toRadian"] +} diff --git a/dist-cdn/esm/2022/gl-matrix-f32.js b/dist-cdn/esm/2022/gl-matrix-f32.js new file mode 100644 index 00000000..ae5dbe15 --- /dev/null +++ b/dist-cdn/esm/2022/gl-matrix-f32.js @@ -0,0 +1,9515 @@ +// gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library. +// @author Brandon Jones +// @author Colin MacKenzie IV +// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md) + +// src/common/index.ts +var GLM_EPSILON = 1e-6; + +// src/_lib/f32/Mat2.ts +var Mat2 = class _Mat2 extends Float32Array { + static #IDENTITY_2X2 = new Float32Array([ + 1, + 0, + 0, + 1 + ]); + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 4: + super(values); + break; + case 2: + super(values[0], values[1], 4); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v + ]); + } else { + super(v, 0, 4); + } + break; + default: + super(_Mat2.#IDENTITY_2X2); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat2.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat2.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat2} into `this`. + * + * @param a the source vector + * @returns `this` + * @category Methods + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat2.identity(this) + * + * @returns `this` + * @category Methods + */ + identity() { + this.set(_Mat2.#IDENTITY_2X2); + return this; + } + /** + * Multiplies this {@link Mat2} against another one + * Equivalent to `Mat2.multiply(this, this, b);` + * + * @param b - The second operand + * @returns `this` + * @category Methods + */ + multiply(b) { + return _Mat2.multiply(this, this, b); + } + /** + * Alias for {@link Mat2.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat2} + * Equivalent to `Mat2.transpose(this, this);` + * + * @returns `this` + * @category Methods + */ + transpose() { + return _Mat2.transpose(this, this); + } + /** + * Inverts this {@link Mat2} + * Equivalent to `Mat4.invert(this, this);` + * + * @returns `this` + * @category Methods + */ + invert() { + return _Mat2.invert(this, this); + } + /** + * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2.scale(this, this, v);` + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + * @category Methods + */ + scale(v) { + return _Mat2.scale(this, this, v); + } + /** + * Rotates this {@link Mat2} by the given angle around the given axis + * Equivalent to `Mat2.rotate(this, this, rad);` + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + * @category Methods + */ + rotate(rad) { + return _Mat2.rotate(this, this, rad); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2}. + */ + static get BYTE_LENGTH() { + return 4 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat2} + * @category Static + * + * @returns A new {@link Mat2} + */ + static create() { + return new _Mat2(); + } + /** + * Creates a new {@link Mat2} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2} + */ + static clone(a) { + return new _Mat2(a); + } + /** + * Copy the values from one {@link Mat2} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Create a new {@link Mat2} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2} + */ + static fromValues(...values) { + return new _Mat2(...values); + } + /** + * Set the components of a {@link Mat2} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + return out; + } + /** + * Set a {@link Mat2} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out, a) { + if (out === a) { + const a1 = a[1]; + out[1] = a[2]; + out[2] = a1; + } else { + out[0] = a[0]; + out[1] = a[2]; + out[2] = a[1]; + out[3] = a[3]; + } + return out; + } + /** + * Inverts a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + let det = a0 * a3 - a2 * a1; + if (!det) { + return null; + } + det = 1 / det; + out[0] = a3 * det; + out[1] = -a1 * det; + out[2] = -a2 * det; + out[3] = a0 * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out, a) { + const a0 = a[0]; + out[0] = a[3]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a0; + return out; + } + /** + * Calculates the determinant of a {@link Mat2} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + return a[0] * a[3] - a[2] * a[1]; + } + /** + * Adds two {@link Mat2}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + return out; + } + /** + * Alias for {@link Mat2.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat2}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + out[0] = a0 * b0 + a2 * b1; + out[1] = a1 * b0 + a3 * b1; + out[2] = a0 * b2 + a2 * b3; + out[3] = a1 * b2 + a3 * b3; + return out; + } + /** + * Alias for {@link Mat2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Rotates a {@link Mat2} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out, a, rad) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = a0 * c + a2 * s; + out[1] = a1 * c + a3 * s; + out[2] = a0 * -s + a2 * c; + out[3] = a1 * -s + a3 * c; + return out; + } + /** + * Scales the {@link Mat2} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0 * v0; + out[1] = a1 * v0; + out[2] = a2 * v1; + out[3] = a3 * v1; + return out; + } + /** + * Creates a {@link Mat2} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = -s; + out[3] = c; + return out; + } + /** + * Creates a {@link Mat2} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = v[1]; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat2} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]); + } + /** + * Multiply each element of a {@link Mat2} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + return out; + } + /** + * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + return out; + } + /** + * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix + * @category Static + * + * @param L - the lower triangular matrix + * @param D - the diagonal matrix + * @param U - the upper triangular matrix + * @param a - the input matrix to factorize + */ + static LDU(L, D, U, a) { + L[2] = a[2] / a[0]; + U[0] = a[0]; + U[1] = a[1]; + U[3] = a[3] - L[2] * U[1]; + return [L, D, U]; + } + /** + * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + /** + * Returns whether two {@link Mat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)); + } + /** + * Returns a string representation of a {@link Mat2} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat2(${a.join(", ")})`; + } +}; +Mat2.prototype.mul = Mat2.prototype.multiply; +Mat2.mul = Mat2.multiply; +Mat2.sub = Mat2.subtract; + +// src/_lib/f32/Mat2d.ts +var Mat2d = class _Mat2d extends Float32Array { + static #IDENTITY_2X3 = new Float32Array([ + 1, + 0, + 0, + 1, + 0, + 0 + ]); + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 6: + super(values); + break; + case 2: + super(values[0], values[1], 6); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v, + v, + v + ]); + } else { + super(v, 0, 6); + } + break; + default: + super(_Mat2d.#IDENTITY_2X3); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat2d.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat2d.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Mat2d} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat2d.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this.set(_Mat2d.#IDENTITY_2X3); + return this; + } + /** + * Multiplies this {@link Mat2d} against another one + * Equivalent to `Mat2d.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b) { + return _Mat2d.multiply(this, this, b); + } + /** + * Alias for {@link Mat2d.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Translate this {@link Mat2d} by the given vector + * Equivalent to `Mat2d.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v) { + return _Mat2d.translate(this, this, v); + } + /** + * Rotates this {@link Mat2d} by the given angle around the given axis + * Equivalent to `Mat2d.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad) { + return _Mat2d.rotate(this, this, rad); + } + /** + * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2d.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v) { + return _Mat2d.scale(this, this, v); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2d}. + */ + static get BYTE_LENGTH() { + return 6 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat2d} + * @category Static + * + * @returns A new {@link Mat2d} + */ + static create() { + return new _Mat2d(); + } + /** + * Creates a new {@link Mat2d} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2d} + */ + static clone(a) { + return new _Mat2d(a); + } + /** + * Copy the values from one {@link Mat2d} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + return out; + } + /** + * Create a new {@link Mat2d} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2d} + */ + static fromValues(...values) { + return new _Mat2d(...values); + } + /** + * Set the components of a {@link Mat2d} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + return out; + } + /** + * Set a {@link Mat2d} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Inverts a {@link Mat2d} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const aa = a[0]; + const ab = a[1]; + const ac = a[2]; + const ad = a[3]; + const atx = a[4]; + const aty = a[5]; + let det = aa * ad - ab * ac; + if (!det) { + return null; + } + det = 1 / det; + out[0] = ad * det; + out[1] = -ab * det; + out[2] = -ac * det; + out[3] = aa * det; + out[4] = (ac * aty - ad * atx) * det; + out[5] = (ab * atx - aa * aty) * det; + return out; + } + /** + * Calculates the determinant of a {@link Mat2d} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + return a[0] * a[3] - a[1] * a[2]; + } + /** + * Adds two {@link Mat2d}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + return out; + } + /** + * Alias for {@link Mat2d.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat2d}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + out[0] = a0 * b0 + a2 * b1; + out[1] = a1 * b0 + a3 * b1; + out[2] = a0 * b2 + a2 * b3; + out[3] = a1 * b2 + a3 * b3; + out[4] = a0 * b4 + a2 * b5 + a4; + out[5] = a1 * b4 + a3 * b5 + a5; + return out; + } + /** + * Alias for {@link Mat2d.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat2d} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0; + out[1] = a1; + out[2] = a2; + out[3] = a3; + out[4] = a0 * v0 + a2 * v1 + a4; + out[5] = a1 * v0 + a3 * v1 + a5; + return out; + } + /** + * Rotates a {@link Mat2d} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out, a, rad) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = a0 * c + a2 * s; + out[1] = a1 * c + a3 * s; + out[2] = a0 * -s + a2 * c; + out[3] = a1 * -s + a3 * c; + out[4] = a4; + out[5] = a5; + return out; + } + /** + * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0 * v0; + out[1] = a1 * v0; + out[2] = a2 * v1; + out[3] = a3 * v1; + out[4] = a4; + out[5] = a5; + return out; + } + // TODO: Got to fromRotation + /** + * Creates a {@link Mat2d} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = v[0]; + out[5] = v[1]; + return out; + } + /** + * Creates a {@link Mat2d} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = -s; + out[3] = c; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Creates a {@link Mat2d} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = v[1]; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat2d} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1); + } + /** + * Multiply each element of a {@link Mat2d} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + return out; + } + /** + * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + return out; + } + /** + * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5]; + } + /** + * Returns whether two {@link Mat2d}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)); + } + /** + * Returns a string representation of a {@link Mat2d} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat2d(${a.join(", ")})`; + } +}; +Mat2d.mul = Mat2d.multiply; +Mat2d.sub = Mat2d.subtract; + +// src/_lib/f32/Mat3.ts +var Mat3 = class _Mat3 extends Float32Array { + static #IDENTITY_3X3 = new Float32Array([ + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1 + ]); + /** + * Create a {@link Mat3}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 9: + super(values); + break; + case 2: + super(values[0], values[1], 9); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v, + v, + v, + v, + v, + v + ]); + } else { + super(v, 0, 9); + } + break; + default: + super(_Mat3.#IDENTITY_3X3); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat3.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat3.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat3.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this.set(_Mat3.#IDENTITY_3X3); + return this; + } + /** + * Multiplies this {@link Mat3} against another one + * Equivalent to `Mat3.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b) { + return _Mat3.multiply(this, this, b); + } + /** + * Alias for {@link Mat3.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat3} + * Equivalent to `Mat3.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose() { + return _Mat3.transpose(this, this); + } + /** + * Inverts this {@link Mat3} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + return _Mat3.invert(this, this); + } + /** + * Translate this {@link Mat3} by the given vector + * Equivalent to `Mat3.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v) { + return _Mat3.translate(this, this, v); + } + /** + * Rotates this {@link Mat3} by the given angle around the given axis + * Equivalent to `Mat3.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad) { + return _Mat3.rotate(this, this, rad); + } + /** + * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat3.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v) { + return _Mat3.scale(this, this, v); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat3}. + */ + static get BYTE_LENGTH() { + return 9 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat3} + * @category Static + * + * @returns A new {@link Mat3} + */ + static create() { + return new _Mat3(); + } + /** + * Creates a new {@link Mat3} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat3} + */ + static clone(a) { + return new _Mat3(a); + } + /** + * Copy the values from one {@link Mat3} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + return out; + } + /** + * Create a new {@link Mat3} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat3} + */ + static fromValues(...values) { + return new _Mat3(...values); + } + /** + * Set the components of a {@link Mat3} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + out[6] = values[6]; + out[7] = values[7]; + out[8] = values[8]; + return out; + } + /** + * Set a {@link Mat3} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out, a) { + if (out === a) { + const a01 = a[1], a02 = a[2], a12 = a[5]; + out[1] = a[3]; + out[2] = a[6]; + out[3] = a01; + out[5] = a[7]; + out[6] = a02; + out[7] = a12; + } else { + out[0] = a[0]; + out[1] = a[3]; + out[2] = a[6]; + out[3] = a[1]; + out[4] = a[4]; + out[5] = a[7]; + out[6] = a[2]; + out[7] = a[5]; + out[8] = a[8]; + } + return out; + } + /** + * Inverts a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const a00 = a[0], a01 = a[1], a02 = a[2]; + const a10 = a[3], a11 = a[4], a12 = a[5]; + const a20 = a[6], a21 = a[7], a22 = a[8]; + const b01 = a22 * a11 - a12 * a21; + const b11 = -a22 * a10 + a12 * a20; + const b21 = a21 * a10 - a11 * a20; + let det = a00 * b01 + a01 * b11 + a02 * b21; + if (!det) { + return null; + } + det = 1 / det; + out[0] = b01 * det; + out[1] = (-a22 * a01 + a02 * a21) * det; + out[2] = (a12 * a01 - a02 * a11) * det; + out[3] = b11 * det; + out[4] = (a22 * a00 - a02 * a20) * det; + out[5] = (-a12 * a00 + a02 * a10) * det; + out[6] = b21 * det; + out[7] = (-a21 * a00 + a01 * a20) * det; + out[8] = (a11 * a00 - a01 * a10) * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out, a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + out[0] = a11 * a22 - a12 * a21; + out[1] = a02 * a21 - a01 * a22; + out[2] = a01 * a12 - a02 * a11; + out[3] = a12 * a20 - a10 * a22; + out[4] = a00 * a22 - a02 * a20; + out[5] = a02 * a10 - a00 * a12; + out[6] = a10 * a21 - a11 * a20; + out[7] = a01 * a20 - a00 * a21; + out[8] = a00 * a11 - a01 * a10; + return out; + } + /** + * Calculates the determinant of a {@link Mat3} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20); + } + /** + * Adds two {@link Mat3}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + out[8] = a[8] + b[8]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + out[6] = a[6] - b[6]; + out[7] = a[7] - b[7]; + out[8] = a[8] - b[8]; + return out; + } + /** + * Alias for {@link Mat3.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat3}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + let b0 = b[0]; + let b1 = b[1]; + let b2 = b[2]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20; + out[1] = b0 * a01 + b1 * a11 + b2 * a21; + out[2] = b0 * a02 + b1 * a12 + b2 * a22; + b0 = b[3]; + b1 = b[4]; + b2 = b[5]; + out[3] = b0 * a00 + b1 * a10 + b2 * a20; + out[4] = b0 * a01 + b1 * a11 + b2 * a21; + out[5] = b0 * a02 + b1 * a12 + b2 * a22; + b0 = b[6]; + b1 = b[7]; + b2 = b[8]; + out[6] = b0 * a00 + b1 * a10 + b2 * a20; + out[7] = b0 * a01 + b1 * a11 + b2 * a21; + out[8] = b0 * a02 + b1 * a12 + b2 * a22; + return out; + } + /** + * Alias for {@link Mat3.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat3} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + const x = v[0]; + const y = v[1]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a10; + out[4] = a11; + out[5] = a12; + out[6] = x * a00 + y * a10 + a20; + out[7] = x * a01 + y * a11 + a21; + out[8] = x * a02 + y * a12 + a22; + return out; + } + /** + * Rotates a {@link Mat3} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out, a, rad) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c * a00 + s * a10; + out[1] = c * a01 + s * a11; + out[2] = c * a02 + s * a12; + out[3] = c * a10 - s * a00; + out[4] = c * a11 - s * a01; + out[5] = c * a12 - s * a02; + out[6] = a20; + out[7] = a21; + out[8] = a22; + return out; + } + /** + * Scales the {@link Mat3} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const x = v[0]; + const y = v[1]; + out[0] = x * a[0]; + out[1] = x * a[1]; + out[2] = x * a[2]; + out[3] = y * a[3]; + out[4] = y * a[4]; + out[5] = y * a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + return out; + } + /** + * Creates a {@link Mat3} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = v[0]; + out[7] = v[1]; + out[8] = 1; + return out; + } + /** + * Creates a {@link Mat3} from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat3.identity(dest); + * mat3.rotate(dest, dest, rad); + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = 0; + out[3] = -s; + out[4] = c; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Creates a {@link Mat3} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = v[1]; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Copies the upper-left 3x3 values of a {@link Mat2d} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 2x3 matrix + * @returns `out` + */ + static fromMat2d(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = 0; + out[3] = a[2]; + out[4] = a[3]; + out[5] = 0; + out[6] = a[4]; + out[7] = a[5]; + out[8] = 1; + return out; + } + /** + * Calculates a {@link Mat3} from the given quaternion + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param q - {@link Quat} to create matrix from + * @returns `out` + */ + static fromQuat(out, q) { + 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; + out[0] = 1 - yy - zz; + out[3] = yx - wz; + out[6] = zx + wy; + out[1] = yx + wz; + out[4] = 1 - xx - zz; + out[7] = zy - wx; + out[2] = zx - wy; + out[5] = zy + wx; + out[8] = 1 - xx - yy; + return out; + } + /** + * Copies the upper-left 3x3 values of a {@link Mat4} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 4x4 matrix + * @returns `out` + */ + static fromMat4(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[4]; + out[4] = a[5]; + out[5] = a[6]; + out[6] = a[8]; + out[7] = a[9]; + out[8] = a[10]; + return out; + } + /** + * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix + * @category Static + * + * @param {mat3} out mat3 receiving operation result + * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out, a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + return out; + } + /** + * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out, a) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const bx = a[4]; + const by = a[5]; + const bz = a[6]; + const cx = a[8]; + const cy = a[9]; + const cz = a[10]; + out[0] = by * cz - cz * cy; + out[1] = bz * cx - cx * cz; + out[2] = bx * cy - cy * cx; + out[3] = cy * az - cz * ay; + out[4] = cz * ax - cx * az; + out[5] = cx * ay - cy * ax; + out[6] = ay * bz - az * by; + out[7] = az * bx - ax * bz; + out[8] = ax * by - ay * bx; + return out; + } + /** + * Generates a 2D projection matrix with the given bounds + * @category Static + * + * @param out mat3 frustum matrix will be written into + * @param width Width of your gl context + * @param height Height of gl context + * @returns `out` + */ + static projection(out, width, height) { + out[0] = 2 / width; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = -2 / height; + out[5] = 0; + out[6] = -1; + out[7] = 1; + out[8] = 1; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat3} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt( + a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + ); + } + /** + * Multiply each element of a {@link Mat3} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + out[8] = a[8] * b; + return out; + } + /** + * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + out[6] = a[6] + b[6] * scale; + out[7] = a[7] + b[7] * scale; + out[8] = a[8] + b[8] * scale; + return out; + } + /** + * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8]; + } + /** + * Returns whether two {@link Mat3}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const a8 = a[8]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + const b8 = b[8]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)); + } + /** + * Returns a string representation of a {@link Mat3} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat3(${a.join(", ")})`; + } +}; +Mat3.prototype.mul = Mat3.prototype.multiply; +Mat3.mul = Mat3.multiply; +Mat3.sub = Mat3.subtract; + +// src/_lib/f32/Mat4.ts +var Mat4 = class _Mat4 extends Float32Array { + static #IDENTITY_4X4 = new Float32Array([ + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 + ]); + /** + * Temporary variable to prevent repeated allocations in the algorithms within Mat4. + * These are declared as TypedArrays to aid in tree-shaking. + */ + static #TMP_VEC3 = new Float32Array(3); + /** + * Create a {@link Mat4}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 16: + super(values); + break; + case 2: + super(values[0], values[1], 16); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v + ]); + } else { + super(v, 0, 16); + } + break; + default: + super(_Mat4.#IDENTITY_4X4); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat4.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat4.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat4.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this.set(_Mat4.#IDENTITY_4X4); + return this; + } + /** + * Multiplies this {@link Mat4} against another one + * Equivalent to `Mat4.multiply(this, this, b);` + * @category Methods + * + * @param b - The second operand + * @returns `this` + */ + multiply(b) { + return _Mat4.multiply(this, this, b); + } + /** + * Alias for {@link Mat4.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat4} + * Equivalent to `Mat4.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose() { + return _Mat4.transpose(this, this); + } + /** + * Inverts this {@link Mat4} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + return _Mat4.invert(this, this); + } + /** + * Translate this {@link Mat4} by the given vector + * Equivalent to `Mat4.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to translate by + * @returns `this` + */ + translate(v) { + return _Mat4.translate(this, this, v); + } + /** + * Rotates this {@link Mat4} by the given angle around the given axis + * Equivalent to `Mat4.rotate(this, this, rad, axis);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `this` + */ + rotate(rad, axis) { + return _Mat4.rotate(this, this, rad, axis); + } + /** + * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat4.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to scale the matrix by + * @returns `this` + */ + scale(v) { + return _Mat4.scale(this, this, v); + } + /** + * Rotates this {@link Mat4} by the given angle around the X axis + * Equivalent to `Mat4.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateX(rad) { + return _Mat4.rotateX(this, this, rad); + } + /** + * Rotates this {@link Mat4} by the given angle around the Y axis + * Equivalent to `Mat4.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateY(rad) { + return _Mat4.rotateY(this, this, rad); + } + /** + * Rotates this {@link Mat4} by the given angle around the Z axis + * Equivalent to `Mat4.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateZ(rad) { + return _Mat4.rotateZ(this, this, rad); + } + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveNO(fovy, aspect, near, far) { + return _Mat4.perspectiveNO(this, fovy, aspect, near, far); + } + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveZO(fovy, aspect, near, far) { + return _Mat4.perspectiveZO(this, fovy, aspect, near, far); + } + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoNO(left, right, bottom, top, near, far) { + return _Mat4.orthoNO(this, left, right, bottom, top, near, far); + } + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoZO(left, right, bottom, top, near, far) { + return _Mat4.orthoZO(this, left, right, bottom, top, near, far); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat4}. + */ + static get BYTE_LENGTH() { + return 16 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat4} + * @category Static + * + * @returns A new {@link Mat4} + */ + static create() { + return new _Mat4(); + } + /** + * Creates a new {@link Mat4} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat4} + */ + static clone(a) { + return new _Mat4(a); + } + /** + * Copy the values from one {@link Mat4} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + /** + * Create a new mat4 with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat4} + */ + static fromValues(...values) { + return new _Mat4(...values); + } + /** + * Set the components of a mat4 to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + out[6] = values[6]; + out[7] = values[7]; + out[8] = values[8]; + out[9] = values[9]; + out[10] = values[10]; + out[11] = values[11]; + out[12] = values[12]; + out[13] = values[13]; + out[14] = values[14]; + out[15] = values[15]; + return out; + } + /** + * Set a {@link Mat4} to the identity matrix + * @category Static + * + * @param out - The receiving Matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out, a) { + if (out === a) { + const a01 = a[1], a02 = a[2], a03 = a[3]; + const a12 = a[6], a13 = a[7]; + const a23 = a[11]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a01; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a02; + out[9] = a12; + out[11] = a[14]; + out[12] = a03; + out[13] = a13; + out[14] = a23; + } else { + out[0] = a[0]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a[1]; + out[5] = a[5]; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a[2]; + out[9] = a[6]; + out[10] = a[10]; + out[11] = a[14]; + out[12] = a[3]; + out[13] = a[7]; + out[14] = a[11]; + out[15] = a[15]; + } + return out; + } + /** + * Inverts a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out, a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + out[0] = a11 * b11 - a12 * b10 + a13 * b09; + out[1] = a02 * b10 - a01 * b11 - a03 * b09; + out[2] = a31 * b05 - a32 * b04 + a33 * b03; + out[3] = a22 * b04 - a21 * b05 - a23 * b03; + out[4] = a12 * b08 - a10 * b11 - a13 * b07; + out[5] = a00 * b11 - a02 * b08 + a03 * b07; + out[6] = a32 * b02 - a30 * b05 - a33 * b01; + out[7] = a20 * b05 - a22 * b02 + a23 * b01; + out[8] = a10 * b10 - a11 * b08 + a13 * b06; + out[9] = a01 * b08 - a00 * b10 - a03 * b06; + out[10] = a30 * b04 - a31 * b02 + a33 * b00; + out[11] = a21 * b02 - a20 * b04 - a23 * b00; + out[12] = a11 * b07 - a10 * b09 - a12 * b06; + out[13] = a00 * b09 - a01 * b07 + a02 * b06; + out[14] = a31 * b01 - a30 * b03 - a32 * b00; + out[15] = a20 * b03 - a21 * b01 + a22 * b00; + return out; + } + /** + * Calculates the determinant of a {@link Mat4} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b0 = a00 * a11 - a01 * a10; + const b1 = a00 * a12 - a02 * a10; + const b2 = a01 * a12 - a02 * a11; + const b3 = a20 * a31 - a21 * a30; + const b4 = a20 * a32 - a22 * a30; + const b5 = a21 * a32 - a22 * a31; + const b6 = a00 * b5 - a01 * b4 + a02 * b3; + const b7 = a10 * b5 - a11 * b4 + a12 * b3; + const b8 = a20 * b2 - a21 * b1 + a22 * b0; + const b9 = a30 * b2 - a31 * b1 + a32 * b0; + return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9; + } + /** + * Multiplies two {@link Mat4}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + let b0 = b[0]; + let b1 = b[1]; + let b2 = b[2]; + let b3 = b[3]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[4]; + b1 = b[5]; + b2 = b[6]; + b3 = b[7]; + out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[8]; + b1 = b[9]; + b2 = b[10]; + b3 = b[11]; + out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[12]; + b1 = b[13]; + b2 = b[14]; + b3 = b[15]; + out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + return out; + } + /** + * Alias for {@link Mat4.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat4} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const x = v[0]; + const y = v[1]; + const z = v[2]; + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a03; + out[4] = a10; + out[5] = a11; + out[6] = a12; + out[7] = a13; + out[8] = a20; + out[9] = a21; + out[10] = a22; + out[11] = a23; + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + return out; + } + /** + * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec3} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const x = v[0]; + const y = v[1]; + const z = v[2]; + out[0] = a[0] * x; + out[1] = a[1] * x; + out[2] = a[2] * x; + out[3] = a[3] * x; + out[4] = a[4] * y; + out[5] = a[5] * y; + out[6] = a[6] * y; + out[7] = a[7] * y; + out[8] = a[8] * z; + out[9] = a[9] * z; + out[10] = a[10] * z; + out[11] = a[11] * z; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + /** + * Rotates a {@link Mat4} by the given angle around the given axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if axis has a length of 0 + */ + static rotate(out, a, rad, axis) { + let x = axis[0]; + let y = axis[1]; + let z = axis[2]; + let len = Math.sqrt(x * x + y * y + z * z); + if (len < GLM_EPSILON) { + return null; + } + len = 1 / len; + x *= len; + y *= len; + z *= len; + const s = Math.sin(rad); + const c = Math.cos(rad); + const t = 1 - c; + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const b00 = x * x * t + c; + const b01 = y * x * t + z * s; + const b02 = z * x * t - y * s; + const b10 = x * y * t - z * s; + const b11 = y * y * t + c; + const b12 = z * y * t + x * s; + const b20 = x * z * t + y * s; + const b21 = y * z * t - x * s; + const b22 = z * z * t + c; + out[0] = a00 * b00 + a10 * b01 + a20 * b02; + out[1] = a01 * b00 + a11 * b01 + a21 * b02; + out[2] = a02 * b00 + a12 * b01 + a22 * b02; + out[3] = a03 * b00 + a13 * b01 + a23 * b02; + out[4] = a00 * b10 + a10 * b11 + a20 * b12; + out[5] = a01 * b10 + a11 * b11 + a21 * b12; + out[6] = a02 * b10 + a12 * b11 + a22 * b12; + out[7] = a03 * b10 + a13 * b11 + a23 * b12; + out[8] = a00 * b20 + a10 * b21 + a20 * b22; + out[9] = a01 * b20 + a11 * b21 + a21 * b22; + out[10] = a02 * b20 + a12 * b21 + a22 * b22; + out[11] = a03 * b20 + a13 * b21 + a23 * b22; + if (a !== out) { + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + return out; + } + /** + * Rotates a matrix by the given angle around the X axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateX(out, a, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + if (a !== out) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[4] = a10 * c + a20 * s; + out[5] = a11 * c + a21 * s; + out[6] = a12 * c + a22 * s; + out[7] = a13 * c + a23 * s; + out[8] = a20 * c - a10 * s; + out[9] = a21 * c - a11 * s; + out[10] = a22 * c - a12 * s; + out[11] = a23 * c - a13 * s; + return out; + } + /** + * Rotates a matrix by the given angle around the Y axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateY(out, a, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + if (a !== out) { + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[0] = a00 * c - a20 * s; + out[1] = a01 * c - a21 * s; + out[2] = a02 * c - a22 * s; + out[3] = a03 * c - a23 * s; + out[8] = a00 * s + a20 * c; + out[9] = a01 * s + a21 * c; + out[10] = a02 * s + a22 * c; + out[11] = a03 * s + a23 * c; + return out; + } + /** + * Rotates a matrix by the given angle around the Z axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateZ(out, a, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + if (a !== out) { + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[0] = a00 * c + a10 * s; + out[1] = a01 * c + a11 * s; + out[2] = a02 * c + a12 * s; + out[3] = a03 * c + a13 * s; + out[4] = a10 * c - a00 * s; + out[5] = a11 * c - a01 * s; + out[6] = a12 * c - a02 * s; + out[7] = a13 * c - a03 * s; + return out; + } + /** + * Creates a {@link Mat4} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Creates a {@link Mat4} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = v[1]; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = v[2]; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a {@link Mat4} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotate(dest, dest, rad, axis); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if `axis` has a length of 0 + */ + static fromRotation(out, rad, axis) { + let x = axis[0]; + let y = axis[1]; + let z = axis[2]; + let len = Math.sqrt(x * x + y * y + z * z); + if (len < GLM_EPSILON) { + return null; + } + len = 1 / len; + x *= len; + y *= len; + z *= len; + const s = Math.sin(rad); + const c = Math.cos(rad); + const t = 1 - c; + out[0] = x * x * t + c; + out[1] = y * x * t + z * s; + out[2] = z * x * t - y * s; + out[3] = 0; + out[4] = x * y * t - z * s; + out[5] = y * y * t + c; + out[6] = z * y * t + x * s; + out[7] = 0; + out[8] = x * z * t + y * s; + out[9] = y * z * t - x * s; + out[10] = z * z * t + c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateX(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromXRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = c; + out[6] = s; + out[7] = 0; + out[8] = 0; + out[9] = -s; + out[10] = c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateY(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromYRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = 0; + out[2] = -s; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = s; + out[9] = 0; + out[10] = c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateZ(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromZRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = 0; + out[3] = 0; + out[4] = -s; + out[5] = c; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @returns `out` + */ + static fromRotationTranslation(out, q, v) { + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Sets a {@link Mat4} from a {@link Quat2}. + * @category Static + * + * @param out - Matrix + * @param a - Dual Quaternion + * @returns `out` + */ + static fromQuat2(out, a) { + const bx = -a[0]; + const by = -a[1]; + const bz = -a[2]; + const bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const magnitude = bx * bx + by * by + bz * bz + bw * bw; + if (magnitude > 0) { + _Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude; + _Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude; + _Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude; + } else { + _Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; + _Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; + _Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + } + _Mat4.fromRotationTranslation(out, a, _Mat4.#TMP_VEC3); + return out; + } + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out, a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[3] = 0; + out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[7] = 0; + out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out, a) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const bx = a[4]; + const by = a[5]; + const bz = a[6]; + const cx = a[8]; + const cy = a[9]; + const cz = a[10]; + out[0] = by * cz - cz * cy; + out[1] = bz * cx - cx * cz; + out[2] = bx * cy - cy * cx; + out[3] = 0; + out[4] = cy * az - cz * ay; + out[5] = cz * ax - cx * az; + out[6] = cx * ay - cy * ax; + out[7] = 0; + out[8] = ay * bz - az * by; + out[9] = az * bx - ax * bz; + out[10] = ax * by - ay * bx; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Returns the translation vector component of a transformation + * matrix. If a matrix is built with fromRotationTranslation, + * the returned vector will be the same as the translation vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive translation component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getTranslation(out, mat) { + out[0] = mat[12]; + out[1] = mat[13]; + out[2] = mat[14]; + return out; + } + /** + * Returns the scaling factor component of a transformation + * matrix. If a matrix is built with fromRotationTranslationScale + * with a normalized Quaternion parameter, the returned vector will be + * the same as the scaling vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive scaling factor component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getScaling(out, mat) { + const m11 = mat[0]; + const m12 = mat[1]; + const m13 = mat[2]; + const m21 = mat[4]; + const m22 = mat[5]; + const m23 = mat[6]; + const m31 = mat[8]; + const m32 = mat[9]; + const m33 = mat[10]; + out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + return out; + } + /** + * Returns a quaternion representing the rotational component + * of a transformation matrix. If a matrix is built with + * fromRotationTranslation, the returned quaternion will be the + * same as the quaternion originally supplied. + * @category Static + * + * @param out - Quaternion to receive the rotation component + * @param mat - Matrix to be decomposed (input) + * @return `out` + */ + static getRotation(out, mat) { + _Mat4.getScaling(_Mat4.#TMP_VEC3, mat); + const is1 = 1 / _Mat4.#TMP_VEC3[0]; + const is2 = 1 / _Mat4.#TMP_VEC3[1]; + const is3 = 1 / _Mat4.#TMP_VEC3[2]; + const sm11 = mat[0] * is1; + const sm12 = mat[1] * is2; + const sm13 = mat[2] * is3; + const sm21 = mat[4] * is1; + const sm22 = mat[5] * is2; + const sm23 = mat[6] * is3; + const sm31 = mat[8] * is1; + const sm32 = mat[9] * is2; + const sm33 = mat[10] * is3; + const trace = sm11 + sm22 + sm33; + let S = 0; + if (trace > 0) { + S = Math.sqrt(trace + 1) * 2; + out[3] = 0.25 * S; + out[0] = (sm23 - sm32) / S; + out[1] = (sm31 - sm13) / S; + out[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2; + out[3] = (sm23 - sm32) / S; + out[0] = 0.25 * S; + out[1] = (sm12 + sm21) / S; + out[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2; + out[3] = (sm31 - sm13) / S; + out[0] = (sm12 + sm21) / S; + out[1] = 0.25 * S; + out[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2; + out[3] = (sm12 - sm21) / S; + out[0] = (sm31 + sm13) / S; + out[1] = (sm23 + sm32) / S; + out[2] = 0.25 * S; + } + return out; + } + /** + * Decomposes a transformation matrix into its rotation, translation + * and scale components. Returns only the rotation component + * @category Static + * + * @param out_r - Quaternion to receive the rotation component + * @param out_t - Vector to receive the translation vector + * @param out_s - Vector to receive the scaling factor + * @param mat - Matrix to be decomposed (input) + * @returns `out_r` + */ + static decompose(out_r, out_t, out_s, mat) { + out_t[0] = mat[12]; + out_t[1] = mat[13]; + out_t[2] = mat[14]; + const m11 = mat[0]; + const m12 = mat[1]; + const m13 = mat[2]; + const m21 = mat[4]; + const m22 = mat[5]; + const m23 = mat[6]; + const m31 = mat[8]; + const m32 = mat[9]; + const m33 = mat[10]; + out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + const is1 = 1 / out_s[0]; + const is2 = 1 / out_s[1]; + const is3 = 1 / out_s[2]; + const sm11 = m11 * is1; + const sm12 = m12 * is2; + const sm13 = m13 * is3; + const sm21 = m21 * is1; + const sm22 = m22 * is2; + const sm23 = m23 * is3; + const sm31 = m31 * is1; + const sm32 = m32 * is2; + const sm33 = m33 * is3; + const trace = sm11 + sm22 + sm33; + let S = 0; + if (trace > 0) { + S = Math.sqrt(trace + 1) * 2; + out_r[3] = 0.25 * S; + out_r[0] = (sm23 - sm32) / S; + out_r[1] = (sm31 - sm13) / S; + out_r[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2; + out_r[3] = (sm23 - sm32) / S; + out_r[0] = 0.25 * S; + out_r[1] = (sm12 + sm21) / S; + out_r[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2; + out_r[3] = (sm31 - sm13) / S; + out_r[0] = (sm12 + sm21) / S; + out_r[1] = 0.25 * S; + out_r[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2; + out_r[3] = (sm12 - sm21) / S; + out_r[0] = (sm31 + sm13) / S; + out_r[1] = (sm23 + sm32) / S; + out_r[2] = 0.25 * S; + } + return out_r; + } + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @returns `out` + */ + static fromRotationTranslationScale(out, q, v, s) { + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + const sx = s[0]; + const sy = s[1]; + const sz = s[2]; + out[0] = (1 - (yy + zz)) * sx; + out[1] = (xy + wz) * sx; + out[2] = (xz - wy) * sx; + out[3] = 0; + out[4] = (xy - wz) * sy; + out[5] = (1 - (xx + zz)) * sy; + out[6] = (yz + wx) * sy; + out[7] = 0; + out[8] = (xz + wy) * sz; + out[9] = (yz - wx) * sz; + out[10] = (1 - (xx + yy)) * sz; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the + * given origin. This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * mat4.translate(dest, origin); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * mat4.translate(dest, negativeOrigin); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @param o - The origin vector around which to scale and rotate + * @returns `out` + */ + static fromRotationTranslationScaleOrigin(out, q, v, s, o) { + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + const sx = s[0]; + const sy = s[1]; + const sz = s[2]; + const ox = o[0]; + const oy = o[1]; + const oz = o[2]; + const out0 = (1 - (yy + zz)) * sx; + const out1 = (xy + wz) * sx; + const out2 = (xz - wy) * sx; + const out4 = (xy - wz) * sy; + const out5 = (1 - (xx + zz)) * sy; + const out6 = (yz + wx) * sy; + const out8 = (xz + wy) * sz; + const out9 = (yz - wx) * sz; + const out10 = (1 - (xx + yy)) * sz; + out[0] = out0; + out[1] = out1; + out[2] = out2; + out[3] = 0; + out[4] = out4; + out[5] = out5; + out[6] = out6; + out[7] = 0; + out[8] = out8; + out[9] = out9; + out[10] = out10; + out[11] = 0; + out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz); + out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz); + out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); + out[15] = 1; + return out; + } + /** + * Calculates a 4x4 matrix from the given quaternion + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Quaternion to create matrix from + * @returns `out` + */ + static fromQuat(out, q) { + 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; + out[0] = 1 - yy - zz; + out[1] = yx + wz; + out[2] = zx - wy; + out[3] = 0; + out[4] = yx - wz; + out[5] = 1 - xx - zz; + out[6] = zy + wx; + out[7] = 0; + out[8] = zx + wy; + out[9] = zy - wx; + out[10] = 1 - xx - yy; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumNO(out, left, right, bottom, top, near, far = Infinity) { + const rl = 1 / (right - left); + const tb = 1 / (top - bottom); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + /** + * Alias for {@link Mat4.frustumNO} + * @category Static + * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly + */ + static frustum(out, left, right, bottom, top, near, far = Infinity) { + return out; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumZO(out, left, right, bottom, top, near, far = Infinity) { + const rl = 1 / (right - left); + const tb = 1 / (top - bottom); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = far * nf; + out[14] = far * near * nf; + } else { + out[10] = -1; + out[14] = -near; + } + return out; + } + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveNO(out, fovy, aspect, near, far = Infinity) { + const f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + /** + * Alias for {@link Mat4.perspectiveNO} + * @category Static + * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static perspective(out, fovy, aspect, near, far = Infinity) { + return out; + } + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveZO(out, fovy, aspect, near, far = Infinity) { + const f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = far * nf; + out[14] = far * near * nf; + } else { + out[10] = -1; + out[14] = -near; + } + return out; + } + /** + * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating + * projection matrices to be used with the still experimental WebVR API. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + * @deprecated + */ + static perspectiveFromFieldOfView(out, fov, near, far) { + const upTan = Math.tan(fov.upDegrees * Math.PI / 180); + const downTan = Math.tan(fov.downDegrees * Math.PI / 180); + const leftTan = Math.tan(fov.leftDegrees * Math.PI / 180); + const rightTan = Math.tan(fov.rightDegrees * Math.PI / 180); + const xScale = 2 / (leftTan + rightTan); + const yScale = 2 / (upTan + downTan); + out[0] = xScale; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = yScale; + out[6] = 0; + out[7] = 0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = (upTan - downTan) * yScale * 0.5; + out[10] = far / (near - far); + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = far * near / (near - far); + out[15] = 0; + return out; + } + /** + * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoNO(out, left, right, bottom, top, near, far) { + const lr = 1 / (left - right); + const bt = 1 / (bottom - top); + const nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; + } + /** + * Alias for {@link Mat4.orthoNO} + * @category Static + * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static ortho(out, left, right, bottom, top, near, far) { + return out; + } + /** + * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoZO(out, left, right, bottom, top, near, far) { + const lr = 1 / (left - right); + const bt = 1 / (bottom - top); + const nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = near * nf; + out[15] = 1; + return out; + } + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that + * actually makes an object look at another object, you should use targetTo instead. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param center - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static lookAt(out, eye, center, up) { + const eyex = eye[0]; + const eyey = eye[1]; + const eyez = eye[2]; + const upx = up[0]; + const upy = up[1]; + const upz = up[2]; + const centerx = center[0]; + const centery = center[1]; + const centerz = center[2]; + if (Math.abs(eyex - centerx) < GLM_EPSILON && Math.abs(eyey - centery) < GLM_EPSILON && Math.abs(eyez - centerz) < GLM_EPSILON) { + return _Mat4.identity(out); + } + let z0 = eyex - centerx; + let z1 = eyey - centery; + let z2 = eyez - centerz; + let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + z0 *= len; + z1 *= len; + z2 *= len; + let x0 = upy * z2 - upz * z1; + let x1 = upz * z0 - upx * z2; + let x2 = upx * z1 - upy * z0; + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + if (!len) { + x0 = 0; + x1 = 0; + x2 = 0; + } else { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + let y0 = z1 * x2 - z2 * x1; + let y1 = z2 * x0 - z0 * x2; + let y2 = z0 * x1 - z1 * x0; + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + if (!len) { + y0 = 0; + y1 = 0; + y2 = 0; + } else { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + out[0] = x0; + out[1] = y0; + out[2] = z0; + out[3] = 0; + out[4] = x1; + out[5] = y1; + out[6] = z1; + out[7] = 0; + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); + out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); + out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + return out; + } + /** + * Generates a matrix that makes something look at something else. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param target - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static targetTo(out, eye, target, up) { + const eyex = eye[0]; + const eyey = eye[1]; + const eyez = eye[2]; + const upx = up[0]; + const upy = up[1]; + const upz = up[2]; + let z0 = eyex - target[0]; + let z1 = eyey - target[1]; + let z2 = eyez - target[2]; + let len = z0 * z0 + z1 * z1 + z2 * z2; + if (len > 0) { + len = 1 / Math.sqrt(len); + z0 *= len; + z1 *= len; + z2 *= len; + } + let x0 = upy * z2 - upz * z1; + let x1 = upz * z0 - upx * z2; + let x2 = upx * z1 - upy * z0; + len = x0 * x0 + x1 * x1 + x2 * x2; + if (len > 0) { + len = 1 / Math.sqrt(len); + x0 *= len; + x1 *= len; + x2 *= len; + } + out[0] = x0; + out[1] = x1; + out[2] = x2; + out[3] = 0; + out[4] = z1 * x2 - z2 * x1; + out[5] = z2 * x0 - z0 * x2; + out[6] = z0 * x1 - z1 * x0; + out[7] = 0; + out[8] = z0; + out[9] = z1; + out[10] = z2; + out[11] = 0; + out[12] = eyex; + out[13] = eyey; + out[14] = eyez; + out[15] = 1; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat4} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt( + a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + a[9] * a[9] + a[10] * a[10] + a[11] * a[11] + a[12] * a[12] + a[13] * a[13] + a[14] * a[14] + a[15] * a[15] + ); + } + /** + * Adds two {@link Mat4}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + out[8] = a[8] + b[8]; + out[9] = a[9] + b[9]; + out[10] = a[10] + b[10]; + out[11] = a[11] + b[11]; + out[12] = a[12] + b[12]; + out[13] = a[13] + b[13]; + out[14] = a[14] + b[14]; + out[15] = a[15] + b[15]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + out[6] = a[6] - b[6]; + out[7] = a[7] - b[7]; + out[8] = a[8] - b[8]; + out[9] = a[9] - b[9]; + out[10] = a[10] - b[10]; + out[11] = a[11] - b[11]; + out[12] = a[12] - b[12]; + out[13] = a[13] - b[13]; + out[14] = a[14] - b[14]; + out[15] = a[15] - b[15]; + return out; + } + /** + * Alias for {@link Mat4.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiply each element of the matrix by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + out[8] = a[8] * b; + out[9] = a[9] * b; + out[10] = a[10] * b; + out[11] = a[11] * b; + out[12] = a[12] * b; + out[13] = a[13] * b; + out[14] = a[14] * b; + out[15] = a[15] * b; + return out; + } + /** + * Adds two mat4's after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + out[6] = a[6] + b[6] * scale; + out[7] = a[7] + b[7] * scale; + out[8] = a[8] + b[8] * scale; + out[9] = a[9] + b[9] * scale; + out[10] = a[10] + b[10] * scale; + out[11] = a[11] + b[11] * scale; + out[12] = a[12] + b[12] * scale; + out[13] = a[13] + b[13] * scale; + out[14] = a[14] + b[14] * scale; + out[15] = a[15] + b[15] * scale; + return out; + } + /** + * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15]; + } + /** + * Returns whether two {@link Mat4}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const a8 = a[8]; + const a9 = a[9]; + const a10 = a[10]; + const a11 = a[11]; + const a12 = a[12]; + const a13 = a[13]; + const a14 = a[14]; + const a15 = a[15]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + const b8 = b[8]; + const b9 = b[9]; + const b10 = b[10]; + const b11 = b[11]; + const b12 = b[12]; + const b13 = b[13]; + const b14 = b[14]; + const b15 = b[15]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15)); + } + /** + * Returns a string representation of a {@link Mat4} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat4(${a.join(", ")})`; + } +}; +Mat4.prototype.mul = Mat4.prototype.multiply; +Mat4.sub = Mat4.subtract; +Mat4.mul = Mat4.multiply; +Mat4.frustum = Mat4.frustumNO; +Mat4.perspective = Mat4.perspectiveNO; +Mat4.ortho = Mat4.orthoNO; + +// src/_lib/f32/Vec3.ts +var Vec3 = class _Vec3 extends Float32Array { + /** + * Create a {@link Vec3}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 3: + super(values); + break; + case 2: + super(values[0], values[1], 3); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v]); + } else { + super(v, 0, 3); + } + break; + } + default: + super(3); + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z() { + return this[2]; + } + set z(value) { + this[2] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r() { + return this[0]; + } + set r(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g() { + return this[1]; + } + set g(value) { + this[1] = value; + } + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b() { + return this[2]; + } + set b(value) { + this[2] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec3.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec3.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag() { + return this.squaredMagnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec3.str(this);` + * + * @category Accessors + */ + get str() { + return _Vec3.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Adds a {@link Vec3} to `this`. + * Equivalent to `Vec3.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b) { + this[0] += b[0]; + this[1] += b[1]; + this[2] += b[2]; + return this; + } + /** + * Subtracts a {@link Vec3} from `this`. + * Equivalent to `Vec3.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + this[2] -= b[2]; + return this; + } + /** + * Alias for {@link Vec3.subtract} + * @category Methods + */ + sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec3}. + * Equivalent to `Vec3.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + this[2] *= b[2]; + return this; + } + /** + * Alias for {@link Vec3.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec3}. + * Equivalent to `Vec3.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + this[2] /= b[2]; + return this; + } + /** + * Alias for {@link Vec3.divide} + * @category Methods + */ + div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec3.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b) { + this[0] *= b; + this[1] *= b; + this[2] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + this[2] += b[2] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b) { + return _Vec3.distance(this, b); + } + /** + * Alias for {@link Vec3.distance} + * @category Methods + */ + dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b) { + return _Vec3.squaredDistance(this, b); + } + /** + * Alias for {@link Vec3.squaredDistance} + * @category Methods + */ + sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec3.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate() { + this[0] *= -1; + this[1] *= -1; + this[2] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec3.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + this[2] = 1 / this[2]; + return this; + } + /** + * Sets each component of `this` to its absolute value. + * Equivalent to `Vec3.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + this[2] = Math.abs(this[2]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec3}. + * Equivalent to `Vec3.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b) { + return this[0] * b[0] + this[1] * b[1] + this[2] * b[2]; + } + /** + * Normalize `this`. + * Equivalent to `Vec3.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize() { + return _Vec3.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec3}. + */ + static get BYTE_LENGTH() { + return 3 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty vec3 + * @category Static + * + * @returns a new 3D vector + */ + static create() { + return new _Vec3(); + } + /** + * Creates a new vec3 initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 3D vector + */ + static clone(a) { + return new _Vec3(a); + } + /** + * Calculates the magnitude (length) of a {@link Vec3} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Creates a new vec3 initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns a new 3D vector + */ + static fromValues(x, y, z) { + return new _Vec3(x, y, z); + } + /** + * Copy the values from one vec3 to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + return out; + } + /** + * Set the components of a vec3 to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns `out` + */ + static set(out, x, y, z) { + out[0] = x; + out[1] = y; + out[2] = z; + return out; + } + /** + * Adds two {@link Vec3}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + return out; + } + /** + * Alias for {@link Vec3.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return [0, 0, 0]; + } + /** + * Multiplies two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + return out; + } + /** + * Alias for {@link Vec3.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return [0, 0, 0]; + } + /** + * Divides two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + out[2] = a[2] / b[2]; + return out; + } + /** + * Alias for {@link Vec3.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out, a, b) { + return [0, 0, 0]; + } + /** + * Math.ceil the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + out[2] = Math.ceil(a[2]); + return out; + } + /** + * Math.floor the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + out[2] = Math.floor(a[2]); + return out; + } + /** + * Returns the minimum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + return out; + } + /** + * Returns the maximum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + return out; + } + /** + * symmetric round the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + /* + static round(out: Vec3Like, a: Readonly): Vec3Like { + out[0] = glMatrix.round(a[0]); + out[1] = glMatrix.round(a[1]); + out[2] = glMatrix.round(a[2]); + return out; + }*/ + /** + * Scales a vec3 by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out, a, scale) { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + return out; + } + /** + * Adds two vec3's after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredDistance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a, b) { + return 0; + } + /** + * Calculates the squared length of a vec3 + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredLength} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrLen(a, b) { + return 0; + } + /** + * Negates the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + return out; + } + /** + * Returns the inverse of the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + out[2] = 1 / a[2]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec3} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + out[2] = Math.abs(a[2]); + return out; + } + /** + * Normalize a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out, a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + let len = x * x + y * y + z * z; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + out[2] = a[2] * len; + return out; + } + /** + * Calculates the dot product of two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; + } + /** + * Computes the cross product of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static cross(out, a, b) { + const ax = a[0], ay = a[1], az = a[2]; + const bx = b[0], by = b[1], bz = b[2]; + out[0] = ay * bz - az * by; + out[1] = az * bx - ax * bz; + out[2] = ax * by - ay * bx; + return out; + } + /** + * Performs a linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + return out; + } + /** + * Performs a spherical linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out, a, b, t) { + const angle = Math.acos(Math.min(Math.max(_Vec3.dot(a, b), -1), 1)); + const sinTotal = Math.sin(angle); + const ratioA = Math.sin((1 - t) * angle) / sinTotal; + const ratioB = Math.sin(t * angle) / sinTotal; + out[0] = ratioA * a[0] + ratioB * b[0]; + out[1] = ratioA * a[1] + ratioB * b[1]; + out[2] = ratioA * a[2] + ratioB * b[2]; + return out; + } + /** + * Performs a hermite interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static hermite(out, a, b, c, d, t) { + const factorTimes2 = t * t; + const factor1 = factorTimes2 * (2 * t - 3) + 1; + const factor2 = factorTimes2 * (t - 2) + t; + const factor3 = factorTimes2 * (t - 1); + const factor4 = factorTimes2 * (3 - 2 * t); + out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; + out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; + out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; + return out; + } + /** + * Performs a bezier interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static bezier(out, a, b, c, d, t) { + const inverseFactor = 1 - t; + const inverseFactorTimesTwo = inverseFactor * inverseFactor; + const factorTimes2 = t * t; + const factor1 = inverseFactorTimesTwo * inverseFactor; + const factor2 = 3 * t * inverseFactorTimesTwo; + const factor3 = 3 * factorTimes2 * inverseFactor; + const factor4 = factorTimes2 * t; + out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; + out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; + out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; + return out; + } + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned + * @returns `out` + */ + /* + static random(out: Vec3Like, scale) { + scale = scale === undefined ? 1.0 : scale; + + let r = glMatrix.RANDOM() * 2.0 * Math.PI; + let z = glMatrix.RANDOM() * 2.0 - 1.0; + let zScale = Math.sqrt(1.0 - z * z) * scale; + + out[0] = Math.cos(r) * zScale; + out[1] = Math.sin(r) * zScale; + out[2] = z * scale; + return out; + }*/ + /** + * Transforms the vec3 with a mat4. + * 4th vector component is implicitly '1' + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out, a, m) { + const x = a[0], y = a[1], z = a[2]; + const w = m[3] * x + m[7] * y + m[11] * z + m[15] || 1; + out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; + out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; + out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; + return out; + } + /** + * Transforms the vec3 with a mat3. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - the 3x3 matrix to transform with + * @returns `out` + */ + static transformMat3(out, a, m) { + const x = a[0], y = a[1], z = a[2]; + out[0] = x * m[0] + y * m[3] + z * m[6]; + out[1] = x * m[1] + y * m[4] + z * m[7]; + out[2] = x * m[2] + y * m[5] + z * m[8]; + return out; + } + /** + * Transforms the vec3 with a quat + * Can also be used for dual quaternions. (Multiply it with the real part) + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out, a, q) { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const w2 = q[3] * 2; + const x = a[0]; + const y = a[1]; + const z = a[2]; + const uvx = qy * z - qz * y; + const uvy = qz * x - qx * z; + const uvz = qx * y - qy * x; + const uuvx = (qy * uvz - qz * uvy) * 2; + const uuvy = (qz * uvx - qx * uvz) * 2; + const uuvz = (qx * uvy - qy * uvx) * 2; + out[0] = x + uvx * w2 + uuvx; + out[1] = y + uvy * w2 + uuvy; + out[2] = z + uvz * w2 + uuvz; + return out; + } + /** + * Rotate a 3D vector around the x-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateX(out, a, b, rad) { + const by = b[1]; + const bz = b[2]; + const py = a[1] - by; + const pz = a[2] - bz; + out[0] = a[0]; + out[1] = py * Math.cos(rad) - pz * Math.sin(rad) + by; + out[2] = py * Math.sin(rad) + pz * Math.cos(rad) + bz; + return out; + } + /** + * Rotate a 3D vector around the y-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateY(out, a, b, rad) { + const bx = b[0]; + const bz = b[2]; + const px = a[0] - bx; + const pz = a[2] - bz; + out[0] = pz * Math.sin(rad) + px * Math.cos(rad) + bx; + out[1] = a[1]; + out[2] = pz * Math.cos(rad) - px * Math.sin(rad) + bz; + return out; + } + /** + * Rotate a 3D vector around the z-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateZ(out, a, b, rad) { + const bx = b[0]; + const by = b[1]; + const px = a[0] - bx; + const py = a[1] - by; + out[0] = px * Math.cos(rad) - py * Math.sin(rad) + bx; + out[1] = px * Math.sin(rad) + py * Math.cos(rad) + by; + out[2] = b[2]; + return out; + } + /** + * Get the angle between two 3D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static 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 mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz)); + const cosine = mag && _Vec3.dot(a, b) / mag; + return Math.acos(Math.min(Math.max(cosine, -1), 1)); + } + /** + * Set the components of a vec3 to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + return out; + } + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Vec3(${a.join(", ")})`; + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)); + } +}; +Vec3.prototype.sub = Vec3.prototype.subtract; +Vec3.prototype.mul = Vec3.prototype.multiply; +Vec3.prototype.div = Vec3.prototype.divide; +Vec3.prototype.dist = Vec3.prototype.distance; +Vec3.prototype.sqrDist = Vec3.prototype.squaredDistance; +Vec3.sub = Vec3.subtract; +Vec3.mul = Vec3.multiply; +Vec3.div = Vec3.divide; +Vec3.dist = Vec3.distance; +Vec3.sqrDist = Vec3.squaredDistance; +Vec3.sqrLen = Vec3.squaredLength; +Vec3.mag = Vec3.magnitude; +Vec3.length = Vec3.magnitude; +Vec3.len = Vec3.magnitude; + +// src/_lib/f32/Vec4.ts +var Vec4 = class _Vec4 extends Float32Array { + /** + * Create a {@link Vec4}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 4: + super(values); + break; + case 2: + super(values[0], values[1], 4); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v, v]); + } else { + super(v, 0, 4); + } + break; + } + default: + super(4); + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z() { + return this[2]; + } + set z(value) { + this[2] = value; + } + /** + * The w component of the vector. Equivalent to `this[3];` + * @category Vector Components + */ + get w() { + return this[3]; + } + set w(value) { + this[3] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r() { + return this[0]; + } + set r(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g() { + return this[1]; + } + set g(value) { + this[1] = value; + } + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b() { + return this[2]; + } + set b(value) { + this[2] = value; + } + /** + * The a component of the vector. Equivalent to `this[3];` + * @category Color Components + */ + get a() { + return this[3]; + } + set a(value) { + this[3] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec4.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + const w = this[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Vec4.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec4.str(this);` + * + * @category Accessors + */ + get str() { + return _Vec4.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + super.set(a); + return this; + } + /** + * Adds a {@link Vec4} to `this`. + * Equivalent to `Vec4.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b) { + this[0] += b[0]; + this[1] += b[1]; + this[2] += b[2]; + this[3] += b[3]; + return this; + } + /** + * Subtracts a {@link Vec4} from `this`. + * Equivalent to `Vec4.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + this[2] -= b[2]; + this[3] -= b[3]; + return this; + } + /** + * Alias for {@link Vec4.subtract} + * @category Methods + */ + sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec4}. + * Equivalent to `Vec4.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + this[2] *= b[2]; + this[3] *= b[3]; + return this; + } + /** + * Alias for {@link Vec4.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec4}. + * Equivalent to `Vec4.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + this[2] /= b[2]; + this[3] /= b[3]; + return this; + } + /** + * Alias for {@link Vec4.divide} + * @category Methods + */ + div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec4.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b) { + this[0] *= b; + this[1] *= b; + this[2] *= b; + this[3] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + this[2] += b[2] * scale; + this[3] += b[3] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b) { + return _Vec4.distance(this, b); + } + /** + * Alias for {@link Vec4.distance} + * @category Methods + */ + dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b) { + return _Vec4.squaredDistance(this, b); + } + /** + * Alias for {@link Vec4.squaredDistance} + * @category Methods + */ + sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec4.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate() { + this[0] *= -1; + this[1] *= -1; + this[2] *= -1; + this[3] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec4.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + this[2] = 1 / this[2]; + this[3] = 1 / this[3]; + return this; + } + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec4.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + this[2] = Math.abs(this[2]); + this[3] = Math.abs(this[3]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec4}. + * Equivalent to `Vec4.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b) { + return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3]; + } + /** + * Normalize `this`. + * Equivalent to `Vec4.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize() { + return _Vec4.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec4}. + */ + static get BYTE_LENGTH() { + return 4 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty {@link Vec4} + * @category Static + * + * @returns a new 4D vector + */ + static create() { + return new _Vec4(); + } + /** + * Creates a new {@link Vec4} initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 4D vector + */ + static clone(a) { + return new _Vec4(a); + } + /** + * Creates a new {@link Vec4} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new 4D vector + */ + static fromValues(x, y, z, w) { + return new _Vec4(x, y, z, w); + } + /** + * Copy the values from one {@link Vec4} to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Vec4} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + static set(out, x, y, z, w) { + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = w; + return out; + } + /** + * Adds two {@link Vec4}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + return out; + } + /** + * Alias for {@link Vec4.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + out[3] = a[3] * b[3]; + return out; + } + /** + * Alias for {@link Vec4.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Divides two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + out[2] = a[2] / b[2]; + out[3] = a[3] / b[3]; + return out; + } + /** + * Alias for {@link Vec4.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out, a, b) { + return out; + } + /** + * Math.ceil the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + out[2] = Math.ceil(a[2]); + out[3] = Math.ceil(a[3]); + return out; + } + /** + * Math.floor the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + out[2] = Math.floor(a[2]); + out[3] = Math.floor(a[3]); + return out; + } + /** + * Returns the minimum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + out[3] = Math.min(a[3], b[3]); + return out; + } + /** + * Returns the maximum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + out[3] = Math.max(a[3], b[3]); + return out; + } + /** + * Math.round the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + static round(out, a) { + out[0] = Math.round(a[0]); + out[1] = Math.round(a[1]); + out[2] = Math.round(a[2]); + out[3] = Math.round(a[3]); + return out; + } + /** + * Scales a {@link Vec4} by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out, a, scale) { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + out[3] = a[3] * scale; + return out; + } + /** + * Adds two {@link Vec4}'s after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + const w = b[3] - a[3]; + return Math.hypot(x, y, z, w); + } + /** + * Alias for {@link Vec4.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + const w = b[3] - a[3]; + return x * x + y * y + z * z + w * w; + } + /** + * Alias for {@link Vec4.squaredDistance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a, b) { + return 0; + } + /** + * Calculates the magnitude (length) of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate length of + * @returns length of `a` + */ + static magnitude(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Vec4.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + return x * x + y * y + z * z + w * w; + } + /** + * Alias for {@link Vec4.squaredLength} + * @category Static + */ + static sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = -a[3]; + return out; + } + /** + * Returns the inverse of the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + out[2] = 1 / a[2]; + out[3] = 1 / a[3]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec4} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + out[2] = Math.abs(a[2]); + out[3] = Math.abs(a[3]); + return out; + } + /** + * Normalize a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out, a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + let len = x * x + y * y + z * z + w * w; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = x * len; + out[1] = y * len; + out[2] = z * len; + out[3] = w * len; + return out; + } + /** + * Calculates the dot product of two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + /** + * Returns the cross-product of three vectors in a 4-dimensional space + * @category Static + * + * @param out the receiving vector + * @param u - the first vector + * @param v - the second vector + * @param w - the third vector + * @returns result + */ + static cross(out, u, v, w) { + const a = v[0] * w[1] - v[1] * w[0]; + const b = v[0] * w[2] - v[2] * w[0]; + const c = v[0] * w[3] - v[3] * w[0]; + const d = v[1] * w[2] - v[2] * w[1]; + const e = v[1] * w[3] - v[3] * w[1]; + const f = v[2] * w[3] - v[3] * w[2]; + const g = u[0]; + const h = u[1]; + const i = u[2]; + const j = u[3]; + out[0] = h * f - i * e + j * d; + out[1] = -(g * f) + i * c - j * b; + out[2] = g * e - h * c + j * a; + out[3] = -(g * d) + h * b - i * a; + return out; + } + /** + * Performs a linear interpolation between two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + out[3] = aw + t * (b[3] - aw); + return out; + } + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns `out` + */ + /* + static random(out: Vec4Like, scale): Vec4Like { + scale = scale || 1.0; + + // Marsaglia, George. Choosing a Point from the Surface of a + // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646. + // http://projecteuclid.org/euclid.aoms/1177692644; + var v1, v2, v3, v4; + var s1, s2; + do { + v1 = glMatrix.RANDOM() * 2 - 1; + v2 = glMatrix.RANDOM() * 2 - 1; + s1 = v1 * v1 + v2 * v2; + } while (s1 >= 1); + do { + v3 = glMatrix.RANDOM() * 2 - 1; + v4 = glMatrix.RANDOM() * 2 - 1; + s2 = v3 * v3 + v4 * v4; + } while (s2 >= 1); + + var d = Math.sqrt((1 - s1) / s2); + out[0] = scale * v1; + out[1] = scale * v2; + out[2] = scale * v3 * d; + out[3] = scale * v4 * d; + return out; + }*/ + /** + * Transforms the {@link Vec4} with a {@link Mat4}. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out, a, m) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; + out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; + out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; + out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; + return out; + } + /** + * Transforms the {@link Vec4} with a {@link Quat} + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out, a, q) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + const ix = qw * x + qy * z - qz * y; + const iy = qw * y + qz * x - qx * z; + const iz = qw * z + qx * y - qy * x; + const iw = -qx * x - qy * y - qz * z; + out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy; + out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz; + out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Vec4} to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 0; + return out; + } + /** + * Returns a string representation of a {@link Vec4} + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Vec4(${a.join(", ")})`; + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)); + } +}; +Vec4.prototype.sub = Vec4.prototype.subtract; +Vec4.prototype.mul = Vec4.prototype.multiply; +Vec4.prototype.div = Vec4.prototype.divide; +Vec4.prototype.dist = Vec4.prototype.distance; +Vec4.prototype.sqrDist = Vec4.prototype.squaredDistance; +Vec4.sub = Vec4.subtract; +Vec4.mul = Vec4.multiply; +Vec4.div = Vec4.divide; +Vec4.dist = Vec4.distance; +Vec4.sqrDist = Vec4.squaredDistance; +Vec4.sqrLen = Vec4.squaredLength; +Vec4.mag = Vec4.magnitude; +Vec4.length = Vec4.magnitude; +Vec4.len = Vec4.magnitude; + +// src/_lib/f32/Quat.ts +var Quat = class _Quat extends Float32Array { + static #DEFAULT_ANGLE_ORDER = "zyx"; + // Temporary variables to prevent repeated allocations in the algorithms within Quat. + // These are declared as TypedArrays to aid in tree-shaking. + static #TMP_QUAT1 = new Float32Array(4); + static #TMP_QUAT2 = new Float32Array(4); + static #TMP_MAT3 = new Float32Array(9); + static #TMP_VEC3 = new Float32Array(3); + static #X_UNIT_VEC3 = new Float32Array([1, 0, 0]); + static #Y_UNIT_VEC3 = new Float32Array([0, 1, 0]); + /** + * Create a {@link Quat}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 4: + super(values); + break; + case 2: + super(values[0], values[1], 4); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v, v]); + } else { + super(v, 0, 4); + } + break; + } + default: + super(4); + this[3] = 1; + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the quaternion. Equivalent to `this[0];` + * @category Quaternion Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the quaternion. Equivalent to `this[1];` + * @category Quaternion Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + /** + * The z component of the quaternion. Equivalent to `this[2];` + * @category Quaternion Components + */ + get z() { + return this[2]; + } + set z(value) { + this[2] = value; + } + /** + * The w component of the quaternion. Equivalent to `this[3];` + * @category Quaternion Components + */ + get w() { + return this[3]; + } + set w(value) { + this[3] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Quat.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + const w = this[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Quat.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * A string representation of `this` + * Equivalent to `Quat.str(this);` + * + * @category Accessors + */ + get str() { + return _Quat.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Quat} into `this`. + * @category Methods + * + * @param a the source quaternion + * @returns `this` + */ + copy(a) { + super.set(a); + return this; + } + /** + * Set `this` to the identity quaternion + * Equivalent to Quat.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this[0] = 0; + this[1] = 0; + this[2] = 0; + this[3] = 1; + return this; + } + /** + * Multiplies `this` by a {@link Quat}. + * Equivalent to `Quat.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + return _Quat.multiply(this, this, b); + } + /** + * Alias for {@link Quat.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Rotates `this` by the given angle about the X axis + * Equivalent to `Quat.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateX(rad) { + return _Quat.rotateX(this, this, rad); + } + /** + * Rotates `this` by the given angle about the Y axis + * Equivalent to `Quat.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateY(rad) { + return _Quat.rotateY(this, this, rad); + } + /** + * Rotates `this` by the given angle about the Z axis + * Equivalent to `Quat.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateZ(rad) { + return _Quat.rotateZ(this, this, rad); + } + /** + * Inverts `this` + * Equivalent to `Quat.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + return _Quat.invert(this, this); + } + /** + * Scales `this` by a scalar number + * Equivalent to `Quat.scale(this, this, scale);` + * @category Methods + * + * @param scale - amount to scale the vector by + * @returns `this` + */ + scale(scale) { + this[0] *= scale; + this[1] *= scale; + this[2] *= scale; + this[3] *= scale; + return this; + } + /** + * Calculates the dot product of `this` and another {@link Quat} + * Equivalent to `Quat.dot(this, b);` + * @category Methods + * + * @param b - the second operand + * @returns dot product of `this` and b + */ + dot(b) { + return _Quat.dot(this, b); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat}. + */ + static get BYTE_LENGTH() { + return 4 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new identity quat + * @category Static + * + * @returns a new quaternion + */ + static create() { + return new _Quat(); + } + /** + * Set a quat to the identity quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + static identity(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * @category Static + * + * @param out - the receiving quaternion + * @param axis - the axis around which to rotate + * @param rad - the angle in radians + * @returns `out` + **/ + static setAxisAngle(out, axis, rad) { + rad *= 0.5; + const s = Math.sin(rad); + out[0] = s * axis[0]; + out[1] = s * axis[1]; + out[2] = s * axis[2]; + out[3] = Math.cos(rad); + return out; + } + /** + * Gets the rotation axis and angle for a given + * quaternion. If a quaternion is created with + * setAxisAngle, this method will return the same + * values as provided in the original parameter list + * OR functionally equivalent values. + * Example: The quaternion formed by axis [0, 0, 1] and + * angle -90 is the same as the quaternion formed by + * [0, 0, 1] and 270. This method favors the latter. + * @category Static + * + * @param out_axis - Vector receiving the axis of rotation + * @param q - Quaternion to be decomposed + * @return Angle, in radians, of the rotation + */ + static getAxisAngle(out_axis, q) { + const rad = Math.acos(q[3]) * 2; + const s = Math.sin(rad / 2); + if (s > GLM_EPSILON) { + out_axis[0] = q[0] / s; + out_axis[1] = q[1] / s; + out_axis[2] = q[2] / s; + } else { + out_axis[0] = 1; + out_axis[1] = 0; + out_axis[2] = 0; + } + return rad; + } + /** + * Gets the angular distance between two unit quaternions + * @category Static + * + * @param {ReadonlyQuat} a Origin unit quaternion + * @param {ReadonlyQuat} b Destination unit quaternion + * @return {Number} Angle, in radians, between the two quaternions + */ + static getAngle(a, b) { + const dotproduct = _Quat.dot(a, b); + return Math.acos(2 * dotproduct * dotproduct - 1); + } + /** + * Multiplies two quaternions. + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out, a, b) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bx = b[0]; + const by = b[1]; + const bz = b[2]; + const bw = b[3]; + out[0] = ax * bw + aw * bx + ay * bz - az * by; + out[1] = ay * bw + aw * by + az * bx - ax * bz; + out[2] = az * bw + aw * bz + ax * by - ay * bx; + out[3] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + /** + * Rotates a quaternion by the given angle about the X axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out, a, rad) { + rad *= 0.5; + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bx = Math.sin(rad); + const bw = Math.cos(rad); + out[0] = ax * bw + aw * bx; + out[1] = ay * bw + az * bx; + out[2] = az * bw - ay * bx; + out[3] = aw * bw - ax * bx; + return out; + } + /** + * Rotates a quaternion by the given angle about the Y axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out, a, rad) { + rad *= 0.5; + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const by = Math.sin(rad); + const bw = Math.cos(rad); + out[0] = ax * bw - az * by; + out[1] = ay * bw + aw * by; + out[2] = az * bw + ax * by; + out[3] = aw * bw - ay * by; + return out; + } + /** + * Rotates a quaternion by the given angle about the Z axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out, a, rad) { + rad *= 0.5; + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bz = Math.sin(rad); + const bw = Math.cos(rad); + out[0] = ax * bw + ay * bz; + out[1] = ay * bw - ax * bz; + out[2] = az * bw + aw * bz; + out[3] = aw * bw - az * bz; + return out; + } + /** + * Calculates the W component of a quat from the X, Y, and Z components. + * Assumes that quaternion is 1 unit in length. + * Any existing W component will be ignored. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate W component of + * @returns `out` + */ + static calculateW(out, a) { + const x = a[0], y = a[1], z = a[2]; + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = Math.sqrt(Math.abs(1 - x * x - y * y - z * z)); + return out; + } + /** + * Calculate the exponential of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static exp(out, a) { + const x = a[0], y = a[1], z = a[2], w = a[3]; + const r = Math.sqrt(x * x + y * y + z * z); + const et = Math.exp(w); + const s = r > 0 ? et * Math.sin(r) / r : 0; + out[0] = x * s; + out[1] = y * s; + out[2] = z * s; + out[3] = et * Math.cos(r); + return out; + } + /** + * Calculate the natural logarithm of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static ln(out, a) { + const x = a[0], y = a[1], z = a[2], w = a[3]; + const r = Math.sqrt(x * x + y * y + z * z); + const t = r > 0 ? Math.atan2(r, w) / r : 0; + out[0] = x * t; + out[1] = y * t; + out[2] = z * t; + out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w); + return out; + } + /** + * Calculate the scalar power of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @param b - amount to scale the quaternion by + * @returns `out` + */ + static pow(out, a, b) { + _Quat.ln(out, a); + _Quat.scale(out, out, b); + _Quat.exp(out, out); + return out; + } + /** + * Performs a spherical linear interpolation between two quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out, a, b, t) { + const ax = a[0], ay = a[1], az = a[2], aw = a[3]; + let bx = b[0], by = b[1], bz = b[2], bw = b[3]; + let scale0; + let scale1; + let cosom = ax * bx + ay * by + az * bz + aw * bw; + if (cosom < 0) { + cosom = -cosom; + bx = -bx; + by = -by; + bz = -bz; + bw = -bw; + } + if (1 - cosom > GLM_EPSILON) { + const omega = Math.acos(cosom); + const sinom = Math.sin(omega); + scale0 = Math.sin((1 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; + } else { + scale0 = 1 - t; + scale1 = t; + } + out[0] = scale0 * ax + scale1 * bx; + out[1] = scale0 * ay + scale1 * by; + out[2] = scale0 * az + scale1 * bz; + out[3] = scale0 * aw + scale1 * bw; + return out; + } + /** + * Generates a random unit quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + /* static random(out: QuatLike): QuatLike { + // Implementation of http://planning.cs.uiuc.edu/node198.html + // TODO: Calling random 3 times is probably not the fastest solution + let u1 = glMatrix.RANDOM(); + let u2 = glMatrix.RANDOM(); + let u3 = glMatrix.RANDOM(); + + let sqrt1MinusU1 = Math.sqrt(1 - u1); + let sqrtU1 = Math.sqrt(u1); + + out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2); + out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2); + out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3); + out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3); + return out; + }*/ + /** + * Calculates the inverse of a quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate inverse of + * @returns `out` + */ + static invert(out, a) { + const a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; + const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; + const invDot = dot ? 1 / dot : 0; + out[0] = -a0 * invDot; + out[1] = -a1 * invDot; + out[2] = -a2 * invDot; + out[3] = a3 * invDot; + return out; + } + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate conjugate of + * @returns `out` + */ + static conjugate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + return out; + } + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to re-normalize the quaternion yourself where necessary. + * @category Static + * + * @param out - the receiving quaternion + * @param m - rotation matrix + * @returns `out` + */ + static fromMat3(out, m) { + const fTrace = m[0] + m[4] + m[8]; + let fRoot; + if (fTrace > 0) { + fRoot = Math.sqrt(fTrace + 1); + out[3] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[0] = (m[5] - m[7]) * fRoot; + out[1] = (m[6] - m[2]) * fRoot; + out[2] = (m[1] - m[3]) * fRoot; + } else { + let i = 0; + if (m[4] > m[0]) { + i = 1; + } + if (m[8] > m[i * 3 + i]) { + i = 2; + } + const j = (i + 1) % 3; + const k = (i + 2) % 3; + fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1); + out[i] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot; + out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; + out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + } + return out; + } + /** + * Creates a quaternion from the given euler angle x, y, z. + * @category Static + * + * @param out - the receiving quaternion + * @param x - Angle to rotate around X axis in degrees. + * @param y - Angle to rotate around Y axis in degrees. + * @param z - Angle to rotate around Z axis in degrees. + * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx. + * @returns `out` + */ + static fromEuler(out, x, y, z, order = _Quat.#DEFAULT_ANGLE_ORDER) { + const halfToRad = 0.5 * Math.PI / 180; + x *= halfToRad; + y *= halfToRad; + z *= halfToRad; + const sx = Math.sin(x); + const cx = Math.cos(x); + const sy = Math.sin(y); + const cy = Math.cos(y); + const sz = Math.sin(z); + const cz = Math.cos(z); + switch (order) { + case "xyz": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "xzy": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + case "yxz": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + case "yzx": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "zxy": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "zyx": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + default: + throw new Error(`Unknown angle order ${order}`); + } + return out; + } + /** + * Returns a string representation of a quatenion + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Quat(${a.join(", ")})`; + } + /** + * Creates a new quat initialized with values from an existing quaternion + * @category Static + * + * @param a - quaternion to clone + * @returns a new quaternion + */ + static clone(a) { + return new _Quat(a); + } + /** + * Creates a new quat initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new quaternion + */ + static fromValues(x, y, z, w) { + return new _Quat(x, y, z, w); + } + /** + * Copy the values from one quat to another + * @category Static + * + * @param out - the receiving quaternion + * @param a - the source quaternion + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Quat} to the given values + * @category Static + * + * @param out - the receiving quaternion + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static set(out, x, y, z, w) { + return out; + } + /** + * Adds two {@link Quat}'s + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static add(out, a, b) { + return out; + } + /** + * Alias for {@link Quat.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Scales a quat by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param b - amount to scale the vector by + * @returns `out` + */ + static scale(out, a, scale) { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + out[3] = a[3] * scale; + return out; + } + /** + * Calculates the dot product of two quat's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + /** + * Performs a linear interpolation between two quat's + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static lerp(out, a, b, t) { + return out; + } + /** + * Calculates the magnitude (length) of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate length of + * @returns length of `a` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static magnitude(a) { + return 0; + } + /** + * Alias for {@link Quat.magnitude} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mag(a) { + return 0; + } + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate squared length of + * @returns squared length of a + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static squaredLength(a) { + return 0; + } + /** + * Alias for {@link Quat.squaredLength} + * @category Static + */ + static sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Normalize a {@link Quat} + * @category Static + * + * @param out - the receiving quaternion + * @param a - quaternion to normalize + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static normalize(out, a) { + return out; + } + /** + * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first quaternion. + * @param b - The second quaternion. + * @returns True if the vectors are equal, false otherwise. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static exactEquals(a, b) { + return false; + } + /** + * Returns whether the quaternions have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static equals(a, b) { + return false; + } + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * @category Static + * + * @param out - the receiving quaternion. + * @param a - the initial vector + * @param b - the destination vector + * @returns `out` + */ + static rotationTo(out, a, b) { + const dot = Vec3.dot(a, b); + if (dot < -0.999999) { + Vec3.cross(_Quat.#TMP_VEC3, _Quat.#X_UNIT_VEC3, a); + if (Vec3.mag(_Quat.#TMP_VEC3) < 1e-6) { + Vec3.cross(_Quat.#TMP_VEC3, _Quat.#Y_UNIT_VEC3, a); + } + Vec3.normalize(_Quat.#TMP_VEC3, _Quat.#TMP_VEC3); + _Quat.setAxisAngle(out, _Quat.#TMP_VEC3, Math.PI); + return out; + } else if (dot > 0.999999) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } else { + Vec3.cross(_Quat.#TMP_VEC3, a, b); + out[0] = _Quat.#TMP_VEC3[0]; + out[1] = _Quat.#TMP_VEC3[1]; + out[2] = _Quat.#TMP_VEC3[2]; + out[3] = 1 + dot; + return _Quat.normalize(out, out); + } + } + /** + * Performs a spherical linear interpolation with two control points + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static sqlerp(out, a, b, c, d, t) { + _Quat.slerp(_Quat.#TMP_QUAT1, a, d, t); + _Quat.slerp(_Quat.#TMP_QUAT2, b, c, t); + _Quat.slerp(out, _Quat.#TMP_QUAT1, _Quat.#TMP_QUAT2, 2 * t * (1 - t)); + return out; + } + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * @category Static + * + * @param out - The receiving quaternion + * @param view - the vector representing the viewing direction + * @param right - the vector representing the local `right` direction + * @param up - the vector representing the local `up` direction + * @returns `out` + */ + static setAxes(out, view, right, up) { + _Quat.#TMP_MAT3[0] = right[0]; + _Quat.#TMP_MAT3[3] = right[1]; + _Quat.#TMP_MAT3[6] = right[2]; + _Quat.#TMP_MAT3[1] = up[0]; + _Quat.#TMP_MAT3[4] = up[1]; + _Quat.#TMP_MAT3[7] = up[2]; + _Quat.#TMP_MAT3[2] = -view[0]; + _Quat.#TMP_MAT3[5] = -view[1]; + _Quat.#TMP_MAT3[8] = -view[2]; + return _Quat.normalize(out, _Quat.fromMat3(out, _Quat.#TMP_MAT3)); + } +}; +Quat.set = Vec4.set; +Quat.add = Vec4.add; +Quat.lerp = Vec4.lerp; +Quat.normalize = Vec4.normalize; +Quat.squaredLength = Vec4.squaredLength; +Quat.sqrLen = Vec4.squaredLength; +Quat.exactEquals = Vec4.exactEquals; +Quat.equals = Vec4.equals; +Quat.magnitude = Vec4.magnitude; +Quat.prototype.mul = Quat.prototype.multiply; +Quat.mul = Quat.multiply; +Quat.mag = Quat.magnitude; +Quat.length = Quat.magnitude; +Quat.len = Quat.magnitude; + +// src/_lib/f32/Quat2.ts +var Quat2 = class _Quat2 extends Float32Array { + // Temporary variables to prevent repeated allocations in the algorithms within Quat2. + // These are declared as TypedArrays to aid in tree-shaking. + static #TMP_QUAT = new Float32Array(4); + static #TMP_VEC3 = new Float32Array(3); + /** + * Create a {@link Quat2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 8: + super(values); + break; + case 2: + super(values[0], values[1], 8); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v, v, v, v, v, v]); + } else { + super(v, 0, 8); + } + break; + } + default: + super(8); + this[3] = 1; + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Quat2.str(this);` + * + * @category Accessors + */ + get str() { + return _Quat2.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Quat2} into `this`. + * @category Methods + * + * @param a the source dual quaternion + * @returns `this` + */ + copy(a) { + super.set(a); + return this; + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat2}. + */ + static get BYTE_LENGTH() { + return 8 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new identity {@link Quat2} + * @category Static + * + * @returns a new dual quaternion [real -> rotation, dual -> translation] + */ + static create() { + return new _Quat2(); + } + /** + * Creates a {@link Quat2} quat initialized with values from an existing quaternion + * @category Static + * + * @param a - dual quaternion to clone + * @returns a new dual quaternion + */ + static clone(a) { + return new _Quat2(a); + } + /** + * Creates a new {@link Quat2} initialized with the given values + * @category Static + * + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns a new dual quaternion + */ + static fromValues(x1, y1, z1, w1, x2, y2, z2, w2) { + return new _Quat2(x1, y1, z1, w1, x2, y2, z2, w2); + } + /** + * Creates a new {@link Quat2} from the given values (quat and translation) + * @category Static + * + * @param x1 - X component (rotation) + * @param y1 - Y component (rotation) + * @param z1 - Z component (rotation) + * @param w1 - W component (rotation) + * @param x2 - X component (translation) + * @param y2 - Y component (translation) + * @param z2 - Z component (translation) + * @returns a new dual quaternion + */ + static fromRotationTranslationValues(x1, y1, z1, w1, x2, y2, z2) { + const ax = x2 * 0.5; + const ay = y2 * 0.5; + const az = z2 * 0.5; + return new _Quat2( + x1, + y1, + z1, + w1, + ax * w1 + ay * z1 - az * y1, + ay * w1 + az * x1 - ax * z1, + az * w1 + ax * y1 - ay * x1, + -ax * x1 - ay * y1 - az * z1 + ); + } + /** + * Sets a {@link Quat2} from a quaternion and a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @param t - translation vector + * @returns `out` + */ + static fromRotationTranslation(out, q, t) { + const ax = t[0] * 0.5; + const ay = t[1] * 0.5; + const az = t[2] * 0.5; + const bx = q[0]; + const by = q[1]; + const bz = q[2]; + const bw = q[3]; + out[0] = bx; + out[1] = by; + out[2] = bz; + out[3] = bw; + out[4] = ax * bw + ay * bz - az * by; + out[5] = ay * bw + az * bx - ax * bz; + out[6] = az * bw + ax * by - ay * bx; + out[7] = -ax * bx - ay * by - az * bz; + return out; + } + /** + * Sets a {@link Quat2} from a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param t - translation vector + * @returns `out` + */ + static fromTranslation(out, t) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = t[0] * 0.5; + out[5] = t[1] * 0.5; + out[6] = t[2] * 0.5; + out[7] = 0; + return out; + } + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @returns `out` + */ + static fromRotation(out, q) { + out[0] = q[0]; + out[1] = q[1]; + out[2] = q[2]; + out[3] = q[3]; + out[4] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + return out; + } + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param a - the matrix + * @returns `out` + */ + static fromMat4(out, a) { + Mat4.getRotation(_Quat2.#TMP_QUAT, a); + Mat4.getTranslation(_Quat2.#TMP_VEC3, a); + return _Quat2.fromRotationTranslation(out, _Quat2.#TMP_QUAT, _Quat2.#TMP_VEC3); + } + /** + * Copy the values from one {@link Quat2} to another + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the source dual quaternion + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + return out; + } + /** + * Set a {@link Quat2} to the identity dual quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @returns `out` + */ + static identity(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + return out; + } + /** + * Set the components of a {@link Quat2} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns `out` + */ + static set(out, x1, y1, z1, w1, x2, y2, z2, w2) { + out[0] = x1; + out[1] = y1; + out[2] = z1; + out[3] = w1; + out[4] = x2; + out[5] = y2; + out[6] = z2; + out[7] = w2; + return out; + } + /** + * Gets the real part of a dual quat + * @category Static + * + * @param out - real part + * @param a - Dual Quaternion + * @return `out` + */ + static getReal(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Gets the dual part of a dual quat + * @category Static + * + * @param out - dual part + * @param a - Dual Quaternion + * @return `out` + */ + static getDual(out, a) { + out[0] = a[4]; + out[1] = a[5]; + out[2] = a[6]; + out[3] = a[7]; + return out; + } + /** + * Set the real component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the real part + * @return `out` + */ + static setReal(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the dual component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the dual part + * @return `out` + */ + static setDual(out, a) { + out[4] = a[0]; + out[5] = a[1]; + out[6] = a[2]; + out[7] = a[3]; + return out; + } + /** + * Gets the translation of a normalized {@link Quat2} + * @category Static + * + * @param out - the receiving translation vector + * @param a - Dual Quaternion to be decomposed + * @return `out` + */ + static getTranslation(out, a) { + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const bx = -a[0]; + const by = -a[1]; + const bz = -a[2]; + const bw = a[3]; + out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; + out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; + out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + return out; + } + /** + * Translates a {@link Quat2} by the given vector + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const ax1 = a[0]; + const ay1 = a[1]; + const az1 = a[2]; + const aw1 = a[3]; + const bx1 = v[0] * 0.5; + const by1 = v[1] * 0.5; + const bz1 = v[2] * 0.5; + const ax2 = a[4]; + const ay2 = a[5]; + const az2 = a[6]; + const aw2 = a[7]; + out[0] = ax1; + out[1] = ay1; + out[2] = az1; + out[3] = aw1; + out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2; + out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2; + out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2; + out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2; + return out; + } + /** + * Rotates a {@link Quat2} around the X axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out, a, rad) { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateX(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} around the Y axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out, a, rad) { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateY(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} around the Z axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out, a, rad) { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateZ(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} by a given quaternion (a * q) + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param q - quaternion to rotate by + * @returns `out` + */ + static rotateByQuatAppend(out, a, q) { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + let ax = a[0]; + let ay = a[1]; + let az = a[2]; + let aw = a[3]; + out[0] = ax * qw + aw * qx + ay * qz - az * qy; + out[1] = ay * qw + aw * qy + az * qx - ax * qz; + out[2] = az * qw + aw * qz + ax * qy - ay * qx; + out[3] = aw * qw - ax * qx - ay * qy - az * qz; + ax = a[4]; + ay = a[5]; + az = a[6]; + aw = a[7]; + out[4] = ax * qw + aw * qx + ay * qz - az * qy; + out[5] = ay * qw + aw * qy + az * qx - ax * qz; + out[6] = az * qw + aw * qz + ax * qy - ay * qx; + out[7] = aw * qw - ax * qx - ay * qy - az * qz; + return out; + } + /** + * Rotates a {@link Quat2} by a given quaternion (q * a) + * @category Static + * + * @param out - the receiving dual quaternion + * @param q - quaternion to rotate by + * @param a - the dual quaternion to rotate + * @returns `out` + */ + static rotateByQuatPrepend(out, q, a) { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + let bx = a[0]; + let by = a[1]; + let bz = a[2]; + let bw = a[3]; + out[0] = qx * bw + qw * bx + qy * bz - qz * by; + out[1] = qy * bw + qw * by + qz * bx - qx * bz; + out[2] = qz * bw + qw * bz + qx * by - qy * bx; + out[3] = qw * bw - qx * bx - qy * by - qz * bz; + bx = a[4]; + by = a[5]; + bz = a[6]; + bw = a[7]; + out[4] = qx * bw + qw * bx + qy * bz - qz * by; + out[5] = qy * bw + qw * by + qz * bx - qx * bz; + out[6] = qz * bw + qw * bz + qx * by - qy * bx; + out[7] = qw * bw - qx * bx - qy * by - qz * bz; + return out; + } + /** + * Rotates a {@link Quat2} around a given axis. Does the normalization automatically + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param axis - the axis to rotate around + * @param rad - how far the rotation should be + * @returns `out` + */ + static rotateAroundAxis(out, a, axis, rad) { + if (Math.abs(rad) < GLM_EPSILON) { + return _Quat2.copy(out, a); + } + const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]); + rad *= 0.5; + const s = Math.sin(rad); + const bx = s * axis[0] / axisLength; + const by = s * axis[1] / axisLength; + const bz = s * axis[2] / axisLength; + const bw = Math.cos(rad); + const ax1 = a[0]; + const ay1 = a[1]; + const az1 = a[2]; + const aw1 = a[3]; + out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + out[4] = ax * bw + aw * bx + ay * bz - az * by; + out[5] = ay * bw + aw * by + az * bx - ax * bz; + out[6] = az * bw + aw * bz + ax * by - ay * bx; + out[7] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + /** + * Adds two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + return out; + } + /** + * Multiplies two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns {quat2} out + */ + static multiply(out, a, b) { + const ax0 = a[0]; + const ay0 = a[1]; + const az0 = a[2]; + const aw0 = a[3]; + const bx1 = b[4]; + const by1 = b[5]; + const bz1 = b[6]; + const bw1 = b[7]; + const ax1 = a[4]; + const ay1 = a[5]; + const az1 = a[6]; + const aw1 = a[7]; + const bx0 = b[0]; + const by0 = b[1]; + const bz0 = b[2]; + const bw0 = b[3]; + out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0; + out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0; + out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0; + out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0; + out[4] = ax0 * bw1 + aw0 * bx1 + ay0 * bz1 - az0 * by1 + ax1 * bw0 + aw1 * bx0 + ay1 * bz0 - az1 * by0; + out[5] = ay0 * bw1 + aw0 * by1 + az0 * bx1 - ax0 * bz1 + ay1 * bw0 + aw1 * by0 + az1 * bx0 - ax1 * bz0; + out[6] = az0 * bw1 + aw0 * bz1 + ax0 * by1 - ay0 * bx1 + az1 * bw0 + aw1 * bz0 + ax1 * by0 - ay1 * bx0; + out[7] = aw0 * bw1 - ax0 * bx1 - ay0 * by1 - az0 * bz1 + aw1 * bw0 - ax1 * bx0 - ay1 * by0 - az1 * bz0; + return out; + } + /** + * Alias for {@link Quat2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Scales a {@link Quat2} by a scalar value + * @category Static + * + * @param out - the receiving dual quaterion + * @param a - the dual quaternion to scale + * @param b - scalar value to scale the dual quaterion by + * @returns `out` + */ + static scale(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + return out; + } + /** + * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts) + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dot(a, b) { + return 0; + } + /** + * Performs a linear interpolation between two {@link Quat2}s + * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`) + * @category Static + * + * @param out - the receiving dual quat + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const mt = 1 - t; + if (_Quat2.dot(a, b) < 0) { + t = -t; + } + out[0] = a[0] * mt + b[0] * t; + out[1] = a[1] * mt + b[1] * t; + out[2] = a[2] * mt + b[2] * t; + out[3] = a[3] * mt + b[3] * t; + out[4] = a[4] * mt + b[4] * t; + out[5] = a[5] * mt + b[5] * t; + out[6] = a[6] * mt + b[6] * t; + out[7] = a[7] * mt + b[7] * t; + return out; + } + /** + * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quat to calculate inverse of + * @returns `out` + */ + static invert(out, a) { + const sqlen = _Quat2.squaredLength(a); + out[0] = -a[0] / sqlen; + out[1] = -a[1] / sqlen; + out[2] = -a[2] / sqlen; + out[3] = a[3] / sqlen; + out[4] = -a[4] / sqlen; + out[5] = -a[5] / sqlen; + out[6] = -a[6] / sqlen; + out[7] = a[7] / sqlen; + return out; + } + /** + * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than + * {@link Quat2.invert} and produces the same result. + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to calculate conjugate of + * @returns `out` + */ + static conjugate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + out[4] = -a[4]; + out[5] = -a[5]; + out[6] = -a[6]; + out[7] = a[7]; + return out; + } + /** + * Calculates the magnitude (length) of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate length of + * @returns length of `a` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static magnitude(a) { + return 0; + } + /** + * Alias for {@link Quat2.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate squared length of + * @returns squared length of a + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static squaredLength(a) { + return 0; + } + /** + * Alias for {@link Quat2.squaredLength} + * @category Static + */ + static sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Normalize a {@link Quat2} + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to normalize + * @returns `out` + */ + static normalize(out, a) { + let magnitude = _Quat2.squaredLength(a); + if (magnitude > 0) { + magnitude = Math.sqrt(magnitude); + const a0 = a[0] / magnitude; + const a1 = a[1] / magnitude; + const a2 = a[2] / magnitude; + const a3 = a[3] / magnitude; + const b0 = a[4]; + const b1 = a[5]; + const b2 = a[6]; + const b3 = a[7]; + const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3; + out[0] = a0; + out[1] = a1; + out[2] = a2; + out[3] = a3; + out[4] = (b0 - a0 * a_dot_b) / magnitude; + out[5] = (b1 - a1 * a_dot_b) / magnitude; + out[6] = (b2 - a2 * a_dot_b) / magnitude; + out[7] = (b3 - a3 * a_dot_b) / magnitude; + } + return out; + } + /** + * Returns a string representation of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Quat2(${a.join(", ")})`; + } + /** + * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7]; + } + /** + * Returns whether the {@link Quat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)); + } +}; +Quat2.dot = Quat.dot; +Quat2.squaredLength = Quat.squaredLength; +Quat2.sqrLen = Quat.squaredLength; +Quat2.mag = Quat.magnitude; +Quat2.length = Quat.magnitude; +Quat2.len = Quat.magnitude; +Quat2.mul = Quat2.multiply; + +// src/_lib/f32/Vec2.ts +var Vec2 = class _Vec2 extends Float32Array { + /** + * Create a {@link Vec2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 2: { + const v = values[0]; + if (typeof v === "number") { + super([v, values[1]]); + } else { + super(v, values[1], 2); + } + break; + } + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v]); + } else { + super(v, 0, 2); + } + break; + } + default: + super(2); + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r() { + return this[0]; + } + set r(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g() { + return this[1]; + } + set g(value) { + this[1] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec2.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + return Math.hypot(this[0], this[1]); + } + /** + * Alias for {@link Vec2.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec2.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude() { + const x = this[0]; + const y = this[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag() { + return this.squaredMagnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec2.str(this);` + * + * @category Accessors + */ + get str() { + return _Vec2.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec2} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + // Instead of zero(), use a.fill(0) for instances; + /** + * Adds a {@link Vec2} to `this`. + * Equivalent to `Vec2.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b) { + this[0] += b[0]; + this[1] += b[1]; + return this; + } + /** + * Subtracts a {@link Vec2} from `this`. + * Equivalent to `Vec2.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + return this; + } + /** + * Alias for {@link Vec2.subtract} + * @category Methods + */ + sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec2}. + * Equivalent to `Vec2.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + return this; + } + /** + * Alias for {@link Vec2.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec2}. + * Equivalent to `Vec2.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + return this; + } + /** + * Alias for {@link Vec2.divide} + * @category Methods + */ + div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec2.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b) { + this[0] *= b; + this[1] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b) { + return _Vec2.distance(this, b); + } + /** + * Alias for {@link Vec2.distance} + * @category Methods + */ + dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b) { + return _Vec2.squaredDistance(this, b); + } + /** + * Alias for {@link Vec2.squaredDistance} + * @category Methods + */ + sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec2.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate() { + this[0] *= -1; + this[1] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec2.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + return this; + } + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec2.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec2}. + * Equivalent to `Vec2.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b) { + return this[0] * b[0] + this[1] * b[1]; + } + /** + * Normalize `this`. + * Equivalent to `Vec2.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize() { + return _Vec2.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec2}. + */ + static get BYTE_LENGTH() { + return 2 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty {@link Vec2} + * @category Static + * + * @returns A new 2D vector + */ + static create() { + return new _Vec2(); + } + /** + * Creates a new {@link Vec2} initialized with values from an existing vector + * @category Static + * + * @param a - Vector to clone + * @returns A new 2D vector + */ + static clone(a) { + return new _Vec2(a); + } + /** + * Creates a new {@link Vec2} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @returns A new 2D vector + */ + static fromValues(x, y) { + return new _Vec2(x, y); + } + /** + * Copy the values from one {@link Vec2} to another + * @category Static + * + * @param out - the receiving vector + * @param a - The source vector + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + return out; + } + /** + * Set the components of a {@link Vec2} to the given values + * @category Static + * + * @param out - The receiving vector + * @param x - X component + * @param y - Y component + * @returns `out` + */ + static set(out, x, y) { + out[0] = x; + out[1] = y; + return out; + } + /** + * Adds two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + return out; + } + /** + * Alias for {@link Vec2.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return [0, 0]; + } + /** + * Multiplies two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + return out; + } + /** + * Alias for {@link Vec2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return [0, 0]; + } + /** + * Divides two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + return out; + } + /** + * Alias for {@link Vec2.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out, a, b) { + return [0, 0]; + } + /** + * Math.ceil the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to ceil + * @returns `out` + */ + static ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + return out; + } + /** + * Math.floor the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to floor + * @returns `out` + */ + static floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + return out; + } + /** + * Returns the minimum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + return out; + } + /** + * Returns the maximum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + return out; + } + /** + * Math.round the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to round + * @returns `out` + */ + static round(out, a) { + out[0] = Math.round(a[0]); + out[1] = Math.round(a[1]); + return out; + } + /** + * Scales a {@link Vec2} by a scalar number + * @category Static + * + * @param out - The receiving vector + * @param a - The vector to scale + * @param b - Amount to scale the vector by + * @returns `out` + */ + static scale(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + return out; + } + /** + * Adds two Vec2's after scaling the second operand by a scalar value + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param scale - The amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns distance between `a` and `b` + */ + static distance(a, b) { + return Math.hypot(b[0] - a[0], b[1] - a[1]); + } + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Squared distance between `a` and `b` + */ + static squaredDistance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a, b) { + return 0; + } + /** + * Calculates the magnitude (length) of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a) { + const x = a[0]; + const y = a[1]; + return Math.sqrt(x * x + y * y); + } + /** + * Alias for {@link Vec2.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate squared length of + * @returns Squared length of a + */ + static squaredLength(a) { + const x = a[0]; + const y = a[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.squaredLength} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrLen(a, b) { + return 0; + } + /** + * Negates the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to negate + * @returns `out` + */ + static negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + return out; + } + /** + * Returns the inverse of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to invert + * @returns `out` + */ + static inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + return out; + } + /** + * Normalize a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to normalize + * @returns `out` + */ + static normalize(out, a) { + const x = a[0]; + const y = a[1]; + let len = x * x + y * y; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + return out; + } + /** + * Calculates the dot product of two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Dot product of `a` and `b` + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1]; + } + /** + * Computes the cross product of two {@link Vec2}s + * Note that the cross product must by definition produce a 3D vector. + * For this reason there is also not instance equivalent for this function. + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static cross(out, a, b) { + const z = a[0] * b[1] - a[1] * b[0]; + out[0] = out[1] = 0; + out[2] = z; + return out; + } + /** + * Performs a linear interpolation between two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param t - Interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const ax = a[0]; + const ay = a[1]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat2} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[2] * y; + out[1] = m[1] * x + m[3] * y; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat2d} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2d(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[2] * y + m[4]; + out[1] = m[1] * x + m[3] * y + m[5]; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat3} + * 3rd vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat3(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[3] * y + m[6]; + out[1] = m[1] * x + m[4] * y + m[7]; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat4} + * 3rd vector component is implicitly '0' + * 4th vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat4(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[4] * y + m[12]; + out[1] = m[1] * x + m[5] * y + m[13]; + return out; + } + /** + * Rotate a 2D vector + * @category Static + * + * @param out - The receiving {@link Vec2} + * @param a - The {@link Vec2} point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotate(out, a, b, rad) { + const p0 = a[0] - b[0]; + const p1 = a[1] - b[1]; + const sinC = Math.sin(rad); + const cosC = Math.cos(rad); + out[0] = p0 * cosC - p1 * sinC + b[0]; + out[1] = p0 * sinC + p1 * cosC + b[1]; + return out; + } + /** + * Get the angle between two 2D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static angle(a, b) { + const x1 = a[0]; + const y1 = a[1]; + const x2 = b[0]; + const y2 = b[1]; + const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2); + const cosine = mag && (x1 * x2 + y1 * y2) / mag; + return Math.acos(Math.min(Math.max(cosine, -1), 1)); + } + /** + * Set the components of a {@link Vec2} to zero + * @category Static + * + * @param out - The receiving vector + * @returns `out` + */ + static zero(out) { + out[0] = 0; + out[1] = 0; + return out; + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors components are ===, `false` otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors are approximately equal, `false` otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const b0 = b[0]; + const b1 = b[1]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)); + } + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - Vector to represent as a string + * @returns String representation of the vector + */ + static str(a) { + return `Vec2(${a.join(", ")})`; + } +}; +Vec2.prototype.sub = Vec2.prototype.subtract; +Vec2.prototype.mul = Vec2.prototype.multiply; +Vec2.prototype.div = Vec2.prototype.divide; +Vec2.prototype.dist = Vec2.prototype.distance; +Vec2.prototype.sqrDist = Vec2.prototype.squaredDistance; +Vec2.sub = Vec2.subtract; +Vec2.mul = Vec2.multiply; +Vec2.div = Vec2.divide; +Vec2.dist = Vec2.distance; +Vec2.sqrDist = Vec2.squaredDistance; +Vec2.sqrLen = Vec2.squaredLength; +Vec2.mag = Vec2.magnitude; +Vec2.length = Vec2.magnitude; +Vec2.len = Vec2.magnitude; + +// src/swizzle/index.ts +var GLM_SWIZZLES_ENABLED_F32 = false; +function EnableSwizzles() { + if (GLM_SWIZZLES_ENABLED_F32) { + return; + } + const VEC2_SWIZZLES = ["xx", "xy", "yx", "yy", "xxx", "xxy", "xyx", "xyy", "yxx", "yxy", "yyx", "yyy", "xxxx", "xxxy", "xxyx", "xxyy", "xyxx", "xyxy", "xyyx", "xyyy", "yxxx", "yxxy", "yxyx", "yxyy", "yyxx", "yyxy", "yyyx", "yyyy", "rr", "rg", "gr", "gg", "rrr", "rrg", "rgr", "rgg", "grr", "grg", "ggr", "ggg", "rrrr", "rrrg", "rrgr", "rrgg", "rgrr", "rgrg", "rggr", "rggg", "grrr", "grrg", "grgr", "grgg", "ggrr", "ggrg", "gggr", "gggg"]; + const VEC3_SWIZZLES = ["xz", "yz", "zx", "zy", "zz", "xxz", "xyz", "xzx", "xzy", "xzz", "yxz", "yyz", "yzx", "yzy", "yzz", "zxx", "zxy", "zxz", "zyx", "zyy", "zyz", "zzx", "zzy", "zzz", "xxxz", "xxyz", "xxzx", "xxzy", "xxzz", "xyxz", "xyyz", "xyzx", "xyzy", "xyzz", "xzxx", "xzxy", "xzxz", "xzyx", "xzyy", "xzyz", "xzzx", "xzzy", "xzzz", "yxxz", "yxyz", "yxzx", "yxzy", "yxzz", "yyxz", "yyyz", "yyzx", "yyzy", "yyzz", "yzxx", "yzxy", "yzxz", "yzyx", "yzyy", "yzyz", "yzzx", "yzzy", "yzzz", "zxxx", "zxxy", "zxxz", "zxyx", "zxyy", "zxyz", "zxzx", "zxzy", "zxzz", "zyxx", "zyxy", "zyxz", "zyyx", "zyyy", "zyyz", "zyzx", "zyzy", "zyzz", "zzxx", "zzxy", "zzxz", "zzyx", "zzyy", "zzyz", "zzzx", "zzzy", "zzzz", "rb", "gb", "br", "bg", "bb", "rrb", "rgb", "rbr", "rbg", "rbb", "grb", "ggb", "gbr", "gbg", "gbb", "brr", "brg", "brb", "bgr", "bgg", "bgb", "bbr", "bbg", "bbb", "rrrb", "rrgb", "rrbr", "rrbg", "rrbb", "rgrb", "rggb", "rgbr", "rgbg", "rgbb", "rbrr", "rbrg", "rbrb", "rbgr", "rbgg", "rbgb", "rbbr", "rbbg", "rbbb", "grrb", "grgb", "grbr", "grbg", "grbb", "ggrb", "gggb", "ggbr", "ggbg", "ggbb", "gbrr", "gbrg", "gbrb", "gbgr", "gbgg", "gbgb", "gbbr", "gbbg", "gbbb", "brrr", "brrg", "brrb", "brgr", "brgg", "brgb", "brbr", "brbg", "brbb", "bgrr", "bgrg", "bgrb", "bggr", "bggg", "bggb", "bgbr", "bgbg", "bgbb", "bbrr", "bbrg", "bbrb", "bbgr", "bbgg", "bbgb", "bbbr", "bbbg", "bbbb"]; + const VEC4_SWIZZLES = ["xw", "yw", "zw", "wx", "wy", "wz", "ww", "xxw", "xyw", "xzw", "xwx", "xwy", "xwz", "xww", "yxw", "yyw", "yzw", "ywx", "ywy", "ywz", "yww", "zxw", "zyw", "zzw", "zwx", "zwy", "zwz", "zww", "wxx", "wxy", "wxz", "wxw", "wyx", "wyy", "wyz", "wyw", "wzx", "wzy", "wzz", "wzw", "wwx", "wwy", "wwz", "www", "xxxw", "xxyw", "xxzw", "xxwx", "xxwy", "xxwz", "xxww", "xyxw", "xyyw", "xyzw", "xywx", "xywy", "xywz", "xyww", "xzxw", "xzyw", "xzzw", "xzwx", "xzwy", "xzwz", "xzww", "xwxx", "xwxy", "xwxz", "xwxw", "xwyx", "xwyy", "xwyz", "xwyw", "xwzx", "xwzy", "xwzz", "xwzw", "xwwx", "xwwy", "xwwz", "xwww", "yxxw", "yxyw", "yxzw", "yxwx", "yxwy", "yxwz", "yxww", "yyxw", "yyyw", "yyzw", "yywx", "yywy", "yywz", "yyww", "yzxw", "yzyw", "yzzw", "yzwx", "yzwy", "yzwz", "yzww", "ywxx", "ywxy", "ywxz", "ywxw", "ywyx", "ywyy", "ywyz", "ywyw", "ywzx", "ywzy", "ywzz", "ywzw", "ywwx", "ywwy", "ywwz", "ywww", "zxxw", "zxyw", "zxzw", "zxwx", "zxwy", "zxwz", "zxww", "zyxw", "zyyw", "zyzw", "zywx", "zywy", "zywz", "zyww", "zzxw", "zzyw", "zzzw", "zzwx", "zzwy", "zzwz", "zzww", "zwxx", "zwxy", "zwxz", "zwxw", "zwyx", "zwyy", "zwyz", "zwyw", "zwzx", "zwzy", "zwzz", "zwzw", "zwwx", "zwwy", "zwwz", "zwww", "wxxx", "wxxy", "wxxz", "wxxw", "wxyx", "wxyy", "wxyz", "wxyw", "wxzx", "wxzy", "wxzz", "wxzw", "wxwx", "wxwy", "wxwz", "wxww", "wyxx", "wyxy", "wyxz", "wyxw", "wyyx", "wyyy", "wyyz", "wyyw", "wyzx", "wyzy", "wyzz", "wyzw", "wywx", "wywy", "wywz", "wyww", "wzxx", "wzxy", "wzxz", "wzxw", "wzyx", "wzyy", "wzyz", "wzyw", "wzzx", "wzzy", "wzzz", "wzzw", "wzwx", "wzwy", "wzwz", "wzww", "wwxx", "wwxy", "wwxz", "wwxw", "wwyx", "wwyy", "wwyz", "wwyw", "wwzx", "wwzy", "wwzz", "wwzw", "wwwx", "wwwy", "wwwz", "wwww", "ra", "ga", "ba", "ar", "ag", "ab", "aa", "rra", "rga", "rba", "rar", "rag", "rab", "raa", "gra", "gga", "gba", "gar", "gag", "gab", "gaa", "bra", "bga", "bba", "bar", "bag", "bab", "baa", "arr", "arg", "arb", "ara", "agr", "agg", "agb", "aga", "abr", "abg", "abb", "aba", "aar", "aag", "aab", "aaa", "rrra", "rrga", "rrba", "rrar", "rrag", "rrab", "rraa", "rgra", "rgga", "rgba", "rgar", "rgag", "rgab", "rgaa", "rbra", "rbga", "rbba", "rbar", "rbag", "rbab", "rbaa", "rarr", "rarg", "rarb", "rara", "ragr", "ragg", "ragb", "raga", "rabr", "rabg", "rabb", "raba", "raar", "raag", "raab", "raaa", "grra", "grga", "grba", "grar", "grag", "grab", "graa", "ggra", "ggga", "ggba", "ggar", "ggag", "ggab", "ggaa", "gbra", "gbga", "gbba", "gbar", "gbag", "gbab", "gbaa", "garr", "garg", "garb", "gara", "gagr", "gagg", "gagb", "gaga", "gabr", "gabg", "gabb", "gaba", "gaar", "gaag", "gaab", "gaaa", "brra", "brga", "brba", "brar", "brag", "brab", "braa", "bgra", "bgga", "bgba", "bgar", "bgag", "bgab", "bgaa", "bbra", "bbga", "bbba", "bbar", "bbag", "bbab", "bbaa", "barr", "barg", "barb", "bara", "bagr", "bagg", "bagb", "baga", "babr", "babg", "babb", "baba", "baar", "baag", "baab", "baaa", "arrr", "arrg", "arrb", "arra", "argr", "argg", "argb", "arga", "arbr", "arbg", "arbb", "arba", "arar", "arag", "arab", "araa", "agrr", "agrg", "agrb", "agra", "aggr", "aggg", "aggb", "agga", "agbr", "agbg", "agbb", "agba", "agar", "agag", "agab", "agaa", "abrr", "abrg", "abrb", "abra", "abgr", "abgg", "abgb", "abga", "abbr", "abbg", "abbb", "abba", "abar", "abag", "abab", "abaa", "aarr", "aarg", "aarb", "aara", "aagr", "aagg", "aagb", "aaga", "aabr", "aabg", "aabb", "aaba", "aaar", "aaag", "aaab", "aaaa"]; + const SWIZZLE_INDEX = { + x: 0, + r: 0, + y: 1, + g: 1, + z: 2, + b: 2, + w: 3, + a: 3 + }; + function getSwizzleImpl(swizzle) { + switch (swizzle.length) { + case 2: + return function() { + return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]); + }; + case 3: + return function() { + return new Vec3( + this[SWIZZLE_INDEX[swizzle[0]]], + this[SWIZZLE_INDEX[swizzle[1]]], + this[SWIZZLE_INDEX[swizzle[2]]] + ); + }; + case 4: + return function() { + return new Vec4( + this[SWIZZLE_INDEX[swizzle[0]]], + this[SWIZZLE_INDEX[swizzle[1]]], + this[SWIZZLE_INDEX[swizzle[2]]], + this[SWIZZLE_INDEX[swizzle[3]]] + ); + }; + } + throw new Error("Illegal swizzle length"); + } + for (const swizzle of VEC2_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec2.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec3.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + for (const swizzle of VEC3_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec3.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + for (const swizzle of VEC4_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + GLM_SWIZZLES_ENABLED_F32 = true; +} + +// src/util/angleConversion.ts +var GLM_DEG_TO_RAD = Math.PI / 180; +var GLM_RAD_TO_DEG = 180 / Math.PI; +function toDegree(value) { + return value * GLM_RAD_TO_DEG; +} +function toRadian(value) { + return value * GLM_DEG_TO_RAD; +} +export { + EnableSwizzles, + Mat2, + Mat2d, + Mat3, + Mat4, + Quat, + Quat2, + Vec2, + Vec3, + Vec4, + Mat2 as mat2, + Mat2d as mat2d, + Mat3 as mat3, + Mat4 as mat4, + Quat as quat, + Quat2 as quat2, + toDegree, + toRadian, + Vec2 as vec2, + Vec3 as vec3, + Vec4 as vec4 +}; +//# sourceMappingURL=gl-matrix-f32.js.map diff --git a/dist-cdn/esm/2022/gl-matrix-f32.js.map b/dist-cdn/esm/2022/gl-matrix-f32.js.map new file mode 100644 index 00000000..04eb5848 --- /dev/null +++ b/dist-cdn/esm/2022/gl-matrix-f32.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../../../src/common/index.ts", "../../../src/_lib/f32/Mat2.ts", "../../../src/_lib/f32/Mat2d.ts", "../../../src/_lib/f32/Mat3.ts", "../../../src/_lib/f32/Mat4.ts", "../../../src/_lib/f32/Vec3.ts", "../../../src/_lib/f32/Vec4.ts", "../../../src/_lib/f32/Quat.ts", "../../../src/_lib/f32/Quat2.ts", "../../../src/_lib/f32/Vec2.ts", "../../../src/swizzle/index.ts", "../../../src/util/angleConversion.ts"], + "sourcesContent": ["/**\r\n * Provides common resources and constants shared across `gl-matrix`.\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\n/**\r\n * A small constant used to determine the acceptable error margin in floating-point calculations.\r\n */\r\nexport const GLM_EPSILON = 0.000001;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x2 Matrix\r\n */\r\nexport class Mat2 extends Float32Array {\r\n static #IDENTITY_2X2 = new Float32Array([\r\n 1, 0,\r\n 0, 1\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n default:\r\n super(Mat2.#IDENTITY_2X2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2} into `this`.\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2.identity(this)\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n identity(): this {\r\n this.set(Mat2.#IDENTITY_2X2);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2} against another one\r\n * Equivalent to `Mat2.multiply(this, this, b);`\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat2}\r\n * Equivalent to `Mat2.transpose(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n transpose(): this {\r\n return Mat2.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat2}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n invert(): this {\r\n return Mat2.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2.scale(this, this, v);`\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2} by the given angle around the given axis\r\n * Equivalent to `Mat2.rotate(this, this, rad);`\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n rotate(rad: number): this {\r\n return Mat2.rotate(this, this, rad) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2}\r\n */\r\n static create(): Mat2 {\r\n return new Mat2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2}\r\n */\r\n static clone(a: Readonly): Mat2 {\r\n return new Mat2(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2Like, a: Readonly): Mat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2}\r\n */\r\n static fromValues(...values: number[]): Mat2 {\r\n return new Mat2(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2Like, ...values: number[]): Mat2Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2Like): Mat2Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat2Like, a: Readonly): Mat2Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache\r\n // some values\r\n if (out === a) {\r\n const a1 = a[1];\r\n out[1] = a[2];\r\n out[2] = a1;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[2];\r\n out[2] = a[1];\r\n out[3] = a[3];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2Like, a: Mat2Like): Mat2Like | null {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n // Calculate the determinant\r\n let det = a0 * a3 - a2 * a1;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = a3 * det;\r\n out[1] = -a1 * det;\r\n out[2] = -a2 * det;\r\n out[3] = a0 * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat2Like, a: Mat2Like): Mat2Like {\r\n // Caching this value is necessary if out == a\r\n const a0 = a[0];\r\n out[0] = a[3];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[2] * a[1];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n return out;\r\n }\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Rotates a {@link Mat2} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2Like, a: Readonly, rad: number): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2Like, a: Readonly, v: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2Like, rad: number): Mat2Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2Like, v: Readonly): Mat2Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2Like, a: Readonly, b: number): Mat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2Like, a: Readonly, b: Readonly, scale: number): Mat2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\r\n * @category Static\r\n *\r\n * @param L - the lower triangular matrix\r\n * @param D - the diagonal matrix\r\n * @param U - the upper triangular matrix\r\n * @param a - the input matrix to factorize\r\n */\r\n\r\n static LDU(L: Mat2Like, D: Readonly, U: Mat2Like, a: Readonly):\r\n [Mat2Like, Readonly, Mat2Like] {\r\n L[2] = a[2] / a[0];\r\n U[0] = a[0];\r\n U[1] = a[1];\r\n U[3] = a[3] - L[2] * U[1];\r\n return [L, D, U];\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat2.prototype.mul = Mat2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat2.mul = Mat2.multiply;\r\nMat2.sub = Mat2.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x3 Matrix\r\n */\r\nexport class Mat2d extends Float32Array {\r\n static #IDENTITY_2X3 = new Float32Array([\r\n 1, 0,\r\n 0, 1,\r\n 0, 0,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 6:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 6); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 6);\r\n }\r\n break;\r\n default:\r\n super(Mat2d.#IDENTITY_2X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2d.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2d.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2d} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2d.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat2d.#IDENTITY_2X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2d} against another one\r\n * Equivalent to `Mat2d.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2d.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Translate this {@link Mat2d} by the given vector\r\n * Equivalent to `Mat2d.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat2d.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2d} by the given angle around the given axis\r\n * Equivalent to `Mat2d.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat2d.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2d.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2d.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2d}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 6 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2d}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2d}\r\n */\r\n static create(): Mat2d {\r\n return new Mat2d();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2d} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2d}\r\n */\r\n static clone(a: Readonly): Mat2d {\r\n return new Mat2d(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2d} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2dLike, a: Readonly): Mat2dLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2d} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2d}\r\n */\r\n static fromValues(...values: number[]): Mat2d {\r\n return new Mat2d(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2d} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2dLike, ...values: number[]): Mat2dLike {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2d} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2dLike): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2dLike, a: Mat2dLike): Mat2dLike | null {\r\n const aa = a[0];\r\n const ab = a[1];\r\n const ac = a[2];\r\n const ad = a[3];\r\n const atx = a[4];\r\n const aty = a[5];\r\n\r\n let det = aa * ad - ab * ac;\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = ad * det;\r\n out[1] = -ab * det;\r\n out[2] = -ac * det;\r\n out[3] = aa * det;\r\n out[4] = (ac * aty - ad * atx) * det;\r\n out[5] = (ab * atx - aa * aty) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[1] * a[2];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2d}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n out[4] = a0 * b4 + a2 * b5 + a4;\r\n out[5] = a1 * b4 + a3 * b5 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat2d} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n out[4] = a0 * v0 + a2 * v1 + a4;\r\n out[5] = a1 * v0 + a3 * v1 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat2d} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2dLike, a: Readonly, rad: number): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n // TODO: Got to fromRotation\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = v[0];\r\n out[5] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2dLike, rad: number): Mat2dLike {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2d} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2dLike, a: Readonly, b: number): Mat2dLike {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2dLike, a: Readonly, b: Readonly, scale: number):\r\n Mat2dLike {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2d(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Static method alias assignments\r\nMat2d.mul = Mat2d.multiply;\r\nMat2d.sub = Mat2d.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Mat3Like, Mat4Like, Vec2Like, QuatLike } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 3x3 Matrix\r\n */\r\nexport class Mat3 extends Float32Array {\r\n static #IDENTITY_3X3 = new Float32Array([\r\n 1, 0, 0,\r\n 0, 1, 0,\r\n 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 9:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 9); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v,\r\n v, v, v,\r\n v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 9);\r\n }\r\n break;\r\n default:\r\n super(Mat3.#IDENTITY_3X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat3.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat3.#IDENTITY_3X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat3} against another one\r\n * Equivalent to `Mat3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat3.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat3}\r\n * Equivalent to `Mat3.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat3.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat3}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat3.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat3} by the given vector\r\n * Equivalent to `Mat3.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat3.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat3} by the given angle around the given axis\r\n * Equivalent to `Mat3.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat3.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat3.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat3.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 9 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat3}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat3}\r\n */\r\n static create(): Mat3 {\r\n return new Mat3();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat3} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat3}\r\n */\r\n static clone(a: Readonly): Mat3 {\r\n return new Mat3(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat3} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat3} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat3}\r\n */\r\n static fromValues(...values: number[]): Mat3 {\r\n return new Mat3(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat3} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat3Like, ...values: number[]): Mat3Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat3} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat3Like): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat3Like, a: Readonly): Mat3Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a12 = a[5];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a01;\r\n out[5] = a[7];\r\n out[6] = a02;\r\n out[7] = a12;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a[1];\r\n out[4] = a[4];\r\n out[5] = a[7];\r\n out[6] = a[2];\r\n out[7] = a[5];\r\n out[8] = a[8];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat3Like, a: Mat3Like): Mat3Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2];\r\n const a10 = a[3],\r\n a11 = a[4],\r\n a12 = a[5];\r\n const a20 = a[6],\r\n a21 = a[7],\r\n a22 = a[8];\r\n\r\n const b01 = a22 * a11 - a12 * a21;\r\n const b11 = -a22 * a10 + a12 * a20;\r\n const b21 = a21 * a10 - a11 * a20;\r\n\r\n // Calculate the determinant\r\n let det = a00 * b01 + a01 * b11 + a02 * b21;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = b01 * det;\r\n out[1] = (-a22 * a01 + a02 * a21) * det;\r\n out[2] = (a12 * a01 - a02 * a11) * det;\r\n out[3] = b11 * det;\r\n out[4] = (a22 * a00 - a02 * a20) * det;\r\n out[5] = (-a12 * a00 + a02 * a10) * det;\r\n out[6] = b21 * det;\r\n out[7] = (-a21 * a00 + a01 * a20) * det;\r\n out[8] = (a11 * a00 - a01 * a10) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat3Like, a: Mat3Like): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n out[0] = a11 * a22 - a12 * a21;\r\n out[1] = a02 * a21 - a01 * a22;\r\n out[2] = a01 * a12 - a02 * a11;\r\n out[3] = a12 * a20 - a10 * a22;\r\n out[4] = a00 * a22 - a02 * a20;\r\n out[5] = a02 * a10 - a00 * a12;\r\n out[6] = a10 * a21 - a11 * a20;\r\n out[7] = a01 * a20 - a00 * a21;\r\n out[8] = a00 * a11 - a01 * a10;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n return (\r\n a00 * (a22 * a11 - a12 * a21) +\r\n a01 * (-a22 * a10 + a12 * a20) +\r\n a02 * (a21 * a10 - a11 * a20)\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[3];\r\n b1 = b[4];\r\n b2 = b[5];\r\n out[3] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[4] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[5] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[6];\r\n b1 = b[7];\r\n b2 = b[8];\r\n out[6] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[7] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[8] = b0 * a02 + b1 * a12 + b2 * a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat3} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n\r\n out[3] = a10;\r\n out[4] = a11;\r\n out[5] = a12;\r\n\r\n out[6] = x * a00 + y * a10 + a20;\r\n out[7] = x * a01 + y * a11 + a21;\r\n out[8] = x * a02 + y * a12 + a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat3} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat3Like, a: Readonly, rad: number): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c * a00 + s * a10;\r\n out[1] = c * a01 + s * a11;\r\n out[2] = c * a02 + s * a12;\r\n\r\n out[3] = c * a10 - s * a00;\r\n out[4] = c * a11 - s * a01;\r\n out[5] = c * a12 - s * a02;\r\n\r\n out[6] = a20;\r\n out[7] = a21;\r\n out[8] = a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat3} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = x * a[0];\r\n out[1] = x * a[1];\r\n out[2] = x * a[2];\r\n\r\n out[3] = y * a[3];\r\n out[4] = y * a[4];\r\n out[5] = y * a[5];\r\n\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = v[0];\r\n out[7] = v[1];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.rotate(dest, dest, rad);\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat3Like, rad: number): Mat3Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n\r\n out[3] = -s;\r\n out[4] = c;\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n\r\n out[3] = 0;\r\n out[4] = v[1];\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat2d} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 2x3 matrix\r\n * @returns `out`\r\n */\r\n static fromMat2d(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = 0;\r\n\r\n out[3] = a[2];\r\n out[4] = a[3];\r\n out[5] = 0;\r\n\r\n out[6] = a[4];\r\n out[7] = a[5];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param q - {@link Quat} to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat3Like, q: Readonly): Mat3Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[3] = yx - wz;\r\n out[6] = zx + wy;\r\n\r\n out[1] = yx + wz;\r\n out[4] = 1 - xx - zz;\r\n out[7] = zy - wx;\r\n\r\n out[2] = zx - wy;\r\n out[5] = zy + wx;\r\n out[8] = 1 - xx - yy;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat4} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 4x4 matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[4];\r\n out[4] = a[5];\r\n out[5] = a[6];\r\n out[6] = a[8];\r\n out[7] = a[9];\r\n out[8] = a[10];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\r\n * @category Static\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat3Like, a: Readonly): Mat3Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n\r\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n\r\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat3Like, a: Readonly): Mat3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n\r\n out[3] = cy * az - cz * ay;\r\n out[4] = cz * ax - cx * az;\r\n out[5] = cx * ay - cy * ax;\r\n\r\n out[6] = ay * bz - az * by;\r\n out[7] = az * bx - ax * bz;\r\n out[8] = ax * by - ay * bx;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a 2D projection matrix with the given bounds\r\n * @category Static\r\n *\r\n * @param out mat3 frustum matrix will be written into\r\n * @param width Width of your gl context\r\n * @param height Height of gl context\r\n * @returns `out`\r\n */\r\n static projection(out: Mat3Like, width: number, height: number): Mat3Like {\r\n out[0] = 2 / width;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -2 / height;\r\n out[5] = 0;\r\n out[6] = -1;\r\n out[7] = 1;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8]\r\n );\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat3} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat3Like, a: Readonly, b: number): Mat3Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat3Like, a: Readonly, b: Readonly, scale: number): Mat3Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat3(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat3.prototype.mul = Mat3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat3.mul = Mat3.multiply;\r\nMat3.sub = Mat3.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 4x4 Matrix\r\n */\r\nexport class Mat4 extends Float32Array {\r\n static #IDENTITY_4X4 = new Float32Array([\r\n 1, 0, 0, 0,\r\n 0, 1, 0, 0,\r\n 0, 0, 1, 0,\r\n 0, 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Temporary variable to prevent repeated allocations in the algorithms within Mat4.\r\n * These are declared as TypedArrays to aid in tree-shaking.\r\n */\r\n static #TMP_VEC3 = new Float32Array(3);\r\n\r\n /**\r\n * Create a {@link Mat4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 16:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 16); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 16);\r\n }\r\n break;\r\n default:\r\n super(Mat4.#IDENTITY_4X4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat4.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat4.#IDENTITY_4X4);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat4} against another one\r\n * Equivalent to `Mat4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat4.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat4}\r\n * Equivalent to `Mat4.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat4.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat4}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat4.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat4} by the given vector\r\n * Equivalent to `Mat4.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat4.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the given axis\r\n * Equivalent to `Mat4.rotate(this, this, rad, axis);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `this`\r\n */\r\n rotate(rad: number, axis: Readonly): this {\r\n return Mat4.rotate(this, this, rad, axis) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat4.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat4.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the X axis\r\n * Equivalent to `Mat4.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Mat4.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Y axis\r\n * Equivalent to `Mat4.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Mat4.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Z axis\r\n * Equivalent to `Mat4.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Mat4.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveNO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveNO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveZO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveZO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoNO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoNO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoZO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoZO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 16 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat4}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat4}\r\n */\r\n static create(): Mat4 {\r\n return new Mat4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat4} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat4}\r\n */\r\n static clone(a: Readonly): Mat4 {\r\n return new Mat4(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat4} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat4Like, a: Readonly): Mat4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new mat4 with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat4}\r\n */\r\n static fromValues(...values: number[]): Mat4 {\r\n return new Mat4(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a mat4 to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat4Like, ...values: number[]): Mat4Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n out[9] = values[9];\r\n out[10] = values[10];\r\n out[11] = values[11];\r\n out[12] = values[12];\r\n out[13] = values[13];\r\n out[14] = values[14];\r\n out[15] = values[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat4} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat4Like): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat4Like, a: Readonly): Mat4Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a12 = a[6],\r\n a13 = a[7];\r\n const a23 = a[11];\r\n\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a01;\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a02;\r\n out[9] = a12;\r\n out[11] = a[14];\r\n out[12] = a03;\r\n out[13] = a13;\r\n out[14] = a23;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a[1];\r\n out[5] = a[5];\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a[2];\r\n out[9] = a[6];\r\n out[10] = a[10];\r\n out[11] = a[14];\r\n out[12] = a[3];\r\n out[13] = a[7];\r\n out[14] = a[11];\r\n out[15] = a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat4Like, a: Mat4Like): Mat4Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\r\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\r\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\r\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\r\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\r\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\r\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat4Like, a: Mat4Like): Mat4Like {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n out[0] = a11 * b11 - a12 * b10 + a13 * b09;\r\n out[1] = a02 * b10 - a01 * b11 - a03 * b09;\r\n out[2] = a31 * b05 - a32 * b04 + a33 * b03;\r\n out[3] = a22 * b04 - a21 * b05 - a23 * b03;\r\n out[4] = a12 * b08 - a10 * b11 - a13 * b07;\r\n out[5] = a00 * b11 - a02 * b08 + a03 * b07;\r\n out[6] = a32 * b02 - a30 * b05 - a33 * b01;\r\n out[7] = a20 * b05 - a22 * b02 + a23 * b01;\r\n out[8] = a10 * b10 - a11 * b08 + a13 * b06;\r\n out[9] = a01 * b08 - a00 * b10 - a03 * b06;\r\n out[10] = a30 * b04 - a31 * b02 + a33 * b00;\r\n out[11] = a21 * b02 - a20 * b04 - a23 * b00;\r\n out[12] = a11 * b07 - a10 * b09 - a12 * b06;\r\n out[13] = a00 * b09 - a01 * b07 + a02 * b06;\r\n out[14] = a31 * b01 - a30 * b03 - a32 * b00;\r\n out[15] = a20 * b03 - a21 * b01 + a22 * b00;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b0 = a00 * a11 - a01 * a10;\r\n const b1 = a00 * a12 - a02 * a10;\r\n const b2 = a01 * a12 - a02 * a11;\r\n const b3 = a20 * a31 - a21 * a30;\r\n const b4 = a20 * a32 - a22 * a30;\r\n const b5 = a21 * a32 - a22 * a31;\r\n const b6 = a00 * b5 - a01 * b4 + a02 * b3;\r\n const b7 = a10 * b5 - a11 * b4 + a12 * b3;\r\n const b8 = a20 * b2 - a21 * b1 + a22 * b0;\r\n const b9 = a30 * b2 - a31 * b1 + a32 * b0;\r\n\r\n // Calculate the determinant\r\n return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Mat4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n // Cache only the current line of the second matrix\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n let b3 = b[3];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[4];\r\n b1 = b[5];\r\n b2 = b[6];\r\n b3 = b[7];\r\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[8];\r\n b1 = b[9];\r\n b2 = b[10];\r\n b3 = b[11];\r\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[12];\r\n b1 = b[13];\r\n b2 = b[14];\r\n b3 = b[15];\r\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat4} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n if (a === out) {\r\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\r\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\r\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\r\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\r\n } else {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n out[3] = a03;\r\n out[4] = a10;\r\n out[5] = a11;\r\n out[6] = a12;\r\n out[7] = a13;\r\n out[8] = a20;\r\n out[9] = a21;\r\n out[10] = a22;\r\n out[11] = a23;\r\n\r\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\r\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\r\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\r\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec3} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n out[0] = a[0] * x;\r\n out[1] = a[1] * x;\r\n out[2] = a[2] * x;\r\n out[3] = a[3] * x;\r\n out[4] = a[4] * y;\r\n out[5] = a[5] * y;\r\n out[6] = a[6] * y;\r\n out[7] = a[7] * y;\r\n out[8] = a[8] * z;\r\n out[9] = a[9] * z;\r\n out[10] = a[10] * z;\r\n out[11] = a[11] * z;\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat4} by the given angle around the given axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if axis has a length of 0\r\n */\r\n static rotate(out: Mat4Like, a: Readonly, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n // Construct the elements of the rotation matrix\r\n const b00 = x * x * t + c;\r\n const b01 = y * x * t + z * s;\r\n const b02 = z * x * t - y * s;\r\n const b10 = x * y * t - z * s;\r\n const b11 = y * y * t + c;\r\n const b12 = z * y * t + x * s;\r\n const b20 = x * z * t + y * s;\r\n const b21 = y * z * t - x * s;\r\n const b22 = z * z * t + c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\r\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\r\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\r\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\r\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\r\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\r\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\r\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\r\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\r\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\r\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\r\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateX(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[4] = a10 * c + a20 * s;\r\n out[5] = a11 * c + a21 * s;\r\n out[6] = a12 * c + a22 * s;\r\n out[7] = a13 * c + a23 * s;\r\n out[8] = a20 * c - a10 * s;\r\n out[9] = a21 * c - a11 * s;\r\n out[10] = a22 * c - a12 * s;\r\n out[11] = a23 * c - a13 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateY(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c - a20 * s;\r\n out[1] = a01 * c - a21 * s;\r\n out[2] = a02 * c - a22 * s;\r\n out[3] = a03 * c - a23 * s;\r\n out[8] = a00 * s + a20 * c;\r\n out[9] = a01 * s + a21 * c;\r\n out[10] = a02 * s + a22 * c;\r\n out[11] = a03 * s + a23 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c + a10 * s;\r\n out[1] = a01 * c + a11 * s;\r\n out[2] = a02 * c + a12 * s;\r\n out[3] = a03 * c + a13 * s;\r\n out[4] = a10 * c - a00 * s;\r\n out[5] = a11 * c - a01 * s;\r\n out[6] = a12 * c - a02 * s;\r\n out[7] = a13 * c - a03 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = v[1];\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = v[2];\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotate(dest, dest, rad, axis);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if `axis` has a length of 0\r\n */\r\n static fromRotation(out: Mat4Like, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = x * x * t + c;\r\n out[1] = y * x * t + z * s;\r\n out[2] = z * x * t - y * s;\r\n out[3] = 0;\r\n out[4] = x * y * t - z * s;\r\n out[5] = y * y * t + c;\r\n out[6] = z * y * t + x * s;\r\n out[7] = 0;\r\n out[8] = x * z * t + y * s;\r\n out[9] = y * z * t - x * s;\r\n out[10] = z * z * t + c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the X axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateX(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromXRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = c;\r\n out[6] = s;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = -s;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Y axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateY(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromYRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = 0;\r\n out[2] = -s;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = s;\r\n out[9] = 0;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Z axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateZ(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromZRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -s;\r\n out[5] = c;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation and vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Mat4Like, q: Readonly, v: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - (yy + zz);\r\n out[1] = xy + wz;\r\n out[2] = xz - wy;\r\n out[3] = 0;\r\n out[4] = xy - wz;\r\n out[5] = 1 - (xx + zz);\r\n out[6] = yz + wx;\r\n out[7] = 0;\r\n out[8] = xz + wy;\r\n out[9] = yz - wx;\r\n out[10] = 1 - (xx + yy);\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Mat4} from a {@link Quat2}.\r\n * @category Static\r\n *\r\n * @param out - Matrix\r\n * @param a - Dual Quaternion\r\n * @returns `out`\r\n */\r\n static fromQuat2(out: Mat4Like, a: Quat2Like): Mat4Like {\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n\r\n const magnitude = bx * bx + by * by + bz * bz + bw * bw;\r\n\r\n // Only scale if it makes sense\r\n if (magnitude > 0) {\r\n Mat4.#TMP_VEC3[0] = ((ax * bw + aw * bx + ay * bz - az * by) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[1] = ((ay * bw + aw * by + az * bx - ax * bz) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[2] = ((az * bw + aw * bz + ax * by - ay * bx) * 2) / magnitude;\r\n } else {\r\n Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n }\r\n Mat4.fromRotationTranslation(out, a as QuatLike, Mat4.#TMP_VEC3);\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat4Like, a: Readonly): Mat4Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[3] = 0;\r\n\r\n out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[7] = 0;\r\n\r\n out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat4Like, a: Readonly): Mat4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n out[3] = 0;\r\n\r\n out[4] = cy * az - cz * ay;\r\n out[5] = cz * ax - cx * az;\r\n out[6] = cx * ay - cy * ax;\r\n out[7] = 0;\r\n\r\n out[8] = ay * bz - az * by;\r\n out[9] = az * bx - ax * bz;\r\n out[10] = ax * by - ay * bx;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the translation vector component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslation,\r\n * the returned vector will be the same as the translation vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive translation component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getTranslation(out: Vec3Like, mat: Readonly): Vec3Like {\r\n out[0] = mat[12];\r\n out[1] = mat[13];\r\n out[2] = mat[14];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the scaling factor component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslationScale\r\n * with a normalized Quaternion parameter, the returned vector will be\r\n * the same as the scaling vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive scaling factor component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getScaling(out: Vec3Like, mat: Readonly): Vec3Like {\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a quaternion representing the rotational component\r\n * of a transformation matrix. If a matrix is built with\r\n * fromRotationTranslation, the returned quaternion will be the\r\n * same as the quaternion originally supplied.\r\n * @category Static\r\n *\r\n * @param out - Quaternion to receive the rotation component\r\n * @param mat - Matrix to be decomposed (input)\r\n * @return `out`\r\n */\r\n static getRotation(out: QuatLike, mat: Readonly): QuatLike {\r\n Mat4.getScaling(Mat4.#TMP_VEC3, mat);\r\n\r\n const is1 = 1 / Mat4.#TMP_VEC3[0];\r\n const is2 = 1 / Mat4.#TMP_VEC3[1];\r\n const is3 = 1 / Mat4.#TMP_VEC3[2];\r\n\r\n const sm11 = mat[0] * is1;\r\n const sm12 = mat[1] * is2;\r\n const sm13 = mat[2] * is3;\r\n const sm21 = mat[4] * is1;\r\n const sm22 = mat[5] * is2;\r\n const sm23 = mat[6] * is3;\r\n const sm31 = mat[8] * is1;\r\n const sm32 = mat[9] * is2;\r\n const sm33 = mat[10] * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out[3] = 0.25 * S;\r\n out[0] = (sm23 - sm32) / S;\r\n out[1] = (sm31 - sm13) / S;\r\n out[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out[3] = (sm23 - sm32) / S;\r\n out[0] = 0.25 * S;\r\n out[1] = (sm12 + sm21) / S;\r\n out[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out[3] = (sm31 - sm13) / S;\r\n out[0] = (sm12 + sm21) / S;\r\n out[1] = 0.25 * S;\r\n out[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out[3] = (sm12 - sm21) / S;\r\n out[0] = (sm31 + sm13) / S;\r\n out[1] = (sm23 + sm32) / S;\r\n out[2] = 0.25 * S;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Decomposes a transformation matrix into its rotation, translation\r\n * and scale components. Returns only the rotation component\r\n * @category Static\r\n *\r\n * @param out_r - Quaternion to receive the rotation component\r\n * @param out_t - Vector to receive the translation vector\r\n * @param out_s - Vector to receive the scaling factor\r\n * @param mat - Matrix to be decomposed (input)\r\n * @returns `out_r`\r\n */\r\n static decompose(out_r: QuatLike, out_t: Vec3Like, out_s: Vec3Like, mat: Readonly): QuatLike {\r\n out_t[0] = mat[12];\r\n out_t[1] = mat[13];\r\n out_t[2] = mat[14];\r\n\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n const is1 = 1 / out_s[0];\r\n const is2 = 1 / out_s[1];\r\n const is3 = 1 / out_s[2];\r\n\r\n const sm11 = m11 * is1;\r\n const sm12 = m12 * is2;\r\n const sm13 = m13 * is3;\r\n const sm21 = m21 * is1;\r\n const sm22 = m22 * is2;\r\n const sm23 = m23 * is3;\r\n const sm31 = m31 * is1;\r\n const sm32 = m32 * is2;\r\n const sm33 = m33 * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out_r[3] = 0.25 * S;\r\n out_r[0] = (sm23 - sm32) / S;\r\n out_r[1] = (sm31 - sm13) / S;\r\n out_r[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out_r[3] = (sm23 - sm32) / S;\r\n out_r[0] = 0.25 * S;\r\n out_r[1] = (sm12 + sm21) / S;\r\n out_r[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out_r[3] = (sm31 - sm13) / S;\r\n out_r[0] = (sm12 + sm21) / S;\r\n out_r[1] = 0.25 * S;\r\n out_r[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out_r[3] = (sm12 - sm21) / S;\r\n out_r[0] = (sm31 + sm13) / S;\r\n out_r[1] = (sm23 + sm32) / S;\r\n out_r[2] = 0.25 * S;\r\n }\r\n\r\n return out_r;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScale(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n out[0] = (1 - (yy + zz)) * sx;\r\n out[1] = (xy + wz) * sx;\r\n out[2] = (xz - wy) * sx;\r\n out[3] = 0;\r\n out[4] = (xy - wz) * sy;\r\n out[5] = (1 - (xx + zz)) * sy;\r\n out[6] = (yz + wx) * sy;\r\n out[7] = 0;\r\n out[8] = (xz + wy) * sz;\r\n out[9] = (yz - wx) * sz;\r\n out[10] = (1 - (xx + yy)) * sz;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the\r\n * given origin. This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * mat4.translate(dest, origin);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n * mat4.translate(dest, negativeOrigin);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @param o - The origin vector around which to scale and rotate\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScaleOrigin(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly, o: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n const ox = o[0];\r\n const oy = o[1];\r\n const oz = o[2];\r\n\r\n const out0 = (1 - (yy + zz)) * sx;\r\n const out1 = (xy + wz) * sx;\r\n const out2 = (xz - wy) * sx;\r\n const out4 = (xy - wz) * sy;\r\n const out5 = (1 - (xx + zz)) * sy;\r\n const out6 = (yz + wx) * sy;\r\n const out8 = (xz + wy) * sz;\r\n const out9 = (yz - wx) * sz;\r\n const out10 = (1 - (xx + yy)) * sz;\r\n\r\n out[0] = out0;\r\n out[1] = out1;\r\n out[2] = out2;\r\n out[3] = 0;\r\n out[4] = out4;\r\n out[5] = out5;\r\n out[6] = out6;\r\n out[7] = 0;\r\n out[8] = out8;\r\n out[9] = out9;\r\n out[10] = out10;\r\n out[11] = 0;\r\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\r\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\r\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 4x4 matrix from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Quaternion to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat4Like, q: Readonly): Mat4Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[1] = yx + wz;\r\n out[2] = zx - wy;\r\n out[3] = 0;\r\n\r\n out[4] = yx - wz;\r\n out[5] = 1 - xx - zz;\r\n out[6] = zy + wx;\r\n out[7] = 0;\r\n\r\n out[8] = zx + wy;\r\n out[9] = zy - wx;\r\n out[10] = 1 - xx - yy;\r\n out[11] = 0;\r\n\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.frustumNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly\r\n */\r\n static frustum(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like { return out; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveNO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.perspectiveNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static perspective(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveZO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating\r\n * projection matrices to be used with the still experimental WebVR API.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n * @deprecated\r\n */\r\n static perspectiveFromFieldOfView(out: Mat4Like,\r\n fov: { upDegrees: number, downDegrees: number, leftDegrees: number, rightDegrees: number }, near: number,\r\n far: number): Mat4Like {\r\n\r\n const upTan = Math.tan((fov.upDegrees * Math.PI) / 180.0);\r\n const downTan = Math.tan((fov.downDegrees * Math.PI) / 180.0);\r\n const leftTan = Math.tan((fov.leftDegrees * Math.PI) / 180.0);\r\n const rightTan = Math.tan((fov.rightDegrees * Math.PI) / 180.0);\r\n const xScale = 2.0 / (leftTan + rightTan);\r\n const yScale = 2.0 / (upTan + downTan);\r\n\r\n out[0] = xScale;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n out[4] = 0.0;\r\n out[5] = yScale;\r\n out[6] = 0.0;\r\n out[7] = 0.0;\r\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\r\n out[9] = (upTan - downTan) * yScale * 0.5;\r\n out[10] = far / (near - far);\r\n out[11] = -1.0;\r\n out[12] = 0.0;\r\n out[13] = 0.0;\r\n out[14] = (far * near) / (near - far);\r\n out[15] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 2 * nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = (far + near) * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.orthoNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static ortho(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, far: number):\r\n Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = near * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that\r\n * actually makes an object look at another object, you should use targetTo instead.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param center - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static lookAt(out: Mat4Like, eye: Readonly, center: Readonly, up: Readonly): Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n const centerx = center[0];\r\n const centery = center[1];\r\n const centerz = center[2];\r\n\r\n if (\r\n Math.abs(eyex - centerx) < GLM_EPSILON &&\r\n Math.abs(eyey - centery) < GLM_EPSILON &&\r\n Math.abs(eyez - centerz) < GLM_EPSILON\r\n ) {\r\n return Mat4.identity(out);\r\n }\r\n\r\n let z0 = eyex - centerx;\r\n let z1 = eyey - centery;\r\n let z2 = eyez - centerz;\r\n\r\n let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\r\n if (!len) {\r\n x0 = 0;\r\n x1 = 0;\r\n x2 = 0;\r\n } else {\r\n len = 1 / len;\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n let y0 = z1 * x2 - z2 * x1;\r\n let y1 = z2 * x0 - z0 * x2;\r\n let y2 = z0 * x1 - z1 * x0;\r\n\r\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\r\n if (!len) {\r\n y0 = 0;\r\n y1 = 0;\r\n y2 = 0;\r\n } else {\r\n len = 1 / len;\r\n y0 *= len;\r\n y1 *= len;\r\n y2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = y0;\r\n out[2] = z0;\r\n out[3] = 0;\r\n out[4] = x1;\r\n out[5] = y1;\r\n out[6] = z1;\r\n out[7] = 0;\r\n out[8] = x2;\r\n out[9] = y2;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\r\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\r\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a matrix that makes something look at something else.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param target - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static targetTo(out: Mat4Like, eye: Readonly, target: Readonly, up: Readonly):\r\n Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n\r\n let z0 = eyex - target[0];\r\n let z1 = eyey - target[1];\r\n let z2 = eyez - target[2];\r\n\r\n let len = z0 * z0 + z1 * z1 + z2 * z2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n }\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n\r\n len = x0 * x0 + x1 * x1 + x2 * x2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = x1;\r\n out[2] = x2;\r\n out[3] = 0;\r\n out[4] = z1 * x2 - z2 * x1;\r\n out[5] = z2 * x0 - z0 * x2;\r\n out[6] = z0 * x1 - z1 * x0;\r\n out[7] = 0;\r\n out[8] = z0;\r\n out[9] = z1;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = eyex;\r\n out[13] = eyey;\r\n out[14] = eyez;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8] +\r\n a[9] * a[9] +\r\n a[10] * a[10] +\r\n a[11] * a[11] +\r\n a[12] * a[12] +\r\n a[13] * a[13] +\r\n a[14] * a[14] +\r\n a[15] * a[15]\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n out[9] = a[9] + b[9];\r\n out[10] = a[10] + b[10];\r\n out[11] = a[11] + b[11];\r\n out[12] = a[12] + b[12];\r\n out[13] = a[13] + b[13];\r\n out[14] = a[14] + b[14];\r\n out[15] = a[15] + b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n out[9] = a[9] - b[9];\r\n out[10] = a[10] - b[10];\r\n out[11] = a[11] - b[11];\r\n out[12] = a[12] - b[12];\r\n out[13] = a[13] - b[13];\r\n out[14] = a[14] - b[14];\r\n out[15] = a[15] - b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Multiply each element of the matrix by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat4Like, a: Readonly, b: number): Mat4Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n out[9] = a[9] * b;\r\n out[10] = a[10] * b;\r\n out[11] = a[11] * b;\r\n out[12] = a[12] * b;\r\n out[13] = a[13] * b;\r\n out[14] = a[14] * b;\r\n out[15] = a[15] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat4Like, a: Readonly, b: Readonly, scale: number): Mat4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n out[9] = a[9] + b[9] * scale;\r\n out[10] = a[10] + b[10] * scale;\r\n out[11] = a[11] + b[11] * scale;\r\n out[12] = a[12] + b[12] * scale;\r\n out[13] = a[13] + b[13] * scale;\r\n out[14] = a[14] + b[14] * scale;\r\n out[15] = a[15] + b[15] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8] &&\r\n a[9] === b[9] &&\r\n a[10] === b[10] &&\r\n a[11] === b[11] &&\r\n a[12] === b[12] &&\r\n a[13] === b[13] &&\r\n a[14] === b[14] &&\r\n a[15] === b[15]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n const a9 = a[9];\r\n const a10 = a[10];\r\n const a11 = a[11];\r\n const a12 = a[12];\r\n const a13 = a[13];\r\n const a14 = a[14];\r\n const a15 = a[15];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n const b9 = b[9];\r\n const b10 = b[10];\r\n const b11 = b[11];\r\n const b12 = b[12];\r\n const b13 = b[13];\r\n const b14 = b[14];\r\n const b15 = b[15];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) &&\r\n Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) &&\r\n Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) &&\r\n Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) &&\r\n Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) &&\r\n Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) &&\r\n Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) &&\r\n Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat4(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat4.prototype.mul = Mat4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat4.sub = Mat4.subtract;\r\nMat4.mul = Mat4.multiply;\r\nMat4.frustum = Mat4.frustumNO;\r\nMat4.perspective = Mat4.perspectiveNO;\r\nMat4.ortho = Mat4.orthoNO;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, Mat4Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 3 Dimensional Vector\r\n */\r\nexport class Vec3 extends Float32Array {\r\n /**\r\n * Create a {@link Vec3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 3:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 3); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 3);\r\n }\r\n break;\r\n }\r\n default:\r\n super(3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec3.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec3.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec3} to `this`.\r\n * Equivalent to `Vec3.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec3} from `this`.\r\n * Equivalent to `Vec3.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec3.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec3.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec3.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec3.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec3.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to its absolute value.\r\n * Equivalent to `Vec3.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec3}.\r\n * Equivalent to `Vec3.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec3.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec3.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 3 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty vec3\r\n * @category Static\r\n *\r\n * @returns a new 3D vector\r\n */\r\n static create(): Vec3 {\r\n return new Vec3();\r\n }\r\n\r\n /**\r\n * Creates a new vec3 initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 3D vector\r\n */\r\n static clone(a: Readonly): Vec3 {\r\n return new Vec3(a);\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Creates a new vec3 initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns a new 3D vector\r\n */\r\n static fromValues(x: number, y: number, z: number): Vec3 {\r\n return new Vec3(x, y, z);\r\n }\r\n\r\n /**\r\n * Copy the values from one vec3 to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns `out`\r\n */\r\n static set(out: Vec3Like, x: number, y: number, z: number): Vec3Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Multiplies two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; }\r\n\r\n /**\r\n * Divides two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Math.ceil the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * symmetric round the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n /*\r\n static round(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = glMatrix.round(a[0]);\r\n out[1] = glMatrix.round(a[1]);\r\n out[2] = glMatrix.round(a[2]);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Scales a vec3 by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec3Like, a: Readonly, scale: number): Vec3Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two vec3's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec3Like, a: Readonly, b: Readonly, scale: number) {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared length of a vec3\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec3Like, a: Readonly): Vec3Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n let len = x * x + y * y + z * z;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n out[2] = a[2] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2];\r\n const bx = b[0],\r\n by = b[1],\r\n bz = b[2];\r\n\r\n out[0] = ay * bz - az * by;\r\n out[1] = az * bx - ax * bz;\r\n out[2] = ax * by - ay * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const angle = Math.acos(Math.min(Math.max(Vec3.dot(a, b), -1), 1));\r\n const sinTotal = Math.sin(angle);\r\n\r\n const ratioA = Math.sin((1 - t) * angle) / sinTotal;\r\n const ratioB = Math.sin(t * angle) / sinTotal;\r\n out[0] = ratioA * a[0] + ratioB * b[0];\r\n out[1] = ratioA * a[1] + ratioB * b[1];\r\n out[2] = ratioA * a[2] + ratioB * b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a hermite interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static hermite(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const factorTimes2 = t * t;\r\n const factor1 = factorTimes2 * (2 * t - 3) + 1;\r\n const factor2 = factorTimes2 * (t - 2) + t;\r\n const factor3 = factorTimes2 * (t - 1);\r\n const factor4 = factorTimes2 * (3 - 2 * t);\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a bezier interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static bezier(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const inverseFactor = 1 - t;\r\n const inverseFactorTimesTwo = inverseFactor * inverseFactor;\r\n const factorTimes2 = t * t;\r\n const factor1 = inverseFactorTimesTwo * inverseFactor;\r\n const factor2 = 3 * t * inverseFactorTimesTwo;\r\n const factor3 = 3 * factorTimes2 * inverseFactor;\r\n const factor4 = factorTimes2 * t;\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec3Like, scale) {\r\n scale = scale === undefined ? 1.0 : scale;\r\n\r\n let r = glMatrix.RANDOM() * 2.0 * Math.PI;\r\n let z = glMatrix.RANDOM() * 2.0 - 1.0;\r\n let zScale = Math.sqrt(1.0 - z * z) * scale;\r\n\r\n out[0] = Math.cos(r) * zScale;\r\n out[1] = Math.sin(r) * zScale;\r\n out[2] = z * scale;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the vec3 with a mat4.\r\n * 4th vector component is implicitly '1'\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec3Like, a: Readonly, m: Readonly): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1.0;\r\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\r\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\r\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a mat3.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - the 3x3 matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat3(out: Vec3Like, a: Vec3Like, m: Mat3Like): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n out[0] = x * m[0] + y * m[3] + z * m[6];\r\n out[1] = x * m[1] + y * m[4] + z * m[7];\r\n out[2] = x * m[2] + y * m[5] + z * m[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a quat\r\n * Can also be used for dual quaternions. (Multiply it with the real part)\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec3Like, a: Readonly, q: Readonly): Vec3Like {\r\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const w2 = q[3] * 2;\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n // var qvec = [qx, qy, qz];\r\n // var uv = vec3.cross([], qvec, a);\r\n const uvx = (qy * z - qz * y);\r\n const uvy = (qz * x - qx * z);\r\n const uvz = (qx * y - qy * x);\r\n // var uuv = vec3.cross([], qvec, uv);\r\n // vec3.scale(uuv, uuv, 2);\r\n const uuvx = (qy * uvz - qz * uvy) * 2;\r\n const uuvy = (qz * uvx - qx * uvz) * 2;\r\n const uuvz = (qx * uvy - qy * uvx) * 2;\r\n // vec3.scale(uv, uv, 2 * w);\r\n // return vec3.add(out, a, vec3.add(out, uv, uuv));\r\n out[0] = x + (uvx * w2) + uuvx;\r\n out[1] = y + (uvy * w2) + uuvy;\r\n out[2] = z + (uvz * w2) + uuvz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the x-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateX(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const by = b[1];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const py = a[1] - by;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = a[0];\r\n out[1] = (py * Math.cos(rad) - pz * Math.sin(rad)) + by;\r\n out[2] = (py * Math.sin(rad) + pz * Math.cos(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the y-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateY(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (pz * Math.sin(rad) + px * Math.cos(rad)) + bx;\r\n out[1] = a[1];\r\n out[2] = (pz * Math.cos(rad) - px * Math.sin(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the z-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const by = b[1];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const py = a[1] - by;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (px * Math.cos(rad) - py * Math.sin(rad)) + bx;\r\n out[1] = (px * Math.sin(rad) + py * Math.cos(rad)) + by;\r\n out[2] = b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 3D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly) {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz));\r\n const cosine = mag && Vec3.dot(a, b) / mag;\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec3Like): Vec3Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec3(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec3.prototype.sub = Vec3.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.mul = Vec3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.div = Vec3.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.dist = Vec3.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.sqrDist = Vec3.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec3.sub = Vec3.subtract;\r\nVec3.mul = Vec3.multiply;\r\nVec3.div = Vec3.divide;\r\nVec3.dist = Vec3.distance;\r\nVec3.sqrDist = Vec3.squaredDistance;\r\nVec3.sqrLen = Vec3.squaredLength;\r\nVec3.mag = Vec3.magnitude;\r\nVec3.length = Vec3.magnitude;\r\nVec3.len = Vec3.magnitude;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Vec4Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 4 Dimensional Vector\r\n */\r\nexport class Vec4 extends Float32Array {\r\n /**\r\n * Create a {@link Vec4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the vector. Equivalent to `this[3];`\r\n * @category Vector Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The a component of the vector. Equivalent to `this[3];`\r\n * @category Color Components\r\n */\r\n get a(): number { return this[3]; }\r\n set a(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec4.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec4} to `this`.\r\n * Equivalent to `Vec4.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n this[3] += b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec4} from `this`.\r\n * Equivalent to `Vec4.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n this[3] -= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n this[3] *= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n this[3] /= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec4.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n this[3] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n this[3] += b[3] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec4.distance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec4.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec4.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n this[3] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec4.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n this[3] = 1.0 / this[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec4.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n this[3] = Math.abs(this[3]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec4}.\r\n * Equivalent to `Vec4.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec4.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec4.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec4}\r\n * @category Static\r\n *\r\n * @returns a new 4D vector\r\n */\r\n static create(): Vec4 {\r\n return new Vec4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 4D vector\r\n */\r\n static clone(a: Vec4Like): Vec4 {\r\n return new Vec4(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new 4D vector\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Vec4 {\r\n return new Vec4(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec4} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n static set(out: Vec4Like, x: number, y: number, z: number, w: number): Vec4Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n out[3] = a[3] * b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Divides two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n out[3] = a[3] / b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n out[3] = Math.ceil(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n out[3] = Math.floor(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n out[3] = Math.min(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n out[3] = Math.max(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n out[2] = Math.round(a[2]);\r\n out[3] = Math.round(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec4} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec4Like, a: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}'s after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec4Like, a: Readonly, b: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return Math.hypot(x, y, z, w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of `a`\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = -a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n out[3] = 1.0 / a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n out[3] = Math.abs(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec4Like, a: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n let len = x * x + y * y + z * z + w * w;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = x * len;\r\n out[1] = y * len;\r\n out[2] = z * len;\r\n out[3] = w * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Returns the cross-product of three vectors in a 4-dimensional space\r\n * @category Static\r\n *\r\n * @param out the receiving vector\r\n * @param u - the first vector\r\n * @param v - the second vector\r\n * @param w - the third vector\r\n * @returns result\r\n */\r\n static cross(out: Vec4Like, u: Readonly, v: Readonly, w: Readonly): Vec4Like {\r\n const a = v[0] * w[1] - v[1] * w[0];\r\n const b = v[0] * w[2] - v[2] * w[0];\r\n const c = v[0] * w[3] - v[3] * w[0];\r\n const d = v[1] * w[2] - v[2] * w[1];\r\n const e = v[1] * w[3] - v[3] * w[1];\r\n const f = v[2] * w[3] - v[3] * w[2];\r\n const g = u[0];\r\n const h = u[1];\r\n const i = u[2];\r\n const j = u[3];\r\n\r\n out[0] = h * f - i * e + j * d;\r\n out[1] = -(g * f) + i * c - j * b;\r\n out[2] = g * e - h * c + j * a;\r\n out[3] = -(g * d) + h * b - i * a;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec4Like, a: Readonly, b: Readonly, t: number): Vec4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n out[3] = aw + t * (b[3] - aw);\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec4Like, scale): Vec4Like {\r\n scale = scale || 1.0;\r\n\r\n // Marsaglia, George. Choosing a Point from the Surface of a\r\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\r\n // http://projecteuclid.org/euclid.aoms/1177692644;\r\n var v1, v2, v3, v4;\r\n var s1, s2;\r\n do {\r\n v1 = glMatrix.RANDOM() * 2 - 1;\r\n v2 = glMatrix.RANDOM() * 2 - 1;\r\n s1 = v1 * v1 + v2 * v2;\r\n } while (s1 >= 1);\r\n do {\r\n v3 = glMatrix.RANDOM() * 2 - 1;\r\n v4 = glMatrix.RANDOM() * 2 - 1;\r\n s2 = v3 * v3 + v4 * v4;\r\n } while (s2 >= 1);\r\n\r\n var d = Math.sqrt((1 - s1) / s2);\r\n out[0] = scale * v1;\r\n out[1] = scale * v2;\r\n out[2] = scale * v3 * d;\r\n out[3] = scale * v4 * d;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Mat4}.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec4Like, a: Readonly, m: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\r\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\r\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\r\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec4Like, a: Readonly, q: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n\r\n // calculate quat * vec\r\n const ix = qw * x + qy * z - qz * y;\r\n const iy = qw * y + qz * x - qx * z;\r\n const iz = qw * z + qx * y - qy * x;\r\n const iw = -qx * x - qy * y - qz * z;\r\n\r\n // calculate result * inverse quat\r\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\r\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\r\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec4Like): Vec4Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec4(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec4.prototype.sub = Vec4.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.mul = Vec4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.div = Vec4.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.dist = Vec4.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.sqrDist = Vec4.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec4.sub = Vec4.subtract;\r\nVec4.mul = Vec4.multiply;\r\nVec4.div = Vec4.divide;\r\nVec4.dist = Vec4.distance;\r\nVec4.sqrDist = Vec4.squaredDistance;\r\nVec4.sqrLen = Vec4.squaredLength;\r\nVec4.mag = Vec4.magnitude;\r\nVec4.length = Vec4.magnitude;\r\nVec4.len = Vec4.magnitude;\r\n", "import { Vec3 } from './Vec3.js';\r\nimport { Vec4 } from './Vec4.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Quaternion\r\n */\r\nexport class Quat extends Float32Array {\r\n static #DEFAULT_ANGLE_ORDER = 'zyx';\r\n\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT1 = new Float32Array(4);\r\n static #TMP_QUAT2 = new Float32Array(4);\r\n static #TMP_MAT3 = new Float32Array(9);\r\n\r\n static #TMP_VEC3 = new Float32Array(3);\r\n static #X_UNIT_VEC3 = new Float32Array([1, 0, 0]);\r\n static #Y_UNIT_VEC3 = new Float32Array([0, 1, 0]);\r\n\r\n /**\r\n * Create a {@link Quat}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the quaternion. Equivalent to `this[0];`\r\n * @category Quaternion Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the quaternion. Equivalent to `this[1];`\r\n * @category Quaternion Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the quaternion. Equivalent to `this[2];`\r\n * @category Quaternion Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the quaternion. Equivalent to `this[3];`\r\n * @category Quaternion Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Quat.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity quaternion\r\n * Equivalent to Quat.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this[0] = 0;\r\n this[1] = 0;\r\n this[2] = 0;\r\n this[3] = 1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies `this` by a {@link Quat}.\r\n * Equivalent to `Quat.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Quat.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Rotates `this` by the given angle about the X axis\r\n * Equivalent to `Quat.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Quat.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Y axis\r\n * Equivalent to `Quat.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Quat.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Z axis\r\n * Equivalent to `Quat.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Quat.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Inverts `this`\r\n * Equivalent to `Quat.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Quat.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales `this` by a scalar number\r\n * Equivalent to `Quat.scale(this, this, scale);`\r\n * @category Methods\r\n *\r\n * @param scale - amount to scale the vector by\r\n * @returns `this`\r\n */\r\n scale(scale: number): QuatLike {\r\n this[0] *= scale;\r\n this[1] *= scale;\r\n this[2] *= scale;\r\n this[3] *= scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of `this` and another {@link Quat}\r\n * Equivalent to `Quat.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - the second operand\r\n * @returns dot product of `this` and b\r\n */\r\n dot(b: Readonly): number {\r\n return Quat.dot(this, b);\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity quat\r\n * @category Static\r\n *\r\n * @returns a new quaternion\r\n */\r\n static create(): Quat {\r\n return new Quat();\r\n }\r\n\r\n /**\r\n * Set a quat to the identity quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a quat from the given angle and rotation axis,\r\n * then returns it.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param axis - the axis around which to rotate\r\n * @param rad - the angle in radians\r\n * @returns `out`\r\n **/\r\n static setAxisAngle(out: QuatLike, axis: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n out[0] = s * axis[0];\r\n out[1] = s * axis[1];\r\n out[2] = s * axis[2];\r\n out[3] = Math.cos(rad);\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the rotation axis and angle for a given\r\n * quaternion. If a quaternion is created with\r\n * setAxisAngle, this method will return the same\r\n * values as provided in the original parameter list\r\n * OR functionally equivalent values.\r\n * Example: The quaternion formed by axis [0, 0, 1] and\r\n * angle -90 is the same as the quaternion formed by\r\n * [0, 0, 1] and 270. This method favors the latter.\r\n * @category Static\r\n *\r\n * @param out_axis - Vector receiving the axis of rotation\r\n * @param q - Quaternion to be decomposed\r\n * @return Angle, in radians, of the rotation\r\n */\r\n static getAxisAngle(out_axis: Vec3Like, q: Readonly): number {\r\n const rad = Math.acos(q[3]) * 2.0;\r\n const s = Math.sin(rad / 2.0);\r\n if (s > GLM_EPSILON) {\r\n out_axis[0] = q[0] / s;\r\n out_axis[1] = q[1] / s;\r\n out_axis[2] = q[2] / s;\r\n } else {\r\n // If s is zero, return any axis (no rotation - axis does not matter)\r\n out_axis[0] = 1;\r\n out_axis[1] = 0;\r\n out_axis[2] = 0;\r\n }\r\n return rad;\r\n }\r\n\r\n /**\r\n * Gets the angular distance between two unit quaternions\r\n * @category Static\r\n *\r\n * @param {ReadonlyQuat} a Origin unit quaternion\r\n * @param {ReadonlyQuat} b Destination unit quaternion\r\n * @return {Number} Angle, in radians, between the two quaternions\r\n */\r\n static getAngle(a: Readonly, b: Readonly): number {\r\n const dotproduct = Quat.dot(a, b);\r\n\r\n return Math.acos(2 * dotproduct * dotproduct - 1);\r\n }\r\n\r\n /**\r\n * Multiplies two quaternions.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const bw = b[3];\r\n\r\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the X axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + aw * bx;\r\n out[1] = ay * bw + az * bx;\r\n out[2] = az * bw - ay * bx;\r\n out[3] = aw * bw - ax * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Y axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const by = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw - az * by;\r\n out[1] = ay * bw + aw * by;\r\n out[2] = az * bw + ax * by;\r\n out[3] = aw * bw - ay * by;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Z axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bz = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + ay * bz;\r\n out[1] = ay * bw - ax * bz;\r\n out[2] = az * bw + aw * bz;\r\n out[3] = aw * bw - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the W component of a quat from the X, Y, and Z components.\r\n * Assumes that quaternion is 1 unit in length.\r\n * Any existing W component will be ignored.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate W component of\r\n * @returns `out`\r\n */\r\n static calculateW(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the exponential of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static exp(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const et = Math.exp(w);\r\n const s = r > 0 ? (et * Math.sin(r)) / r : 0;\r\n\r\n out[0] = x * s;\r\n out[1] = y * s;\r\n out[2] = z * s;\r\n out[3] = et * Math.cos(r);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the natural logarithm of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static ln(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const t = r > 0 ? Math.atan2(r, w) / r : 0;\r\n\r\n out[0] = x * t;\r\n out[1] = y * t;\r\n out[2] = z * t;\r\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the scalar power of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @param b - amount to scale the quaternion by\r\n * @returns `out`\r\n */\r\n static pow(out: QuatLike, a: Readonly, b: number): QuatLike {\r\n Quat.ln(out, a);\r\n Quat.scale(out, out, b);\r\n Quat.exp(out, out);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike {\r\n // benchmarks:\r\n // http://jsperf.com/quaternion-slerp-implementations\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2],\r\n aw = a[3];\r\n let bx = b[0],\r\n by = b[1],\r\n bz = b[2],\r\n bw = b[3];\r\n\r\n let scale0: number;\r\n let scale1: number;\r\n\r\n // calc cosine\r\n let cosom = ax * bx + ay * by + az * bz + aw * bw;\r\n // adjust signs (if necessary)\r\n if (cosom < 0.0) {\r\n cosom = -cosom;\r\n bx = -bx;\r\n by = -by;\r\n bz = -bz;\r\n bw = -bw;\r\n }\r\n // calculate coefficients\r\n if (1.0 - cosom > GLM_EPSILON) {\r\n // standard case (slerp)\r\n const omega = Math.acos(cosom);\r\n const sinom = Math.sin(omega);\r\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\r\n scale1 = Math.sin(t * omega) / sinom;\r\n } else {\r\n // \"from\" and \"to\" quaternions are very close\r\n // ... so we can do a linear interpolation\r\n scale0 = 1.0 - t;\r\n scale1 = t;\r\n }\r\n // calculate final values\r\n out[0] = scale0 * ax + scale1 * bx;\r\n out[1] = scale0 * ay + scale1 * by;\r\n out[2] = scale0 * az + scale1 * bz;\r\n out[3] = scale0 * aw + scale1 * bw;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random unit quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n /* static random(out: QuatLike): QuatLike {\r\n // Implementation of http://planning.cs.uiuc.edu/node198.html\r\n // TODO: Calling random 3 times is probably not the fastest solution\r\n let u1 = glMatrix.RANDOM();\r\n let u2 = glMatrix.RANDOM();\r\n let u3 = glMatrix.RANDOM();\r\n\r\n let sqrt1MinusU1 = Math.sqrt(1 - u1);\r\n let sqrtU1 = Math.sqrt(u1);\r\n\r\n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\r\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\r\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\r\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Calculates the inverse of a quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: QuatLike, a: Readonly): QuatLike {\r\n const a0 = a[0],\r\n a1 = a[1],\r\n a2 = a[2],\r\n a3 = a[3];\r\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\r\n const invDot = dot ? 1.0 / dot : 0;\r\n\r\n // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\r\n\r\n out[0] = -a0 * invDot;\r\n out[1] = -a1 * invDot;\r\n out[2] = -a2 * invDot;\r\n out[3] = a3 * invDot;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a quat\r\n * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given 3x3 rotation matrix.\r\n *\r\n * NOTE: The resultant quaternion is not normalized, so you should be sure\r\n * to re-normalize the quaternion yourself where necessary.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param m - rotation matrix\r\n * @returns `out`\r\n */\r\n static fromMat3(out: QuatLike, m: Readonly): QuatLike {\r\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\r\n // article \"Quaternion Calculus and Fast Animation\".\r\n const fTrace = m[0] + m[4] + m[8];\r\n let fRoot: number;\r\n\r\n if (fTrace > 0.0) {\r\n // |w| > 1/2, may as well choose w > 1/2\r\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\r\n out[3] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot; // 1/(4w)\r\n out[0] = (m[5] - m[7]) * fRoot;\r\n out[1] = (m[6] - m[2]) * fRoot;\r\n out[2] = (m[1] - m[3]) * fRoot;\r\n } else {\r\n // |w| <= 1/2\r\n let i = 0;\r\n if (m[4] > m[0]) { i = 1; }\r\n if (m[8] > m[i * 3 + i]) { i = 2; }\r\n const j = (i + 1) % 3;\r\n const k = (i + 2) % 3;\r\n\r\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\r\n out[i] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot;\r\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\r\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\r\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given euler angle x, y, z.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - Angle to rotate around X axis in degrees.\r\n * @param y - Angle to rotate around Y axis in degrees.\r\n * @param z - Angle to rotate around Z axis in degrees.\r\n * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx.\r\n * @returns `out`\r\n */\r\n static fromEuler(out: QuatLike, x: number, y: number, z: number, order = Quat.#DEFAULT_ANGLE_ORDER): QuatLike {\r\n const halfToRad = (0.5 * Math.PI) / 180.0;\r\n x *= halfToRad;\r\n y *= halfToRad;\r\n z *= halfToRad;\r\n\r\n const sx = Math.sin(x);\r\n const cx = Math.cos(x);\r\n const sy = Math.sin(y);\r\n const cy = Math.cos(y);\r\n const sz = Math.sin(z);\r\n const cz = Math.cos(z);\r\n\r\n switch (order) {\r\n case 'xyz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'xzy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yxz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yzx':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zxy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zyx':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n default:\r\n throw new Error(`Unknown angle order ${order}`);\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a quatenion\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - quaternion to clone\r\n * @returns a new quaternion\r\n */\r\n static clone(a: Readonly): Quat {\r\n return new Quat(a);\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new quaternion\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Quat {\r\n return new Quat(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one quat to another\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the source quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static set(out: QuatLike, x: number, y: number, z: number, w: number): QuatLike { return out; }\r\n\r\n /**\r\n * Adds two {@link Quat}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static add(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Scales a quat by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param b - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: QuatLike, a: Readonly, scale: number): QuatLike {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two quat's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two quat's\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static lerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike { return out; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mag(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quaternion to normalize\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static normalize(out: QuatLike, a: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first quaternion.\r\n * @param b - The second quaternion.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static exactEquals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Returns whether the quaternions have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static equals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Sets a quaternion to represent the shortest rotation from one\r\n * vector to another.\r\n *\r\n * Both vectors are assumed to be unit length.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion.\r\n * @param a - the initial vector\r\n * @param b - the destination vector\r\n * @returns `out`\r\n */\r\n static rotationTo(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const dot = Vec3.dot(a, b);\r\n\r\n if (dot < -0.999999) {\r\n Vec3.cross(Quat.#TMP_VEC3, Quat.#X_UNIT_VEC3, a);\r\n if (Vec3.mag(Quat.#TMP_VEC3) < 0.000001) { Vec3.cross(Quat.#TMP_VEC3, Quat.#Y_UNIT_VEC3, a); }\r\n Vec3.normalize(Quat.#TMP_VEC3, Quat.#TMP_VEC3);\r\n Quat.setAxisAngle(out, Quat.#TMP_VEC3, Math.PI);\r\n return out;\r\n } else if (dot > 0.999999) {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n } else {\r\n Vec3.cross(Quat.#TMP_VEC3, a, b);\r\n out[0] = Quat.#TMP_VEC3[0];\r\n out[1] = Quat.#TMP_VEC3[1];\r\n out[2] = Quat.#TMP_VEC3[2];\r\n out[3] = 1 + dot;\r\n return Quat.normalize(out, out);\r\n }\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static sqlerp(out: QuatLike, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): QuatLike {\r\n Quat.slerp(Quat.#TMP_QUAT1, a, d, t);\r\n Quat.slerp(Quat.#TMP_QUAT2, b, c, t);\r\n Quat.slerp(out, Quat.#TMP_QUAT1, Quat.#TMP_QUAT2, 2 * t * (1 - t));\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets the specified quaternion with values corresponding to the given\r\n * axes. Each axis is a vec3 and is expected to be unit length and\r\n * perpendicular to all other specified axes.\r\n * @category Static\r\n *\r\n * @param out - The receiving quaternion\r\n * @param view - the vector representing the viewing direction\r\n * @param right - the vector representing the local `right` direction\r\n * @param up - the vector representing the local `up` direction\r\n * @returns `out`\r\n */\r\n static setAxes(out: QuatLike, view: Readonly, right: Readonly, up: Readonly): QuatLike {\r\n Quat.#TMP_MAT3[0] = right[0];\r\n Quat.#TMP_MAT3[3] = right[1];\r\n Quat.#TMP_MAT3[6] = right[2];\r\n\r\n Quat.#TMP_MAT3[1] = up[0];\r\n Quat.#TMP_MAT3[4] = up[1];\r\n Quat.#TMP_MAT3[7] = up[2];\r\n\r\n Quat.#TMP_MAT3[2] = -view[0];\r\n Quat.#TMP_MAT3[5] = -view[1];\r\n Quat.#TMP_MAT3[8] = -view[2];\r\n\r\n return Quat.normalize(out, Quat.fromMat3(out, Quat.#TMP_MAT3));\r\n }\r\n}\r\n\r\n// Methods which re-use the Vec4 implementation\r\nQuat.set = Vec4.set;\r\nQuat.add = Vec4.add;\r\nQuat.lerp = Vec4.lerp;\r\nQuat.normalize = Vec4.normalize;\r\nQuat.squaredLength = Vec4.squaredLength;\r\nQuat.sqrLen = Vec4.squaredLength;\r\nQuat.exactEquals = Vec4.exactEquals;\r\nQuat.equals = Vec4.equals;\r\nQuat.magnitude = Vec4.magnitude;\r\n\r\n// Instance method alias assignments\r\nQuat.prototype.mul = Quat.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nQuat.mul = Quat.multiply;\r\nQuat.mag = Quat.magnitude;\r\nQuat.length = Quat.magnitude;\r\nQuat.len = Quat.magnitude;\r\n", "import { Mat4 } from './Mat4.js';\r\nimport { Quat } from './Quat.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Dual Quaternion\r\n */\r\nexport class Quat2 extends Float32Array {\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat2.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT = new Float32Array(4);\r\n static #TMP_VEC3 = new Float32Array(3);\r\n\r\n /**\r\n * Create a {@link Quat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 8:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 8); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v, v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 8);\r\n }\r\n break;\r\n }\r\n default:\r\n super(8);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source dual quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 8 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity {@link Quat2}\r\n * @category Static\r\n *\r\n * @returns a new dual quaternion [real -> rotation, dual -> translation]\r\n */\r\n static create(): Quat2 {\r\n return new Quat2();\r\n }\r\n\r\n /**\r\n * Creates a {@link Quat2} quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to clone\r\n * @returns a new dual quaternion\r\n */\r\n static clone(a: Quat2Like): Quat2 {\r\n return new Quat2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns a new dual quaternion\r\n */\r\n static fromValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2 {\r\n return new Quat2(x1, y1, z1, w1, x2, y2, z2, w2);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} from the given values (quat and translation)\r\n * @category Static\r\n *\r\n * @param x1 - X component (rotation)\r\n * @param y1 - Y component (rotation)\r\n * @param z1 - Z component (rotation)\r\n * @param w1 - W component (rotation)\r\n * @param x2 - X component (translation)\r\n * @param y2 - Y component (translation)\r\n * @param z2 - Z component (translation)\r\n * @returns a new dual quaternion\r\n */\r\n static fromRotationTranslationValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number): Quat2 {\r\n const ax = x2 * 0.5;\r\n const ay = y2 * 0.5;\r\n const az = z2 * 0.5;\r\n\r\n return new Quat2(x1, y1, z1, w1,\r\n ax * w1 + ay * z1 - az * y1,\r\n ay * w1 + az * x1 - ax * z1,\r\n az * w1 + ax * y1 - ay * x1,\r\n -ax * x1 - ay * y1 - az * z1);\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion and a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Quat2Like, q: Readonly, t: Readonly): Quat2Like {\r\n const ax = t[0] * 0.5;\r\n const ay = t[1] * 0.5;\r\n const az = t[2] * 0.5;\r\n const bx = q[0];\r\n const by = q[1];\r\n const bz = q[2];\r\n const bw = q[3];\r\n out[0] = bx;\r\n out[1] = by;\r\n out[2] = bz;\r\n out[3] = bw;\r\n out[4] = ax * bw + ay * bz - az * by;\r\n out[5] = ay * bw + az * bx - ax * bz;\r\n out[6] = az * bw + ax * by - ay * bx;\r\n out[7] = -ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Quat2Like, t: Readonly): Quat2Like {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = t[0] * 0.5;\r\n out[5] = t[1] * 0.5;\r\n out[6] = t[2] * 0.5;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Quat2Like, q: Readonly): Quat2Like {\r\n out[0] = q[0];\r\n out[1] = q[1];\r\n out[2] = q[2];\r\n out[3] = q[3];\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param a - the matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Quat2Like, a: Readonly): Quat2Like {\r\n Mat4.getRotation(Quat2.#TMP_QUAT, a);\r\n Mat4.getTranslation(Quat2.#TMP_VEC3, a);\r\n return Quat2.fromRotationTranslation(out, Quat2.#TMP_QUAT, Quat2.#TMP_VEC3);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Quat2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the source dual quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Quat2} to the identity dual quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns `out`\r\n */\r\n static set(out: Quat2Like, x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2Like {\r\n out[0] = x1;\r\n out[1] = y1;\r\n out[2] = z1;\r\n out[3] = w1;\r\n out[4] = x2;\r\n out[5] = y2;\r\n out[6] = z2;\r\n out[7] = w2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the real part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - real part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getReal(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Gets the dual part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - dual part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getDual(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[4];\r\n out[1] = a[5];\r\n out[2] = a[6];\r\n out[3] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the real component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the real part\r\n * @return `out`\r\n */\r\n static setReal(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Set the dual component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the dual part\r\n * @return `out`\r\n */\r\n static setDual(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[4] = a[0];\r\n out[5] = a[1];\r\n out[6] = a[2];\r\n out[7] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the translation of a normalized {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving translation vector\r\n * @param a - Dual Quaternion to be decomposed\r\n * @return `out`\r\n */\r\n static getTranslation(out: Vec3Like, a: Readonly): Vec3Like {\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Translates a {@link Quat2} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Quat2Like, a: Readonly, v: Readonly): Quat2Like {\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n const bx1 = v[0] * 0.5;\r\n const by1 = v[1] * 0.5;\r\n const bz1 = v[2] * 0.5;\r\n const ax2 = a[4];\r\n const ay2 = a[5];\r\n const az2 = a[6];\r\n const aw2 = a[7];\r\n out[0] = ax1;\r\n out[1] = ay1;\r\n out[2] = az1;\r\n out[3] = aw1;\r\n out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2;\r\n out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2;\r\n out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2;\r\n out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateX(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateY(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateZ(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (a * q)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param q - quaternion to rotate by\r\n * @returns `out`\r\n */\r\n static rotateByQuatAppend(out: Quat2Like, a: Readonly, q: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let ax = a[0];\r\n let ay = a[1];\r\n let az = a[2];\r\n let aw = a[3];\r\n\r\n out[0] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[1] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[2] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[3] = aw * qw - ax * qx - ay * qy - az * qz;\r\n ax = a[4];\r\n ay = a[5];\r\n az = a[6];\r\n aw = a[7];\r\n out[4] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[5] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[6] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[7] = aw * qw - ax * qx - ay * qy - az * qz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (q * a)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param q - quaternion to rotate by\r\n * @param a - the dual quaternion to rotate\r\n * @returns `out`\r\n */\r\n static rotateByQuatPrepend(out: Quat2Like, q: Readonly, a: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let bx = a[0];\r\n let by = a[1];\r\n let bz = a[2];\r\n let bw = a[3];\r\n\r\n out[0] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[1] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[2] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[3] = qw * bw - qx * bx - qy * by - qz * bz;\r\n bx = a[4];\r\n by = a[5];\r\n bz = a[6];\r\n bw = a[7];\r\n out[4] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[5] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[6] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[7] = qw * bw - qx * bx - qy * by - qz * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around a given axis. Does the normalization automatically\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param axis - the axis to rotate around\r\n * @param rad - how far the rotation should be\r\n * @returns `out`\r\n */\r\n static rotateAroundAxis(out: Quat2Like, a: Readonly, axis: Readonly, rad: number): Quat2Like {\r\n // Special case for rad = 0\r\n if (Math.abs(rad) < GLM_EPSILON) {\r\n return Quat2.copy(out, a);\r\n }\r\n const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);\r\n\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n const bx = (s * axis[0]) / axisLength;\r\n const by = (s * axis[1]) / axisLength;\r\n const bz = (s * axis[2]) / axisLength;\r\n const bw = Math.cos(rad);\r\n\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n out[4] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[5] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[6] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[7] = aw * bw - ax * bx - ay * by - az * bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns {quat2} out\r\n */\r\n static multiply(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n const ax0 = a[0];\r\n const ay0 = a[1];\r\n const az0 = a[2];\r\n const aw0 = a[3];\r\n const bx1 = b[4];\r\n const by1 = b[5];\r\n const bz1 = b[6];\r\n const bw1 = b[7];\r\n const ax1 = a[4];\r\n const ay1 = a[5];\r\n const az1 = a[6];\r\n const aw1 = a[7];\r\n const bx0 = b[0];\r\n const by0 = b[1];\r\n const bz0 = b[2];\r\n const bw0 = b[3];\r\n out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0;\r\n out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0;\r\n out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0;\r\n out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0;\r\n out[4] =\r\n ax0 * bw1 +\r\n aw0 * bx1 +\r\n ay0 * bz1 -\r\n az0 * by1 +\r\n ax1 * bw0 +\r\n aw1 * bx0 +\r\n ay1 * bz0 -\r\n az1 * by0;\r\n out[5] =\r\n ay0 * bw1 +\r\n aw0 * by1 +\r\n az0 * bx1 -\r\n ax0 * bz1 +\r\n ay1 * bw0 +\r\n aw1 * by0 +\r\n az1 * bx0 -\r\n ax1 * bz0;\r\n out[6] =\r\n az0 * bw1 +\r\n aw0 * bz1 +\r\n ax0 * by1 -\r\n ay0 * bx1 +\r\n az1 * bw0 +\r\n aw1 * bz0 +\r\n ax1 * by0 -\r\n ay1 * bx0;\r\n out[7] =\r\n aw0 * bw1 -\r\n ax0 * bx1 -\r\n ay0 * by1 -\r\n az0 * bz1 +\r\n aw1 * bw0 -\r\n ax1 * bx0 -\r\n ay1 * by0 -\r\n az1 * bz0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like { return out; }\r\n\r\n /**\r\n * Scales a {@link Quat2} by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaterion\r\n * @param a - the dual quaternion to scale\r\n * @param b - scalar value to scale the dual quaterion by\r\n * @returns `out`\r\n */\r\n static scale(out: Quat2Like, a: Readonly, b: number): Quat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts)\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dot(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Quat2}s\r\n * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quat\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Quat2Like, a: Readonly, b: Readonly, t: number): Quat2Like {\r\n const mt = 1 - t;\r\n if (Quat2.dot(a, b) < 0) { t = -t; }\r\n\r\n out[0] = a[0] * mt + b[0] * t;\r\n out[1] = a[1] * mt + b[1] * t;\r\n out[2] = a[2] * mt + b[2] * t;\r\n out[3] = a[3] * mt + b[3] * t;\r\n out[4] = a[4] * mt + b[4] * t;\r\n out[5] = a[5] * mt + b[5] * t;\r\n out[6] = a[6] * mt + b[6] * t;\r\n out[7] = a[7] * mt + b[7] * t;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: Quat2Like, a: Readonly): Quat2Like {\r\n const sqlen = Quat2.squaredLength(a);\r\n out[0] = -a[0] / sqlen;\r\n out[1] = -a[1] / sqlen;\r\n out[2] = -a[2] / sqlen;\r\n out[3] = a[3] / sqlen;\r\n out[4] = -a[4] / sqlen;\r\n out[5] = -a[5] / sqlen;\r\n out[6] = -a[6] / sqlen;\r\n out[7] = a[7] / sqlen;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than\r\n * {@link Quat2.invert} and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n out[4] = -a[4];\r\n out[5] = -a[5];\r\n out[6] = -a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Quat2Like, a: Readonly): Quat2Like {\r\n let magnitude = Quat2.squaredLength(a);\r\n if (magnitude > 0) {\r\n magnitude = Math.sqrt(magnitude);\r\n\r\n const a0 = a[0] / magnitude;\r\n const a1 = a[1] / magnitude;\r\n const a2 = a[2] / magnitude;\r\n const a3 = a[3] / magnitude;\r\n\r\n const b0 = a[4];\r\n const b1 = a[5];\r\n const b2 = a[6];\r\n const b3 = a[7];\r\n\r\n const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3;\r\n\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n\r\n out[4] = (b0 - a0 * a_dot_b) / magnitude;\r\n out[5] = (b1 - a1 * a_dot_b) / magnitude;\r\n out[6] = (b2 - a2 * a_dot_b) / magnitude;\r\n out[7] = (b3 - a3 * a_dot_b) / magnitude;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat2(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7))\r\n );\r\n }\r\n}\r\n\r\n// Methods which re-use the Quat implementation\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.dot = Quat.dot;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.squaredLength = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.sqrLen = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.mag = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.length = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.len = Quat.magnitude;\r\n\r\n// Static method alias assignments\r\nQuat2.mul = Quat2.multiply;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Mat2dLike, Mat3Like, Mat4Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 2 Dimensional Vector\r\n */\r\nexport class Vec2 extends Float32Array {\r\n /**\r\n * Create a {@link Vec2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 2:{\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, values[1]!]);\r\n } else {\r\n super(v as ArrayBufferLike, values[1], 2);\r\n }\r\n break;\r\n }\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 2);\r\n }\r\n break;\r\n }\r\n default:\r\n super(2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec2.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n return Math.hypot(this[0], this[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec2.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n // Instead of zero(), use a.fill(0) for instances;\r\n\r\n /**\r\n * Adds a {@link Vec2} to `this`.\r\n * Equivalent to `Vec2.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec2} from `this`.\r\n * Equivalent to `Vec2.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec2.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec2.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec2.squaredDistance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec2.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec2.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec2.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec2}.\r\n * Equivalent to `Vec2.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec2.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec2.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 2 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec2}\r\n * @category Static\r\n *\r\n * @returns A new 2D vector\r\n */\r\n static create(): Vec2 {\r\n return new Vec2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - Vector to clone\r\n * @returns A new 2D vector\r\n */\r\n static clone(a: Readonly): Vec2 {\r\n return new Vec2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns A new 2D vector\r\n */\r\n static fromValues(x: number, y: number): Vec2 {\r\n return new Vec2(x, y);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - The source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns `out`\r\n */\r\n static set(out: Vec2Like, x: number, y: number): Vec2Like {\r\n out[0] = x;\r\n out[1] = y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Multiplies two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Divides two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec2} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to scale\r\n * @param b - Amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec2Like, a: Readonly, b: number): Vec2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two Vec2's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param scale - The amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec2Like, a: Readonly, b: Readonly, scale: number): Vec2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns distance between `a` and `b`\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n return Math.hypot(b[0] - a[0], b[1] - a[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Squared distance between `a` and `b`\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return Math.sqrt(x * x + y * y);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate squared length of\r\n * @returns Squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec2Like, a: Readonly) {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec2Like, a: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n let len = x * x + y * y;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Dot product of `a` and `b`\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two {@link Vec2}s\r\n * Note that the cross product must by definition produce a 3D vector.\r\n * For this reason there is also not instance equivalent for this function.\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n const z = a[0] * b[1] - a[1] * b[0];\r\n out[0] = out[1] = 0;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param t - Interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec2Like, a: Readonly, b: Readonly, t: number): Vec2Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y;\r\n out[1] = m[1] * x + m[3] * y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2d}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2d(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y + m[4];\r\n out[1] = m[1] * x + m[3] * y + m[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat3}\r\n * 3rd vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat3(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[3] * y + m[6];\r\n out[1] = m[1] * x + m[4] * y + m[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat4}\r\n * 3rd vector component is implicitly '0'\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat4(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[4] * y + m[12];\r\n out[1] = m[1] * x + m[5] * y + m[13];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 2D vector\r\n * @category Static\r\n *\r\n * @param out - The receiving {@link Vec2}\r\n * @param a - The {@link Vec2} point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotate(out: Vec2Like, a: Readonly, b: Readonly, rad: number): Vec2Like {\r\n // Translate point to the origin\r\n const p0 = a[0] - b[0];\r\n const p1 = a[1] - b[1];\r\n const sinC = Math.sin(rad);\r\n const cosC = Math.cos(rad);\r\n\r\n // perform rotation and translate to correct position\r\n out[0] = p0 * cosC - p1 * sinC + b[0];\r\n out[1] = p0 * sinC + p1 * cosC + b[1];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 2D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly): number {\r\n const x1 = a[0];\r\n const y1 = a[1];\r\n const x2 = b[0];\r\n const y2 = b[1];\r\n // mag is the product of the magnitudes of a and b\r\n const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2);\r\n // mag &&.. short circuits if mag == 0\r\n const cosine = mag && (x1 * x2 + y1 * y2) / mag;\r\n // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to zero\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec2Like): Vec2Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors components are ===, `false` otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors are approximately equal, `false` otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - Vector to represent as a string\r\n * @returns String representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec2.prototype.sub = Vec2.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.mul = Vec2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.div = Vec2.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.dist = Vec2.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.sqrDist = Vec2.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec2.sub = Vec2.subtract;\r\nVec2.mul = Vec2.multiply;\r\nVec2.div = Vec2.divide;\r\nVec2.dist = Vec2.distance;\r\nVec2.sqrDist = Vec2.squaredDistance;\r\nVec2.sqrLen = Vec2.squaredLength;\r\nVec2.mag = Vec2.magnitude;\r\nVec2.length = Vec2.magnitude;\r\nVec2.len = Vec2.magnitude;\r\n", "/**\r\n * To enable additional swizzle accessors for vector classes (32-bit) invoke the {@link EnableSwizzles} function from\r\n * the `gl-matrix/swizzle` sub-path export. To enable ambient module declarations for IDE / Typescript support please\r\n * see {@link gl-matrix/types/swizzle}.\r\n *\r\n * To enable swizzling for the 64-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle/f64}.\r\n *\r\n * @example\r\n * ```ts\r\n * import { Vec3 } from 'gl-matrix';\r\n * import { EnableSwizzles } from 'gl-matrix/swizzle';\r\n *\r\n * EnableSwizzles();\r\n *\r\n * const vec = new Vec3(0, 1, 2);\r\n * const vecSwizzled = vec.zyx; // Returns a new Vec3(2, 1, 0).\r\n * ```\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\nimport { Vec2, Vec3, Vec4 } from '#gl-matrix';\r\n\r\n/**\r\n * Internal `gl-matrix` variable tracking if swizzling is enabled (32-bit).\r\n */\r\nlet GLM_SWIZZLES_ENABLED_F32 = false;\r\n\r\n/**\r\n * Enables Swizzle operations on {@link gl-matrix.Vec2 | Vec2} / {@link gl-matrix.Vec3 | Vec3} /\r\n * {@link gl-matrix.Vec4 | Vec4} types from {@link gl-matrix | gl-matrix} (32-bit).\r\n *\r\n * Swizzle operations are performed by using the `.` operator in conjunction with any combination\r\n * of between two and four component names, either from the set `xyzw` or `rgbw` (though not intermixed).\r\n * They return a new vector with the same number of components as specified in the swizzle attribute.\r\n *\r\n * @example\r\n * ```js\r\n * import { Vec3, EnableSwizzles } from 'gl-matrix';\r\n *\r\n * EnableSwizzles();\r\n *\r\n * let v = new Vec3(0, 1, 2);\r\n *\r\n * v.yx; // returns new Vec2(1, 0)\r\n * v.xzy; // returns new Vec3(0, 2, 1)\r\n * v.zyxz; // returns new Vec4(2, 1, 0, 2)\r\n *\r\n * v.rgb; // returns new Vec3(0, 1, 2)\r\n * v.rbg; // returns new Vec3(0, 2, 1)\r\n * v.gg; // returns new Vec2(1, 1)\r\n * ```\r\n */\r\nexport function EnableSwizzles(): void {\r\n /* v8 ignore next 1 */\r\n if (GLM_SWIZZLES_ENABLED_F32) { return; }\r\n\r\n /* eslint-disable comma-spacing, max-len */\r\n\r\n // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should\r\n // not be modified by hand.\r\n // [Swizzle Autogen]\r\n\r\n const VEC2_SWIZZLES = ['xx','xy','yx','yy','xxx','xxy','xyx','xyy','yxx','yxy','yyx','yyy','xxxx','xxxy','xxyx','xxyy','xyxx','xyxy','xyyx','xyyy','yxxx','yxxy','yxyx','yxyy','yyxx','yyxy','yyyx','yyyy','rr','rg','gr','gg','rrr','rrg','rgr','rgg','grr','grg','ggr','ggg','rrrr','rrrg','rrgr','rrgg','rgrr','rgrg','rggr','rggg','grrr','grrg','grgr','grgg','ggrr','ggrg','gggr','gggg'];\r\n const VEC3_SWIZZLES = ['xz','yz','zx','zy','zz','xxz','xyz','xzx','xzy','xzz','yxz','yyz','yzx','yzy','yzz','zxx','zxy','zxz','zyx','zyy','zyz','zzx','zzy','zzz','xxxz','xxyz','xxzx','xxzy','xxzz','xyxz','xyyz','xyzx','xyzy','xyzz','xzxx','xzxy','xzxz','xzyx','xzyy','xzyz','xzzx','xzzy','xzzz','yxxz','yxyz','yxzx','yxzy','yxzz','yyxz','yyyz','yyzx','yyzy','yyzz','yzxx','yzxy','yzxz','yzyx','yzyy','yzyz','yzzx','yzzy','yzzz','zxxx','zxxy','zxxz','zxyx','zxyy','zxyz','zxzx','zxzy','zxzz','zyxx','zyxy','zyxz','zyyx','zyyy','zyyz','zyzx','zyzy','zyzz','zzxx','zzxy','zzxz','zzyx','zzyy','zzyz','zzzx','zzzy','zzzz','rb','gb','br','bg','bb','rrb','rgb','rbr','rbg','rbb','grb','ggb','gbr','gbg','gbb','brr','brg','brb','bgr','bgg','bgb','bbr','bbg','bbb','rrrb','rrgb','rrbr','rrbg','rrbb','rgrb','rggb','rgbr','rgbg','rgbb','rbrr','rbrg','rbrb','rbgr','rbgg','rbgb','rbbr','rbbg','rbbb','grrb','grgb','grbr','grbg','grbb','ggrb','gggb','ggbr','ggbg','ggbb','gbrr','gbrg','gbrb','gbgr','gbgg','gbgb','gbbr','gbbg','gbbb','brrr','brrg','brrb','brgr','brgg','brgb','brbr','brbg','brbb','bgrr','bgrg','bgrb','bggr','bggg','bggb','bgbr','bgbg','bgbb','bbrr','bbrg','bbrb','bbgr','bbgg','bbgb','bbbr','bbbg','bbbb'];\r\n const VEC4_SWIZZLES = ['xw','yw','zw','wx','wy','wz','ww','xxw','xyw','xzw','xwx','xwy','xwz','xww','yxw','yyw','yzw','ywx','ywy','ywz','yww','zxw','zyw','zzw','zwx','zwy','zwz','zww','wxx','wxy','wxz','wxw','wyx','wyy','wyz','wyw','wzx','wzy','wzz','wzw','wwx','wwy','wwz','www','xxxw','xxyw','xxzw','xxwx','xxwy','xxwz','xxww','xyxw','xyyw','xyzw','xywx','xywy','xywz','xyww','xzxw','xzyw','xzzw','xzwx','xzwy','xzwz','xzww','xwxx','xwxy','xwxz','xwxw','xwyx','xwyy','xwyz','xwyw','xwzx','xwzy','xwzz','xwzw','xwwx','xwwy','xwwz','xwww','yxxw','yxyw','yxzw','yxwx','yxwy','yxwz','yxww','yyxw','yyyw','yyzw','yywx','yywy','yywz','yyww','yzxw','yzyw','yzzw','yzwx','yzwy','yzwz','yzww','ywxx','ywxy','ywxz','ywxw','ywyx','ywyy','ywyz','ywyw','ywzx','ywzy','ywzz','ywzw','ywwx','ywwy','ywwz','ywww','zxxw','zxyw','zxzw','zxwx','zxwy','zxwz','zxww','zyxw','zyyw','zyzw','zywx','zywy','zywz','zyww','zzxw','zzyw','zzzw','zzwx','zzwy','zzwz','zzww','zwxx','zwxy','zwxz','zwxw','zwyx','zwyy','zwyz','zwyw','zwzx','zwzy','zwzz','zwzw','zwwx','zwwy','zwwz','zwww','wxxx','wxxy','wxxz','wxxw','wxyx','wxyy','wxyz','wxyw','wxzx','wxzy','wxzz','wxzw','wxwx','wxwy','wxwz','wxww','wyxx','wyxy','wyxz','wyxw','wyyx','wyyy','wyyz','wyyw','wyzx','wyzy','wyzz','wyzw','wywx','wywy','wywz','wyww','wzxx','wzxy','wzxz','wzxw','wzyx','wzyy','wzyz','wzyw','wzzx','wzzy','wzzz','wzzw','wzwx','wzwy','wzwz','wzww','wwxx','wwxy','wwxz','wwxw','wwyx','wwyy','wwyz','wwyw','wwzx','wwzy','wwzz','wwzw','wwwx','wwwy','wwwz','wwww','ra','ga','ba','ar','ag','ab','aa','rra','rga','rba','rar','rag','rab','raa','gra','gga','gba','gar','gag','gab','gaa','bra','bga','bba','bar','bag','bab','baa','arr','arg','arb','ara','agr','agg','agb','aga','abr','abg','abb','aba','aar','aag','aab','aaa','rrra','rrga','rrba','rrar','rrag','rrab','rraa','rgra','rgga','rgba','rgar','rgag','rgab','rgaa','rbra','rbga','rbba','rbar','rbag','rbab','rbaa','rarr','rarg','rarb','rara','ragr','ragg','ragb','raga','rabr','rabg','rabb','raba','raar','raag','raab','raaa','grra','grga','grba','grar','grag','grab','graa','ggra','ggga','ggba','ggar','ggag','ggab','ggaa','gbra','gbga','gbba','gbar','gbag','gbab','gbaa','garr','garg','garb','gara','gagr','gagg','gagb','gaga','gabr','gabg','gabb','gaba','gaar','gaag','gaab','gaaa','brra','brga','brba','brar','brag','brab','braa','bgra','bgga','bgba','bgar','bgag','bgab','bgaa','bbra','bbga','bbba','bbar','bbag','bbab','bbaa','barr','barg','barb','bara','bagr','bagg','bagb','baga','babr','babg','babb','baba','baar','baag','baab','baaa','arrr','arrg','arrb','arra','argr','argg','argb','arga','arbr','arbg','arbb','arba','arar','arag','arab','araa','agrr','agrg','agrb','agra','aggr','aggg','aggb','agga','agbr','agbg','agbb','agba','agar','agag','agab','agaa','abrr','abrg','abrb','abra','abgr','abgg','abgb','abga','abbr','abbg','abbb','abba','abar','abag','abab','abaa','aarr','aarg','aarb','aara','aagr','aagg','aagb','aaga','aabr','aabg','aabb','aaba','aaar','aaag','aaab','aaaa'];\r\n\r\n // [/Swizzle Autogen]\r\n\r\n /* eslint-enable comma-spacing, max-len */\r\n\r\n /**\r\n * Internal swizzle index table for `gl-matrix`.\r\n */\r\n const SWIZZLE_INDEX: Record = {\r\n x: 0, r: 0,\r\n y: 1, g: 1,\r\n z: 2, b: 2,\r\n w: 3, a: 3,\r\n };\r\n\r\n /**\r\n * Internal helper function to convert and return a `gl-matrix` vector by swizzle format.\r\n *\r\n * @param swizzle - Swizzle format to apply.\r\n * @returns {Vec2 | Vec3 | Vec4} New swizzled vector instance.\r\n */\r\n function getSwizzleImpl(swizzle: string): () => Vec2 | Vec3 | Vec4 {\r\n switch (swizzle.length) {\r\n case 2:\r\n return function(this: Float32Array) {\r\n return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]);\r\n };\r\n case 3:\r\n return function(this: Float32Array) {\r\n return new Vec3(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]]);\r\n };\r\n case 4:\r\n return function(this: Float32Array) {\r\n return new Vec4(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]], this[SWIZZLE_INDEX[swizzle[3]]]);\r\n };\r\n }\r\n\r\n throw new Error('Illegal swizzle length');\r\n }\r\n\r\n for (const swizzle of VEC2_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec2.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC3_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC4_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n GLM_SWIZZLES_ENABLED_F32 = true;\r\n}\r\n", "/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_DEG_TO_RAD: number = Math.PI / 180;\r\n\r\n/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_RAD_TO_DEG: number = 180 / Math.PI;\r\n\r\n/**\r\n * Convert `radians` to `degrees`.\r\n *\r\n * @param value - Angle in `radians`.\r\n * @returns Angle in `degrees`.\r\n */\r\nexport function toDegree(value: number): number {\r\n return value * GLM_RAD_TO_DEG;\r\n}\r\n\r\n/**\r\n * Convert `degrees` to `radians`.\r\n *\r\n * @param value - Angle in `degrees`.\r\n * @returns Angle in `radians`.\r\n */\r\nexport function toRadian(value: number): number {\r\n return value * GLM_DEG_TO_RAD;\r\n}\r\n"], + "mappings": ";;;;;;AASO,IAAM,cAAc;;;ACFpB,IAAM,OAAN,MAAM,cAAa,aAAa;AAAA,EACrC,OAAO,gBAAgB,IAAI,aAAa;AAAA,IACtC;AAAA,IAAG;AAAA,IACH;AAAA,IAAG;AAAA,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;AAEA,aAAW,WAAW,eAAe;AACnC,UAAM,OAAO,eAAe,OAAO;AACnC,WAAO,eAAe,KAAK,WAAW,SAAS;AAAA,MAC7C,KAAK;AAAA,IACP,CAAC;AACD,WAAO,eAAe,KAAK,WAAW,SAAS;AAAA,MAC7C,KAAK;AAAA,IACP,CAAC;AACD,WAAO,eAAe,KAAK,WAAW,SAAS;AAAA,MAC7C,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAEA,aAAW,WAAW,eAAe;AACnC,UAAM,OAAO,eAAe,OAAO;AACnC,WAAO,eAAe,KAAK,WAAW,SAAS;AAAA,MAC7C,KAAK;AAAA,IACP,CAAC;AACD,WAAO,eAAe,KAAK,WAAW,SAAS;AAAA,MAC7C,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAEA,aAAW,WAAW,eAAe;AACnC,UAAM,OAAO,eAAe,OAAO;AACnC,WAAO,eAAe,KAAK,WAAW,SAAS;AAAA,MAC7C,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAEA,6BAA2B;AAC7B;;;ACxIA,IAAM,iBAAyB,KAAK,KAAK;AAKzC,IAAM,iBAAyB,MAAM,KAAK;AAQnC,SAAS,SAAS,OAAuB;AAC9C,SAAO,QAAQ;AACjB;AAQO,SAAS,SAAS,OAAuB;AAC9C,SAAO,QAAQ;AACjB;", + "names": [] +} diff --git a/dist-cdn/esm/2022/gl-matrix-f32.min.js b/dist-cdn/esm/2022/gl-matrix-f32.min.js new file mode 100644 index 00000000..7c0105dc --- /dev/null +++ b/dist-cdn/esm/2022/gl-matrix-f32.min.js @@ -0,0 +1,6 @@ +// gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library. +// @author Brandon Jones +// @author Colin MacKenzie IV +// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md) +var Z=class b extends Float32Array{static#t=new Float32Array([1,0,0,1]);constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t]):super(t,0,4);break;default:super(b.#t);break}}get str(){return b.str(this)}copy(e){return this.set(e),this}identity(){return this.set(b.#t),this}multiply(e){return b.multiply(this,this,e)}mul(e){return this}transpose(){return b.transpose(this,this)}invert(){return b.invert(this,this)}scale(e){return b.scale(this,this,e)}rotate(e){return b.rotate(this,this,e)}static get BYTE_LENGTH(){return 4*Float32Array.BYTES_PER_ELEMENT}static create(){return new b}static clone(e){return new b(e)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static fromValues(...e){return new b(...e)}static set(e,...t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}static transpose(e,t){if(e===t){let n=t[1];e[1]=t[2],e[2]=n}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*a-r*s;return i?(i=1/i,e[0]=a*i,e[1]=-s*i,e[2]=-r*i,e[3]=n*i,e):null}static adjoint(e,t){let n=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=n,e}static determinant(e){return e[0]*e[3]-e[2]*e[1]}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*c+a*y,e[1]=r*c+i*y,e[2]=s*L+a*k,e[3]=r*L+i*k,e}static mul(e,t,n){return e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+a*c,e[1]=r*y+i*c,e[2]=s*-c+a*y,e[3]=r*-c+i*y,e}static scale(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1];return e[0]=s*c,e[1]=r*c,e[2]=a*y,e[3]=i*y,e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=-n,e[3]=s,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3])}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e}static LDU(e,t,n,s){return e[2]=s[2]/s[0],n[0]=s[0],n[1]=s[1],n[3]=s[3]-e[2]*n[1],[e,t,n]}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=t[0],c=t[1],y=t[2],L=t[3];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(a-L)<=1e-6*Math.max(1,Math.abs(a),Math.abs(L))}static str(e){return`Mat2(${e.join(", ")})`}};Z.prototype.mul=Z.prototype.multiply;Z.mul=Z.multiply;Z.sub=Z.subtract;var j=class b extends Float32Array{static#t=new Float32Array([1,0,0,1,0,0]);constructor(...e){switch(e.length){case 6:super(e);break;case 2:super(e[0],e[1],6);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t,t,t]):super(t,0,6);break;default:super(b.#t);break}}get str(){return b.str(this)}copy(e){return this.set(e),this}identity(){return this.set(b.#t),this}multiply(e){return b.multiply(this,this,e)}mul(e){return this}translate(e){return b.translate(this,this,e)}rotate(e){return b.rotate(this,this,e)}scale(e){return b.scale(this,this,e)}static get BYTE_LENGTH(){return 6*Float32Array.BYTES_PER_ELEMENT}static create(){return new b}static clone(e){return new b(e)}static copy(e,t){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}static fromValues(...e){return new b(...e)}static set(e,...t){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}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=n*a-s*r;return y?(y=1/y,e[0]=a*y,e[1]=-s*y,e[2]=-r*y,e[3]=n*y,e[4]=(r*c-a*i)*y,e[5]=(s*i-n*c)*y,e):null}static determinant(e){return e[0]*e[3]-e[1]*e[2]}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1],l=n[2],M=n[3],h=n[4],d=n[5];return e[0]=s*L+a*k,e[1]=r*L+i*k,e[2]=s*l+a*M,e[3]=r*l+i*M,e[4]=s*h+a*d+c,e[5]=r*h+i*d+y,e}static mul(e,t,n){return e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=s*L+a*k+c,e[5]=r*L+i*k+y,e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=Math.sin(n),k=Math.cos(n);return e[0]=s*k+a*L,e[1]=r*k+i*L,e[2]=s*-L+a*k,e[3]=r*-L+i*k,e[4]=c,e[5]=y,e}static scale(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1];return e[0]=s*L,e[1]=r*L,e[2]=a*k,e[3]=i*k,e[4]=c,e[5]=y,e}static fromTranslation(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0],e[5]=t[1],e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=-n,e[3]=s,e[4]=0,e[5]=0,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e[4]=0,e[5]=0,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+1)}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=t[0],L=t[1],k=t[2],l=t[3],M=t[4],h=t[5];return Math.abs(n-y)<=1e-6*Math.max(1,Math.abs(n),Math.abs(y))&&Math.abs(s-L)<=1e-6*Math.max(1,Math.abs(s),Math.abs(L))&&Math.abs(r-k)<=1e-6*Math.max(1,Math.abs(r),Math.abs(k))&&Math.abs(a-l)<=1e-6*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(i-M)<=1e-6*Math.max(1,Math.abs(i),Math.abs(M))&&Math.abs(c-h)<=1e-6*Math.max(1,Math.abs(c),Math.abs(h))}static str(e){return`Mat2d(${e.join(", ")})`}};j.mul=j.multiply;j.sub=j.subtract;var G=class b extends Float32Array{static#t=new Float32Array([1,0,0,0,1,0,0,0,1]);constructor(...e){switch(e.length){case 9:super(e);break;case 2:super(e[0],e[1],9);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t,t,t,t,t,t]):super(t,0,9);break;default:super(b.#t);break}}get str(){return b.str(this)}copy(e){return this.set(e),this}identity(){return this.set(b.#t),this}multiply(e){return b.multiply(this,this,e)}mul(e){return this}transpose(){return b.transpose(this,this)}invert(){return b.invert(this,this)}translate(e){return b.translate(this,this,e)}rotate(e){return b.rotate(this,this,e)}scale(e){return b.scale(this,this,e)}static get BYTE_LENGTH(){return 9*Float32Array.BYTES_PER_ELEMENT}static create(){return new b}static clone(e){return new b(e)}static copy(e,t){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}static fromValues(...e){return new b(...e)}static set(e,...t){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}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static transpose(e,t){if(e===t){let n=t[1],s=t[2],r=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=s,e[7]=r}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=k*i-c*L,M=-k*a+c*y,h=L*a-i*y,d=n*l+s*M+r*h;return d?(d=1/d,e[0]=l*d,e[1]=(-k*s+r*L)*d,e[2]=(c*s-r*i)*d,e[3]=M*d,e[4]=(k*n-r*y)*d,e[5]=(-c*n+r*a)*d,e[6]=h*d,e[7]=(-L*n+s*y)*d,e[8]=(i*n-s*a)*d,e):null}static adjoint(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8];return e[0]=i*k-c*L,e[1]=r*L-s*k,e[2]=s*c-r*i,e[3]=c*y-a*k,e[4]=n*k-r*y,e[5]=r*a-n*c,e[6]=a*L-i*y,e[7]=s*y-n*L,e[8]=n*i-s*a,e}static determinant(e){let t=e[0],n=e[1],s=e[2],r=e[3],a=e[4],i=e[5],c=e[6],y=e[7],L=e[8];return t*(L*a-i*y)+n*(-L*r+i*c)+s*(y*r-a*c)}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=n[0],h=n[1],d=n[2];return e[0]=M*s+h*i+d*L,e[1]=M*r+h*c+d*k,e[2]=M*a+h*y+d*l,M=n[3],h=n[4],d=n[5],e[3]=M*s+h*i+d*L,e[4]=M*r+h*c+d*k,e[5]=M*a+h*y+d*l,M=n[6],h=n[7],d=n[8],e[6]=M*s+h*i+d*L,e[7]=M*r+h*c+d*k,e[8]=M*a+h*y+d*l,e}static mul(e,t,n){return e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=n[0],h=n[1];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=c,e[5]=y,e[6]=M*s+h*i+L,e[7]=M*r+h*c+k,e[8]=M*a+h*y+l,e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=Math.sin(n),h=Math.cos(n);return e[0]=h*s+M*i,e[1]=h*r+M*c,e[2]=h*a+M*y,e[3]=h*i-M*s,e[4]=h*c-M*r,e[5]=h*y-M*a,e[6]=L,e[7]=k,e[8]=l,e}static scale(e,t,n){let s=n[0],r=n[1];return e[0]=s*t[0],e[1]=s*t[1],e[2]=s*t[2],e[3]=r*t[3],e[4]=r*t[4],e[5]=r*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}static fromTranslation(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=0,e[3]=-n,e[4]=s,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static fromMat2d(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}static fromQuat(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n+n,c=s+s,y=r+r,L=n*i,k=s*i,l=s*c,M=r*i,h=r*c,d=r*y,m=a*i,o=a*c,x=a*y;return e[0]=1-l-d,e[3]=k-x,e[6]=M+o,e[1]=k+x,e[4]=1-L-d,e[7]=h-m,e[2]=M-o,e[5]=h+m,e[8]=1-L-l,e}static fromMat4(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}static normalFromMat4(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],M=t[10],h=t[11],d=t[12],m=t[13],o=t[14],x=t[15],z=n*c-s*i,R=n*y-r*i,g=n*L-a*i,w=s*y-r*c,V=s*L-a*c,T=r*L-a*y,A=k*m-l*d,D=k*o-M*d,f=k*x-h*d,I=l*o-M*m,S=l*x-h*m,F=M*x-h*o,Q=z*F-R*S+g*I+w*f-V*D+T*A;return Q?(Q=1/Q,e[0]=(c*F-y*S+L*I)*Q,e[1]=(y*f-i*F-L*D)*Q,e[2]=(i*S-c*f+L*A)*Q,e[3]=(r*S-s*F-a*I)*Q,e[4]=(n*F-r*f+a*D)*Q,e[5]=(s*f-n*S-a*A)*Q,e[6]=(m*T-o*V+x*w)*Q,e[7]=(o*g-d*T-x*R)*Q,e[8]=(d*V-m*g+x*z)*Q,e):null}static normalFromMat4Fast(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=i*k-k*L,e[1]=c*y-y*k,e[2]=a*L-L*y,e[3]=L*r-k*s,e[4]=k*n-y*r,e[5]=y*s-L*n,e[6]=s*c-r*i,e[7]=r*a-n*c,e[8]=n*i-s*a,e}static projection(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8])}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e[6]=t[6]+n[6]*s,e[7]=t[7]+n[7]*s,e[8]=t[8]+n[8]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=e[8],l=t[0],M=t[1],h=t[2],d=t[3],m=t[4],o=t[5],x=t[6],z=t[7],R=t[8];return Math.abs(n-l)<=1e-6*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(s-M)<=1e-6*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(r-h)<=1e-6*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(a-d)<=1e-6*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(i-m)<=1e-6*Math.max(1,Math.abs(i),Math.abs(m))&&Math.abs(c-o)<=1e-6*Math.max(1,Math.abs(c),Math.abs(o))&&Math.abs(y-x)<=1e-6*Math.max(1,Math.abs(y),Math.abs(x))&&Math.abs(L-z)<=1e-6*Math.max(1,Math.abs(L),Math.abs(z))&&Math.abs(k-R)<=1e-6*Math.max(1,Math.abs(k),Math.abs(R))}static str(e){return`Mat3(${e.join(", ")})`}};G.prototype.mul=G.prototype.multiply;G.mul=G.multiply;G.sub=G.subtract;var P=class b extends Float32Array{static#t=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);static#e=new Float32Array(3);constructor(...e){switch(e.length){case 16:super(e);break;case 2:super(e[0],e[1],16);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t]):super(t,0,16);break;default:super(b.#t);break}}get str(){return b.str(this)}copy(e){return this.set(e),this}identity(){return this.set(b.#t),this}multiply(e){return b.multiply(this,this,e)}mul(e){return this}transpose(){return b.transpose(this,this)}invert(){return b.invert(this,this)}translate(e){return b.translate(this,this,e)}rotate(e,t){return b.rotate(this,this,e,t)}scale(e){return b.scale(this,this,e)}rotateX(e){return b.rotateX(this,this,e)}rotateY(e){return b.rotateY(this,this,e)}rotateZ(e){return b.rotateZ(this,this,e)}perspectiveNO(e,t,n,s){return b.perspectiveNO(this,e,t,n,s)}perspectiveZO(e,t,n,s){return b.perspectiveZO(this,e,t,n,s)}orthoNO(e,t,n,s,r,a){return b.orthoNO(this,e,t,n,s,r,a)}orthoZO(e,t,n,s,r,a){return b.orthoZO(this,e,t,n,s,r,a)}static get BYTE_LENGTH(){return 16*Float32Array.BYTES_PER_ELEMENT}static create(){return new b}static clone(e){return new b(e)}static copy(e,t){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}static fromValues(...e){return new b(...e)}static set(e,...t){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}static identity(e){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}static transpose(e,t){if(e===t){let n=t[1],s=t[2],r=t[3],a=t[6],i=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=s,e[9]=a,e[11]=t[14],e[12]=r,e[13]=i,e[14]=c}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],M=t[10],h=t[11],d=t[12],m=t[13],o=t[14],x=t[15],z=n*c-s*i,R=n*y-r*i,g=n*L-a*i,w=s*y-r*c,V=s*L-a*c,T=r*L-a*y,A=k*m-l*d,D=k*o-M*d,f=k*x-h*d,I=l*o-M*m,S=l*x-h*m,F=M*x-h*o,Q=z*F-R*S+g*I+w*f-V*D+T*A;return Q?(Q=1/Q,e[0]=(c*F-y*S+L*I)*Q,e[1]=(r*S-s*F-a*I)*Q,e[2]=(m*T-o*V+x*w)*Q,e[3]=(M*V-l*T-h*w)*Q,e[4]=(y*f-i*F-L*D)*Q,e[5]=(n*F-r*f+a*D)*Q,e[6]=(o*g-d*T-x*R)*Q,e[7]=(k*T-M*g+h*R)*Q,e[8]=(i*S-c*f+L*A)*Q,e[9]=(s*f-n*S-a*A)*Q,e[10]=(d*V-m*g+x*z)*Q,e[11]=(l*g-k*V-h*z)*Q,e[12]=(c*D-i*I-y*A)*Q,e[13]=(n*I-s*D+r*A)*Q,e[14]=(m*R-d*w-o*z)*Q,e[15]=(k*w-l*R+M*z)*Q,e):null}static adjoint(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],M=t[10],h=t[11],d=t[12],m=t[13],o=t[14],x=t[15],z=n*c-s*i,R=n*y-r*i,g=n*L-a*i,w=s*y-r*c,V=s*L-a*c,T=r*L-a*y,A=k*m-l*d,D=k*o-M*d,f=k*x-h*d,I=l*o-M*m,S=l*x-h*m,F=M*x-h*o;return e[0]=c*F-y*S+L*I,e[1]=r*S-s*F-a*I,e[2]=m*T-o*V+x*w,e[3]=M*V-l*T-h*w,e[4]=y*f-i*F-L*D,e[5]=n*F-r*f+a*D,e[6]=o*g-d*T-x*R,e[7]=k*T-M*g+h*R,e[8]=i*S-c*f+L*A,e[9]=s*f-n*S-a*A,e[10]=d*V-m*g+x*z,e[11]=l*g-k*V-h*z,e[12]=c*D-i*I-y*A,e[13]=n*I-s*D+r*A,e[14]=m*R-d*w-o*z,e[15]=k*w-l*R+M*z,e}static determinant(e){let t=e[0],n=e[1],s=e[2],r=e[3],a=e[4],i=e[5],c=e[6],y=e[7],L=e[8],k=e[9],l=e[10],M=e[11],h=e[12],d=e[13],m=e[14],o=e[15],x=t*i-n*a,z=t*c-s*a,R=n*c-s*i,g=L*d-k*h,w=L*m-l*h,V=k*m-l*d,T=t*V-n*w+s*g,A=a*V-i*w+c*g,D=L*R-k*z+l*x,f=h*R-d*z+m*x;return y*T-r*A+o*D-M*f}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=t[9],h=t[10],d=t[11],m=t[12],o=t[13],x=t[14],z=t[15],R=n[0],g=n[1],w=n[2],V=n[3];return e[0]=R*s+g*c+w*l+V*m,e[1]=R*r+g*y+w*M+V*o,e[2]=R*a+g*L+w*h+V*x,e[3]=R*i+g*k+w*d+V*z,R=n[4],g=n[5],w=n[6],V=n[7],e[4]=R*s+g*c+w*l+V*m,e[5]=R*r+g*y+w*M+V*o,e[6]=R*a+g*L+w*h+V*x,e[7]=R*i+g*k+w*d+V*z,R=n[8],g=n[9],w=n[10],V=n[11],e[8]=R*s+g*c+w*l+V*m,e[9]=R*r+g*y+w*M+V*o,e[10]=R*a+g*L+w*h+V*x,e[11]=R*i+g*k+w*d+V*z,R=n[12],g=n[13],w=n[14],V=n[15],e[12]=R*s+g*c+w*l+V*m,e[13]=R*r+g*y+w*M+V*o,e[14]=R*a+g*L+w*h+V*x,e[15]=R*i+g*k+w*d+V*z,e}static mul(e,t,n){return e}static translate(e,t,n){let s=n[0],r=n[1],a=n[2];if(t===e)e[12]=t[0]*s+t[4]*r+t[8]*a+t[12],e[13]=t[1]*s+t[5]*r+t[9]*a+t[13],e[14]=t[2]*s+t[6]*r+t[10]*a+t[14],e[15]=t[3]*s+t[7]*r+t[11]*a+t[15];else{let i=t[0],c=t[1],y=t[2],L=t[3],k=t[4],l=t[5],M=t[6],h=t[7],d=t[8],m=t[9],o=t[10],x=t[11];e[0]=i,e[1]=c,e[2]=y,e[3]=L,e[4]=k,e[5]=l,e[6]=M,e[7]=h,e[8]=d,e[9]=m,e[10]=o,e[11]=x,e[12]=i*s+k*r+d*a+t[12],e[13]=c*s+l*r+m*a+t[13],e[14]=y*s+M*r+o*a+t[14],e[15]=L*s+h*r+x*a+t[15]}return e}static scale(e,t,n){let s=n[0],r=n[1],a=n[2];return e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e[3]=t[3]*s,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}static rotate(e,t,n,s){let r=s[0],a=s[1],i=s[2],c=Math.sqrt(r*r+a*a+i*i);if(c<1e-6)return null;c=1/c,r*=c,a*=c,i*=c;let y=Math.sin(n),L=Math.cos(n),k=1-L,l=t[0],M=t[1],h=t[2],d=t[3],m=t[4],o=t[5],x=t[6],z=t[7],R=t[8],g=t[9],w=t[10],V=t[11],T=r*r*k+L,A=a*r*k+i*y,D=i*r*k-a*y,f=r*a*k-i*y,I=a*a*k+L,S=i*a*k+r*y,F=r*i*k+a*y,Q=a*i*k-r*y,Y=i*i*k+L;return e[0]=l*T+m*A+R*D,e[1]=M*T+o*A+g*D,e[2]=h*T+x*A+w*D,e[3]=d*T+z*A+V*D,e[4]=l*f+m*I+R*S,e[5]=M*f+o*I+g*S,e[6]=h*f+x*I+w*S,e[7]=d*f+z*I+V*S,e[8]=l*F+m*Q+R*Y,e[9]=M*F+o*Q+g*Y,e[10]=h*F+x*Q+w*Y,e[11]=d*F+z*Q+V*Y,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e}static rotateX(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[4],i=t[5],c=t[6],y=t[7],L=t[8],k=t[9],l=t[10],M=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*r+L*s,e[5]=i*r+k*s,e[6]=c*r+l*s,e[7]=y*r+M*s,e[8]=L*r-a*s,e[9]=k*r-i*s,e[10]=l*r-c*s,e[11]=M*r-y*s,e}static rotateY(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[0],i=t[1],c=t[2],y=t[3],L=t[8],k=t[9],l=t[10],M=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*r-L*s,e[1]=i*r-k*s,e[2]=c*r-l*s,e[3]=y*r-M*s,e[8]=a*s+L*r,e[9]=i*s+k*r,e[10]=c*s+l*r,e[11]=y*s+M*r,e}static rotateZ(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[0],i=t[1],c=t[2],y=t[3],L=t[4],k=t[5],l=t[6],M=t[7];return t!==e&&(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[0]=a*r+L*s,e[1]=i*r+k*s,e[2]=c*r+l*s,e[3]=y*r+M*s,e[4]=L*r-a*s,e[5]=k*r-i*s,e[6]=l*r-c*s,e[7]=M*r-y*s,e}static fromTranslation(e,t){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]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromRotation(e,t,n){let s=n[0],r=n[1],a=n[2],i=Math.sqrt(s*s+r*r+a*a);if(i<1e-6)return null;i=1/i,s*=i,r*=i,a*=i;let c=Math.sin(t),y=Math.cos(t),L=1-y;return e[0]=s*s*L+y,e[1]=r*s*L+a*c,e[2]=a*s*L-r*c,e[3]=0,e[4]=s*r*L-a*c,e[5]=r*r*L+y,e[6]=a*r*L+s*c,e[7]=0,e[8]=s*a*L+r*c,e[9]=r*a*L-s*c,e[10]=a*a*L+y,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromXRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=n,e[7]=0,e[8]=0,e[9]=-n,e[10]=s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromYRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromZRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=0,e[3]=0,e[4]=-n,e[5]=s,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}static fromRotationTranslation(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=s+s,y=r+r,L=a+a,k=s*c,l=s*y,M=s*L,h=r*y,d=r*L,m=a*L,o=i*c,x=i*y,z=i*L;return e[0]=1-(h+m),e[1]=l+z,e[2]=M-x,e[3]=0,e[4]=l-z,e[5]=1-(k+m),e[6]=d+o,e[7]=0,e[8]=M+x,e[9]=d-o,e[10]=1-(k+h),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}static fromQuat2(e,t){let n=-t[0],s=-t[1],r=-t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=n*n+s*s+r*r+a*a;return k>0?(b.#e[0]=(i*a+L*n+c*r-y*s)*2/k,b.#e[1]=(c*a+L*s+y*n-i*r)*2/k,b.#e[2]=(y*a+L*r+i*s-c*n)*2/k):(b.#e[0]=(i*a+L*n+c*r-y*s)*2,b.#e[1]=(c*a+L*s+y*n-i*r)*2,b.#e[2]=(y*a+L*r+i*s-c*n)*2),b.fromRotationTranslation(e,t,b.#e),e}static normalFromMat4(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],M=t[10],h=t[11],d=t[12],m=t[13],o=t[14],x=t[15],z=n*c-s*i,R=n*y-r*i,g=n*L-a*i,w=s*y-r*c,V=s*L-a*c,T=r*L-a*y,A=k*m-l*d,D=k*o-M*d,f=k*x-h*d,I=l*o-M*m,S=l*x-h*m,F=M*x-h*o,Q=z*F-R*S+g*I+w*f-V*D+T*A;return Q?(Q=1/Q,e[0]=(c*F-y*S+L*I)*Q,e[1]=(y*f-i*F-L*D)*Q,e[2]=(i*S-c*f+L*A)*Q,e[3]=0,e[4]=(r*S-s*F-a*I)*Q,e[5]=(n*F-r*f+a*D)*Q,e[6]=(s*f-n*S-a*A)*Q,e[7]=0,e[8]=(m*T-o*V+x*w)*Q,e[9]=(o*g-d*T-x*R)*Q,e[10]=(d*V-m*g+x*z)*Q,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):null}static normalFromMat4Fast(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=i*k-k*L,e[1]=c*y-y*k,e[2]=a*L-L*y,e[3]=0,e[4]=L*r-k*s,e[5]=k*n-y*r,e[6]=y*s-L*n,e[7]=0,e[8]=s*c-r*i,e[9]=r*a-n*c,e[10]=n*i-s*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static getTranslation(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}static getScaling(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=Math.sqrt(n*n+s*s+r*r),e[1]=Math.sqrt(a*a+i*i+c*c),e[2]=Math.sqrt(y*y+L*L+k*k),e}static getRotation(e,t){b.getScaling(b.#e,t);let n=1/b.#e[0],s=1/b.#e[1],r=1/b.#e[2],a=t[0]*n,i=t[1]*s,c=t[2]*r,y=t[4]*n,L=t[5]*s,k=t[6]*r,l=t[8]*n,M=t[9]*s,h=t[10]*r,d=a+L+h,m=0;return d>0?(m=Math.sqrt(d+1)*2,e[3]=.25*m,e[0]=(k-M)/m,e[1]=(l-c)/m,e[2]=(i-y)/m):a>L&&a>h?(m=Math.sqrt(1+a-L-h)*2,e[3]=(k-M)/m,e[0]=.25*m,e[1]=(i+y)/m,e[2]=(l+c)/m):L>h?(m=Math.sqrt(1+L-a-h)*2,e[3]=(l-c)/m,e[0]=(i+y)/m,e[1]=.25*m,e[2]=(k+M)/m):(m=Math.sqrt(1+h-a-L)*2,e[3]=(i-y)/m,e[0]=(l+c)/m,e[1]=(k+M)/m,e[2]=.25*m),e}static decompose(e,t,n,s){t[0]=s[12],t[1]=s[13],t[2]=s[14];let r=s[0],a=s[1],i=s[2],c=s[4],y=s[5],L=s[6],k=s[8],l=s[9],M=s[10];n[0]=Math.sqrt(r*r+a*a+i*i),n[1]=Math.sqrt(c*c+y*y+L*L),n[2]=Math.sqrt(k*k+l*l+M*M);let h=1/n[0],d=1/n[1],m=1/n[2],o=r*h,x=a*d,z=i*m,R=c*h,g=y*d,w=L*m,V=k*h,T=l*d,A=M*m,D=o+g+A,f=0;return D>0?(f=Math.sqrt(D+1)*2,e[3]=.25*f,e[0]=(w-T)/f,e[1]=(V-z)/f,e[2]=(x-R)/f):o>g&&o>A?(f=Math.sqrt(1+o-g-A)*2,e[3]=(w-T)/f,e[0]=.25*f,e[1]=(x+R)/f,e[2]=(V+z)/f):g>A?(f=Math.sqrt(1+g-o-A)*2,e[3]=(V-z)/f,e[0]=(x+R)/f,e[1]=.25*f,e[2]=(w+T)/f):(f=Math.sqrt(1+A-o-g)*2,e[3]=(x-R)/f,e[0]=(V+z)/f,e[1]=(w+T)/f,e[2]=.25*f),e}static fromRotationTranslationScale(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3],y=r+r,L=a+a,k=i+i,l=r*y,M=r*L,h=r*k,d=a*L,m=a*k,o=i*k,x=c*y,z=c*L,R=c*k,g=s[0],w=s[1],V=s[2];return e[0]=(1-(d+o))*g,e[1]=(M+R)*g,e[2]=(h-z)*g,e[3]=0,e[4]=(M-R)*w,e[5]=(1-(l+o))*w,e[6]=(m+x)*w,e[7]=0,e[8]=(h+z)*V,e[9]=(m-x)*V,e[10]=(1-(l+d))*V,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}static fromRotationTranslationScaleOrigin(e,t,n,s,r){let a=t[0],i=t[1],c=t[2],y=t[3],L=a+a,k=i+i,l=c+c,M=a*L,h=a*k,d=a*l,m=i*k,o=i*l,x=c*l,z=y*L,R=y*k,g=y*l,w=s[0],V=s[1],T=s[2],A=r[0],D=r[1],f=r[2],I=(1-(m+x))*w,S=(h+g)*w,F=(d-R)*w,Q=(h-g)*V,Y=(1-(M+x))*V,X=(o+z)*V,C=(d+R)*T,$=(o-z)*T,H=(1-(M+m))*T;return e[0]=I,e[1]=S,e[2]=F,e[3]=0,e[4]=Q,e[5]=Y,e[6]=X,e[7]=0,e[8]=C,e[9]=$,e[10]=H,e[11]=0,e[12]=n[0]+A-(I*A+Q*D+C*f),e[13]=n[1]+D-(S*A+Y*D+$*f),e[14]=n[2]+f-(F*A+X*D+H*f),e[15]=1,e}static fromQuat(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n+n,c=s+s,y=r+r,L=n*i,k=s*i,l=s*c,M=r*i,h=r*c,d=r*y,m=a*i,o=a*c,x=a*y;return e[0]=1-l-d,e[1]=k+x,e[2]=M-o,e[3]=0,e[4]=k-x,e[5]=1-L-d,e[6]=h+m,e[7]=0,e[8]=M+o,e[9]=h-m,e[10]=1-L-l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static frustumNO(e,t,n,s,r,a,i=1/0){let c=1/(n-t),y=1/(r-s);if(e[0]=a*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*y,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(r+s)*y,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let L=1/(a-i);e[10]=(i+a)*L,e[14]=2*i*a*L}else e[10]=-1,e[14]=-2*a;return e}static frustum(e,t,n,s,r,a,i=1/0){return e}static frustumZO(e,t,n,s,r,a,i=1/0){let c=1/(n-t),y=1/(r-s);if(e[0]=a*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*y,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(r+s)*y,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let L=1/(a-i);e[10]=i*L,e[14]=i*a*L}else e[10]=-1,e[14]=-a;return e}static perspectiveNO(e,t,n,s,r=1/0){let a=1/Math.tan(t/2);if(e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,r!=null&&r!==1/0){let i=1/(s-r);e[10]=(r+s)*i,e[14]=2*r*s*i}else e[10]=-1,e[14]=-2*s;return e}static perspective(e,t,n,s,r=1/0){return e}static perspectiveZO(e,t,n,s,r=1/0){let a=1/Math.tan(t/2);if(e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,r!=null&&r!==1/0){let i=1/(s-r);e[10]=r*i,e[14]=r*s*i}else e[10]=-1,e[14]=-s;return e}static perspectiveFromFieldOfView(e,t,n,s){let r=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),i=Math.tan(t.leftDegrees*Math.PI/180),c=Math.tan(t.rightDegrees*Math.PI/180),y=2/(i+c),L=2/(r+a);return e[0]=y,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=L,e[6]=0,e[7]=0,e[8]=-((i-c)*y*.5),e[9]=(r-a)*L*.5,e[10]=s/(n-s),e[11]=-1,e[12]=0,e[13]=0,e[14]=s*n/(n-s),e[15]=0,e}static orthoNO(e,t,n,s,r,a,i){let c=1/(t-n),y=1/(s-r),L=1/(a-i);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*L,e[11]=0,e[12]=(t+n)*c,e[13]=(r+s)*y,e[14]=(i+a)*L,e[15]=1,e}static ortho(e,t,n,s,r,a,i){return e}static orthoZO(e,t,n,s,r,a,i){let c=1/(t-n),y=1/(s-r),L=1/(a-i);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=L,e[11]=0,e[12]=(t+n)*c,e[13]=(r+s)*y,e[14]=a*L,e[15]=1,e}static lookAt(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=s[0],y=s[1],L=s[2],k=n[0],l=n[1],M=n[2];if(Math.abs(r-k)<1e-6&&Math.abs(a-l)<1e-6&&Math.abs(i-M)<1e-6)return b.identity(e);let h=r-k,d=a-l,m=i-M,o=1/Math.sqrt(h*h+d*d+m*m);h*=o,d*=o,m*=o;let x=y*m-L*d,z=L*h-c*m,R=c*d-y*h;o=Math.sqrt(x*x+z*z+R*R),o?(o=1/o,x*=o,z*=o,R*=o):(x=0,z=0,R=0);let g=d*R-m*z,w=m*x-h*R,V=h*z-d*x;return o=Math.sqrt(g*g+w*w+V*V),o?(o=1/o,g*=o,w*=o,V*=o):(g=0,w=0,V=0),e[0]=x,e[1]=g,e[2]=h,e[3]=0,e[4]=z,e[5]=w,e[6]=d,e[7]=0,e[8]=R,e[9]=V,e[10]=m,e[11]=0,e[12]=-(x*r+z*a+R*i),e[13]=-(g*r+w*a+V*i),e[14]=-(h*r+d*a+m*i),e[15]=1,e}static targetTo(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=s[0],y=s[1],L=s[2],k=r-n[0],l=a-n[1],M=i-n[2],h=k*k+l*l+M*M;h>0&&(h=1/Math.sqrt(h),k*=h,l*=h,M*=h);let d=y*M-L*l,m=L*k-c*M,o=c*l-y*k;return h=d*d+m*m+o*o,h>0&&(h=1/Math.sqrt(h),d*=h,m*=h,o*=h),e[0]=d,e[1]=m,e[2]=o,e[3]=0,e[4]=l*o-M*m,e[5]=M*d-k*o,e[6]=k*m-l*d,e[7]=0,e[8]=k,e[9]=l,e[10]=M,e[11]=0,e[12]=r,e[13]=a,e[14]=i,e[15]=1,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8]+e[9]*e[9]+e[10]*e[10]+e[11]*e[11]+e[12]*e[12]+e[13]*e[13]+e[14]*e[14]+e[15]*e[15])}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}static sub(e,t,n){return e}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e[6]=t[6]+n[6]*s,e[7]=t[7]+n[7]*s,e[8]=t[8]+n[8]*s,e[9]=t[9]+n[9]*s,e[10]=t[10]+n[10]*s,e[11]=t[11]+n[11]*s,e[12]=t[12]+n[12]*s,e[13]=t[13]+n[13]*s,e[14]=t[14]+n[14]*s,e[15]=t[15]+n[15]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=e[8],l=e[9],M=e[10],h=e[11],d=e[12],m=e[13],o=e[14],x=e[15],z=t[0],R=t[1],g=t[2],w=t[3],V=t[4],T=t[5],A=t[6],D=t[7],f=t[8],I=t[9],S=t[10],F=t[11],Q=t[12],Y=t[13],X=t[14],C=t[15];return Math.abs(n-z)<=1e-6*Math.max(1,Math.abs(n),Math.abs(z))&&Math.abs(s-R)<=1e-6*Math.max(1,Math.abs(s),Math.abs(R))&&Math.abs(r-g)<=1e-6*Math.max(1,Math.abs(r),Math.abs(g))&&Math.abs(a-w)<=1e-6*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(i-V)<=1e-6*Math.max(1,Math.abs(i),Math.abs(V))&&Math.abs(c-T)<=1e-6*Math.max(1,Math.abs(c),Math.abs(T))&&Math.abs(y-A)<=1e-6*Math.max(1,Math.abs(y),Math.abs(A))&&Math.abs(L-D)<=1e-6*Math.max(1,Math.abs(L),Math.abs(D))&&Math.abs(k-f)<=1e-6*Math.max(1,Math.abs(k),Math.abs(f))&&Math.abs(l-I)<=1e-6*Math.max(1,Math.abs(l),Math.abs(I))&&Math.abs(M-S)<=1e-6*Math.max(1,Math.abs(M),Math.abs(S))&&Math.abs(h-F)<=1e-6*Math.max(1,Math.abs(h),Math.abs(F))&&Math.abs(d-Q)<=1e-6*Math.max(1,Math.abs(d),Math.abs(Q))&&Math.abs(m-Y)<=1e-6*Math.max(1,Math.abs(m),Math.abs(Y))&&Math.abs(o-X)<=1e-6*Math.max(1,Math.abs(o),Math.abs(X))&&Math.abs(x-C)<=1e-6*Math.max(1,Math.abs(x),Math.abs(C))}static str(e){return`Mat4(${e.join(", ")})`}};P.prototype.mul=P.prototype.multiply;P.sub=P.subtract;P.mul=P.multiply;P.frustum=P.frustumNO;P.perspective=P.perspectiveNO;P.ortho=P.orthoNO;var q=class b extends Float32Array{constructor(...e){switch(e.length){case 3:super(e);break;case 2:super(e[0],e[1],3);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t]):super(t,0,3);break}default:super(3);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get b(){return this[2]}set b(e){this[2]=e}get magnitude(){let e=this[0],t=this[1],n=this[2];return Math.sqrt(e*e+t*t+n*n)}get mag(){return this.magnitude}get squaredMagnitude(){let e=this[0],t=this[1],n=this[2];return e*e+t*t+n*n}get sqrMag(){return this.squaredMagnitude}get str(){return b.str(this)}copy(e){return this.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this[2]+=e[2],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this[2]-=e[2],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this[2]*=e[2],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this[2]/=e[2],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this[2]+=e[2]*t,this}distance(e){return b.distance(this,e)}dist(e){return 0}squaredDistance(e){return b.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this[2]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this[2]=1/this[2],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this[2]=Math.abs(this[2]),this}dot(e){return this[0]*e[0]+this[1]*e[1]+this[2]*e[2]}normalize(){return b.normalize(this,this)}static get BYTE_LENGTH(){return 3*Float32Array.BYTES_PER_ELEMENT}static create(){return new b}static clone(e){return new b(e)}static magnitude(e){let t=e[0],n=e[1],s=e[2];return Math.sqrt(t*t+n*n+s*s)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static fromValues(e,t,n){return new b(e,t,n)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}static set(e,t,n,s){return e[0]=t,e[1]=n,e[2]=s,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}static sub(e,t,n){return[0,0,0]}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}static mul(e,t,n){return[0,0,0]}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e}static div(e,t,n){return[0,0,0]}static ceil(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}static floor(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e}static distance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2];return Math.sqrt(n*n+s*s+r*r)}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2];return n*n+s*s+r*r}static sqrDist(e,t){return 0}static squaredLength(e){let t=e[0],n=e[1],s=e[2];return t*t+n*n+s*s}static sqrLen(e,t){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e}static normalize(e,t){let n=t[0],s=t[1],r=t[2],a=n*n+s*s+r*r;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}static cross(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[0],c=n[1],y=n[2];return e[0]=r*y-a*c,e[1]=a*i-s*y,e[2]=s*c-r*i,e}static lerp(e,t,n,s){let r=t[0],a=t[1],i=t[2];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e[2]=i+s*(n[2]-i),e}static slerp(e,t,n,s){let r=Math.acos(Math.min(Math.max(b.dot(t,n),-1),1)),a=Math.sin(r),i=Math.sin((1-s)*r)/a,c=Math.sin(s*r)/a;return e[0]=i*t[0]+c*n[0],e[1]=i*t[1]+c*n[1],e[2]=i*t[2]+c*n[2],e}static hermite(e,t,n,s,r,a){let i=a*a,c=i*(2*a-3)+1,y=i*(a-2)+a,L=i*(a-1),k=i*(3-2*a);return e[0]=t[0]*c+n[0]*y+s[0]*L+r[0]*k,e[1]=t[1]*c+n[1]*y+s[1]*L+r[1]*k,e[2]=t[2]*c+n[2]*y+s[2]*L+r[2]*k,e}static bezier(e,t,n,s,r,a){let i=1-a,c=i*i,y=a*a,L=c*i,k=3*a*c,l=3*y*i,M=y*a;return e[0]=t[0]*L+n[0]*k+s[0]*l+r[0]*M,e[1]=t[1]*L+n[1]*k+s[1]*l+r[1]*M,e[2]=t[2]*L+n[2]*k+s[2]*l+r[2]*M,e}static transformMat4(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[3]*s+n[7]*r+n[11]*a+n[15]||1;return e[0]=(n[0]*s+n[4]*r+n[8]*a+n[12])/i,e[1]=(n[1]*s+n[5]*r+n[9]*a+n[13])/i,e[2]=(n[2]*s+n[6]*r+n[10]*a+n[14])/i,e}static transformMat3(e,t,n){let s=t[0],r=t[1],a=t[2];return e[0]=s*n[0]+r*n[3]+a*n[6],e[1]=s*n[1]+r*n[4]+a*n[7],e[2]=s*n[2]+r*n[5]+a*n[8],e}static transformQuat(e,t,n){let s=n[0],r=n[1],a=n[2],i=n[3]*2,c=t[0],y=t[1],L=t[2],k=r*L-a*y,l=a*c-s*L,M=s*y-r*c,h=(r*M-a*l)*2,d=(a*k-s*M)*2,m=(s*l-r*k)*2;return e[0]=c+k*i+h,e[1]=y+l*i+d,e[2]=L+M*i+m,e}static rotateX(e,t,n,s){let r=n[1],a=n[2],i=t[1]-r,c=t[2]-a;return e[0]=t[0],e[1]=i*Math.cos(s)-c*Math.sin(s)+r,e[2]=i*Math.sin(s)+c*Math.cos(s)+a,e}static rotateY(e,t,n,s){let r=n[0],a=n[2],i=t[0]-r,c=t[2]-a;return e[0]=c*Math.sin(s)+i*Math.cos(s)+r,e[1]=t[1],e[2]=c*Math.cos(s)-i*Math.sin(s)+a,e}static rotateZ(e,t,n,s){let r=n[0],a=n[1],i=t[0]-r,c=t[1]-a;return e[0]=i*Math.cos(s)-c*Math.sin(s)+r,e[1]=i*Math.sin(s)+c*Math.cos(s)+a,e[2]=n[2],e}static angle(e,t){let n=e[0],s=e[1],r=e[2],a=t[0],i=t[1],c=t[2],y=Math.sqrt((n*n+s*s+r*r)*(a*a+i*i+c*c)),L=y&&b.dot(e,t)/y;return Math.acos(Math.min(Math.max(L,-1),1))}static zero(e){return e[0]=0,e[1]=0,e[2]=0,e}static str(e){return`Vec3(${e.join(", ")})`}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=t[0],i=t[1],c=t[2];return Math.abs(n-a)<=1e-6*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(s-i)<=1e-6*Math.max(1,Math.abs(s),Math.abs(i))&&Math.abs(r-c)<=1e-6*Math.max(1,Math.abs(r),Math.abs(c))}};q.prototype.sub=q.prototype.subtract;q.prototype.mul=q.prototype.multiply;q.prototype.div=q.prototype.divide;q.prototype.dist=q.prototype.distance;q.prototype.sqrDist=q.prototype.squaredDistance;q.sub=q.subtract;q.mul=q.multiply;q.div=q.divide;q.dist=q.distance;q.sqrDist=q.squaredDistance;q.sqrLen=q.squaredLength;q.mag=q.magnitude;q.length=q.magnitude;q.len=q.magnitude;var E=class b extends Float32Array{constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t,t]):super(t,0,4);break}default:super(4);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get w(){return this[3]}set w(e){this[3]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get b(){return this[2]}set b(e){this[2]=e}get a(){return this[3]}set a(e){this[3]=e}get magnitude(){let e=this[0],t=this[1],n=this[2],s=this[3];return Math.sqrt(e*e+t*t+n*n+s*s)}get mag(){return this.magnitude}get str(){return b.str(this)}copy(e){return super.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this[2]+=e[2],this[3]+=e[3],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this[2]-=e[2],this[3]-=e[3],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this[2]*=e[2],this[3]*=e[3],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this[2]/=e[2],this[3]/=e[3],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this[3]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this[2]+=e[2]*t,this[3]+=e[3]*t,this}distance(e){return b.distance(this,e)}dist(e){return 0}squaredDistance(e){return b.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this[2]*=-1,this[3]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this[2]=1/this[2],this[3]=1/this[3],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this[2]=Math.abs(this[2]),this[3]=Math.abs(this[3]),this}dot(e){return this[0]*e[0]+this[1]*e[1]+this[2]*e[2]+this[3]*e[3]}normalize(){return b.normalize(this,this)}static get BYTE_LENGTH(){return 4*Float32Array.BYTES_PER_ELEMENT}static create(){return new b}static clone(e){return new b(e)}static fromValues(e,t,n,s){return new b(e,t,n,s)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static set(e,t,n,s,r){return e[0]=t,e[1]=n,e[2]=s,e[3]=r,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}static sub(e,t,n){return e}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e[3]=t[3]*n[3],e}static mul(e,t,n){return e}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e[3]=t[3]/n[3],e}static div(e,t,n){return e}static ceil(e,t){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}static floor(e,t){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}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e[3]=Math.min(t[3],n[3]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e[3]=Math.max(t[3],n[3]),e}static round(e,t){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}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e}static distance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2],a=t[3]-e[3];return Math.hypot(n,s,r,a)}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2],a=t[3]-e[3];return n*n+s*s+r*r+a*a}static sqrDist(e,t){return 0}static magnitude(e){let t=e[0],n=e[1],s=e[2],r=e[3];return Math.sqrt(t*t+n*n+s*s+r*r)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){let t=e[0],n=e[1],s=e[2],r=e[3];return t*t+n*n+s*s+r*r}static sqrLen(e){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e}static normalize(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*n+s*s+r*r+a*a;return i>0&&(i=1/Math.sqrt(i)),e[0]=n*i,e[1]=s*i,e[2]=r*i,e[3]=a*i,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}static cross(e,t,n,s){let r=n[0]*s[1]-n[1]*s[0],a=n[0]*s[2]-n[2]*s[0],i=n[0]*s[3]-n[3]*s[0],c=n[1]*s[2]-n[2]*s[1],y=n[1]*s[3]-n[3]*s[1],L=n[2]*s[3]-n[3]*s[2],k=t[0],l=t[1],M=t[2],h=t[3];return e[0]=l*L-M*y+h*c,e[1]=-(k*L)+M*i-h*a,e[2]=k*y-l*i+h*r,e[3]=-(k*c)+l*a-M*r,e}static lerp(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e[2]=i+s*(n[2]-i),e[3]=c+s*(n[3]-c),e}static transformMat4(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3];return e[0]=n[0]*s+n[4]*r+n[8]*a+n[12]*i,e[1]=n[1]*s+n[5]*r+n[9]*a+n[13]*i,e[2]=n[2]*s+n[6]*r+n[10]*a+n[14]*i,e[3]=n[3]*s+n[7]*r+n[11]*a+n[15]*i,e}static transformQuat(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[0],c=n[1],y=n[2],L=n[3],k=L*s+c*a-y*r,l=L*r+y*s-i*a,M=L*a+i*r-c*s,h=-i*s-c*r-y*a;return e[0]=k*L+h*-i+l*-y-M*-c,e[1]=l*L+h*-c+M*-i-k*-y,e[2]=M*L+h*-y+k*-c-l*-i,e[3]=t[3],e}static zero(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}static str(e){return`Vec4(${e.join(", ")})`}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=t[0],c=t[1],y=t[2],L=t[3];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(a-L)<=1e-6*Math.max(1,Math.abs(a),Math.abs(L))}};E.prototype.sub=E.prototype.subtract;E.prototype.mul=E.prototype.multiply;E.prototype.div=E.prototype.divide;E.prototype.dist=E.prototype.distance;E.prototype.sqrDist=E.prototype.squaredDistance;E.sub=E.subtract;E.mul=E.multiply;E.div=E.divide;E.dist=E.distance;E.sqrDist=E.squaredDistance;E.sqrLen=E.squaredLength;E.mag=E.magnitude;E.length=E.magnitude;E.len=E.magnitude;var N=class b extends Float32Array{static#t="zyx";static#e=new Float32Array(4);static#r=new Float32Array(4);static#n=new Float32Array(9);static#s=new Float32Array(3);static#a=new Float32Array([1,0,0]);static#i=new Float32Array([0,1,0]);constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t,t]):super(t,0,4);break}default:super(4),this[3]=1;break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get w(){return this[3]}set w(e){this[3]=e}get magnitude(){let e=this[0],t=this[1],n=this[2],s=this[3];return Math.sqrt(e*e+t*t+n*n+s*s)}get mag(){return this.magnitude}get str(){return b.str(this)}copy(e){return super.set(e),this}identity(){return this[0]=0,this[1]=0,this[2]=0,this[3]=1,this}multiply(e){return b.multiply(this,this,e)}mul(e){return this}rotateX(e){return b.rotateX(this,this,e)}rotateY(e){return b.rotateY(this,this,e)}rotateZ(e){return b.rotateZ(this,this,e)}invert(){return b.invert(this,this)}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this[3]*=e,this}dot(e){return b.dot(this,e)}static get BYTE_LENGTH(){return 4*Float32Array.BYTES_PER_ELEMENT}static create(){return new b}static identity(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}static setAxisAngle(e,t,n){n*=.5;let s=Math.sin(n);return e[0]=s*t[0],e[1]=s*t[1],e[2]=s*t[2],e[3]=Math.cos(n),e}static getAxisAngle(e,t){let n=Math.acos(t[3])*2,s=Math.sin(n/2);return s>1e-6?(e[0]=t[0]/s,e[1]=t[1]/s,e[2]=t[2]/s):(e[0]=1,e[1]=0,e[2]=0),n}static getAngle(e,t){let n=b.dot(e,t);return Math.acos(2*n*n-1)}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*k+i*c+r*L-a*y,e[1]=r*k+i*y+a*c-s*L,e[2]=a*k+i*L+s*y-r*c,e[3]=i*k-s*c-r*y-a*L,e}static rotateX(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+i*c,e[1]=r*y+a*c,e[2]=a*y-r*c,e[3]=i*y-s*c,e}static rotateY(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y-a*c,e[1]=r*y+i*c,e[2]=a*y+s*c,e[3]=i*y-r*c,e}static rotateZ(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+r*c,e[1]=r*y-s*c,e[2]=a*y+i*c,e[3]=i*y-a*c,e}static calculateW(e,t){let n=t[0],s=t[1],r=t[2];return e[0]=n,e[1]=s,e[2]=r,e[3]=Math.sqrt(Math.abs(1-n*n-s*s-r*r)),e}static exp(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=Math.sqrt(n*n+s*s+r*r),c=Math.exp(a),y=i>0?c*Math.sin(i)/i:0;return e[0]=n*y,e[1]=s*y,e[2]=r*y,e[3]=c*Math.cos(i),e}static ln(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=Math.sqrt(n*n+s*s+r*r),c=i>0?Math.atan2(i,a)/i:0;return e[0]=n*c,e[1]=s*c,e[2]=r*c,e[3]=.5*Math.log(n*n+s*s+r*r+a*a),e}static pow(e,t,n){return b.ln(e,t),b.scale(e,e,n),b.exp(e,e),e}static slerp(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3],y=n[0],L=n[1],k=n[2],l=n[3],M,h,d=r*y+a*L+i*k+c*l;if(d<0&&(d=-d,y=-y,L=-L,k=-k,l=-l),1-d>1e-6){let m=Math.acos(d),o=Math.sin(m);M=Math.sin((1-s)*m)/o,h=Math.sin(s*m)/o}else M=1-s,h=s;return e[0]=M*r+h*y,e[1]=M*a+h*L,e[2]=M*i+h*k,e[3]=M*c+h*l,e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*n+s*s+r*r+a*a,c=i?1/i:0;return e[0]=-n*c,e[1]=-s*c,e[2]=-r*c,e[3]=a*c,e}static conjugate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}static fromMat3(e,t){let n=t[0]+t[4]+t[8],s;if(n>0)s=Math.sqrt(n+1),e[3]=.5*s,s=.5/s,e[0]=(t[5]-t[7])*s,e[1]=(t[6]-t[2])*s,e[2]=(t[1]-t[3])*s;else{let r=0;t[4]>t[0]&&(r=1),t[8]>t[r*3+r]&&(r=2);let a=(r+1)%3,i=(r+2)%3;s=Math.sqrt(t[r*3+r]-t[a*3+a]-t[i*3+i]+1),e[r]=.5*s,s=.5/s,e[3]=(t[a*3+i]-t[i*3+a])*s,e[a]=(t[a*3+r]+t[r*3+a])*s,e[i]=(t[i*3+r]+t[r*3+i])*s}return e}static fromEuler(e,t,n,s,r=b.#t){let a=.5*Math.PI/180;t*=a,n*=a,s*=a;let i=Math.sin(t),c=Math.cos(t),y=Math.sin(n),L=Math.cos(n),k=Math.sin(s),l=Math.cos(s);switch(r){case"xyz":e[0]=i*L*l+c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l-i*y*k;break;case"xzy":e[0]=i*L*l-c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l+i*y*k;break;case"yxz":e[0]=i*L*l+c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l+i*y*k;break;case"yzx":e[0]=i*L*l+c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l-i*y*k;break;case"zxy":e[0]=i*L*l-c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l-i*y*k;break;case"zyx":e[0]=i*L*l-c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l+i*y*k;break;default:throw new Error(`Unknown angle order ${r}`)}return e}static str(e){return`Quat(${e.join(", ")})`}static clone(e){return new b(e)}static fromValues(e,t,n,s){return new b(e,t,n,s)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static set(e,t,n,s,r){return e}static add(e,t,n){return e}static mul(e,t,n){return e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}static lerp(e,t,n,s){return e}static magnitude(e){return 0}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){return 0}static sqrLen(e){return 0}static normalize(e,t){return e}static exactEquals(e,t){return!1}static equals(e,t){return!1}static rotationTo(e,t,n){let s=q.dot(t,n);return s<-.999999?(q.cross(b.#s,b.#a,t),q.mag(b.#s)<1e-6&&q.cross(b.#s,b.#i,t),q.normalize(b.#s,b.#s),b.setAxisAngle(e,b.#s,Math.PI),e):s>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(q.cross(b.#s,t,n),e[0]=b.#s[0],e[1]=b.#s[1],e[2]=b.#s[2],e[3]=1+s,b.normalize(e,e))}static sqlerp(e,t,n,s,r,a){return b.slerp(b.#e,t,r,a),b.slerp(b.#r,n,s,a),b.slerp(e,b.#e,b.#r,2*a*(1-a)),e}static setAxes(e,t,n,s){return b.#n[0]=n[0],b.#n[3]=n[1],b.#n[6]=n[2],b.#n[1]=s[0],b.#n[4]=s[1],b.#n[7]=s[2],b.#n[2]=-t[0],b.#n[5]=-t[1],b.#n[8]=-t[2],b.normalize(e,b.fromMat3(e,b.#n))}};N.set=E.set;N.add=E.add;N.lerp=E.lerp;N.normalize=E.normalize;N.squaredLength=E.squaredLength;N.sqrLen=E.squaredLength;N.exactEquals=E.exactEquals;N.equals=E.equals;N.magnitude=E.magnitude;N.prototype.mul=N.prototype.multiply;N.mul=N.multiply;N.mag=N.magnitude;N.length=N.magnitude;N.len=N.magnitude;var O=class b extends Float32Array{static#t=new Float32Array(4);static#e=new Float32Array(3);constructor(...e){switch(e.length){case 8:super(e);break;case 2:super(e[0],e[1],8);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t,t,t,t,t,t]):super(t,0,8);break}default:super(8),this[3]=1;break}}get str(){return b.str(this)}copy(e){return super.set(e),this}static get BYTE_LENGTH(){return 8*Float32Array.BYTES_PER_ELEMENT}static create(){return new b}static clone(e){return new b(e)}static fromValues(e,t,n,s,r,a,i,c){return new b(e,t,n,s,r,a,i,c)}static fromRotationTranslationValues(e,t,n,s,r,a,i){let c=r*.5,y=a*.5,L=i*.5;return new b(e,t,n,s,c*s+y*n-L*t,y*s+L*e-c*n,L*s+c*t-y*e,-c*e-y*t-L*n)}static fromRotationTranslation(e,t,n){let s=n[0]*.5,r=n[1]*.5,a=n[2]*.5,i=t[0],c=t[1],y=t[2],L=t[3];return e[0]=i,e[1]=c,e[2]=y,e[3]=L,e[4]=s*L+r*y-a*c,e[5]=r*L+a*i-s*y,e[6]=a*L+s*c-r*i,e[7]=-s*i-r*c-a*y,e}static fromTranslation(e,t){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0]*.5,e[5]=t[1]*.5,e[6]=t[2]*.5,e[7]=0,e}static fromRotation(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=0,e[5]=0,e[6]=0,e[7]=0,e}static fromMat4(e,t){return P.getRotation(b.#t,t),P.getTranslation(b.#e,t),b.fromRotationTranslation(e,b.#t,b.#e)}static copy(e,t){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}static identity(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e}static set(e,t,n,s,r,a,i,c,y){return e[0]=t,e[1]=n,e[2]=s,e[3]=r,e[4]=a,e[5]=i,e[6]=c,e[7]=y,e}static getReal(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static getDual(e,t){return e[0]=t[4],e[1]=t[5],e[2]=t[6],e[3]=t[7],e}static setReal(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static setDual(e,t){return e[4]=t[0],e[5]=t[1],e[6]=t[2],e[7]=t[3],e}static getTranslation(e,t){let n=t[4],s=t[5],r=t[6],a=t[7],i=-t[0],c=-t[1],y=-t[2],L=t[3];return e[0]=(n*L+a*i+s*y-r*c)*2,e[1]=(s*L+a*c+r*i-n*y)*2,e[2]=(r*L+a*y+n*c-s*i)*2,e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0]*.5,y=n[1]*.5,L=n[2]*.5,k=t[4],l=t[5],M=t[6],h=t[7];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=i*c+r*L-a*y+k,e[5]=i*y+a*c-s*L+l,e[6]=i*L+s*y-r*c+M,e[7]=-s*c-r*y-a*L+h,e}static rotateX(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,M=y*i+k*r+L*s-c*a,h=L*i+k*a+c*r-y*s,d=k*i-c*s-y*r-L*a;return N.rotateX(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+d*s+M*a-h*r,e[5]=M*i+d*r+h*s-l*a,e[6]=h*i+d*a+l*r-M*s,e[7]=d*i-l*s-M*r-h*a,e}static rotateY(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,M=y*i+k*r+L*s-c*a,h=L*i+k*a+c*r-y*s,d=k*i-c*s-y*r-L*a;return N.rotateY(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+d*s+M*a-h*r,e[5]=M*i+d*r+h*s-l*a,e[6]=h*i+d*a+l*r-M*s,e[7]=d*i-l*s-M*r-h*a,e}static rotateZ(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,M=y*i+k*r+L*s-c*a,h=L*i+k*a+c*r-y*s,d=k*i-c*s-y*r-L*a;return N.rotateZ(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+d*s+M*a-h*r,e[5]=M*i+d*r+h*s-l*a,e[6]=h*i+d*a+l*r-M*s,e[7]=d*i-l*s-M*r-h*a,e}static rotateByQuatAppend(e,t,n){let s=n[0],r=n[1],a=n[2],i=n[3],c=t[0],y=t[1],L=t[2],k=t[3];return e[0]=c*i+k*s+y*a-L*r,e[1]=y*i+k*r+L*s-c*a,e[2]=L*i+k*a+c*r-y*s,e[3]=k*i-c*s-y*r-L*a,c=t[4],y=t[5],L=t[6],k=t[7],e[4]=c*i+k*s+y*a-L*r,e[5]=y*i+k*r+L*s-c*a,e[6]=L*i+k*a+c*r-y*s,e[7]=k*i-c*s-y*r-L*a,e}static rotateByQuatPrepend(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*k+i*c+r*L-a*y,e[1]=r*k+i*y+a*c-s*L,e[2]=a*k+i*L+s*y-r*c,e[3]=i*k-s*c-r*y-a*L,c=n[4],y=n[5],L=n[6],k=n[7],e[4]=s*k+i*c+r*L-a*y,e[5]=r*k+i*y+a*c-s*L,e[6]=a*k+i*L+s*y-r*c,e[7]=i*k-s*c-r*y-a*L,e}static rotateAroundAxis(e,t,n,s){if(Math.abs(s)<1e-6)return b.copy(e,t);let r=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);s*=.5;let a=Math.sin(s),i=a*n[0]/r,c=a*n[1]/r,y=a*n[2]/r,L=Math.cos(s),k=t[0],l=t[1],M=t[2],h=t[3];e[0]=k*L+h*i+l*y-M*c,e[1]=l*L+h*c+M*i-k*y,e[2]=M*L+h*y+k*c-l*i,e[3]=h*L-k*i-l*c-M*y;let d=t[4],m=t[5],o=t[6],x=t[7];return e[4]=d*L+x*i+m*y-o*c,e[5]=m*L+x*c+o*i-d*y,e[6]=o*L+x*y+d*c-m*i,e[7]=x*L-d*i-m*c-o*y,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[4],y=n[5],L=n[6],k=n[7],l=t[4],M=t[5],h=t[6],d=t[7],m=n[0],o=n[1],x=n[2],z=n[3];return e[0]=s*z+i*m+r*x-a*o,e[1]=r*z+i*o+a*m-s*x,e[2]=a*z+i*x+s*o-r*m,e[3]=i*z-s*m-r*o-a*x,e[4]=s*k+i*c+r*L-a*y+l*z+d*m+M*x-h*o,e[5]=r*k+i*y+a*c-s*L+M*z+d*o+h*m-l*x,e[6]=a*k+i*L+s*y-r*c+h*z+d*x+l*o-M*m,e[7]=i*k-s*c-r*y-a*L+d*z-l*m-M*o-h*x,e}static mul(e,t,n){return e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e}static dot(e,t){return 0}static lerp(e,t,n,s){let r=1-s;return b.dot(t,n)<0&&(s=-s),e[0]=t[0]*r+n[0]*s,e[1]=t[1]*r+n[1]*s,e[2]=t[2]*r+n[2]*s,e[3]=t[3]*r+n[3]*s,e[4]=t[4]*r+n[4]*s,e[5]=t[5]*r+n[5]*s,e[6]=t[6]*r+n[6]*s,e[7]=t[7]*r+n[7]*s,e}static invert(e,t){let n=b.squaredLength(t);return e[0]=-t[0]/n,e[1]=-t[1]/n,e[2]=-t[2]/n,e[3]=t[3]/n,e[4]=-t[4]/n,e[5]=-t[5]/n,e[6]=-t[6]/n,e[7]=t[7]/n,e}static conjugate(e,t){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}static magnitude(e){return 0}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){return 0}static sqrLen(e){return 0}static normalize(e,t){let n=b.squaredLength(t);if(n>0){n=Math.sqrt(n);let s=t[0]/n,r=t[1]/n,a=t[2]/n,i=t[3]/n,c=t[4],y=t[5],L=t[6],k=t[7],l=s*c+r*y+a*L+i*k;e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=(c-s*l)/n,e[5]=(y-r*l)/n,e[6]=(L-a*l)/n,e[7]=(k-i*l)/n}return e}static str(e){return`Quat2(${e.join(", ")})`}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=t[0],l=t[1],M=t[2],h=t[3],d=t[4],m=t[5],o=t[6],x=t[7];return Math.abs(n-k)<=1e-6*Math.max(1,Math.abs(n),Math.abs(k))&&Math.abs(s-l)<=1e-6*Math.max(1,Math.abs(s),Math.abs(l))&&Math.abs(r-M)<=1e-6*Math.max(1,Math.abs(r),Math.abs(M))&&Math.abs(a-h)<=1e-6*Math.max(1,Math.abs(a),Math.abs(h))&&Math.abs(i-d)<=1e-6*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(c-m)<=1e-6*Math.max(1,Math.abs(c),Math.abs(m))&&Math.abs(y-o)<=1e-6*Math.max(1,Math.abs(y),Math.abs(o))&&Math.abs(L-x)<=1e-6*Math.max(1,Math.abs(L),Math.abs(x))}};O.dot=N.dot;O.squaredLength=N.squaredLength;O.sqrLen=N.squaredLength;O.mag=N.magnitude;O.length=N.magnitude;O.len=N.magnitude;O.mul=O.multiply;var B=class b extends Float32Array{constructor(...e){switch(e.length){case 2:{let t=e[0];typeof t=="number"?super([t,e[1]]):super(t,e[1],2);break}case 1:{let t=e[0];typeof t=="number"?super([t,t]):super(t,0,2);break}default:super(2);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get magnitude(){return Math.hypot(this[0],this[1])}get mag(){return this.magnitude}get squaredMagnitude(){let e=this[0],t=this[1];return e*e+t*t}get sqrMag(){return this.squaredMagnitude}get str(){return b.str(this)}copy(e){return this.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this}distance(e){return b.distance(this,e)}dist(e){return 0}squaredDistance(e){return b.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this}dot(e){return this[0]*e[0]+this[1]*e[1]}normalize(){return b.normalize(this,this)}static get BYTE_LENGTH(){return 2*Float32Array.BYTES_PER_ELEMENT}static create(){return new b}static clone(e){return new b(e)}static fromValues(e,t){return new b(e,t)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e}static set(e,t,n){return e[0]=t,e[1]=n,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}static sub(e,t,n){return[0,0]}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e}static mul(e,t,n){return[0,0]}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e}static div(e,t,n){return[0,0]}static ceil(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}static floor(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e}static round(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e}static distance(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1])}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1];return n*n+s*s}static sqrDist(e,t){return 0}static magnitude(e){let t=e[0],n=e[1];return Math.sqrt(t*t+n*n)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){let t=e[0],n=e[1];return t*t+n*n}static sqrLen(e,t){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e}static normalize(e,t){let n=t[0],s=t[1],r=n*n+s*s;return r>0&&(r=1/Math.sqrt(r)),e[0]=t[0]*r,e[1]=t[1]*r,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]}static cross(e,t,n){let s=t[0]*n[1]-t[1]*n[0];return e[0]=e[1]=0,e[2]=s,e}static lerp(e,t,n,s){let r=t[0],a=t[1];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e}static transformMat2(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[2]*r,e[1]=n[1]*s+n[3]*r,e}static transformMat2d(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[2]*r+n[4],e[1]=n[1]*s+n[3]*r+n[5],e}static transformMat3(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[3]*r+n[6],e[1]=n[1]*s+n[4]*r+n[7],e}static transformMat4(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[4]*r+n[12],e[1]=n[1]*s+n[5]*r+n[13],e}static rotate(e,t,n,s){let r=t[0]-n[0],a=t[1]-n[1],i=Math.sin(s),c=Math.cos(s);return e[0]=r*c-a*i+n[0],e[1]=r*i+a*c+n[1],e}static angle(e,t){let n=e[0],s=e[1],r=t[0],a=t[1],i=Math.sqrt(n*n+s*s)*Math.sqrt(r*r+a*a),c=i&&(n*r+s*a)/i;return Math.acos(Math.min(Math.max(c,-1),1))}static zero(e){return e[0]=0,e[1]=0,e}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]}static equals(e,t){let n=e[0],s=e[1],r=t[0],a=t[1];return Math.abs(n-r)<=1e-6*Math.max(1,Math.abs(n),Math.abs(r))&&Math.abs(s-a)<=1e-6*Math.max(1,Math.abs(s),Math.abs(a))}static str(e){return`Vec2(${e.join(", ")})`}};B.prototype.sub=B.prototype.subtract;B.prototype.mul=B.prototype.multiply;B.prototype.div=B.prototype.divide;B.prototype.dist=B.prototype.distance;B.prototype.sqrDist=B.prototype.squaredDistance;B.sub=B.subtract;B.mul=B.multiply;B.div=B.divide;B.dist=B.distance;B.sqrDist=B.squaredDistance;B.sqrLen=B.squaredLength;B.mag=B.magnitude;B.length=B.magnitude;B.len=B.magnitude;var W=!1;function ze(){if(W)return;let b=["xx","xy","yx","yy","xxx","xxy","xyx","xyy","yxx","yxy","yyx","yyy","xxxx","xxxy","xxyx","xxyy","xyxx","xyxy","xyyx","xyyy","yxxx","yxxy","yxyx","yxyy","yyxx","yyxy","yyyx","yyyy","rr","rg","gr","gg","rrr","rrg","rgr","rgg","grr","grg","ggr","ggg","rrrr","rrrg","rrgr","rrgg","rgrr","rgrg","rggr","rggg","grrr","grrg","grgr","grgg","ggrr","ggrg","gggr","gggg"],e=["xz","yz","zx","zy","zz","xxz","xyz","xzx","xzy","xzz","yxz","yyz","yzx","yzy","yzz","zxx","zxy","zxz","zyx","zyy","zyz","zzx","zzy","zzz","xxxz","xxyz","xxzx","xxzy","xxzz","xyxz","xyyz","xyzx","xyzy","xyzz","xzxx","xzxy","xzxz","xzyx","xzyy","xzyz","xzzx","xzzy","xzzz","yxxz","yxyz","yxzx","yxzy","yxzz","yyxz","yyyz","yyzx","yyzy","yyzz","yzxx","yzxy","yzxz","yzyx","yzyy","yzyz","yzzx","yzzy","yzzz","zxxx","zxxy","zxxz","zxyx","zxyy","zxyz","zxzx","zxzy","zxzz","zyxx","zyxy","zyxz","zyyx","zyyy","zyyz","zyzx","zyzy","zyzz","zzxx","zzxy","zzxz","zzyx","zzyy","zzyz","zzzx","zzzy","zzzz","rb","gb","br","bg","bb","rrb","rgb","rbr","rbg","rbb","grb","ggb","gbr","gbg","gbb","brr","brg","brb","bgr","bgg","bgb","bbr","bbg","bbb","rrrb","rrgb","rrbr","rrbg","rrbb","rgrb","rggb","rgbr","rgbg","rgbb","rbrr","rbrg","rbrb","rbgr","rbgg","rbgb","rbbr","rbbg","rbbb","grrb","grgb","grbr","grbg","grbb","ggrb","gggb","ggbr","ggbg","ggbb","gbrr","gbrg","gbrb","gbgr","gbgg","gbgb","gbbr","gbbg","gbbb","brrr","brrg","brrb","brgr","brgg","brgb","brbr","brbg","brbb","bgrr","bgrg","bgrb","bggr","bggg","bggb","bgbr","bgbg","bgbb","bbrr","bbrg","bbrb","bbgr","bbgg","bbgb","bbbr","bbbg","bbbb"],t=["xw","yw","zw","wx","wy","wz","ww","xxw","xyw","xzw","xwx","xwy","xwz","xww","yxw","yyw","yzw","ywx","ywy","ywz","yww","zxw","zyw","zzw","zwx","zwy","zwz","zww","wxx","wxy","wxz","wxw","wyx","wyy","wyz","wyw","wzx","wzy","wzz","wzw","wwx","wwy","wwz","www","xxxw","xxyw","xxzw","xxwx","xxwy","xxwz","xxww","xyxw","xyyw","xyzw","xywx","xywy","xywz","xyww","xzxw","xzyw","xzzw","xzwx","xzwy","xzwz","xzww","xwxx","xwxy","xwxz","xwxw","xwyx","xwyy","xwyz","xwyw","xwzx","xwzy","xwzz","xwzw","xwwx","xwwy","xwwz","xwww","yxxw","yxyw","yxzw","yxwx","yxwy","yxwz","yxww","yyxw","yyyw","yyzw","yywx","yywy","yywz","yyww","yzxw","yzyw","yzzw","yzwx","yzwy","yzwz","yzww","ywxx","ywxy","ywxz","ywxw","ywyx","ywyy","ywyz","ywyw","ywzx","ywzy","ywzz","ywzw","ywwx","ywwy","ywwz","ywww","zxxw","zxyw","zxzw","zxwx","zxwy","zxwz","zxww","zyxw","zyyw","zyzw","zywx","zywy","zywz","zyww","zzxw","zzyw","zzzw","zzwx","zzwy","zzwz","zzww","zwxx","zwxy","zwxz","zwxw","zwyx","zwyy","zwyz","zwyw","zwzx","zwzy","zwzz","zwzw","zwwx","zwwy","zwwz","zwww","wxxx","wxxy","wxxz","wxxw","wxyx","wxyy","wxyz","wxyw","wxzx","wxzy","wxzz","wxzw","wxwx","wxwy","wxwz","wxww","wyxx","wyxy","wyxz","wyxw","wyyx","wyyy","wyyz","wyyw","wyzx","wyzy","wyzz","wyzw","wywx","wywy","wywz","wyww","wzxx","wzxy","wzxz","wzxw","wzyx","wzyy","wzyz","wzyw","wzzx","wzzy","wzzz","wzzw","wzwx","wzwy","wzwz","wzww","wwxx","wwxy","wwxz","wwxw","wwyx","wwyy","wwyz","wwyw","wwzx","wwzy","wwzz","wwzw","wwwx","wwwy","wwwz","wwww","ra","ga","ba","ar","ag","ab","aa","rra","rga","rba","rar","rag","rab","raa","gra","gga","gba","gar","gag","gab","gaa","bra","bga","bba","bar","bag","bab","baa","arr","arg","arb","ara","agr","agg","agb","aga","abr","abg","abb","aba","aar","aag","aab","aaa","rrra","rrga","rrba","rrar","rrag","rrab","rraa","rgra","rgga","rgba","rgar","rgag","rgab","rgaa","rbra","rbga","rbba","rbar","rbag","rbab","rbaa","rarr","rarg","rarb","rara","ragr","ragg","ragb","raga","rabr","rabg","rabb","raba","raar","raag","raab","raaa","grra","grga","grba","grar","grag","grab","graa","ggra","ggga","ggba","ggar","ggag","ggab","ggaa","gbra","gbga","gbba","gbar","gbag","gbab","gbaa","garr","garg","garb","gara","gagr","gagg","gagb","gaga","gabr","gabg","gabb","gaba","gaar","gaag","gaab","gaaa","brra","brga","brba","brar","brag","brab","braa","bgra","bgga","bgba","bgar","bgag","bgab","bgaa","bbra","bbga","bbba","bbar","bbag","bbab","bbaa","barr","barg","barb","bara","bagr","bagg","bagb","baga","babr","babg","babb","baba","baar","baag","baab","baaa","arrr","arrg","arrb","arra","argr","argg","argb","arga","arbr","arbg","arbb","arba","arar","arag","arab","araa","agrr","agrg","agrb","agra","aggr","aggg","aggb","agga","agbr","agbg","agbb","agba","agar","agag","agab","agaa","abrr","abrg","abrb","abra","abgr","abgg","abgb","abga","abbr","abbg","abbb","abba","abar","abag","abab","abaa","aarr","aarg","aarb","aara","aagr","aagg","aagb","aaga","aabr","aabg","aabb","aaba","aaar","aaag","aaab","aaaa"],n={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};function s(r){switch(r.length){case 2:return function(){return new B(this[n[r[0]]],this[n[r[1]]])};case 3:return function(){return new q(this[n[r[0]]],this[n[r[1]]],this[n[r[2]]])};case 4:return function(){return new E(this[n[r[0]]],this[n[r[1]]],this[n[r[2]]],this[n[r[3]]])}}throw new Error("Illegal swizzle length")}for(let r of b){let a=s(r);Object.defineProperty(B.prototype,r,{get:a}),Object.defineProperty(q.prototype,r,{get:a}),Object.defineProperty(E.prototype,r,{get:a})}for(let r of e){let a=s(r);Object.defineProperty(q.prototype,r,{get:a}),Object.defineProperty(E.prototype,r,{get:a})}for(let r of t){let a=s(r);Object.defineProperty(E.prototype,r,{get:a})}W=!0}var U=Math.PI/180,J=180/Math.PI;function pe(b){return b*J}function fe(b){return b*U}export{ze as EnableSwizzles,Z as Mat2,j as Mat2d,G as Mat3,P as Mat4,N as Quat,O as Quat2,B as Vec2,q as Vec3,E as Vec4,Z as mat2,j as mat2d,G as mat3,P as mat4,N as quat,O as quat2,pe as toDegree,fe as toRadian,B as vec2,q as vec3,E as vec4}; +//# sourceMappingURL=gl-matrix-f32.min.js.map diff --git a/dist-cdn/esm/2022/gl-matrix-f32.min.js.map b/dist-cdn/esm/2022/gl-matrix-f32.min.js.map new file mode 100644 index 00000000..20b49309 --- /dev/null +++ b/dist-cdn/esm/2022/gl-matrix-f32.min.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../../../src/_lib/f32/Mat2.ts", "../../../src/_lib/f32/Mat2d.ts", "../../../src/_lib/f32/Mat3.ts", "../../../src/_lib/f32/Mat4.ts", "../../../src/_lib/f32/Vec3.ts", "../../../src/_lib/f32/Vec4.ts", "../../../src/_lib/f32/Quat.ts", "../../../src/_lib/f32/Quat2.ts", "../../../src/_lib/f32/Vec2.ts", "../../../src/swizzle/index.ts", "../../../src/util/angleConversion.ts"], + "sourcesContent": ["import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x2 Matrix\r\n */\r\nexport class Mat2 extends Float32Array {\r\n static #IDENTITY_2X2 = new Float32Array([\r\n 1, 0,\r\n 0, 1\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n default:\r\n super(Mat2.#IDENTITY_2X2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2} into `this`.\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2.identity(this)\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n identity(): this {\r\n this.set(Mat2.#IDENTITY_2X2);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2} against another one\r\n * Equivalent to `Mat2.multiply(this, this, b);`\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat2}\r\n * Equivalent to `Mat2.transpose(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n transpose(): this {\r\n return Mat2.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat2}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n invert(): this {\r\n return Mat2.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2.scale(this, this, v);`\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2} by the given angle around the given axis\r\n * Equivalent to `Mat2.rotate(this, this, rad);`\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n rotate(rad: number): this {\r\n return Mat2.rotate(this, this, rad) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2}\r\n */\r\n static create(): Mat2 {\r\n return new Mat2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2}\r\n */\r\n static clone(a: Readonly): Mat2 {\r\n return new Mat2(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2Like, a: Readonly): Mat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2}\r\n */\r\n static fromValues(...values: number[]): Mat2 {\r\n return new Mat2(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2Like, ...values: number[]): Mat2Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2Like): Mat2Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat2Like, a: Readonly): Mat2Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache\r\n // some values\r\n if (out === a) {\r\n const a1 = a[1];\r\n out[1] = a[2];\r\n out[2] = a1;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[2];\r\n out[2] = a[1];\r\n out[3] = a[3];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2Like, a: Mat2Like): Mat2Like | null {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n // Calculate the determinant\r\n let det = a0 * a3 - a2 * a1;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = a3 * det;\r\n out[1] = -a1 * det;\r\n out[2] = -a2 * det;\r\n out[3] = a0 * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat2Like, a: Mat2Like): Mat2Like {\r\n // Caching this value is necessary if out == a\r\n const a0 = a[0];\r\n out[0] = a[3];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[2] * a[1];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n return out;\r\n }\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Rotates a {@link Mat2} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2Like, a: Readonly, rad: number): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2Like, a: Readonly, v: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2Like, rad: number): Mat2Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2Like, v: Readonly): Mat2Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2Like, a: Readonly, b: number): Mat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2Like, a: Readonly, b: Readonly, scale: number): Mat2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\r\n * @category Static\r\n *\r\n * @param L - the lower triangular matrix\r\n * @param D - the diagonal matrix\r\n * @param U - the upper triangular matrix\r\n * @param a - the input matrix to factorize\r\n */\r\n\r\n static LDU(L: Mat2Like, D: Readonly, U: Mat2Like, a: Readonly):\r\n [Mat2Like, Readonly, Mat2Like] {\r\n L[2] = a[2] / a[0];\r\n U[0] = a[0];\r\n U[1] = a[1];\r\n U[3] = a[3] - L[2] * U[1];\r\n return [L, D, U];\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat2.prototype.mul = Mat2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat2.mul = Mat2.multiply;\r\nMat2.sub = Mat2.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x3 Matrix\r\n */\r\nexport class Mat2d extends Float32Array {\r\n static #IDENTITY_2X3 = new Float32Array([\r\n 1, 0,\r\n 0, 1,\r\n 0, 0,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 6:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 6); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 6);\r\n }\r\n break;\r\n default:\r\n super(Mat2d.#IDENTITY_2X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2d.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2d.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2d} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2d.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat2d.#IDENTITY_2X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2d} against another one\r\n * Equivalent to `Mat2d.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2d.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Translate this {@link Mat2d} by the given vector\r\n * Equivalent to `Mat2d.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat2d.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2d} by the given angle around the given axis\r\n * Equivalent to `Mat2d.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat2d.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2d.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2d.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2d}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 6 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2d}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2d}\r\n */\r\n static create(): Mat2d {\r\n return new Mat2d();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2d} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2d}\r\n */\r\n static clone(a: Readonly): Mat2d {\r\n return new Mat2d(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2d} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2dLike, a: Readonly): Mat2dLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2d} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2d}\r\n */\r\n static fromValues(...values: number[]): Mat2d {\r\n return new Mat2d(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2d} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2dLike, ...values: number[]): Mat2dLike {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2d} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2dLike): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2dLike, a: Mat2dLike): Mat2dLike | null {\r\n const aa = a[0];\r\n const ab = a[1];\r\n const ac = a[2];\r\n const ad = a[3];\r\n const atx = a[4];\r\n const aty = a[5];\r\n\r\n let det = aa * ad - ab * ac;\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = ad * det;\r\n out[1] = -ab * det;\r\n out[2] = -ac * det;\r\n out[3] = aa * det;\r\n out[4] = (ac * aty - ad * atx) * det;\r\n out[5] = (ab * atx - aa * aty) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[1] * a[2];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2d}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n out[4] = a0 * b4 + a2 * b5 + a4;\r\n out[5] = a1 * b4 + a3 * b5 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat2d} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n out[4] = a0 * v0 + a2 * v1 + a4;\r\n out[5] = a1 * v0 + a3 * v1 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat2d} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2dLike, a: Readonly, rad: number): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n // TODO: Got to fromRotation\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = v[0];\r\n out[5] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2dLike, rad: number): Mat2dLike {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2d} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2dLike, a: Readonly, b: number): Mat2dLike {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2dLike, a: Readonly, b: Readonly, scale: number):\r\n Mat2dLike {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2d(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Static method alias assignments\r\nMat2d.mul = Mat2d.multiply;\r\nMat2d.sub = Mat2d.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Mat3Like, Mat4Like, Vec2Like, QuatLike } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 3x3 Matrix\r\n */\r\nexport class Mat3 extends Float32Array {\r\n static #IDENTITY_3X3 = new Float32Array([\r\n 1, 0, 0,\r\n 0, 1, 0,\r\n 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 9:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 9); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v,\r\n v, v, v,\r\n v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 9);\r\n }\r\n break;\r\n default:\r\n super(Mat3.#IDENTITY_3X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat3.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat3.#IDENTITY_3X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat3} against another one\r\n * Equivalent to `Mat3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat3.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat3}\r\n * Equivalent to `Mat3.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat3.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat3}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat3.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat3} by the given vector\r\n * Equivalent to `Mat3.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat3.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat3} by the given angle around the given axis\r\n * Equivalent to `Mat3.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat3.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat3.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat3.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 9 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat3}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat3}\r\n */\r\n static create(): Mat3 {\r\n return new Mat3();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat3} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat3}\r\n */\r\n static clone(a: Readonly): Mat3 {\r\n return new Mat3(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat3} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat3} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat3}\r\n */\r\n static fromValues(...values: number[]): Mat3 {\r\n return new Mat3(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat3} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat3Like, ...values: number[]): Mat3Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat3} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat3Like): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat3Like, a: Readonly): Mat3Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a12 = a[5];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a01;\r\n out[5] = a[7];\r\n out[6] = a02;\r\n out[7] = a12;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a[1];\r\n out[4] = a[4];\r\n out[5] = a[7];\r\n out[6] = a[2];\r\n out[7] = a[5];\r\n out[8] = a[8];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat3Like, a: Mat3Like): Mat3Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2];\r\n const a10 = a[3],\r\n a11 = a[4],\r\n a12 = a[5];\r\n const a20 = a[6],\r\n a21 = a[7],\r\n a22 = a[8];\r\n\r\n const b01 = a22 * a11 - a12 * a21;\r\n const b11 = -a22 * a10 + a12 * a20;\r\n const b21 = a21 * a10 - a11 * a20;\r\n\r\n // Calculate the determinant\r\n let det = a00 * b01 + a01 * b11 + a02 * b21;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = b01 * det;\r\n out[1] = (-a22 * a01 + a02 * a21) * det;\r\n out[2] = (a12 * a01 - a02 * a11) * det;\r\n out[3] = b11 * det;\r\n out[4] = (a22 * a00 - a02 * a20) * det;\r\n out[5] = (-a12 * a00 + a02 * a10) * det;\r\n out[6] = b21 * det;\r\n out[7] = (-a21 * a00 + a01 * a20) * det;\r\n out[8] = (a11 * a00 - a01 * a10) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat3Like, a: Mat3Like): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n out[0] = a11 * a22 - a12 * a21;\r\n out[1] = a02 * a21 - a01 * a22;\r\n out[2] = a01 * a12 - a02 * a11;\r\n out[3] = a12 * a20 - a10 * a22;\r\n out[4] = a00 * a22 - a02 * a20;\r\n out[5] = a02 * a10 - a00 * a12;\r\n out[6] = a10 * a21 - a11 * a20;\r\n out[7] = a01 * a20 - a00 * a21;\r\n out[8] = a00 * a11 - a01 * a10;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n return (\r\n a00 * (a22 * a11 - a12 * a21) +\r\n a01 * (-a22 * a10 + a12 * a20) +\r\n a02 * (a21 * a10 - a11 * a20)\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[3];\r\n b1 = b[4];\r\n b2 = b[5];\r\n out[3] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[4] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[5] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[6];\r\n b1 = b[7];\r\n b2 = b[8];\r\n out[6] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[7] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[8] = b0 * a02 + b1 * a12 + b2 * a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat3} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n\r\n out[3] = a10;\r\n out[4] = a11;\r\n out[5] = a12;\r\n\r\n out[6] = x * a00 + y * a10 + a20;\r\n out[7] = x * a01 + y * a11 + a21;\r\n out[8] = x * a02 + y * a12 + a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat3} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat3Like, a: Readonly, rad: number): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c * a00 + s * a10;\r\n out[1] = c * a01 + s * a11;\r\n out[2] = c * a02 + s * a12;\r\n\r\n out[3] = c * a10 - s * a00;\r\n out[4] = c * a11 - s * a01;\r\n out[5] = c * a12 - s * a02;\r\n\r\n out[6] = a20;\r\n out[7] = a21;\r\n out[8] = a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat3} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = x * a[0];\r\n out[1] = x * a[1];\r\n out[2] = x * a[2];\r\n\r\n out[3] = y * a[3];\r\n out[4] = y * a[4];\r\n out[5] = y * a[5];\r\n\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = v[0];\r\n out[7] = v[1];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.rotate(dest, dest, rad);\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat3Like, rad: number): Mat3Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n\r\n out[3] = -s;\r\n out[4] = c;\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n\r\n out[3] = 0;\r\n out[4] = v[1];\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat2d} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 2x3 matrix\r\n * @returns `out`\r\n */\r\n static fromMat2d(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = 0;\r\n\r\n out[3] = a[2];\r\n out[4] = a[3];\r\n out[5] = 0;\r\n\r\n out[6] = a[4];\r\n out[7] = a[5];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param q - {@link Quat} to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat3Like, q: Readonly): Mat3Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[3] = yx - wz;\r\n out[6] = zx + wy;\r\n\r\n out[1] = yx + wz;\r\n out[4] = 1 - xx - zz;\r\n out[7] = zy - wx;\r\n\r\n out[2] = zx - wy;\r\n out[5] = zy + wx;\r\n out[8] = 1 - xx - yy;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat4} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 4x4 matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[4];\r\n out[4] = a[5];\r\n out[5] = a[6];\r\n out[6] = a[8];\r\n out[7] = a[9];\r\n out[8] = a[10];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\r\n * @category Static\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat3Like, a: Readonly): Mat3Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n\r\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n\r\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat3Like, a: Readonly): Mat3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n\r\n out[3] = cy * az - cz * ay;\r\n out[4] = cz * ax - cx * az;\r\n out[5] = cx * ay - cy * ax;\r\n\r\n out[6] = ay * bz - az * by;\r\n out[7] = az * bx - ax * bz;\r\n out[8] = ax * by - ay * bx;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a 2D projection matrix with the given bounds\r\n * @category Static\r\n *\r\n * @param out mat3 frustum matrix will be written into\r\n * @param width Width of your gl context\r\n * @param height Height of gl context\r\n * @returns `out`\r\n */\r\n static projection(out: Mat3Like, width: number, height: number): Mat3Like {\r\n out[0] = 2 / width;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -2 / height;\r\n out[5] = 0;\r\n out[6] = -1;\r\n out[7] = 1;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8]\r\n );\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat3} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat3Like, a: Readonly, b: number): Mat3Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat3Like, a: Readonly, b: Readonly, scale: number): Mat3Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat3(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat3.prototype.mul = Mat3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat3.mul = Mat3.multiply;\r\nMat3.sub = Mat3.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 4x4 Matrix\r\n */\r\nexport class Mat4 extends Float32Array {\r\n static #IDENTITY_4X4 = new Float32Array([\r\n 1, 0, 0, 0,\r\n 0, 1, 0, 0,\r\n 0, 0, 1, 0,\r\n 0, 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Temporary variable to prevent repeated allocations in the algorithms within Mat4.\r\n * These are declared as TypedArrays to aid in tree-shaking.\r\n */\r\n static #TMP_VEC3 = new Float32Array(3);\r\n\r\n /**\r\n * Create a {@link Mat4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 16:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 16); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 16);\r\n }\r\n break;\r\n default:\r\n super(Mat4.#IDENTITY_4X4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat4.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat4.#IDENTITY_4X4);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat4} against another one\r\n * Equivalent to `Mat4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat4.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat4}\r\n * Equivalent to `Mat4.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat4.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat4}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat4.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat4} by the given vector\r\n * Equivalent to `Mat4.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat4.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the given axis\r\n * Equivalent to `Mat4.rotate(this, this, rad, axis);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `this`\r\n */\r\n rotate(rad: number, axis: Readonly): this {\r\n return Mat4.rotate(this, this, rad, axis) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat4.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat4.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the X axis\r\n * Equivalent to `Mat4.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Mat4.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Y axis\r\n * Equivalent to `Mat4.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Mat4.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Z axis\r\n * Equivalent to `Mat4.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Mat4.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveNO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveNO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveZO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveZO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoNO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoNO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoZO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoZO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 16 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat4}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat4}\r\n */\r\n static create(): Mat4 {\r\n return new Mat4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat4} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat4}\r\n */\r\n static clone(a: Readonly): Mat4 {\r\n return new Mat4(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat4} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat4Like, a: Readonly): Mat4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new mat4 with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat4}\r\n */\r\n static fromValues(...values: number[]): Mat4 {\r\n return new Mat4(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a mat4 to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat4Like, ...values: number[]): Mat4Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n out[9] = values[9];\r\n out[10] = values[10];\r\n out[11] = values[11];\r\n out[12] = values[12];\r\n out[13] = values[13];\r\n out[14] = values[14];\r\n out[15] = values[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat4} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat4Like): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat4Like, a: Readonly): Mat4Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a12 = a[6],\r\n a13 = a[7];\r\n const a23 = a[11];\r\n\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a01;\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a02;\r\n out[9] = a12;\r\n out[11] = a[14];\r\n out[12] = a03;\r\n out[13] = a13;\r\n out[14] = a23;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a[1];\r\n out[5] = a[5];\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a[2];\r\n out[9] = a[6];\r\n out[10] = a[10];\r\n out[11] = a[14];\r\n out[12] = a[3];\r\n out[13] = a[7];\r\n out[14] = a[11];\r\n out[15] = a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat4Like, a: Mat4Like): Mat4Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\r\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\r\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\r\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\r\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\r\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\r\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat4Like, a: Mat4Like): Mat4Like {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n out[0] = a11 * b11 - a12 * b10 + a13 * b09;\r\n out[1] = a02 * b10 - a01 * b11 - a03 * b09;\r\n out[2] = a31 * b05 - a32 * b04 + a33 * b03;\r\n out[3] = a22 * b04 - a21 * b05 - a23 * b03;\r\n out[4] = a12 * b08 - a10 * b11 - a13 * b07;\r\n out[5] = a00 * b11 - a02 * b08 + a03 * b07;\r\n out[6] = a32 * b02 - a30 * b05 - a33 * b01;\r\n out[7] = a20 * b05 - a22 * b02 + a23 * b01;\r\n out[8] = a10 * b10 - a11 * b08 + a13 * b06;\r\n out[9] = a01 * b08 - a00 * b10 - a03 * b06;\r\n out[10] = a30 * b04 - a31 * b02 + a33 * b00;\r\n out[11] = a21 * b02 - a20 * b04 - a23 * b00;\r\n out[12] = a11 * b07 - a10 * b09 - a12 * b06;\r\n out[13] = a00 * b09 - a01 * b07 + a02 * b06;\r\n out[14] = a31 * b01 - a30 * b03 - a32 * b00;\r\n out[15] = a20 * b03 - a21 * b01 + a22 * b00;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b0 = a00 * a11 - a01 * a10;\r\n const b1 = a00 * a12 - a02 * a10;\r\n const b2 = a01 * a12 - a02 * a11;\r\n const b3 = a20 * a31 - a21 * a30;\r\n const b4 = a20 * a32 - a22 * a30;\r\n const b5 = a21 * a32 - a22 * a31;\r\n const b6 = a00 * b5 - a01 * b4 + a02 * b3;\r\n const b7 = a10 * b5 - a11 * b4 + a12 * b3;\r\n const b8 = a20 * b2 - a21 * b1 + a22 * b0;\r\n const b9 = a30 * b2 - a31 * b1 + a32 * b0;\r\n\r\n // Calculate the determinant\r\n return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Mat4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n // Cache only the current line of the second matrix\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n let b3 = b[3];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[4];\r\n b1 = b[5];\r\n b2 = b[6];\r\n b3 = b[7];\r\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[8];\r\n b1 = b[9];\r\n b2 = b[10];\r\n b3 = b[11];\r\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[12];\r\n b1 = b[13];\r\n b2 = b[14];\r\n b3 = b[15];\r\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat4} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n if (a === out) {\r\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\r\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\r\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\r\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\r\n } else {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n out[3] = a03;\r\n out[4] = a10;\r\n out[5] = a11;\r\n out[6] = a12;\r\n out[7] = a13;\r\n out[8] = a20;\r\n out[9] = a21;\r\n out[10] = a22;\r\n out[11] = a23;\r\n\r\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\r\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\r\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\r\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec3} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n out[0] = a[0] * x;\r\n out[1] = a[1] * x;\r\n out[2] = a[2] * x;\r\n out[3] = a[3] * x;\r\n out[4] = a[4] * y;\r\n out[5] = a[5] * y;\r\n out[6] = a[6] * y;\r\n out[7] = a[7] * y;\r\n out[8] = a[8] * z;\r\n out[9] = a[9] * z;\r\n out[10] = a[10] * z;\r\n out[11] = a[11] * z;\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat4} by the given angle around the given axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if axis has a length of 0\r\n */\r\n static rotate(out: Mat4Like, a: Readonly, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n // Construct the elements of the rotation matrix\r\n const b00 = x * x * t + c;\r\n const b01 = y * x * t + z * s;\r\n const b02 = z * x * t - y * s;\r\n const b10 = x * y * t - z * s;\r\n const b11 = y * y * t + c;\r\n const b12 = z * y * t + x * s;\r\n const b20 = x * z * t + y * s;\r\n const b21 = y * z * t - x * s;\r\n const b22 = z * z * t + c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\r\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\r\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\r\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\r\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\r\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\r\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\r\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\r\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\r\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\r\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\r\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateX(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[4] = a10 * c + a20 * s;\r\n out[5] = a11 * c + a21 * s;\r\n out[6] = a12 * c + a22 * s;\r\n out[7] = a13 * c + a23 * s;\r\n out[8] = a20 * c - a10 * s;\r\n out[9] = a21 * c - a11 * s;\r\n out[10] = a22 * c - a12 * s;\r\n out[11] = a23 * c - a13 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateY(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c - a20 * s;\r\n out[1] = a01 * c - a21 * s;\r\n out[2] = a02 * c - a22 * s;\r\n out[3] = a03 * c - a23 * s;\r\n out[8] = a00 * s + a20 * c;\r\n out[9] = a01 * s + a21 * c;\r\n out[10] = a02 * s + a22 * c;\r\n out[11] = a03 * s + a23 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c + a10 * s;\r\n out[1] = a01 * c + a11 * s;\r\n out[2] = a02 * c + a12 * s;\r\n out[3] = a03 * c + a13 * s;\r\n out[4] = a10 * c - a00 * s;\r\n out[5] = a11 * c - a01 * s;\r\n out[6] = a12 * c - a02 * s;\r\n out[7] = a13 * c - a03 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = v[1];\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = v[2];\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotate(dest, dest, rad, axis);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if `axis` has a length of 0\r\n */\r\n static fromRotation(out: Mat4Like, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = x * x * t + c;\r\n out[1] = y * x * t + z * s;\r\n out[2] = z * x * t - y * s;\r\n out[3] = 0;\r\n out[4] = x * y * t - z * s;\r\n out[5] = y * y * t + c;\r\n out[6] = z * y * t + x * s;\r\n out[7] = 0;\r\n out[8] = x * z * t + y * s;\r\n out[9] = y * z * t - x * s;\r\n out[10] = z * z * t + c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the X axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateX(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromXRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = c;\r\n out[6] = s;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = -s;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Y axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateY(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromYRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = 0;\r\n out[2] = -s;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = s;\r\n out[9] = 0;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Z axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateZ(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromZRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -s;\r\n out[5] = c;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation and vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Mat4Like, q: Readonly, v: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - (yy + zz);\r\n out[1] = xy + wz;\r\n out[2] = xz - wy;\r\n out[3] = 0;\r\n out[4] = xy - wz;\r\n out[5] = 1 - (xx + zz);\r\n out[6] = yz + wx;\r\n out[7] = 0;\r\n out[8] = xz + wy;\r\n out[9] = yz - wx;\r\n out[10] = 1 - (xx + yy);\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Mat4} from a {@link Quat2}.\r\n * @category Static\r\n *\r\n * @param out - Matrix\r\n * @param a - Dual Quaternion\r\n * @returns `out`\r\n */\r\n static fromQuat2(out: Mat4Like, a: Quat2Like): Mat4Like {\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n\r\n const magnitude = bx * bx + by * by + bz * bz + bw * bw;\r\n\r\n // Only scale if it makes sense\r\n if (magnitude > 0) {\r\n Mat4.#TMP_VEC3[0] = ((ax * bw + aw * bx + ay * bz - az * by) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[1] = ((ay * bw + aw * by + az * bx - ax * bz) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[2] = ((az * bw + aw * bz + ax * by - ay * bx) * 2) / magnitude;\r\n } else {\r\n Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n }\r\n Mat4.fromRotationTranslation(out, a as QuatLike, Mat4.#TMP_VEC3);\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat4Like, a: Readonly): Mat4Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[3] = 0;\r\n\r\n out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[7] = 0;\r\n\r\n out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat4Like, a: Readonly): Mat4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n out[3] = 0;\r\n\r\n out[4] = cy * az - cz * ay;\r\n out[5] = cz * ax - cx * az;\r\n out[6] = cx * ay - cy * ax;\r\n out[7] = 0;\r\n\r\n out[8] = ay * bz - az * by;\r\n out[9] = az * bx - ax * bz;\r\n out[10] = ax * by - ay * bx;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the translation vector component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslation,\r\n * the returned vector will be the same as the translation vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive translation component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getTranslation(out: Vec3Like, mat: Readonly): Vec3Like {\r\n out[0] = mat[12];\r\n out[1] = mat[13];\r\n out[2] = mat[14];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the scaling factor component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslationScale\r\n * with a normalized Quaternion parameter, the returned vector will be\r\n * the same as the scaling vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive scaling factor component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getScaling(out: Vec3Like, mat: Readonly): Vec3Like {\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a quaternion representing the rotational component\r\n * of a transformation matrix. If a matrix is built with\r\n * fromRotationTranslation, the returned quaternion will be the\r\n * same as the quaternion originally supplied.\r\n * @category Static\r\n *\r\n * @param out - Quaternion to receive the rotation component\r\n * @param mat - Matrix to be decomposed (input)\r\n * @return `out`\r\n */\r\n static getRotation(out: QuatLike, mat: Readonly): QuatLike {\r\n Mat4.getScaling(Mat4.#TMP_VEC3, mat);\r\n\r\n const is1 = 1 / Mat4.#TMP_VEC3[0];\r\n const is2 = 1 / Mat4.#TMP_VEC3[1];\r\n const is3 = 1 / Mat4.#TMP_VEC3[2];\r\n\r\n const sm11 = mat[0] * is1;\r\n const sm12 = mat[1] * is2;\r\n const sm13 = mat[2] * is3;\r\n const sm21 = mat[4] * is1;\r\n const sm22 = mat[5] * is2;\r\n const sm23 = mat[6] * is3;\r\n const sm31 = mat[8] * is1;\r\n const sm32 = mat[9] * is2;\r\n const sm33 = mat[10] * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out[3] = 0.25 * S;\r\n out[0] = (sm23 - sm32) / S;\r\n out[1] = (sm31 - sm13) / S;\r\n out[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out[3] = (sm23 - sm32) / S;\r\n out[0] = 0.25 * S;\r\n out[1] = (sm12 + sm21) / S;\r\n out[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out[3] = (sm31 - sm13) / S;\r\n out[0] = (sm12 + sm21) / S;\r\n out[1] = 0.25 * S;\r\n out[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out[3] = (sm12 - sm21) / S;\r\n out[0] = (sm31 + sm13) / S;\r\n out[1] = (sm23 + sm32) / S;\r\n out[2] = 0.25 * S;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Decomposes a transformation matrix into its rotation, translation\r\n * and scale components. Returns only the rotation component\r\n * @category Static\r\n *\r\n * @param out_r - Quaternion to receive the rotation component\r\n * @param out_t - Vector to receive the translation vector\r\n * @param out_s - Vector to receive the scaling factor\r\n * @param mat - Matrix to be decomposed (input)\r\n * @returns `out_r`\r\n */\r\n static decompose(out_r: QuatLike, out_t: Vec3Like, out_s: Vec3Like, mat: Readonly): QuatLike {\r\n out_t[0] = mat[12];\r\n out_t[1] = mat[13];\r\n out_t[2] = mat[14];\r\n\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n const is1 = 1 / out_s[0];\r\n const is2 = 1 / out_s[1];\r\n const is3 = 1 / out_s[2];\r\n\r\n const sm11 = m11 * is1;\r\n const sm12 = m12 * is2;\r\n const sm13 = m13 * is3;\r\n const sm21 = m21 * is1;\r\n const sm22 = m22 * is2;\r\n const sm23 = m23 * is3;\r\n const sm31 = m31 * is1;\r\n const sm32 = m32 * is2;\r\n const sm33 = m33 * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out_r[3] = 0.25 * S;\r\n out_r[0] = (sm23 - sm32) / S;\r\n out_r[1] = (sm31 - sm13) / S;\r\n out_r[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out_r[3] = (sm23 - sm32) / S;\r\n out_r[0] = 0.25 * S;\r\n out_r[1] = (sm12 + sm21) / S;\r\n out_r[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out_r[3] = (sm31 - sm13) / S;\r\n out_r[0] = (sm12 + sm21) / S;\r\n out_r[1] = 0.25 * S;\r\n out_r[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out_r[3] = (sm12 - sm21) / S;\r\n out_r[0] = (sm31 + sm13) / S;\r\n out_r[1] = (sm23 + sm32) / S;\r\n out_r[2] = 0.25 * S;\r\n }\r\n\r\n return out_r;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScale(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n out[0] = (1 - (yy + zz)) * sx;\r\n out[1] = (xy + wz) * sx;\r\n out[2] = (xz - wy) * sx;\r\n out[3] = 0;\r\n out[4] = (xy - wz) * sy;\r\n out[5] = (1 - (xx + zz)) * sy;\r\n out[6] = (yz + wx) * sy;\r\n out[7] = 0;\r\n out[8] = (xz + wy) * sz;\r\n out[9] = (yz - wx) * sz;\r\n out[10] = (1 - (xx + yy)) * sz;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the\r\n * given origin. This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * mat4.translate(dest, origin);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n * mat4.translate(dest, negativeOrigin);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @param o - The origin vector around which to scale and rotate\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScaleOrigin(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly, o: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n const ox = o[0];\r\n const oy = o[1];\r\n const oz = o[2];\r\n\r\n const out0 = (1 - (yy + zz)) * sx;\r\n const out1 = (xy + wz) * sx;\r\n const out2 = (xz - wy) * sx;\r\n const out4 = (xy - wz) * sy;\r\n const out5 = (1 - (xx + zz)) * sy;\r\n const out6 = (yz + wx) * sy;\r\n const out8 = (xz + wy) * sz;\r\n const out9 = (yz - wx) * sz;\r\n const out10 = (1 - (xx + yy)) * sz;\r\n\r\n out[0] = out0;\r\n out[1] = out1;\r\n out[2] = out2;\r\n out[3] = 0;\r\n out[4] = out4;\r\n out[5] = out5;\r\n out[6] = out6;\r\n out[7] = 0;\r\n out[8] = out8;\r\n out[9] = out9;\r\n out[10] = out10;\r\n out[11] = 0;\r\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\r\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\r\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 4x4 matrix from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Quaternion to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat4Like, q: Readonly): Mat4Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[1] = yx + wz;\r\n out[2] = zx - wy;\r\n out[3] = 0;\r\n\r\n out[4] = yx - wz;\r\n out[5] = 1 - xx - zz;\r\n out[6] = zy + wx;\r\n out[7] = 0;\r\n\r\n out[8] = zx + wy;\r\n out[9] = zy - wx;\r\n out[10] = 1 - xx - yy;\r\n out[11] = 0;\r\n\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.frustumNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly\r\n */\r\n static frustum(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like { return out; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveNO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.perspectiveNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static perspective(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveZO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating\r\n * projection matrices to be used with the still experimental WebVR API.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n * @deprecated\r\n */\r\n static perspectiveFromFieldOfView(out: Mat4Like,\r\n fov: { upDegrees: number, downDegrees: number, leftDegrees: number, rightDegrees: number }, near: number,\r\n far: number): Mat4Like {\r\n\r\n const upTan = Math.tan((fov.upDegrees * Math.PI) / 180.0);\r\n const downTan = Math.tan((fov.downDegrees * Math.PI) / 180.0);\r\n const leftTan = Math.tan((fov.leftDegrees * Math.PI) / 180.0);\r\n const rightTan = Math.tan((fov.rightDegrees * Math.PI) / 180.0);\r\n const xScale = 2.0 / (leftTan + rightTan);\r\n const yScale = 2.0 / (upTan + downTan);\r\n\r\n out[0] = xScale;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n out[4] = 0.0;\r\n out[5] = yScale;\r\n out[6] = 0.0;\r\n out[7] = 0.0;\r\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\r\n out[9] = (upTan - downTan) * yScale * 0.5;\r\n out[10] = far / (near - far);\r\n out[11] = -1.0;\r\n out[12] = 0.0;\r\n out[13] = 0.0;\r\n out[14] = (far * near) / (near - far);\r\n out[15] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 2 * nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = (far + near) * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.orthoNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static ortho(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, far: number):\r\n Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = near * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that\r\n * actually makes an object look at another object, you should use targetTo instead.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param center - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static lookAt(out: Mat4Like, eye: Readonly, center: Readonly, up: Readonly): Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n const centerx = center[0];\r\n const centery = center[1];\r\n const centerz = center[2];\r\n\r\n if (\r\n Math.abs(eyex - centerx) < GLM_EPSILON &&\r\n Math.abs(eyey - centery) < GLM_EPSILON &&\r\n Math.abs(eyez - centerz) < GLM_EPSILON\r\n ) {\r\n return Mat4.identity(out);\r\n }\r\n\r\n let z0 = eyex - centerx;\r\n let z1 = eyey - centery;\r\n let z2 = eyez - centerz;\r\n\r\n let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\r\n if (!len) {\r\n x0 = 0;\r\n x1 = 0;\r\n x2 = 0;\r\n } else {\r\n len = 1 / len;\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n let y0 = z1 * x2 - z2 * x1;\r\n let y1 = z2 * x0 - z0 * x2;\r\n let y2 = z0 * x1 - z1 * x0;\r\n\r\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\r\n if (!len) {\r\n y0 = 0;\r\n y1 = 0;\r\n y2 = 0;\r\n } else {\r\n len = 1 / len;\r\n y0 *= len;\r\n y1 *= len;\r\n y2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = y0;\r\n out[2] = z0;\r\n out[3] = 0;\r\n out[4] = x1;\r\n out[5] = y1;\r\n out[6] = z1;\r\n out[7] = 0;\r\n out[8] = x2;\r\n out[9] = y2;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\r\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\r\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a matrix that makes something look at something else.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param target - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static targetTo(out: Mat4Like, eye: Readonly, target: Readonly, up: Readonly):\r\n Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n\r\n let z0 = eyex - target[0];\r\n let z1 = eyey - target[1];\r\n let z2 = eyez - target[2];\r\n\r\n let len = z0 * z0 + z1 * z1 + z2 * z2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n }\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n\r\n len = x0 * x0 + x1 * x1 + x2 * x2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = x1;\r\n out[2] = x2;\r\n out[3] = 0;\r\n out[4] = z1 * x2 - z2 * x1;\r\n out[5] = z2 * x0 - z0 * x2;\r\n out[6] = z0 * x1 - z1 * x0;\r\n out[7] = 0;\r\n out[8] = z0;\r\n out[9] = z1;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = eyex;\r\n out[13] = eyey;\r\n out[14] = eyez;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8] +\r\n a[9] * a[9] +\r\n a[10] * a[10] +\r\n a[11] * a[11] +\r\n a[12] * a[12] +\r\n a[13] * a[13] +\r\n a[14] * a[14] +\r\n a[15] * a[15]\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n out[9] = a[9] + b[9];\r\n out[10] = a[10] + b[10];\r\n out[11] = a[11] + b[11];\r\n out[12] = a[12] + b[12];\r\n out[13] = a[13] + b[13];\r\n out[14] = a[14] + b[14];\r\n out[15] = a[15] + b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n out[9] = a[9] - b[9];\r\n out[10] = a[10] - b[10];\r\n out[11] = a[11] - b[11];\r\n out[12] = a[12] - b[12];\r\n out[13] = a[13] - b[13];\r\n out[14] = a[14] - b[14];\r\n out[15] = a[15] - b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Multiply each element of the matrix by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat4Like, a: Readonly, b: number): Mat4Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n out[9] = a[9] * b;\r\n out[10] = a[10] * b;\r\n out[11] = a[11] * b;\r\n out[12] = a[12] * b;\r\n out[13] = a[13] * b;\r\n out[14] = a[14] * b;\r\n out[15] = a[15] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat4Like, a: Readonly, b: Readonly, scale: number): Mat4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n out[9] = a[9] + b[9] * scale;\r\n out[10] = a[10] + b[10] * scale;\r\n out[11] = a[11] + b[11] * scale;\r\n out[12] = a[12] + b[12] * scale;\r\n out[13] = a[13] + b[13] * scale;\r\n out[14] = a[14] + b[14] * scale;\r\n out[15] = a[15] + b[15] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8] &&\r\n a[9] === b[9] &&\r\n a[10] === b[10] &&\r\n a[11] === b[11] &&\r\n a[12] === b[12] &&\r\n a[13] === b[13] &&\r\n a[14] === b[14] &&\r\n a[15] === b[15]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n const a9 = a[9];\r\n const a10 = a[10];\r\n const a11 = a[11];\r\n const a12 = a[12];\r\n const a13 = a[13];\r\n const a14 = a[14];\r\n const a15 = a[15];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n const b9 = b[9];\r\n const b10 = b[10];\r\n const b11 = b[11];\r\n const b12 = b[12];\r\n const b13 = b[13];\r\n const b14 = b[14];\r\n const b15 = b[15];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) &&\r\n Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) &&\r\n Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) &&\r\n Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) &&\r\n Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) &&\r\n Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) &&\r\n Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) &&\r\n Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat4(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat4.prototype.mul = Mat4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat4.sub = Mat4.subtract;\r\nMat4.mul = Mat4.multiply;\r\nMat4.frustum = Mat4.frustumNO;\r\nMat4.perspective = Mat4.perspectiveNO;\r\nMat4.ortho = Mat4.orthoNO;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, Mat4Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 3 Dimensional Vector\r\n */\r\nexport class Vec3 extends Float32Array {\r\n /**\r\n * Create a {@link Vec3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 3:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 3); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 3);\r\n }\r\n break;\r\n }\r\n default:\r\n super(3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec3.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec3.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec3} to `this`.\r\n * Equivalent to `Vec3.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec3} from `this`.\r\n * Equivalent to `Vec3.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec3.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec3.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec3.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec3.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec3.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to its absolute value.\r\n * Equivalent to `Vec3.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec3}.\r\n * Equivalent to `Vec3.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec3.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec3.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 3 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty vec3\r\n * @category Static\r\n *\r\n * @returns a new 3D vector\r\n */\r\n static create(): Vec3 {\r\n return new Vec3();\r\n }\r\n\r\n /**\r\n * Creates a new vec3 initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 3D vector\r\n */\r\n static clone(a: Readonly): Vec3 {\r\n return new Vec3(a);\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Creates a new vec3 initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns a new 3D vector\r\n */\r\n static fromValues(x: number, y: number, z: number): Vec3 {\r\n return new Vec3(x, y, z);\r\n }\r\n\r\n /**\r\n * Copy the values from one vec3 to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns `out`\r\n */\r\n static set(out: Vec3Like, x: number, y: number, z: number): Vec3Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Multiplies two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; }\r\n\r\n /**\r\n * Divides two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Math.ceil the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * symmetric round the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n /*\r\n static round(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = glMatrix.round(a[0]);\r\n out[1] = glMatrix.round(a[1]);\r\n out[2] = glMatrix.round(a[2]);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Scales a vec3 by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec3Like, a: Readonly, scale: number): Vec3Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two vec3's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec3Like, a: Readonly, b: Readonly, scale: number) {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared length of a vec3\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec3Like, a: Readonly): Vec3Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n let len = x * x + y * y + z * z;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n out[2] = a[2] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2];\r\n const bx = b[0],\r\n by = b[1],\r\n bz = b[2];\r\n\r\n out[0] = ay * bz - az * by;\r\n out[1] = az * bx - ax * bz;\r\n out[2] = ax * by - ay * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const angle = Math.acos(Math.min(Math.max(Vec3.dot(a, b), -1), 1));\r\n const sinTotal = Math.sin(angle);\r\n\r\n const ratioA = Math.sin((1 - t) * angle) / sinTotal;\r\n const ratioB = Math.sin(t * angle) / sinTotal;\r\n out[0] = ratioA * a[0] + ratioB * b[0];\r\n out[1] = ratioA * a[1] + ratioB * b[1];\r\n out[2] = ratioA * a[2] + ratioB * b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a hermite interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static hermite(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const factorTimes2 = t * t;\r\n const factor1 = factorTimes2 * (2 * t - 3) + 1;\r\n const factor2 = factorTimes2 * (t - 2) + t;\r\n const factor3 = factorTimes2 * (t - 1);\r\n const factor4 = factorTimes2 * (3 - 2 * t);\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a bezier interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static bezier(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const inverseFactor = 1 - t;\r\n const inverseFactorTimesTwo = inverseFactor * inverseFactor;\r\n const factorTimes2 = t * t;\r\n const factor1 = inverseFactorTimesTwo * inverseFactor;\r\n const factor2 = 3 * t * inverseFactorTimesTwo;\r\n const factor3 = 3 * factorTimes2 * inverseFactor;\r\n const factor4 = factorTimes2 * t;\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec3Like, scale) {\r\n scale = scale === undefined ? 1.0 : scale;\r\n\r\n let r = glMatrix.RANDOM() * 2.0 * Math.PI;\r\n let z = glMatrix.RANDOM() * 2.0 - 1.0;\r\n let zScale = Math.sqrt(1.0 - z * z) * scale;\r\n\r\n out[0] = Math.cos(r) * zScale;\r\n out[1] = Math.sin(r) * zScale;\r\n out[2] = z * scale;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the vec3 with a mat4.\r\n * 4th vector component is implicitly '1'\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec3Like, a: Readonly, m: Readonly): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1.0;\r\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\r\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\r\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a mat3.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - the 3x3 matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat3(out: Vec3Like, a: Vec3Like, m: Mat3Like): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n out[0] = x * m[0] + y * m[3] + z * m[6];\r\n out[1] = x * m[1] + y * m[4] + z * m[7];\r\n out[2] = x * m[2] + y * m[5] + z * m[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a quat\r\n * Can also be used for dual quaternions. (Multiply it with the real part)\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec3Like, a: Readonly, q: Readonly): Vec3Like {\r\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const w2 = q[3] * 2;\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n // var qvec = [qx, qy, qz];\r\n // var uv = vec3.cross([], qvec, a);\r\n const uvx = (qy * z - qz * y);\r\n const uvy = (qz * x - qx * z);\r\n const uvz = (qx * y - qy * x);\r\n // var uuv = vec3.cross([], qvec, uv);\r\n // vec3.scale(uuv, uuv, 2);\r\n const uuvx = (qy * uvz - qz * uvy) * 2;\r\n const uuvy = (qz * uvx - qx * uvz) * 2;\r\n const uuvz = (qx * uvy - qy * uvx) * 2;\r\n // vec3.scale(uv, uv, 2 * w);\r\n // return vec3.add(out, a, vec3.add(out, uv, uuv));\r\n out[0] = x + (uvx * w2) + uuvx;\r\n out[1] = y + (uvy * w2) + uuvy;\r\n out[2] = z + (uvz * w2) + uuvz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the x-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateX(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const by = b[1];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const py = a[1] - by;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = a[0];\r\n out[1] = (py * Math.cos(rad) - pz * Math.sin(rad)) + by;\r\n out[2] = (py * Math.sin(rad) + pz * Math.cos(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the y-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateY(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (pz * Math.sin(rad) + px * Math.cos(rad)) + bx;\r\n out[1] = a[1];\r\n out[2] = (pz * Math.cos(rad) - px * Math.sin(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the z-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const by = b[1];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const py = a[1] - by;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (px * Math.cos(rad) - py * Math.sin(rad)) + bx;\r\n out[1] = (px * Math.sin(rad) + py * Math.cos(rad)) + by;\r\n out[2] = b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 3D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly) {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz));\r\n const cosine = mag && Vec3.dot(a, b) / mag;\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec3Like): Vec3Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec3(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec3.prototype.sub = Vec3.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.mul = Vec3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.div = Vec3.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.dist = Vec3.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.sqrDist = Vec3.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec3.sub = Vec3.subtract;\r\nVec3.mul = Vec3.multiply;\r\nVec3.div = Vec3.divide;\r\nVec3.dist = Vec3.distance;\r\nVec3.sqrDist = Vec3.squaredDistance;\r\nVec3.sqrLen = Vec3.squaredLength;\r\nVec3.mag = Vec3.magnitude;\r\nVec3.length = Vec3.magnitude;\r\nVec3.len = Vec3.magnitude;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Vec4Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 4 Dimensional Vector\r\n */\r\nexport class Vec4 extends Float32Array {\r\n /**\r\n * Create a {@link Vec4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the vector. Equivalent to `this[3];`\r\n * @category Vector Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The a component of the vector. Equivalent to `this[3];`\r\n * @category Color Components\r\n */\r\n get a(): number { return this[3]; }\r\n set a(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec4.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec4} to `this`.\r\n * Equivalent to `Vec4.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n this[3] += b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec4} from `this`.\r\n * Equivalent to `Vec4.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n this[3] -= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n this[3] *= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n this[3] /= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec4.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n this[3] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n this[3] += b[3] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec4.distance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec4.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec4.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n this[3] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec4.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n this[3] = 1.0 / this[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec4.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n this[3] = Math.abs(this[3]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec4}.\r\n * Equivalent to `Vec4.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec4.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec4.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec4}\r\n * @category Static\r\n *\r\n * @returns a new 4D vector\r\n */\r\n static create(): Vec4 {\r\n return new Vec4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 4D vector\r\n */\r\n static clone(a: Vec4Like): Vec4 {\r\n return new Vec4(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new 4D vector\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Vec4 {\r\n return new Vec4(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec4} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n static set(out: Vec4Like, x: number, y: number, z: number, w: number): Vec4Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n out[3] = a[3] * b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Divides two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n out[3] = a[3] / b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n out[3] = Math.ceil(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n out[3] = Math.floor(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n out[3] = Math.min(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n out[3] = Math.max(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n out[2] = Math.round(a[2]);\r\n out[3] = Math.round(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec4} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec4Like, a: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}'s after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec4Like, a: Readonly, b: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return Math.hypot(x, y, z, w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of `a`\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = -a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n out[3] = 1.0 / a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n out[3] = Math.abs(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec4Like, a: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n let len = x * x + y * y + z * z + w * w;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = x * len;\r\n out[1] = y * len;\r\n out[2] = z * len;\r\n out[3] = w * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Returns the cross-product of three vectors in a 4-dimensional space\r\n * @category Static\r\n *\r\n * @param out the receiving vector\r\n * @param u - the first vector\r\n * @param v - the second vector\r\n * @param w - the third vector\r\n * @returns result\r\n */\r\n static cross(out: Vec4Like, u: Readonly, v: Readonly, w: Readonly): Vec4Like {\r\n const a = v[0] * w[1] - v[1] * w[0];\r\n const b = v[0] * w[2] - v[2] * w[0];\r\n const c = v[0] * w[3] - v[3] * w[0];\r\n const d = v[1] * w[2] - v[2] * w[1];\r\n const e = v[1] * w[3] - v[3] * w[1];\r\n const f = v[2] * w[3] - v[3] * w[2];\r\n const g = u[0];\r\n const h = u[1];\r\n const i = u[2];\r\n const j = u[3];\r\n\r\n out[0] = h * f - i * e + j * d;\r\n out[1] = -(g * f) + i * c - j * b;\r\n out[2] = g * e - h * c + j * a;\r\n out[3] = -(g * d) + h * b - i * a;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec4Like, a: Readonly, b: Readonly, t: number): Vec4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n out[3] = aw + t * (b[3] - aw);\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec4Like, scale): Vec4Like {\r\n scale = scale || 1.0;\r\n\r\n // Marsaglia, George. Choosing a Point from the Surface of a\r\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\r\n // http://projecteuclid.org/euclid.aoms/1177692644;\r\n var v1, v2, v3, v4;\r\n var s1, s2;\r\n do {\r\n v1 = glMatrix.RANDOM() * 2 - 1;\r\n v2 = glMatrix.RANDOM() * 2 - 1;\r\n s1 = v1 * v1 + v2 * v2;\r\n } while (s1 >= 1);\r\n do {\r\n v3 = glMatrix.RANDOM() * 2 - 1;\r\n v4 = glMatrix.RANDOM() * 2 - 1;\r\n s2 = v3 * v3 + v4 * v4;\r\n } while (s2 >= 1);\r\n\r\n var d = Math.sqrt((1 - s1) / s2);\r\n out[0] = scale * v1;\r\n out[1] = scale * v2;\r\n out[2] = scale * v3 * d;\r\n out[3] = scale * v4 * d;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Mat4}.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec4Like, a: Readonly, m: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\r\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\r\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\r\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec4Like, a: Readonly, q: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n\r\n // calculate quat * vec\r\n const ix = qw * x + qy * z - qz * y;\r\n const iy = qw * y + qz * x - qx * z;\r\n const iz = qw * z + qx * y - qy * x;\r\n const iw = -qx * x - qy * y - qz * z;\r\n\r\n // calculate result * inverse quat\r\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\r\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\r\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec4Like): Vec4Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec4(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec4.prototype.sub = Vec4.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.mul = Vec4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.div = Vec4.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.dist = Vec4.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.sqrDist = Vec4.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec4.sub = Vec4.subtract;\r\nVec4.mul = Vec4.multiply;\r\nVec4.div = Vec4.divide;\r\nVec4.dist = Vec4.distance;\r\nVec4.sqrDist = Vec4.squaredDistance;\r\nVec4.sqrLen = Vec4.squaredLength;\r\nVec4.mag = Vec4.magnitude;\r\nVec4.length = Vec4.magnitude;\r\nVec4.len = Vec4.magnitude;\r\n", "import { Vec3 } from './Vec3.js';\r\nimport { Vec4 } from './Vec4.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Quaternion\r\n */\r\nexport class Quat extends Float32Array {\r\n static #DEFAULT_ANGLE_ORDER = 'zyx';\r\n\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT1 = new Float32Array(4);\r\n static #TMP_QUAT2 = new Float32Array(4);\r\n static #TMP_MAT3 = new Float32Array(9);\r\n\r\n static #TMP_VEC3 = new Float32Array(3);\r\n static #X_UNIT_VEC3 = new Float32Array([1, 0, 0]);\r\n static #Y_UNIT_VEC3 = new Float32Array([0, 1, 0]);\r\n\r\n /**\r\n * Create a {@link Quat}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the quaternion. Equivalent to `this[0];`\r\n * @category Quaternion Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the quaternion. Equivalent to `this[1];`\r\n * @category Quaternion Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the quaternion. Equivalent to `this[2];`\r\n * @category Quaternion Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the quaternion. Equivalent to `this[3];`\r\n * @category Quaternion Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Quat.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity quaternion\r\n * Equivalent to Quat.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this[0] = 0;\r\n this[1] = 0;\r\n this[2] = 0;\r\n this[3] = 1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies `this` by a {@link Quat}.\r\n * Equivalent to `Quat.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Quat.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Rotates `this` by the given angle about the X axis\r\n * Equivalent to `Quat.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Quat.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Y axis\r\n * Equivalent to `Quat.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Quat.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Z axis\r\n * Equivalent to `Quat.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Quat.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Inverts `this`\r\n * Equivalent to `Quat.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Quat.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales `this` by a scalar number\r\n * Equivalent to `Quat.scale(this, this, scale);`\r\n * @category Methods\r\n *\r\n * @param scale - amount to scale the vector by\r\n * @returns `this`\r\n */\r\n scale(scale: number): QuatLike {\r\n this[0] *= scale;\r\n this[1] *= scale;\r\n this[2] *= scale;\r\n this[3] *= scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of `this` and another {@link Quat}\r\n * Equivalent to `Quat.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - the second operand\r\n * @returns dot product of `this` and b\r\n */\r\n dot(b: Readonly): number {\r\n return Quat.dot(this, b);\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity quat\r\n * @category Static\r\n *\r\n * @returns a new quaternion\r\n */\r\n static create(): Quat {\r\n return new Quat();\r\n }\r\n\r\n /**\r\n * Set a quat to the identity quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a quat from the given angle and rotation axis,\r\n * then returns it.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param axis - the axis around which to rotate\r\n * @param rad - the angle in radians\r\n * @returns `out`\r\n **/\r\n static setAxisAngle(out: QuatLike, axis: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n out[0] = s * axis[0];\r\n out[1] = s * axis[1];\r\n out[2] = s * axis[2];\r\n out[3] = Math.cos(rad);\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the rotation axis and angle for a given\r\n * quaternion. If a quaternion is created with\r\n * setAxisAngle, this method will return the same\r\n * values as provided in the original parameter list\r\n * OR functionally equivalent values.\r\n * Example: The quaternion formed by axis [0, 0, 1] and\r\n * angle -90 is the same as the quaternion formed by\r\n * [0, 0, 1] and 270. This method favors the latter.\r\n * @category Static\r\n *\r\n * @param out_axis - Vector receiving the axis of rotation\r\n * @param q - Quaternion to be decomposed\r\n * @return Angle, in radians, of the rotation\r\n */\r\n static getAxisAngle(out_axis: Vec3Like, q: Readonly): number {\r\n const rad = Math.acos(q[3]) * 2.0;\r\n const s = Math.sin(rad / 2.0);\r\n if (s > GLM_EPSILON) {\r\n out_axis[0] = q[0] / s;\r\n out_axis[1] = q[1] / s;\r\n out_axis[2] = q[2] / s;\r\n } else {\r\n // If s is zero, return any axis (no rotation - axis does not matter)\r\n out_axis[0] = 1;\r\n out_axis[1] = 0;\r\n out_axis[2] = 0;\r\n }\r\n return rad;\r\n }\r\n\r\n /**\r\n * Gets the angular distance between two unit quaternions\r\n * @category Static\r\n *\r\n * @param {ReadonlyQuat} a Origin unit quaternion\r\n * @param {ReadonlyQuat} b Destination unit quaternion\r\n * @return {Number} Angle, in radians, between the two quaternions\r\n */\r\n static getAngle(a: Readonly, b: Readonly): number {\r\n const dotproduct = Quat.dot(a, b);\r\n\r\n return Math.acos(2 * dotproduct * dotproduct - 1);\r\n }\r\n\r\n /**\r\n * Multiplies two quaternions.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const bw = b[3];\r\n\r\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the X axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + aw * bx;\r\n out[1] = ay * bw + az * bx;\r\n out[2] = az * bw - ay * bx;\r\n out[3] = aw * bw - ax * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Y axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const by = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw - az * by;\r\n out[1] = ay * bw + aw * by;\r\n out[2] = az * bw + ax * by;\r\n out[3] = aw * bw - ay * by;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Z axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bz = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + ay * bz;\r\n out[1] = ay * bw - ax * bz;\r\n out[2] = az * bw + aw * bz;\r\n out[3] = aw * bw - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the W component of a quat from the X, Y, and Z components.\r\n * Assumes that quaternion is 1 unit in length.\r\n * Any existing W component will be ignored.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate W component of\r\n * @returns `out`\r\n */\r\n static calculateW(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the exponential of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static exp(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const et = Math.exp(w);\r\n const s = r > 0 ? (et * Math.sin(r)) / r : 0;\r\n\r\n out[0] = x * s;\r\n out[1] = y * s;\r\n out[2] = z * s;\r\n out[3] = et * Math.cos(r);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the natural logarithm of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static ln(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const t = r > 0 ? Math.atan2(r, w) / r : 0;\r\n\r\n out[0] = x * t;\r\n out[1] = y * t;\r\n out[2] = z * t;\r\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the scalar power of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @param b - amount to scale the quaternion by\r\n * @returns `out`\r\n */\r\n static pow(out: QuatLike, a: Readonly, b: number): QuatLike {\r\n Quat.ln(out, a);\r\n Quat.scale(out, out, b);\r\n Quat.exp(out, out);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike {\r\n // benchmarks:\r\n // http://jsperf.com/quaternion-slerp-implementations\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2],\r\n aw = a[3];\r\n let bx = b[0],\r\n by = b[1],\r\n bz = b[2],\r\n bw = b[3];\r\n\r\n let scale0: number;\r\n let scale1: number;\r\n\r\n // calc cosine\r\n let cosom = ax * bx + ay * by + az * bz + aw * bw;\r\n // adjust signs (if necessary)\r\n if (cosom < 0.0) {\r\n cosom = -cosom;\r\n bx = -bx;\r\n by = -by;\r\n bz = -bz;\r\n bw = -bw;\r\n }\r\n // calculate coefficients\r\n if (1.0 - cosom > GLM_EPSILON) {\r\n // standard case (slerp)\r\n const omega = Math.acos(cosom);\r\n const sinom = Math.sin(omega);\r\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\r\n scale1 = Math.sin(t * omega) / sinom;\r\n } else {\r\n // \"from\" and \"to\" quaternions are very close\r\n // ... so we can do a linear interpolation\r\n scale0 = 1.0 - t;\r\n scale1 = t;\r\n }\r\n // calculate final values\r\n out[0] = scale0 * ax + scale1 * bx;\r\n out[1] = scale0 * ay + scale1 * by;\r\n out[2] = scale0 * az + scale1 * bz;\r\n out[3] = scale0 * aw + scale1 * bw;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random unit quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n /* static random(out: QuatLike): QuatLike {\r\n // Implementation of http://planning.cs.uiuc.edu/node198.html\r\n // TODO: Calling random 3 times is probably not the fastest solution\r\n let u1 = glMatrix.RANDOM();\r\n let u2 = glMatrix.RANDOM();\r\n let u3 = glMatrix.RANDOM();\r\n\r\n let sqrt1MinusU1 = Math.sqrt(1 - u1);\r\n let sqrtU1 = Math.sqrt(u1);\r\n\r\n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\r\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\r\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\r\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Calculates the inverse of a quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: QuatLike, a: Readonly): QuatLike {\r\n const a0 = a[0],\r\n a1 = a[1],\r\n a2 = a[2],\r\n a3 = a[3];\r\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\r\n const invDot = dot ? 1.0 / dot : 0;\r\n\r\n // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\r\n\r\n out[0] = -a0 * invDot;\r\n out[1] = -a1 * invDot;\r\n out[2] = -a2 * invDot;\r\n out[3] = a3 * invDot;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a quat\r\n * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given 3x3 rotation matrix.\r\n *\r\n * NOTE: The resultant quaternion is not normalized, so you should be sure\r\n * to re-normalize the quaternion yourself where necessary.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param m - rotation matrix\r\n * @returns `out`\r\n */\r\n static fromMat3(out: QuatLike, m: Readonly): QuatLike {\r\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\r\n // article \"Quaternion Calculus and Fast Animation\".\r\n const fTrace = m[0] + m[4] + m[8];\r\n let fRoot: number;\r\n\r\n if (fTrace > 0.0) {\r\n // |w| > 1/2, may as well choose w > 1/2\r\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\r\n out[3] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot; // 1/(4w)\r\n out[0] = (m[5] - m[7]) * fRoot;\r\n out[1] = (m[6] - m[2]) * fRoot;\r\n out[2] = (m[1] - m[3]) * fRoot;\r\n } else {\r\n // |w| <= 1/2\r\n let i = 0;\r\n if (m[4] > m[0]) { i = 1; }\r\n if (m[8] > m[i * 3 + i]) { i = 2; }\r\n const j = (i + 1) % 3;\r\n const k = (i + 2) % 3;\r\n\r\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\r\n out[i] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot;\r\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\r\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\r\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given euler angle x, y, z.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - Angle to rotate around X axis in degrees.\r\n * @param y - Angle to rotate around Y axis in degrees.\r\n * @param z - Angle to rotate around Z axis in degrees.\r\n * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx.\r\n * @returns `out`\r\n */\r\n static fromEuler(out: QuatLike, x: number, y: number, z: number, order = Quat.#DEFAULT_ANGLE_ORDER): QuatLike {\r\n const halfToRad = (0.5 * Math.PI) / 180.0;\r\n x *= halfToRad;\r\n y *= halfToRad;\r\n z *= halfToRad;\r\n\r\n const sx = Math.sin(x);\r\n const cx = Math.cos(x);\r\n const sy = Math.sin(y);\r\n const cy = Math.cos(y);\r\n const sz = Math.sin(z);\r\n const cz = Math.cos(z);\r\n\r\n switch (order) {\r\n case 'xyz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'xzy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yxz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yzx':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zxy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zyx':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n default:\r\n throw new Error(`Unknown angle order ${order}`);\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a quatenion\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - quaternion to clone\r\n * @returns a new quaternion\r\n */\r\n static clone(a: Readonly): Quat {\r\n return new Quat(a);\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new quaternion\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Quat {\r\n return new Quat(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one quat to another\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the source quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static set(out: QuatLike, x: number, y: number, z: number, w: number): QuatLike { return out; }\r\n\r\n /**\r\n * Adds two {@link Quat}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static add(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Scales a quat by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param b - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: QuatLike, a: Readonly, scale: number): QuatLike {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two quat's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two quat's\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static lerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike { return out; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mag(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quaternion to normalize\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static normalize(out: QuatLike, a: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first quaternion.\r\n * @param b - The second quaternion.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static exactEquals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Returns whether the quaternions have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static equals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Sets a quaternion to represent the shortest rotation from one\r\n * vector to another.\r\n *\r\n * Both vectors are assumed to be unit length.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion.\r\n * @param a - the initial vector\r\n * @param b - the destination vector\r\n * @returns `out`\r\n */\r\n static rotationTo(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const dot = Vec3.dot(a, b);\r\n\r\n if (dot < -0.999999) {\r\n Vec3.cross(Quat.#TMP_VEC3, Quat.#X_UNIT_VEC3, a);\r\n if (Vec3.mag(Quat.#TMP_VEC3) < 0.000001) { Vec3.cross(Quat.#TMP_VEC3, Quat.#Y_UNIT_VEC3, a); }\r\n Vec3.normalize(Quat.#TMP_VEC3, Quat.#TMP_VEC3);\r\n Quat.setAxisAngle(out, Quat.#TMP_VEC3, Math.PI);\r\n return out;\r\n } else if (dot > 0.999999) {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n } else {\r\n Vec3.cross(Quat.#TMP_VEC3, a, b);\r\n out[0] = Quat.#TMP_VEC3[0];\r\n out[1] = Quat.#TMP_VEC3[1];\r\n out[2] = Quat.#TMP_VEC3[2];\r\n out[3] = 1 + dot;\r\n return Quat.normalize(out, out);\r\n }\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static sqlerp(out: QuatLike, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): QuatLike {\r\n Quat.slerp(Quat.#TMP_QUAT1, a, d, t);\r\n Quat.slerp(Quat.#TMP_QUAT2, b, c, t);\r\n Quat.slerp(out, Quat.#TMP_QUAT1, Quat.#TMP_QUAT2, 2 * t * (1 - t));\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets the specified quaternion with values corresponding to the given\r\n * axes. Each axis is a vec3 and is expected to be unit length and\r\n * perpendicular to all other specified axes.\r\n * @category Static\r\n *\r\n * @param out - The receiving quaternion\r\n * @param view - the vector representing the viewing direction\r\n * @param right - the vector representing the local `right` direction\r\n * @param up - the vector representing the local `up` direction\r\n * @returns `out`\r\n */\r\n static setAxes(out: QuatLike, view: Readonly, right: Readonly, up: Readonly): QuatLike {\r\n Quat.#TMP_MAT3[0] = right[0];\r\n Quat.#TMP_MAT3[3] = right[1];\r\n Quat.#TMP_MAT3[6] = right[2];\r\n\r\n Quat.#TMP_MAT3[1] = up[0];\r\n Quat.#TMP_MAT3[4] = up[1];\r\n Quat.#TMP_MAT3[7] = up[2];\r\n\r\n Quat.#TMP_MAT3[2] = -view[0];\r\n Quat.#TMP_MAT3[5] = -view[1];\r\n Quat.#TMP_MAT3[8] = -view[2];\r\n\r\n return Quat.normalize(out, Quat.fromMat3(out, Quat.#TMP_MAT3));\r\n }\r\n}\r\n\r\n// Methods which re-use the Vec4 implementation\r\nQuat.set = Vec4.set;\r\nQuat.add = Vec4.add;\r\nQuat.lerp = Vec4.lerp;\r\nQuat.normalize = Vec4.normalize;\r\nQuat.squaredLength = Vec4.squaredLength;\r\nQuat.sqrLen = Vec4.squaredLength;\r\nQuat.exactEquals = Vec4.exactEquals;\r\nQuat.equals = Vec4.equals;\r\nQuat.magnitude = Vec4.magnitude;\r\n\r\n// Instance method alias assignments\r\nQuat.prototype.mul = Quat.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nQuat.mul = Quat.multiply;\r\nQuat.mag = Quat.magnitude;\r\nQuat.length = Quat.magnitude;\r\nQuat.len = Quat.magnitude;\r\n", "import { Mat4 } from './Mat4.js';\r\nimport { Quat } from './Quat.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Dual Quaternion\r\n */\r\nexport class Quat2 extends Float32Array {\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat2.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT = new Float32Array(4);\r\n static #TMP_VEC3 = new Float32Array(3);\r\n\r\n /**\r\n * Create a {@link Quat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 8:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 8); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v, v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 8);\r\n }\r\n break;\r\n }\r\n default:\r\n super(8);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source dual quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 8 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity {@link Quat2}\r\n * @category Static\r\n *\r\n * @returns a new dual quaternion [real -> rotation, dual -> translation]\r\n */\r\n static create(): Quat2 {\r\n return new Quat2();\r\n }\r\n\r\n /**\r\n * Creates a {@link Quat2} quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to clone\r\n * @returns a new dual quaternion\r\n */\r\n static clone(a: Quat2Like): Quat2 {\r\n return new Quat2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns a new dual quaternion\r\n */\r\n static fromValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2 {\r\n return new Quat2(x1, y1, z1, w1, x2, y2, z2, w2);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} from the given values (quat and translation)\r\n * @category Static\r\n *\r\n * @param x1 - X component (rotation)\r\n * @param y1 - Y component (rotation)\r\n * @param z1 - Z component (rotation)\r\n * @param w1 - W component (rotation)\r\n * @param x2 - X component (translation)\r\n * @param y2 - Y component (translation)\r\n * @param z2 - Z component (translation)\r\n * @returns a new dual quaternion\r\n */\r\n static fromRotationTranslationValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number): Quat2 {\r\n const ax = x2 * 0.5;\r\n const ay = y2 * 0.5;\r\n const az = z2 * 0.5;\r\n\r\n return new Quat2(x1, y1, z1, w1,\r\n ax * w1 + ay * z1 - az * y1,\r\n ay * w1 + az * x1 - ax * z1,\r\n az * w1 + ax * y1 - ay * x1,\r\n -ax * x1 - ay * y1 - az * z1);\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion and a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Quat2Like, q: Readonly, t: Readonly): Quat2Like {\r\n const ax = t[0] * 0.5;\r\n const ay = t[1] * 0.5;\r\n const az = t[2] * 0.5;\r\n const bx = q[0];\r\n const by = q[1];\r\n const bz = q[2];\r\n const bw = q[3];\r\n out[0] = bx;\r\n out[1] = by;\r\n out[2] = bz;\r\n out[3] = bw;\r\n out[4] = ax * bw + ay * bz - az * by;\r\n out[5] = ay * bw + az * bx - ax * bz;\r\n out[6] = az * bw + ax * by - ay * bx;\r\n out[7] = -ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Quat2Like, t: Readonly): Quat2Like {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = t[0] * 0.5;\r\n out[5] = t[1] * 0.5;\r\n out[6] = t[2] * 0.5;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Quat2Like, q: Readonly): Quat2Like {\r\n out[0] = q[0];\r\n out[1] = q[1];\r\n out[2] = q[2];\r\n out[3] = q[3];\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param a - the matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Quat2Like, a: Readonly): Quat2Like {\r\n Mat4.getRotation(Quat2.#TMP_QUAT, a);\r\n Mat4.getTranslation(Quat2.#TMP_VEC3, a);\r\n return Quat2.fromRotationTranslation(out, Quat2.#TMP_QUAT, Quat2.#TMP_VEC3);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Quat2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the source dual quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Quat2} to the identity dual quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns `out`\r\n */\r\n static set(out: Quat2Like, x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2Like {\r\n out[0] = x1;\r\n out[1] = y1;\r\n out[2] = z1;\r\n out[3] = w1;\r\n out[4] = x2;\r\n out[5] = y2;\r\n out[6] = z2;\r\n out[7] = w2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the real part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - real part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getReal(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Gets the dual part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - dual part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getDual(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[4];\r\n out[1] = a[5];\r\n out[2] = a[6];\r\n out[3] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the real component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the real part\r\n * @return `out`\r\n */\r\n static setReal(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Set the dual component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the dual part\r\n * @return `out`\r\n */\r\n static setDual(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[4] = a[0];\r\n out[5] = a[1];\r\n out[6] = a[2];\r\n out[7] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the translation of a normalized {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving translation vector\r\n * @param a - Dual Quaternion to be decomposed\r\n * @return `out`\r\n */\r\n static getTranslation(out: Vec3Like, a: Readonly): Vec3Like {\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Translates a {@link Quat2} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Quat2Like, a: Readonly, v: Readonly): Quat2Like {\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n const bx1 = v[0] * 0.5;\r\n const by1 = v[1] * 0.5;\r\n const bz1 = v[2] * 0.5;\r\n const ax2 = a[4];\r\n const ay2 = a[5];\r\n const az2 = a[6];\r\n const aw2 = a[7];\r\n out[0] = ax1;\r\n out[1] = ay1;\r\n out[2] = az1;\r\n out[3] = aw1;\r\n out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2;\r\n out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2;\r\n out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2;\r\n out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateX(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateY(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateZ(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (a * q)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param q - quaternion to rotate by\r\n * @returns `out`\r\n */\r\n static rotateByQuatAppend(out: Quat2Like, a: Readonly, q: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let ax = a[0];\r\n let ay = a[1];\r\n let az = a[2];\r\n let aw = a[3];\r\n\r\n out[0] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[1] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[2] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[3] = aw * qw - ax * qx - ay * qy - az * qz;\r\n ax = a[4];\r\n ay = a[5];\r\n az = a[6];\r\n aw = a[7];\r\n out[4] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[5] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[6] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[7] = aw * qw - ax * qx - ay * qy - az * qz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (q * a)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param q - quaternion to rotate by\r\n * @param a - the dual quaternion to rotate\r\n * @returns `out`\r\n */\r\n static rotateByQuatPrepend(out: Quat2Like, q: Readonly, a: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let bx = a[0];\r\n let by = a[1];\r\n let bz = a[2];\r\n let bw = a[3];\r\n\r\n out[0] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[1] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[2] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[3] = qw * bw - qx * bx - qy * by - qz * bz;\r\n bx = a[4];\r\n by = a[5];\r\n bz = a[6];\r\n bw = a[7];\r\n out[4] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[5] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[6] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[7] = qw * bw - qx * bx - qy * by - qz * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around a given axis. Does the normalization automatically\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param axis - the axis to rotate around\r\n * @param rad - how far the rotation should be\r\n * @returns `out`\r\n */\r\n static rotateAroundAxis(out: Quat2Like, a: Readonly, axis: Readonly, rad: number): Quat2Like {\r\n // Special case for rad = 0\r\n if (Math.abs(rad) < GLM_EPSILON) {\r\n return Quat2.copy(out, a);\r\n }\r\n const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);\r\n\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n const bx = (s * axis[0]) / axisLength;\r\n const by = (s * axis[1]) / axisLength;\r\n const bz = (s * axis[2]) / axisLength;\r\n const bw = Math.cos(rad);\r\n\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n out[4] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[5] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[6] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[7] = aw * bw - ax * bx - ay * by - az * bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns {quat2} out\r\n */\r\n static multiply(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n const ax0 = a[0];\r\n const ay0 = a[1];\r\n const az0 = a[2];\r\n const aw0 = a[3];\r\n const bx1 = b[4];\r\n const by1 = b[5];\r\n const bz1 = b[6];\r\n const bw1 = b[7];\r\n const ax1 = a[4];\r\n const ay1 = a[5];\r\n const az1 = a[6];\r\n const aw1 = a[7];\r\n const bx0 = b[0];\r\n const by0 = b[1];\r\n const bz0 = b[2];\r\n const bw0 = b[3];\r\n out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0;\r\n out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0;\r\n out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0;\r\n out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0;\r\n out[4] =\r\n ax0 * bw1 +\r\n aw0 * bx1 +\r\n ay0 * bz1 -\r\n az0 * by1 +\r\n ax1 * bw0 +\r\n aw1 * bx0 +\r\n ay1 * bz0 -\r\n az1 * by0;\r\n out[5] =\r\n ay0 * bw1 +\r\n aw0 * by1 +\r\n az0 * bx1 -\r\n ax0 * bz1 +\r\n ay1 * bw0 +\r\n aw1 * by0 +\r\n az1 * bx0 -\r\n ax1 * bz0;\r\n out[6] =\r\n az0 * bw1 +\r\n aw0 * bz1 +\r\n ax0 * by1 -\r\n ay0 * bx1 +\r\n az1 * bw0 +\r\n aw1 * bz0 +\r\n ax1 * by0 -\r\n ay1 * bx0;\r\n out[7] =\r\n aw0 * bw1 -\r\n ax0 * bx1 -\r\n ay0 * by1 -\r\n az0 * bz1 +\r\n aw1 * bw0 -\r\n ax1 * bx0 -\r\n ay1 * by0 -\r\n az1 * bz0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like { return out; }\r\n\r\n /**\r\n * Scales a {@link Quat2} by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaterion\r\n * @param a - the dual quaternion to scale\r\n * @param b - scalar value to scale the dual quaterion by\r\n * @returns `out`\r\n */\r\n static scale(out: Quat2Like, a: Readonly, b: number): Quat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts)\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dot(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Quat2}s\r\n * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quat\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Quat2Like, a: Readonly, b: Readonly, t: number): Quat2Like {\r\n const mt = 1 - t;\r\n if (Quat2.dot(a, b) < 0) { t = -t; }\r\n\r\n out[0] = a[0] * mt + b[0] * t;\r\n out[1] = a[1] * mt + b[1] * t;\r\n out[2] = a[2] * mt + b[2] * t;\r\n out[3] = a[3] * mt + b[3] * t;\r\n out[4] = a[4] * mt + b[4] * t;\r\n out[5] = a[5] * mt + b[5] * t;\r\n out[6] = a[6] * mt + b[6] * t;\r\n out[7] = a[7] * mt + b[7] * t;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: Quat2Like, a: Readonly): Quat2Like {\r\n const sqlen = Quat2.squaredLength(a);\r\n out[0] = -a[0] / sqlen;\r\n out[1] = -a[1] / sqlen;\r\n out[2] = -a[2] / sqlen;\r\n out[3] = a[3] / sqlen;\r\n out[4] = -a[4] / sqlen;\r\n out[5] = -a[5] / sqlen;\r\n out[6] = -a[6] / sqlen;\r\n out[7] = a[7] / sqlen;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than\r\n * {@link Quat2.invert} and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n out[4] = -a[4];\r\n out[5] = -a[5];\r\n out[6] = -a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Quat2Like, a: Readonly): Quat2Like {\r\n let magnitude = Quat2.squaredLength(a);\r\n if (magnitude > 0) {\r\n magnitude = Math.sqrt(magnitude);\r\n\r\n const a0 = a[0] / magnitude;\r\n const a1 = a[1] / magnitude;\r\n const a2 = a[2] / magnitude;\r\n const a3 = a[3] / magnitude;\r\n\r\n const b0 = a[4];\r\n const b1 = a[5];\r\n const b2 = a[6];\r\n const b3 = a[7];\r\n\r\n const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3;\r\n\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n\r\n out[4] = (b0 - a0 * a_dot_b) / magnitude;\r\n out[5] = (b1 - a1 * a_dot_b) / magnitude;\r\n out[6] = (b2 - a2 * a_dot_b) / magnitude;\r\n out[7] = (b3 - a3 * a_dot_b) / magnitude;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat2(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7))\r\n );\r\n }\r\n}\r\n\r\n// Methods which re-use the Quat implementation\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.dot = Quat.dot;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.squaredLength = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.sqrLen = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.mag = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.length = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.len = Quat.magnitude;\r\n\r\n// Static method alias assignments\r\nQuat2.mul = Quat2.multiply;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Mat2dLike, Mat3Like, Mat4Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 2 Dimensional Vector\r\n */\r\nexport class Vec2 extends Float32Array {\r\n /**\r\n * Create a {@link Vec2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 2:{\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, values[1]!]);\r\n } else {\r\n super(v as ArrayBufferLike, values[1], 2);\r\n }\r\n break;\r\n }\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 2);\r\n }\r\n break;\r\n }\r\n default:\r\n super(2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec2.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n return Math.hypot(this[0], this[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec2.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n // Instead of zero(), use a.fill(0) for instances;\r\n\r\n /**\r\n * Adds a {@link Vec2} to `this`.\r\n * Equivalent to `Vec2.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec2} from `this`.\r\n * Equivalent to `Vec2.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec2.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec2.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec2.squaredDistance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec2.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec2.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec2.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec2}.\r\n * Equivalent to `Vec2.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec2.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec2.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 2 * Float32Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec2}\r\n * @category Static\r\n *\r\n * @returns A new 2D vector\r\n */\r\n static create(): Vec2 {\r\n return new Vec2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - Vector to clone\r\n * @returns A new 2D vector\r\n */\r\n static clone(a: Readonly): Vec2 {\r\n return new Vec2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns A new 2D vector\r\n */\r\n static fromValues(x: number, y: number): Vec2 {\r\n return new Vec2(x, y);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - The source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns `out`\r\n */\r\n static set(out: Vec2Like, x: number, y: number): Vec2Like {\r\n out[0] = x;\r\n out[1] = y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Multiplies two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Divides two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec2} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to scale\r\n * @param b - Amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec2Like, a: Readonly, b: number): Vec2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two Vec2's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param scale - The amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec2Like, a: Readonly, b: Readonly, scale: number): Vec2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns distance between `a` and `b`\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n return Math.hypot(b[0] - a[0], b[1] - a[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Squared distance between `a` and `b`\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return Math.sqrt(x * x + y * y);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate squared length of\r\n * @returns Squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec2Like, a: Readonly) {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec2Like, a: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n let len = x * x + y * y;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Dot product of `a` and `b`\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two {@link Vec2}s\r\n * Note that the cross product must by definition produce a 3D vector.\r\n * For this reason there is also not instance equivalent for this function.\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n const z = a[0] * b[1] - a[1] * b[0];\r\n out[0] = out[1] = 0;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param t - Interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec2Like, a: Readonly, b: Readonly, t: number): Vec2Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y;\r\n out[1] = m[1] * x + m[3] * y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2d}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2d(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y + m[4];\r\n out[1] = m[1] * x + m[3] * y + m[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat3}\r\n * 3rd vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat3(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[3] * y + m[6];\r\n out[1] = m[1] * x + m[4] * y + m[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat4}\r\n * 3rd vector component is implicitly '0'\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat4(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[4] * y + m[12];\r\n out[1] = m[1] * x + m[5] * y + m[13];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 2D vector\r\n * @category Static\r\n *\r\n * @param out - The receiving {@link Vec2}\r\n * @param a - The {@link Vec2} point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotate(out: Vec2Like, a: Readonly, b: Readonly, rad: number): Vec2Like {\r\n // Translate point to the origin\r\n const p0 = a[0] - b[0];\r\n const p1 = a[1] - b[1];\r\n const sinC = Math.sin(rad);\r\n const cosC = Math.cos(rad);\r\n\r\n // perform rotation and translate to correct position\r\n out[0] = p0 * cosC - p1 * sinC + b[0];\r\n out[1] = p0 * sinC + p1 * cosC + b[1];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 2D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly): number {\r\n const x1 = a[0];\r\n const y1 = a[1];\r\n const x2 = b[0];\r\n const y2 = b[1];\r\n // mag is the product of the magnitudes of a and b\r\n const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2);\r\n // mag &&.. short circuits if mag == 0\r\n const cosine = mag && (x1 * x2 + y1 * y2) / mag;\r\n // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to zero\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec2Like): Vec2Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors components are ===, `false` otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors are approximately equal, `false` otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - Vector to represent as a string\r\n * @returns String representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec2.prototype.sub = Vec2.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.mul = Vec2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.div = Vec2.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.dist = Vec2.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.sqrDist = Vec2.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec2.sub = Vec2.subtract;\r\nVec2.mul = Vec2.multiply;\r\nVec2.div = Vec2.divide;\r\nVec2.dist = Vec2.distance;\r\nVec2.sqrDist = Vec2.squaredDistance;\r\nVec2.sqrLen = Vec2.squaredLength;\r\nVec2.mag = Vec2.magnitude;\r\nVec2.length = Vec2.magnitude;\r\nVec2.len = Vec2.magnitude;\r\n", "/**\r\n * To enable additional swizzle accessors for vector classes (32-bit) invoke the {@link EnableSwizzles} function from\r\n * the `gl-matrix/swizzle` sub-path export. To enable ambient module declarations for IDE / Typescript support please\r\n * see {@link gl-matrix/types/swizzle}.\r\n *\r\n * To enable swizzling for the 64-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle/f64}.\r\n *\r\n * @example\r\n * ```ts\r\n * import { Vec3 } from 'gl-matrix';\r\n * import { EnableSwizzles } from 'gl-matrix/swizzle';\r\n *\r\n * EnableSwizzles();\r\n *\r\n * const vec = new Vec3(0, 1, 2);\r\n * const vecSwizzled = vec.zyx; // Returns a new Vec3(2, 1, 0).\r\n * ```\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\nimport { Vec2, Vec3, Vec4 } from '#gl-matrix';\r\n\r\n/**\r\n * Internal `gl-matrix` variable tracking if swizzling is enabled (32-bit).\r\n */\r\nlet GLM_SWIZZLES_ENABLED_F32 = false;\r\n\r\n/**\r\n * Enables Swizzle operations on {@link gl-matrix.Vec2 | Vec2} / {@link gl-matrix.Vec3 | Vec3} /\r\n * {@link gl-matrix.Vec4 | Vec4} types from {@link gl-matrix | gl-matrix} (32-bit).\r\n *\r\n * Swizzle operations are performed by using the `.` operator in conjunction with any combination\r\n * of between two and four component names, either from the set `xyzw` or `rgbw` (though not intermixed).\r\n * They return a new vector with the same number of components as specified in the swizzle attribute.\r\n *\r\n * @example\r\n * ```js\r\n * import { Vec3, EnableSwizzles } from 'gl-matrix';\r\n *\r\n * EnableSwizzles();\r\n *\r\n * let v = new Vec3(0, 1, 2);\r\n *\r\n * v.yx; // returns new Vec2(1, 0)\r\n * v.xzy; // returns new Vec3(0, 2, 1)\r\n * v.zyxz; // returns new Vec4(2, 1, 0, 2)\r\n *\r\n * v.rgb; // returns new Vec3(0, 1, 2)\r\n * v.rbg; // returns new Vec3(0, 2, 1)\r\n * v.gg; // returns new Vec2(1, 1)\r\n * ```\r\n */\r\nexport function EnableSwizzles(): void {\r\n /* v8 ignore next 1 */\r\n if (GLM_SWIZZLES_ENABLED_F32) { return; }\r\n\r\n /* eslint-disable comma-spacing, max-len */\r\n\r\n // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should\r\n // not be modified by hand.\r\n // [Swizzle Autogen]\r\n\r\n const VEC2_SWIZZLES = ['xx','xy','yx','yy','xxx','xxy','xyx','xyy','yxx','yxy','yyx','yyy','xxxx','xxxy','xxyx','xxyy','xyxx','xyxy','xyyx','xyyy','yxxx','yxxy','yxyx','yxyy','yyxx','yyxy','yyyx','yyyy','rr','rg','gr','gg','rrr','rrg','rgr','rgg','grr','grg','ggr','ggg','rrrr','rrrg','rrgr','rrgg','rgrr','rgrg','rggr','rggg','grrr','grrg','grgr','grgg','ggrr','ggrg','gggr','gggg'];\r\n const VEC3_SWIZZLES = ['xz','yz','zx','zy','zz','xxz','xyz','xzx','xzy','xzz','yxz','yyz','yzx','yzy','yzz','zxx','zxy','zxz','zyx','zyy','zyz','zzx','zzy','zzz','xxxz','xxyz','xxzx','xxzy','xxzz','xyxz','xyyz','xyzx','xyzy','xyzz','xzxx','xzxy','xzxz','xzyx','xzyy','xzyz','xzzx','xzzy','xzzz','yxxz','yxyz','yxzx','yxzy','yxzz','yyxz','yyyz','yyzx','yyzy','yyzz','yzxx','yzxy','yzxz','yzyx','yzyy','yzyz','yzzx','yzzy','yzzz','zxxx','zxxy','zxxz','zxyx','zxyy','zxyz','zxzx','zxzy','zxzz','zyxx','zyxy','zyxz','zyyx','zyyy','zyyz','zyzx','zyzy','zyzz','zzxx','zzxy','zzxz','zzyx','zzyy','zzyz','zzzx','zzzy','zzzz','rb','gb','br','bg','bb','rrb','rgb','rbr','rbg','rbb','grb','ggb','gbr','gbg','gbb','brr','brg','brb','bgr','bgg','bgb','bbr','bbg','bbb','rrrb','rrgb','rrbr','rrbg','rrbb','rgrb','rggb','rgbr','rgbg','rgbb','rbrr','rbrg','rbrb','rbgr','rbgg','rbgb','rbbr','rbbg','rbbb','grrb','grgb','grbr','grbg','grbb','ggrb','gggb','ggbr','ggbg','ggbb','gbrr','gbrg','gbrb','gbgr','gbgg','gbgb','gbbr','gbbg','gbbb','brrr','brrg','brrb','brgr','brgg','brgb','brbr','brbg','brbb','bgrr','bgrg','bgrb','bggr','bggg','bggb','bgbr','bgbg','bgbb','bbrr','bbrg','bbrb','bbgr','bbgg','bbgb','bbbr','bbbg','bbbb'];\r\n const VEC4_SWIZZLES = ['xw','yw','zw','wx','wy','wz','ww','xxw','xyw','xzw','xwx','xwy','xwz','xww','yxw','yyw','yzw','ywx','ywy','ywz','yww','zxw','zyw','zzw','zwx','zwy','zwz','zww','wxx','wxy','wxz','wxw','wyx','wyy','wyz','wyw','wzx','wzy','wzz','wzw','wwx','wwy','wwz','www','xxxw','xxyw','xxzw','xxwx','xxwy','xxwz','xxww','xyxw','xyyw','xyzw','xywx','xywy','xywz','xyww','xzxw','xzyw','xzzw','xzwx','xzwy','xzwz','xzww','xwxx','xwxy','xwxz','xwxw','xwyx','xwyy','xwyz','xwyw','xwzx','xwzy','xwzz','xwzw','xwwx','xwwy','xwwz','xwww','yxxw','yxyw','yxzw','yxwx','yxwy','yxwz','yxww','yyxw','yyyw','yyzw','yywx','yywy','yywz','yyww','yzxw','yzyw','yzzw','yzwx','yzwy','yzwz','yzww','ywxx','ywxy','ywxz','ywxw','ywyx','ywyy','ywyz','ywyw','ywzx','ywzy','ywzz','ywzw','ywwx','ywwy','ywwz','ywww','zxxw','zxyw','zxzw','zxwx','zxwy','zxwz','zxww','zyxw','zyyw','zyzw','zywx','zywy','zywz','zyww','zzxw','zzyw','zzzw','zzwx','zzwy','zzwz','zzww','zwxx','zwxy','zwxz','zwxw','zwyx','zwyy','zwyz','zwyw','zwzx','zwzy','zwzz','zwzw','zwwx','zwwy','zwwz','zwww','wxxx','wxxy','wxxz','wxxw','wxyx','wxyy','wxyz','wxyw','wxzx','wxzy','wxzz','wxzw','wxwx','wxwy','wxwz','wxww','wyxx','wyxy','wyxz','wyxw','wyyx','wyyy','wyyz','wyyw','wyzx','wyzy','wyzz','wyzw','wywx','wywy','wywz','wyww','wzxx','wzxy','wzxz','wzxw','wzyx','wzyy','wzyz','wzyw','wzzx','wzzy','wzzz','wzzw','wzwx','wzwy','wzwz','wzww','wwxx','wwxy','wwxz','wwxw','wwyx','wwyy','wwyz','wwyw','wwzx','wwzy','wwzz','wwzw','wwwx','wwwy','wwwz','wwww','ra','ga','ba','ar','ag','ab','aa','rra','rga','rba','rar','rag','rab','raa','gra','gga','gba','gar','gag','gab','gaa','bra','bga','bba','bar','bag','bab','baa','arr','arg','arb','ara','agr','agg','agb','aga','abr','abg','abb','aba','aar','aag','aab','aaa','rrra','rrga','rrba','rrar','rrag','rrab','rraa','rgra','rgga','rgba','rgar','rgag','rgab','rgaa','rbra','rbga','rbba','rbar','rbag','rbab','rbaa','rarr','rarg','rarb','rara','ragr','ragg','ragb','raga','rabr','rabg','rabb','raba','raar','raag','raab','raaa','grra','grga','grba','grar','grag','grab','graa','ggra','ggga','ggba','ggar','ggag','ggab','ggaa','gbra','gbga','gbba','gbar','gbag','gbab','gbaa','garr','garg','garb','gara','gagr','gagg','gagb','gaga','gabr','gabg','gabb','gaba','gaar','gaag','gaab','gaaa','brra','brga','brba','brar','brag','brab','braa','bgra','bgga','bgba','bgar','bgag','bgab','bgaa','bbra','bbga','bbba','bbar','bbag','bbab','bbaa','barr','barg','barb','bara','bagr','bagg','bagb','baga','babr','babg','babb','baba','baar','baag','baab','baaa','arrr','arrg','arrb','arra','argr','argg','argb','arga','arbr','arbg','arbb','arba','arar','arag','arab','araa','agrr','agrg','agrb','agra','aggr','aggg','aggb','agga','agbr','agbg','agbb','agba','agar','agag','agab','agaa','abrr','abrg','abrb','abra','abgr','abgg','abgb','abga','abbr','abbg','abbb','abba','abar','abag','abab','abaa','aarr','aarg','aarb','aara','aagr','aagg','aagb','aaga','aabr','aabg','aabb','aaba','aaar','aaag','aaab','aaaa'];\r\n\r\n // [/Swizzle Autogen]\r\n\r\n /* eslint-enable comma-spacing, max-len */\r\n\r\n /**\r\n * Internal swizzle index table for `gl-matrix`.\r\n */\r\n const SWIZZLE_INDEX: Record = {\r\n x: 0, r: 0,\r\n y: 1, g: 1,\r\n z: 2, b: 2,\r\n w: 3, a: 3,\r\n };\r\n\r\n /**\r\n * Internal helper function to convert and return a `gl-matrix` vector by swizzle format.\r\n *\r\n * @param swizzle - Swizzle format to apply.\r\n * @returns {Vec2 | Vec3 | Vec4} New swizzled vector instance.\r\n */\r\n function getSwizzleImpl(swizzle: string): () => Vec2 | Vec3 | Vec4 {\r\n switch (swizzle.length) {\r\n case 2:\r\n return function(this: Float32Array) {\r\n return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]);\r\n };\r\n case 3:\r\n return function(this: Float32Array) {\r\n return new Vec3(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]]);\r\n };\r\n case 4:\r\n return function(this: Float32Array) {\r\n return new Vec4(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]], this[SWIZZLE_INDEX[swizzle[3]]]);\r\n };\r\n }\r\n\r\n throw new Error('Illegal swizzle length');\r\n }\r\n\r\n for (const swizzle of VEC2_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec2.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC3_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC4_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n GLM_SWIZZLES_ENABLED_F32 = true;\r\n}\r\n", "/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_DEG_TO_RAD: number = Math.PI / 180;\r\n\r\n/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_RAD_TO_DEG: number = 180 / Math.PI;\r\n\r\n/**\r\n * Convert `radians` to `degrees`.\r\n *\r\n * @param value - Angle in `radians`.\r\n * @returns Angle in `degrees`.\r\n */\r\nexport function toDegree(value: number): number {\r\n return value * GLM_RAD_TO_DEG;\r\n}\r\n\r\n/**\r\n * Convert `degrees` to `radians`.\r\n *\r\n * @param value - Angle in `degrees`.\r\n * @returns Angle in `radians`.\r\n */\r\nexport function toRadian(value: number): number {\r\n return value * GLM_DEG_TO_RAD;\r\n}\r\n"], + "mappings": ";;;;AAOO,IAAMA,EAAN,MAAMC,UAAa,YAAa,CACrC,MAAOC,GAAgB,IAAI,aAAa,CACtC,EAAG,EACH,EAAG,CACL,CAAC,EAOD,eAAeC,EAAoE,CACjF,OAAQA,EAAO,OAAQ,CACrB,IAAK,GACH,MAAMA,CAAM,EAAG,MACjB,IAAK,GACH,MAAMA,EAAO,CAAC,EAAsBA,EAAO,CAAC,EAAG,CAAC,EAAG,MACrD,IAAK,GACH,IAAMC,EAAID,EAAO,CAAC,EACd,OAAOC,GAAM,SACf,MAAM,CACJA,EAAGA,EACHA,EAAGA,CAAC,CAAC,EAEP,MAAMA,EAAsB,EAAG,CAAC,EAElC,MACF,QACE,MAAMH,EAAKC,EAAa,EAAG,KAC/B,CACF,CAYA,IAAI,KAAc,CAChB,OAAOD,EAAK,IAA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1", "scale", "L", "D", "U", "Mat2d", "_Mat2d", "#IDENTITY_2X3", "values", "v", "a", "b", "rad", "out", "aa", "ab", "ac", "ad", "atx", "aty", "det", "a0", "a1", "a2", "a3", "a4", "a5", "b0", "b1", "b2", "b3", "b4", "b5", "v0", "v1", "s", "c", "scale", "Mat3", "_Mat3", "#IDENTITY_3X3", "values", "v", "a", "b", "rad", "out", "a01", "a02", "a12", "a00", "a10", "a11", "a20", "a21", "a22", "b01", "b11", "b21", "det", "b0", "b1", "b2", "x", "y", "s", "c", "q", "z", "w", "x2", "y2", "z2", "xx", "yx", "yy", "zx", "zy", "zz", "wx", "wy", "wz", "a03", "a13", "a23", "a30", "a31", "a32", "a33", "b00", "b02", "b03", "b04", "b05", "b06", "b07", "b08", "b09", "b10", "ax", "ay", "az", "bx", "by", "bz", "cx", "cy", "cz", "width", "height", "scale", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "b3", "b4", "b5", "b6", "b7", "b8", "Mat4", "_Mat4", "#IDENTITY_4X4", "#TMP_VEC3", "values", "v", "a", "b", "rad", "axis", "fovy", "aspect", "near", "far", "left", "right", "bottom", "top", "out", "a01", "a02", "a03", "a12", "a13", "a23", "a00", "a10", "a11", "a20", "a21", "a22", "a30", "a31", "a32", "a33", "b00", "b01", "b02", "b03", "b04", "b05", "b06", "b07", "b08", "b09", "b10", "b11", "det", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "x", "y", "z", "len", "s", "c", "t", "b12", "b20", "b21", "b22", "q", "w", "x2", "y2", "z2", "xx", "xy", "xz", "yy", "yz", "zz", "wx", "wy", "wz", "bx", "by", "bz", "bw", "ax", "ay", "az", "aw", "magnitude", "cx", "cy", "cz", "mat", "m11", "m12", "m13", "m21", "m22", "m23", "m31", "m32", "m33", "is1", "is2", "is3", "sm11", "sm12", "sm13", "sm21", "sm22", "sm23", "sm31", "sm32", "sm33", "trace", "S", "out_r", "out_t", "out_s", "sx", "sy", "sz", "o", "ox", "oy", "oz", "out0", "out1", "out2", "out4", "out5", "out6", "out8", "out9", "out10", "yx", "zx", "zy", "rl", "tb", "nf", "f", "fov", "upTan", "downTan", "leftTan", "rightTan", "xScale", "yScale", "lr", "bt", "eye", "center", "up", "eyex", "eyey", "eyez", "upx", "upy", "upz", "centerx", "centery", "centerz", "z0", "z1", "x0", "x1", "y0", "y1", "target", "scale", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a14", "a15", "b13", "b14", "b15", "Vec3", "_Vec3", "values", "v", "value", "x", "y", "z", "a", "b", "scale", "out", "len", "ax", "ay", "az", "bx", "by", "bz", "t", "angle", "sinTotal", "ratioA", "ratioB", "c", "d", "factorTimes2", "factor1", "factor2", "factor3", "factor4", "inverseFactor", "inverseFactorTimesTwo", "m", "w", "q", "qx", "qy", "qz", "w2", "uvx", "uvy", "uvz", "uuvx", "uuvy", "uuvz", "rad", "py", "pz", "px", "mag", "cosine", "a0", "a1", "a2", "b0", "b1", "b2", "Vec4", "_Vec4", "values", "v", "value", "x", "y", "z", "w", "a", "b", "scale", "out", "len", "u", "c", "d", "e", "f", "g", "h", "i", "j", "t", "ax", "ay", "az", "aw", "m", "q", "qx", "qy", "qz", "qw", "ix", "iy", "iz", "iw", "a0", "a1", "a2", "a3", "b0", "b1", "b2", "b3", "Quat", "_Quat", "#DEFAULT_ANGLE_ORDER", "#TMP_QUAT1", "#TMP_QUAT2", "#TMP_MAT3", "#TMP_VEC3", "#X_UNIT_VEC3", "#Y_UNIT_VEC3", "values", "v", "value", "x", "y", "z", "w", "a", "b", "rad", "scale", "out", "axis", "out_axis", "q", "dotproduct", "ax", "ay", "az", "aw", "bx", "by", "bz", "bw", "r", "et", "s", "t", "scale0", "scale1", "cosom", "omega", "sinom", "a0", "a1", "a2", "a3", "dot", "invDot", "m", "fTrace", "fRoot", "i", "j", "k", "order", "halfToRad", "sx", "cx", "sy", "cy", "sz", "cz", "Vec3", "c", "d", "view", "right", "up", "Vec4", "Quat2", "_Quat2", "#TMP_QUAT", "#TMP_VEC3", "values", "v", "a", "x1", "y1", "z1", "w1", "x2", "y2", "z2", "w2", "ax", "ay", "az", "out", "q", "t", "bx", "by", "bz", "bw", "Mat4", "aw", "ax1", "ay1", "az1", "aw1", "bx1", "by1", "bz1", "ax2", "ay2", "az2", "aw2", "rad", "Quat", "qx", "qy", "qz", "qw", "axis", "axisLength", "s", "b", "ax0", "ay0", "az0", "aw0", "bw1", "bx0", "by0", "bz0", "bw0", "mt", "sqlen", "magnitude", "a0", "a1", "a2", "a3", "b0", "b1", "b2", "b3", "a_dot_b", "a4", "a5", "a6", "a7", "b4", "b5", "b6", "b7", "Vec2", "_Vec2", "values", "v", "value", "x", "y", "a", "b", "scale", "out", "len", "z", "t", "ax", "ay", "m", "rad", "p0", "p1", "sinC", "cosC", "x1", "y1", "x2", "y2", "mag", "cosine", "a0", "a1", "b0", "b1", "GLM_SWIZZLES_ENABLED_F32", "EnableSwizzles", "VEC2_SWIZZLES", "VEC3_SWIZZLES", "VEC4_SWIZZLES", "SWIZZLE_INDEX", "getSwizzleImpl", "swizzle", "Vec2", "Vec3", "Vec4", "impl", "GLM_DEG_TO_RAD", "GLM_RAD_TO_DEG", "toDegree", "value", "toRadian"] +} diff --git a/dist-cdn/esm/2022/gl-matrix-f64.js b/dist-cdn/esm/2022/gl-matrix-f64.js new file mode 100644 index 00000000..bdd6fe37 --- /dev/null +++ b/dist-cdn/esm/2022/gl-matrix-f64.js @@ -0,0 +1,9506 @@ +// gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library. +// @author Brandon Jones +// @author Colin MacKenzie IV +// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md) + +// src/common/index.ts +var GLM_EPSILON = 1e-6; + +// src/_lib/f64/Mat2.ts +var Mat2 = class _Mat2 extends Float64Array { + static #IDENTITY_2X2 = new Float64Array([ + 1, + 0, + 0, + 1 + ]); + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 4: + super(values); + break; + case 2: + super(values[0], values[1], 4); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v + ]); + } else { + super(v, 0, 4); + } + break; + default: + super(_Mat2.#IDENTITY_2X2); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat2.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat2.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat2} into `this`. + * + * @param a the source vector + * @returns `this` + * @category Methods + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat2.identity(this) + * + * @returns `this` + * @category Methods + */ + identity() { + this.set(_Mat2.#IDENTITY_2X2); + return this; + } + /** + * Multiplies this {@link Mat2} against another one + * Equivalent to `Mat2.multiply(this, this, b);` + * + * @param b - The second operand + * @returns `this` + * @category Methods + */ + multiply(b) { + return _Mat2.multiply(this, this, b); + } + /** + * Alias for {@link Mat2.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat2} + * Equivalent to `Mat2.transpose(this, this);` + * + * @returns `this` + * @category Methods + */ + transpose() { + return _Mat2.transpose(this, this); + } + /** + * Inverts this {@link Mat2} + * Equivalent to `Mat4.invert(this, this);` + * + * @returns `this` + * @category Methods + */ + invert() { + return _Mat2.invert(this, this); + } + /** + * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2.scale(this, this, v);` + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + * @category Methods + */ + scale(v) { + return _Mat2.scale(this, this, v); + } + /** + * Rotates this {@link Mat2} by the given angle around the given axis + * Equivalent to `Mat2.rotate(this, this, rad);` + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + * @category Methods + */ + rotate(rad) { + return _Mat2.rotate(this, this, rad); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2}. + */ + static get BYTE_LENGTH() { + return 4 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat2} + * @category Static + * + * @returns A new {@link Mat2} + */ + static create() { + return new _Mat2(); + } + /** + * Creates a new {@link Mat2} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2} + */ + static clone(a) { + return new _Mat2(a); + } + /** + * Copy the values from one {@link Mat2} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Create a new {@link Mat2} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2} + */ + static fromValues(...values) { + return new _Mat2(...values); + } + /** + * Set the components of a {@link Mat2} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + return out; + } + /** + * Set a {@link Mat2} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out, a) { + if (out === a) { + const a1 = a[1]; + out[1] = a[2]; + out[2] = a1; + } else { + out[0] = a[0]; + out[1] = a[2]; + out[2] = a[1]; + out[3] = a[3]; + } + return out; + } + /** + * Inverts a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + let det = a0 * a3 - a2 * a1; + if (!det) { + return null; + } + det = 1 / det; + out[0] = a3 * det; + out[1] = -a1 * det; + out[2] = -a2 * det; + out[3] = a0 * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out, a) { + const a0 = a[0]; + out[0] = a[3]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a0; + return out; + } + /** + * Calculates the determinant of a {@link Mat2} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + return a[0] * a[3] - a[2] * a[1]; + } + /** + * Adds two {@link Mat2}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + return out; + } + /** + * Alias for {@link Mat2.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat2}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + out[0] = a0 * b0 + a2 * b1; + out[1] = a1 * b0 + a3 * b1; + out[2] = a0 * b2 + a2 * b3; + out[3] = a1 * b2 + a3 * b3; + return out; + } + /** + * Alias for {@link Mat2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Rotates a {@link Mat2} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out, a, rad) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = a0 * c + a2 * s; + out[1] = a1 * c + a3 * s; + out[2] = a0 * -s + a2 * c; + out[3] = a1 * -s + a3 * c; + return out; + } + /** + * Scales the {@link Mat2} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0 * v0; + out[1] = a1 * v0; + out[2] = a2 * v1; + out[3] = a3 * v1; + return out; + } + /** + * Creates a {@link Mat2} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = -s; + out[3] = c; + return out; + } + /** + * Creates a {@link Mat2} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = v[1]; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat2} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]); + } + /** + * Multiply each element of a {@link Mat2} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + return out; + } + /** + * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + return out; + } + /** + * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix + * @category Static + * + * @param L - the lower triangular matrix + * @param D - the diagonal matrix + * @param U - the upper triangular matrix + * @param a - the input matrix to factorize + */ + static LDU(L, D, U, a) { + L[2] = a[2] / a[0]; + U[0] = a[0]; + U[1] = a[1]; + U[3] = a[3] - L[2] * U[1]; + return [L, D, U]; + } + /** + * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + /** + * Returns whether two {@link Mat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)); + } + /** + * Returns a string representation of a {@link Mat2} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat2(${a.join(", ")})`; + } +}; +Mat2.prototype.mul = Mat2.prototype.multiply; +Mat2.mul = Mat2.multiply; +Mat2.sub = Mat2.subtract; + +// src/_lib/f64/Mat2d.ts +var Mat2d = class _Mat2d extends Float64Array { + static #IDENTITY_2X3 = new Float64Array([ + 1, + 0, + 0, + 1, + 0, + 0 + ]); + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 6: + super(values); + break; + case 2: + super(values[0], values[1], 6); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v, + v, + v + ]); + } else { + super(v, 0, 6); + } + break; + default: + super(_Mat2d.#IDENTITY_2X3); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat2d.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat2d.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Mat2d} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat2d.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this.set(_Mat2d.#IDENTITY_2X3); + return this; + } + /** + * Multiplies this {@link Mat2d} against another one + * Equivalent to `Mat2d.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b) { + return _Mat2d.multiply(this, this, b); + } + /** + * Alias for {@link Mat2d.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Translate this {@link Mat2d} by the given vector + * Equivalent to `Mat2d.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v) { + return _Mat2d.translate(this, this, v); + } + /** + * Rotates this {@link Mat2d} by the given angle around the given axis + * Equivalent to `Mat2d.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad) { + return _Mat2d.rotate(this, this, rad); + } + /** + * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2d.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v) { + return _Mat2d.scale(this, this, v); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2d}. + */ + static get BYTE_LENGTH() { + return 6 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat2d} + * @category Static + * + * @returns A new {@link Mat2d} + */ + static create() { + return new _Mat2d(); + } + /** + * Creates a new {@link Mat2d} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2d} + */ + static clone(a) { + return new _Mat2d(a); + } + /** + * Copy the values from one {@link Mat2d} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + return out; + } + /** + * Create a new {@link Mat2d} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2d} + */ + static fromValues(...values) { + return new _Mat2d(...values); + } + /** + * Set the components of a {@link Mat2d} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + return out; + } + /** + * Set a {@link Mat2d} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Inverts a {@link Mat2d} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const aa = a[0]; + const ab = a[1]; + const ac = a[2]; + const ad = a[3]; + const atx = a[4]; + const aty = a[5]; + let det = aa * ad - ab * ac; + if (!det) { + return null; + } + det = 1 / det; + out[0] = ad * det; + out[1] = -ab * det; + out[2] = -ac * det; + out[3] = aa * det; + out[4] = (ac * aty - ad * atx) * det; + out[5] = (ab * atx - aa * aty) * det; + return out; + } + /** + * Calculates the determinant of a {@link Mat2d} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + return a[0] * a[3] - a[1] * a[2]; + } + /** + * Adds two {@link Mat2d}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + return out; + } + /** + * Alias for {@link Mat2d.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat2d}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + out[0] = a0 * b0 + a2 * b1; + out[1] = a1 * b0 + a3 * b1; + out[2] = a0 * b2 + a2 * b3; + out[3] = a1 * b2 + a3 * b3; + out[4] = a0 * b4 + a2 * b5 + a4; + out[5] = a1 * b4 + a3 * b5 + a5; + return out; + } + /** + * Alias for {@link Mat2d.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat2d} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0; + out[1] = a1; + out[2] = a2; + out[3] = a3; + out[4] = a0 * v0 + a2 * v1 + a4; + out[5] = a1 * v0 + a3 * v1 + a5; + return out; + } + /** + * Rotates a {@link Mat2d} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out, a, rad) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = a0 * c + a2 * s; + out[1] = a1 * c + a3 * s; + out[2] = a0 * -s + a2 * c; + out[3] = a1 * -s + a3 * c; + out[4] = a4; + out[5] = a5; + return out; + } + /** + * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0 * v0; + out[1] = a1 * v0; + out[2] = a2 * v1; + out[3] = a3 * v1; + out[4] = a4; + out[5] = a5; + return out; + } + // TODO: Got to fromRotation + /** + * Creates a {@link Mat2d} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = v[0]; + out[5] = v[1]; + return out; + } + /** + * Creates a {@link Mat2d} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = -s; + out[3] = c; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Creates a {@link Mat2d} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = v[1]; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat2d} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1); + } + /** + * Multiply each element of a {@link Mat2d} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + return out; + } + /** + * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + return out; + } + /** + * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5]; + } + /** + * Returns whether two {@link Mat2d}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)); + } + /** + * Returns a string representation of a {@link Mat2d} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat2d(${a.join(", ")})`; + } +}; +Mat2d.mul = Mat2d.multiply; +Mat2d.sub = Mat2d.subtract; + +// src/_lib/f64/Mat3.ts +var Mat3 = class _Mat3 extends Float64Array { + static #IDENTITY_3X3 = new Float64Array([ + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1 + ]); + /** + * Create a {@link Mat3}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 9: + super(values); + break; + case 2: + super(values[0], values[1], 9); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v, + v, + v, + v, + v, + v + ]); + } else { + super(v, 0, 9); + } + break; + default: + super(_Mat3.#IDENTITY_3X3); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat3.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat3.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat3.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this.set(_Mat3.#IDENTITY_3X3); + return this; + } + /** + * Multiplies this {@link Mat3} against another one + * Equivalent to `Mat3.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b) { + return _Mat3.multiply(this, this, b); + } + /** + * Alias for {@link Mat3.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat3} + * Equivalent to `Mat3.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose() { + return _Mat3.transpose(this, this); + } + /** + * Inverts this {@link Mat3} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + return _Mat3.invert(this, this); + } + /** + * Translate this {@link Mat3} by the given vector + * Equivalent to `Mat3.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v) { + return _Mat3.translate(this, this, v); + } + /** + * Rotates this {@link Mat3} by the given angle around the given axis + * Equivalent to `Mat3.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad) { + return _Mat3.rotate(this, this, rad); + } + /** + * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat3.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v) { + return _Mat3.scale(this, this, v); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat3}. + */ + static get BYTE_LENGTH() { + return 9 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat3} + * @category Static + * + * @returns A new {@link Mat3} + */ + static create() { + return new _Mat3(); + } + /** + * Creates a new {@link Mat3} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat3} + */ + static clone(a) { + return new _Mat3(a); + } + /** + * Copy the values from one {@link Mat3} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + return out; + } + /** + * Create a new {@link Mat3} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat3} + */ + static fromValues(...values) { + return new _Mat3(...values); + } + /** + * Set the components of a {@link Mat3} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + out[6] = values[6]; + out[7] = values[7]; + out[8] = values[8]; + return out; + } + /** + * Set a {@link Mat3} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out, a) { + if (out === a) { + const a01 = a[1], a02 = a[2], a12 = a[5]; + out[1] = a[3]; + out[2] = a[6]; + out[3] = a01; + out[5] = a[7]; + out[6] = a02; + out[7] = a12; + } else { + out[0] = a[0]; + out[1] = a[3]; + out[2] = a[6]; + out[3] = a[1]; + out[4] = a[4]; + out[5] = a[7]; + out[6] = a[2]; + out[7] = a[5]; + out[8] = a[8]; + } + return out; + } + /** + * Inverts a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const a00 = a[0], a01 = a[1], a02 = a[2]; + const a10 = a[3], a11 = a[4], a12 = a[5]; + const a20 = a[6], a21 = a[7], a22 = a[8]; + const b01 = a22 * a11 - a12 * a21; + const b11 = -a22 * a10 + a12 * a20; + const b21 = a21 * a10 - a11 * a20; + let det = a00 * b01 + a01 * b11 + a02 * b21; + if (!det) { + return null; + } + det = 1 / det; + out[0] = b01 * det; + out[1] = (-a22 * a01 + a02 * a21) * det; + out[2] = (a12 * a01 - a02 * a11) * det; + out[3] = b11 * det; + out[4] = (a22 * a00 - a02 * a20) * det; + out[5] = (-a12 * a00 + a02 * a10) * det; + out[6] = b21 * det; + out[7] = (-a21 * a00 + a01 * a20) * det; + out[8] = (a11 * a00 - a01 * a10) * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out, a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + out[0] = a11 * a22 - a12 * a21; + out[1] = a02 * a21 - a01 * a22; + out[2] = a01 * a12 - a02 * a11; + out[3] = a12 * a20 - a10 * a22; + out[4] = a00 * a22 - a02 * a20; + out[5] = a02 * a10 - a00 * a12; + out[6] = a10 * a21 - a11 * a20; + out[7] = a01 * a20 - a00 * a21; + out[8] = a00 * a11 - a01 * a10; + return out; + } + /** + * Calculates the determinant of a {@link Mat3} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20); + } + /** + * Adds two {@link Mat3}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + out[8] = a[8] + b[8]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + out[6] = a[6] - b[6]; + out[7] = a[7] - b[7]; + out[8] = a[8] - b[8]; + return out; + } + /** + * Alias for {@link Mat3.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat3}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + let b0 = b[0]; + let b1 = b[1]; + let b2 = b[2]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20; + out[1] = b0 * a01 + b1 * a11 + b2 * a21; + out[2] = b0 * a02 + b1 * a12 + b2 * a22; + b0 = b[3]; + b1 = b[4]; + b2 = b[5]; + out[3] = b0 * a00 + b1 * a10 + b2 * a20; + out[4] = b0 * a01 + b1 * a11 + b2 * a21; + out[5] = b0 * a02 + b1 * a12 + b2 * a22; + b0 = b[6]; + b1 = b[7]; + b2 = b[8]; + out[6] = b0 * a00 + b1 * a10 + b2 * a20; + out[7] = b0 * a01 + b1 * a11 + b2 * a21; + out[8] = b0 * a02 + b1 * a12 + b2 * a22; + return out; + } + /** + * Alias for {@link Mat3.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat3} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + const x = v[0]; + const y = v[1]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a10; + out[4] = a11; + out[5] = a12; + out[6] = x * a00 + y * a10 + a20; + out[7] = x * a01 + y * a11 + a21; + out[8] = x * a02 + y * a12 + a22; + return out; + } + /** + * Rotates a {@link Mat3} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out, a, rad) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c * a00 + s * a10; + out[1] = c * a01 + s * a11; + out[2] = c * a02 + s * a12; + out[3] = c * a10 - s * a00; + out[4] = c * a11 - s * a01; + out[5] = c * a12 - s * a02; + out[6] = a20; + out[7] = a21; + out[8] = a22; + return out; + } + /** + * Scales the {@link Mat3} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const x = v[0]; + const y = v[1]; + out[0] = x * a[0]; + out[1] = x * a[1]; + out[2] = x * a[2]; + out[3] = y * a[3]; + out[4] = y * a[4]; + out[5] = y * a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + return out; + } + /** + * Creates a {@link Mat3} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = v[0]; + out[7] = v[1]; + out[8] = 1; + return out; + } + /** + * Creates a {@link Mat3} from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat3.identity(dest); + * mat3.rotate(dest, dest, rad); + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = 0; + out[3] = -s; + out[4] = c; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Creates a {@link Mat3} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = v[1]; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Copies the upper-left 3x3 values of a {@link Mat2d} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 2x3 matrix + * @returns `out` + */ + static fromMat2d(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = 0; + out[3] = a[2]; + out[4] = a[3]; + out[5] = 0; + out[6] = a[4]; + out[7] = a[5]; + out[8] = 1; + return out; + } + /** + * Calculates a {@link Mat3} from the given quaternion + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param q - {@link Quat} to create matrix from + * @returns `out` + */ + static fromQuat(out, q) { + 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; + out[0] = 1 - yy - zz; + out[3] = yx - wz; + out[6] = zx + wy; + out[1] = yx + wz; + out[4] = 1 - xx - zz; + out[7] = zy - wx; + out[2] = zx - wy; + out[5] = zy + wx; + out[8] = 1 - xx - yy; + return out; + } + /** + * Copies the upper-left 3x3 values of a {@link Mat4} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 4x4 matrix + * @returns `out` + */ + static fromMat4(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[4]; + out[4] = a[5]; + out[5] = a[6]; + out[6] = a[8]; + out[7] = a[9]; + out[8] = a[10]; + return out; + } + /** + * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix + * @category Static + * + * @param {mat3} out mat3 receiving operation result + * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out, a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + return out; + } + /** + * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out, a) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const bx = a[4]; + const by = a[5]; + const bz = a[6]; + const cx = a[8]; + const cy = a[9]; + const cz = a[10]; + out[0] = by * cz - cz * cy; + out[1] = bz * cx - cx * cz; + out[2] = bx * cy - cy * cx; + out[3] = cy * az - cz * ay; + out[4] = cz * ax - cx * az; + out[5] = cx * ay - cy * ax; + out[6] = ay * bz - az * by; + out[7] = az * bx - ax * bz; + out[8] = ax * by - ay * bx; + return out; + } + /** + * Generates a 2D projection matrix with the given bounds + * @category Static + * + * @param out mat3 frustum matrix will be written into + * @param width Width of your gl context + * @param height Height of gl context + * @returns `out` + */ + static projection(out, width, height) { + out[0] = 2 / width; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = -2 / height; + out[5] = 0; + out[6] = -1; + out[7] = 1; + out[8] = 1; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat3} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt( + a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + ); + } + /** + * Multiply each element of a {@link Mat3} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + out[8] = a[8] * b; + return out; + } + /** + * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + out[6] = a[6] + b[6] * scale; + out[7] = a[7] + b[7] * scale; + out[8] = a[8] + b[8] * scale; + return out; + } + /** + * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8]; + } + /** + * Returns whether two {@link Mat3}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const a8 = a[8]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + const b8 = b[8]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)); + } + /** + * Returns a string representation of a {@link Mat3} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat3(${a.join(", ")})`; + } +}; +Mat3.prototype.mul = Mat3.prototype.multiply; +Mat3.mul = Mat3.multiply; +Mat3.sub = Mat3.subtract; + +// src/_lib/f64/Mat4.ts +var Mat4 = class _Mat4 extends Float64Array { + static #IDENTITY_4X4 = new Float64Array([ + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 + ]); + /** + * Temporary variable to prevent repeated allocations in the algorithms within Mat4. + * These are declared as TypedArrays to aid in tree-shaking. + */ + static #TMP_VEC3 = new Float64Array(3); + /** + * Create a {@link Mat4}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 16: + super(values); + break; + case 2: + super(values[0], values[1], 16); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v + ]); + } else { + super(v, 0, 16); + } + break; + default: + super(_Mat4.#IDENTITY_4X4); + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat4.str(this);` + * + * @category Accessors + */ + get str() { + return _Mat4.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat4.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this.set(_Mat4.#IDENTITY_4X4); + return this; + } + /** + * Multiplies this {@link Mat4} against another one + * Equivalent to `Mat4.multiply(this, this, b);` + * @category Methods + * + * @param b - The second operand + * @returns `this` + */ + multiply(b) { + return _Mat4.multiply(this, this, b); + } + /** + * Alias for {@link Mat4.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat4} + * Equivalent to `Mat4.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose() { + return _Mat4.transpose(this, this); + } + /** + * Inverts this {@link Mat4} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + return _Mat4.invert(this, this); + } + /** + * Translate this {@link Mat4} by the given vector + * Equivalent to `Mat4.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to translate by + * @returns `this` + */ + translate(v) { + return _Mat4.translate(this, this, v); + } + /** + * Rotates this {@link Mat4} by the given angle around the given axis + * Equivalent to `Mat4.rotate(this, this, rad, axis);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `this` + */ + rotate(rad, axis) { + return _Mat4.rotate(this, this, rad, axis); + } + /** + * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat4.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to scale the matrix by + * @returns `this` + */ + scale(v) { + return _Mat4.scale(this, this, v); + } + /** + * Rotates this {@link Mat4} by the given angle around the X axis + * Equivalent to `Mat4.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateX(rad) { + return _Mat4.rotateX(this, this, rad); + } + /** + * Rotates this {@link Mat4} by the given angle around the Y axis + * Equivalent to `Mat4.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateY(rad) { + return _Mat4.rotateY(this, this, rad); + } + /** + * Rotates this {@link Mat4} by the given angle around the Z axis + * Equivalent to `Mat4.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateZ(rad) { + return _Mat4.rotateZ(this, this, rad); + } + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveNO(fovy, aspect, near, far) { + return _Mat4.perspectiveNO(this, fovy, aspect, near, far); + } + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveZO(fovy, aspect, near, far) { + return _Mat4.perspectiveZO(this, fovy, aspect, near, far); + } + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoNO(left, right, bottom, top, near, far) { + return _Mat4.orthoNO(this, left, right, bottom, top, near, far); + } + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoZO(left, right, bottom, top, near, far) { + return _Mat4.orthoZO(this, left, right, bottom, top, near, far); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat4}. + */ + static get BYTE_LENGTH() { + return 16 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat4} + * @category Static + * + * @returns A new {@link Mat4} + */ + static create() { + return new _Mat4(); + } + /** + * Creates a new {@link Mat4} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat4} + */ + static clone(a) { + return new _Mat4(a); + } + /** + * Copy the values from one {@link Mat4} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + /** + * Create a new mat4 with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat4} + */ + static fromValues(...values) { + return new _Mat4(...values); + } + /** + * Set the components of a mat4 to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + out[6] = values[6]; + out[7] = values[7]; + out[8] = values[8]; + out[9] = values[9]; + out[10] = values[10]; + out[11] = values[11]; + out[12] = values[12]; + out[13] = values[13]; + out[14] = values[14]; + out[15] = values[15]; + return out; + } + /** + * Set a {@link Mat4} to the identity matrix + * @category Static + * + * @param out - The receiving Matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out, a) { + if (out === a) { + const a01 = a[1], a02 = a[2], a03 = a[3]; + const a12 = a[6], a13 = a[7]; + const a23 = a[11]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a01; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a02; + out[9] = a12; + out[11] = a[14]; + out[12] = a03; + out[13] = a13; + out[14] = a23; + } else { + out[0] = a[0]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a[1]; + out[5] = a[5]; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a[2]; + out[9] = a[6]; + out[10] = a[10]; + out[11] = a[14]; + out[12] = a[3]; + out[13] = a[7]; + out[14] = a[11]; + out[15] = a[15]; + } + return out; + } + /** + * Inverts a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out, a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out, a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + out[0] = a11 * b11 - a12 * b10 + a13 * b09; + out[1] = a02 * b10 - a01 * b11 - a03 * b09; + out[2] = a31 * b05 - a32 * b04 + a33 * b03; + out[3] = a22 * b04 - a21 * b05 - a23 * b03; + out[4] = a12 * b08 - a10 * b11 - a13 * b07; + out[5] = a00 * b11 - a02 * b08 + a03 * b07; + out[6] = a32 * b02 - a30 * b05 - a33 * b01; + out[7] = a20 * b05 - a22 * b02 + a23 * b01; + out[8] = a10 * b10 - a11 * b08 + a13 * b06; + out[9] = a01 * b08 - a00 * b10 - a03 * b06; + out[10] = a30 * b04 - a31 * b02 + a33 * b00; + out[11] = a21 * b02 - a20 * b04 - a23 * b00; + out[12] = a11 * b07 - a10 * b09 - a12 * b06; + out[13] = a00 * b09 - a01 * b07 + a02 * b06; + out[14] = a31 * b01 - a30 * b03 - a32 * b00; + out[15] = a20 * b03 - a21 * b01 + a22 * b00; + return out; + } + /** + * Calculates the determinant of a {@link Mat4} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b0 = a00 * a11 - a01 * a10; + const b1 = a00 * a12 - a02 * a10; + const b2 = a01 * a12 - a02 * a11; + const b3 = a20 * a31 - a21 * a30; + const b4 = a20 * a32 - a22 * a30; + const b5 = a21 * a32 - a22 * a31; + const b6 = a00 * b5 - a01 * b4 + a02 * b3; + const b7 = a10 * b5 - a11 * b4 + a12 * b3; + const b8 = a20 * b2 - a21 * b1 + a22 * b0; + const b9 = a30 * b2 - a31 * b1 + a32 * b0; + return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9; + } + /** + * Multiplies two {@link Mat4}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + let b0 = b[0]; + let b1 = b[1]; + let b2 = b[2]; + let b3 = b[3]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[4]; + b1 = b[5]; + b2 = b[6]; + b3 = b[7]; + out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[8]; + b1 = b[9]; + b2 = b[10]; + b3 = b[11]; + out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[12]; + b1 = b[13]; + b2 = b[14]; + b3 = b[15]; + out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + return out; + } + /** + * Alias for {@link Mat4.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat4} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const x = v[0]; + const y = v[1]; + const z = v[2]; + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a03; + out[4] = a10; + out[5] = a11; + out[6] = a12; + out[7] = a13; + out[8] = a20; + out[9] = a21; + out[10] = a22; + out[11] = a23; + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + return out; + } + /** + * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec3} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const x = v[0]; + const y = v[1]; + const z = v[2]; + out[0] = a[0] * x; + out[1] = a[1] * x; + out[2] = a[2] * x; + out[3] = a[3] * x; + out[4] = a[4] * y; + out[5] = a[5] * y; + out[6] = a[6] * y; + out[7] = a[7] * y; + out[8] = a[8] * z; + out[9] = a[9] * z; + out[10] = a[10] * z; + out[11] = a[11] * z; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + /** + * Rotates a {@link Mat4} by the given angle around the given axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if axis has a length of 0 + */ + static rotate(out, a, rad, axis) { + let x = axis[0]; + let y = axis[1]; + let z = axis[2]; + let len = Math.sqrt(x * x + y * y + z * z); + if (len < GLM_EPSILON) { + return null; + } + len = 1 / len; + x *= len; + y *= len; + z *= len; + const s = Math.sin(rad); + const c = Math.cos(rad); + const t = 1 - c; + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const b00 = x * x * t + c; + const b01 = y * x * t + z * s; + const b02 = z * x * t - y * s; + const b10 = x * y * t - z * s; + const b11 = y * y * t + c; + const b12 = z * y * t + x * s; + const b20 = x * z * t + y * s; + const b21 = y * z * t - x * s; + const b22 = z * z * t + c; + out[0] = a00 * b00 + a10 * b01 + a20 * b02; + out[1] = a01 * b00 + a11 * b01 + a21 * b02; + out[2] = a02 * b00 + a12 * b01 + a22 * b02; + out[3] = a03 * b00 + a13 * b01 + a23 * b02; + out[4] = a00 * b10 + a10 * b11 + a20 * b12; + out[5] = a01 * b10 + a11 * b11 + a21 * b12; + out[6] = a02 * b10 + a12 * b11 + a22 * b12; + out[7] = a03 * b10 + a13 * b11 + a23 * b12; + out[8] = a00 * b20 + a10 * b21 + a20 * b22; + out[9] = a01 * b20 + a11 * b21 + a21 * b22; + out[10] = a02 * b20 + a12 * b21 + a22 * b22; + out[11] = a03 * b20 + a13 * b21 + a23 * b22; + if (a !== out) { + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + return out; + } + /** + * Rotates a matrix by the given angle around the X axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateX(out, a, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + if (a !== out) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[4] = a10 * c + a20 * s; + out[5] = a11 * c + a21 * s; + out[6] = a12 * c + a22 * s; + out[7] = a13 * c + a23 * s; + out[8] = a20 * c - a10 * s; + out[9] = a21 * c - a11 * s; + out[10] = a22 * c - a12 * s; + out[11] = a23 * c - a13 * s; + return out; + } + /** + * Rotates a matrix by the given angle around the Y axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateY(out, a, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + if (a !== out) { + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[0] = a00 * c - a20 * s; + out[1] = a01 * c - a21 * s; + out[2] = a02 * c - a22 * s; + out[3] = a03 * c - a23 * s; + out[8] = a00 * s + a20 * c; + out[9] = a01 * s + a21 * c; + out[10] = a02 * s + a22 * c; + out[11] = a03 * s + a23 * c; + return out; + } + /** + * Rotates a matrix by the given angle around the Z axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateZ(out, a, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + if (a !== out) { + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[0] = a00 * c + a10 * s; + out[1] = a01 * c + a11 * s; + out[2] = a02 * c + a12 * s; + out[3] = a03 * c + a13 * s; + out[4] = a10 * c - a00 * s; + out[5] = a11 * c - a01 * s; + out[6] = a12 * c - a02 * s; + out[7] = a13 * c - a03 * s; + return out; + } + /** + * Creates a {@link Mat4} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Creates a {@link Mat4} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = v[1]; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = v[2]; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a {@link Mat4} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotate(dest, dest, rad, axis); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if `axis` has a length of 0 + */ + static fromRotation(out, rad, axis) { + let x = axis[0]; + let y = axis[1]; + let z = axis[2]; + let len = Math.sqrt(x * x + y * y + z * z); + if (len < GLM_EPSILON) { + return null; + } + len = 1 / len; + x *= len; + y *= len; + z *= len; + const s = Math.sin(rad); + const c = Math.cos(rad); + const t = 1 - c; + out[0] = x * x * t + c; + out[1] = y * x * t + z * s; + out[2] = z * x * t - y * s; + out[3] = 0; + out[4] = x * y * t - z * s; + out[5] = y * y * t + c; + out[6] = z * y * t + x * s; + out[7] = 0; + out[8] = x * z * t + y * s; + out[9] = y * z * t - x * s; + out[10] = z * z * t + c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateX(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromXRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = c; + out[6] = s; + out[7] = 0; + out[8] = 0; + out[9] = -s; + out[10] = c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateY(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromYRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = 0; + out[2] = -s; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = s; + out[9] = 0; + out[10] = c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateZ(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromZRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = 0; + out[3] = 0; + out[4] = -s; + out[5] = c; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @returns `out` + */ + static fromRotationTranslation(out, q, v) { + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Sets a {@link Mat4} from a {@link Quat2}. + * @category Static + * + * @param out - Matrix + * @param a - Dual Quaternion + * @returns `out` + */ + static fromQuat2(out, a) { + const bx = -a[0]; + const by = -a[1]; + const bz = -a[2]; + const bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const magnitude = bx * bx + by * by + bz * bz + bw * bw; + if (magnitude > 0) { + _Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude; + _Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude; + _Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude; + } else { + _Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; + _Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; + _Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + } + _Mat4.fromRotationTranslation(out, a, _Mat4.#TMP_VEC3); + return out; + } + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out, a) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[3] = 0; + out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[7] = 0; + out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out, a) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const bx = a[4]; + const by = a[5]; + const bz = a[6]; + const cx = a[8]; + const cy = a[9]; + const cz = a[10]; + out[0] = by * cz - cz * cy; + out[1] = bz * cx - cx * cz; + out[2] = bx * cy - cy * cx; + out[3] = 0; + out[4] = cy * az - cz * ay; + out[5] = cz * ax - cx * az; + out[6] = cx * ay - cy * ax; + out[7] = 0; + out[8] = ay * bz - az * by; + out[9] = az * bx - ax * bz; + out[10] = ax * by - ay * bx; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Returns the translation vector component of a transformation + * matrix. If a matrix is built with fromRotationTranslation, + * the returned vector will be the same as the translation vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive translation component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getTranslation(out, mat) { + out[0] = mat[12]; + out[1] = mat[13]; + out[2] = mat[14]; + return out; + } + /** + * Returns the scaling factor component of a transformation + * matrix. If a matrix is built with fromRotationTranslationScale + * with a normalized Quaternion parameter, the returned vector will be + * the same as the scaling vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive scaling factor component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getScaling(out, mat) { + const m11 = mat[0]; + const m12 = mat[1]; + const m13 = mat[2]; + const m21 = mat[4]; + const m22 = mat[5]; + const m23 = mat[6]; + const m31 = mat[8]; + const m32 = mat[9]; + const m33 = mat[10]; + out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + return out; + } + /** + * Returns a quaternion representing the rotational component + * of a transformation matrix. If a matrix is built with + * fromRotationTranslation, the returned quaternion will be the + * same as the quaternion originally supplied. + * @category Static + * + * @param out - Quaternion to receive the rotation component + * @param mat - Matrix to be decomposed (input) + * @return `out` + */ + static getRotation(out, mat) { + _Mat4.getScaling(_Mat4.#TMP_VEC3, mat); + const is1 = 1 / _Mat4.#TMP_VEC3[0]; + const is2 = 1 / _Mat4.#TMP_VEC3[1]; + const is3 = 1 / _Mat4.#TMP_VEC3[2]; + const sm11 = mat[0] * is1; + const sm12 = mat[1] * is2; + const sm13 = mat[2] * is3; + const sm21 = mat[4] * is1; + const sm22 = mat[5] * is2; + const sm23 = mat[6] * is3; + const sm31 = mat[8] * is1; + const sm32 = mat[9] * is2; + const sm33 = mat[10] * is3; + const trace = sm11 + sm22 + sm33; + let S = 0; + if (trace > 0) { + S = Math.sqrt(trace + 1) * 2; + out[3] = 0.25 * S; + out[0] = (sm23 - sm32) / S; + out[1] = (sm31 - sm13) / S; + out[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2; + out[3] = (sm23 - sm32) / S; + out[0] = 0.25 * S; + out[1] = (sm12 + sm21) / S; + out[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2; + out[3] = (sm31 - sm13) / S; + out[0] = (sm12 + sm21) / S; + out[1] = 0.25 * S; + out[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2; + out[3] = (sm12 - sm21) / S; + out[0] = (sm31 + sm13) / S; + out[1] = (sm23 + sm32) / S; + out[2] = 0.25 * S; + } + return out; + } + /** + * Decomposes a transformation matrix into its rotation, translation + * and scale components. Returns only the rotation component + * @category Static + * + * @param out_r - Quaternion to receive the rotation component + * @param out_t - Vector to receive the translation vector + * @param out_s - Vector to receive the scaling factor + * @param mat - Matrix to be decomposed (input) + * @returns `out_r` + */ + static decompose(out_r, out_t, out_s, mat) { + out_t[0] = mat[12]; + out_t[1] = mat[13]; + out_t[2] = mat[14]; + const m11 = mat[0]; + const m12 = mat[1]; + const m13 = mat[2]; + const m21 = mat[4]; + const m22 = mat[5]; + const m23 = mat[6]; + const m31 = mat[8]; + const m32 = mat[9]; + const m33 = mat[10]; + out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + const is1 = 1 / out_s[0]; + const is2 = 1 / out_s[1]; + const is3 = 1 / out_s[2]; + const sm11 = m11 * is1; + const sm12 = m12 * is2; + const sm13 = m13 * is3; + const sm21 = m21 * is1; + const sm22 = m22 * is2; + const sm23 = m23 * is3; + const sm31 = m31 * is1; + const sm32 = m32 * is2; + const sm33 = m33 * is3; + const trace = sm11 + sm22 + sm33; + let S = 0; + if (trace > 0) { + S = Math.sqrt(trace + 1) * 2; + out_r[3] = 0.25 * S; + out_r[0] = (sm23 - sm32) / S; + out_r[1] = (sm31 - sm13) / S; + out_r[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2; + out_r[3] = (sm23 - sm32) / S; + out_r[0] = 0.25 * S; + out_r[1] = (sm12 + sm21) / S; + out_r[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2; + out_r[3] = (sm31 - sm13) / S; + out_r[0] = (sm12 + sm21) / S; + out_r[1] = 0.25 * S; + out_r[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2; + out_r[3] = (sm12 - sm21) / S; + out_r[0] = (sm31 + sm13) / S; + out_r[1] = (sm23 + sm32) / S; + out_r[2] = 0.25 * S; + } + return out_r; + } + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @returns `out` + */ + static fromRotationTranslationScale(out, q, v, s) { + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + const sx = s[0]; + const sy = s[1]; + const sz = s[2]; + out[0] = (1 - (yy + zz)) * sx; + out[1] = (xy + wz) * sx; + out[2] = (xz - wy) * sx; + out[3] = 0; + out[4] = (xy - wz) * sy; + out[5] = (1 - (xx + zz)) * sy; + out[6] = (yz + wx) * sy; + out[7] = 0; + out[8] = (xz + wy) * sz; + out[9] = (yz - wx) * sz; + out[10] = (1 - (xx + yy)) * sz; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the + * given origin. This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * mat4.translate(dest, origin); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * mat4.translate(dest, negativeOrigin); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @param o - The origin vector around which to scale and rotate + * @returns `out` + */ + static fromRotationTranslationScaleOrigin(out, q, v, s, o) { + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + const sx = s[0]; + const sy = s[1]; + const sz = s[2]; + const ox = o[0]; + const oy = o[1]; + const oz = o[2]; + const out0 = (1 - (yy + zz)) * sx; + const out1 = (xy + wz) * sx; + const out2 = (xz - wy) * sx; + const out4 = (xy - wz) * sy; + const out5 = (1 - (xx + zz)) * sy; + const out6 = (yz + wx) * sy; + const out8 = (xz + wy) * sz; + const out9 = (yz - wx) * sz; + const out10 = (1 - (xx + yy)) * sz; + out[0] = out0; + out[1] = out1; + out[2] = out2; + out[3] = 0; + out[4] = out4; + out[5] = out5; + out[6] = out6; + out[7] = 0; + out[8] = out8; + out[9] = out9; + out[10] = out10; + out[11] = 0; + out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz); + out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz); + out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); + out[15] = 1; + return out; + } + /** + * Calculates a 4x4 matrix from the given quaternion + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Quaternion to create matrix from + * @returns `out` + */ + static fromQuat(out, q) { + 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; + out[0] = 1 - yy - zz; + out[1] = yx + wz; + out[2] = zx - wy; + out[3] = 0; + out[4] = yx - wz; + out[5] = 1 - xx - zz; + out[6] = zy + wx; + out[7] = 0; + out[8] = zx + wy; + out[9] = zy - wx; + out[10] = 1 - xx - yy; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumNO(out, left, right, bottom, top, near, far = Infinity) { + const rl = 1 / (right - left); + const tb = 1 / (top - bottom); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + /** + * Alias for {@link Mat4.frustumNO} + * @category Static + * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly + */ + static frustum(out, left, right, bottom, top, near, far = Infinity) { + return out; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumZO(out, left, right, bottom, top, near, far = Infinity) { + const rl = 1 / (right - left); + const tb = 1 / (top - bottom); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = far * nf; + out[14] = far * near * nf; + } else { + out[10] = -1; + out[14] = -near; + } + return out; + } + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveNO(out, fovy, aspect, near, far = Infinity) { + const f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + /** + * Alias for {@link Mat4.perspectiveNO} + * @category Static + * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static perspective(out, fovy, aspect, near, far = Infinity) { + return out; + } + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveZO(out, fovy, aspect, near, far = Infinity) { + const f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = far * nf; + out[14] = far * near * nf; + } else { + out[10] = -1; + out[14] = -near; + } + return out; + } + /** + * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating + * projection matrices to be used with the still experimental WebVR API. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + * @deprecated + */ + static perspectiveFromFieldOfView(out, fov, near, far) { + const upTan = Math.tan(fov.upDegrees * Math.PI / 180); + const downTan = Math.tan(fov.downDegrees * Math.PI / 180); + const leftTan = Math.tan(fov.leftDegrees * Math.PI / 180); + const rightTan = Math.tan(fov.rightDegrees * Math.PI / 180); + const xScale = 2 / (leftTan + rightTan); + const yScale = 2 / (upTan + downTan); + out[0] = xScale; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = yScale; + out[6] = 0; + out[7] = 0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = (upTan - downTan) * yScale * 0.5; + out[10] = far / (near - far); + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = far * near / (near - far); + out[15] = 0; + return out; + } + /** + * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoNO(out, left, right, bottom, top, near, far) { + const lr = 1 / (left - right); + const bt = 1 / (bottom - top); + const nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; + } + /** + * Alias for {@link Mat4.orthoNO} + * @category Static + * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static ortho(out, left, right, bottom, top, near, far) { + return out; + } + /** + * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoZO(out, left, right, bottom, top, near, far) { + const lr = 1 / (left - right); + const bt = 1 / (bottom - top); + const nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = near * nf; + out[15] = 1; + return out; + } + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that + * actually makes an object look at another object, you should use targetTo instead. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param center - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static lookAt(out, eye, center, up) { + const eyex = eye[0]; + const eyey = eye[1]; + const eyez = eye[2]; + const upx = up[0]; + const upy = up[1]; + const upz = up[2]; + const centerx = center[0]; + const centery = center[1]; + const centerz = center[2]; + if (Math.abs(eyex - centerx) < GLM_EPSILON && Math.abs(eyey - centery) < GLM_EPSILON && Math.abs(eyez - centerz) < GLM_EPSILON) { + return _Mat4.identity(out); + } + let z0 = eyex - centerx; + let z1 = eyey - centery; + let z2 = eyez - centerz; + let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + z0 *= len; + z1 *= len; + z2 *= len; + let x0 = upy * z2 - upz * z1; + let x1 = upz * z0 - upx * z2; + let x2 = upx * z1 - upy * z0; + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + if (!len) { + x0 = 0; + x1 = 0; + x2 = 0; + } else { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + let y0 = z1 * x2 - z2 * x1; + let y1 = z2 * x0 - z0 * x2; + let y2 = z0 * x1 - z1 * x0; + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + if (!len) { + y0 = 0; + y1 = 0; + y2 = 0; + } else { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + out[0] = x0; + out[1] = y0; + out[2] = z0; + out[3] = 0; + out[4] = x1; + out[5] = y1; + out[6] = z1; + out[7] = 0; + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); + out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); + out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + return out; + } + /** + * Generates a matrix that makes something look at something else. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param target - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static targetTo(out, eye, target, up) { + const eyex = eye[0]; + const eyey = eye[1]; + const eyez = eye[2]; + const upx = up[0]; + const upy = up[1]; + const upz = up[2]; + let z0 = eyex - target[0]; + let z1 = eyey - target[1]; + let z2 = eyez - target[2]; + let len = z0 * z0 + z1 * z1 + z2 * z2; + if (len > 0) { + len = 1 / Math.sqrt(len); + z0 *= len; + z1 *= len; + z2 *= len; + } + let x0 = upy * z2 - upz * z1; + let x1 = upz * z0 - upx * z2; + let x2 = upx * z1 - upy * z0; + len = x0 * x0 + x1 * x1 + x2 * x2; + if (len > 0) { + len = 1 / Math.sqrt(len); + x0 *= len; + x1 *= len; + x2 *= len; + } + out[0] = x0; + out[1] = x1; + out[2] = x2; + out[3] = 0; + out[4] = z1 * x2 - z2 * x1; + out[5] = z2 * x0 - z0 * x2; + out[6] = z0 * x1 - z1 * x0; + out[7] = 0; + out[8] = z0; + out[9] = z1; + out[10] = z2; + out[11] = 0; + out[12] = eyex; + out[13] = eyey; + out[14] = eyez; + out[15] = 1; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat4} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt( + a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + a[9] * a[9] + a[10] * a[10] + a[11] * a[11] + a[12] * a[12] + a[13] * a[13] + a[14] * a[14] + a[15] * a[15] + ); + } + /** + * Adds two {@link Mat4}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + out[8] = a[8] + b[8]; + out[9] = a[9] + b[9]; + out[10] = a[10] + b[10]; + out[11] = a[11] + b[11]; + out[12] = a[12] + b[12]; + out[13] = a[13] + b[13]; + out[14] = a[14] + b[14]; + out[15] = a[15] + b[15]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + out[6] = a[6] - b[6]; + out[7] = a[7] - b[7]; + out[8] = a[8] - b[8]; + out[9] = a[9] - b[9]; + out[10] = a[10] - b[10]; + out[11] = a[11] - b[11]; + out[12] = a[12] - b[12]; + out[13] = a[13] - b[13]; + out[14] = a[14] - b[14]; + out[15] = a[15] - b[15]; + return out; + } + /** + * Alias for {@link Mat4.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiply each element of the matrix by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + out[8] = a[8] * b; + out[9] = a[9] * b; + out[10] = a[10] * b; + out[11] = a[11] * b; + out[12] = a[12] * b; + out[13] = a[13] * b; + out[14] = a[14] * b; + out[15] = a[15] * b; + return out; + } + /** + * Adds two mat4's after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + out[6] = a[6] + b[6] * scale; + out[7] = a[7] + b[7] * scale; + out[8] = a[8] + b[8] * scale; + out[9] = a[9] + b[9] * scale; + out[10] = a[10] + b[10] * scale; + out[11] = a[11] + b[11] * scale; + out[12] = a[12] + b[12] * scale; + out[13] = a[13] + b[13] * scale; + out[14] = a[14] + b[14] * scale; + out[15] = a[15] + b[15] * scale; + return out; + } + /** + * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15]; + } + /** + * Returns whether two {@link Mat4}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const a8 = a[8]; + const a9 = a[9]; + const a10 = a[10]; + const a11 = a[11]; + const a12 = a[12]; + const a13 = a[13]; + const a14 = a[14]; + const a15 = a[15]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + const b8 = b[8]; + const b9 = b[9]; + const b10 = b[10]; + const b11 = b[11]; + const b12 = b[12]; + const b13 = b[13]; + const b14 = b[14]; + const b15 = b[15]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15)); + } + /** + * Returns a string representation of a {@link Mat4} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat4(${a.join(", ")})`; + } +}; +Mat4.prototype.mul = Mat4.prototype.multiply; +Mat4.sub = Mat4.subtract; +Mat4.mul = Mat4.multiply; +Mat4.frustum = Mat4.frustumNO; +Mat4.perspective = Mat4.perspectiveNO; +Mat4.ortho = Mat4.orthoNO; + +// src/_lib/f64/Vec3.ts +var Vec3 = class _Vec3 extends Float64Array { + /** + * Create a {@link Vec3}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 3: + super(values); + break; + case 2: + super(values[0], values[1], 3); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v]); + } else { + super(v, 0, 3); + } + break; + } + default: + super(3); + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z() { + return this[2]; + } + set z(value) { + this[2] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r() { + return this[0]; + } + set r(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g() { + return this[1]; + } + set g(value) { + this[1] = value; + } + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b() { + return this[2]; + } + set b(value) { + this[2] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec3.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec3.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag() { + return this.squaredMagnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec3.str(this);` + * + * @category Accessors + */ + get str() { + return _Vec3.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Adds a {@link Vec3} to `this`. + * Equivalent to `Vec3.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b) { + this[0] += b[0]; + this[1] += b[1]; + this[2] += b[2]; + return this; + } + /** + * Subtracts a {@link Vec3} from `this`. + * Equivalent to `Vec3.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + this[2] -= b[2]; + return this; + } + /** + * Alias for {@link Vec3.subtract} + * @category Methods + */ + sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec3}. + * Equivalent to `Vec3.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + this[2] *= b[2]; + return this; + } + /** + * Alias for {@link Vec3.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec3}. + * Equivalent to `Vec3.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + this[2] /= b[2]; + return this; + } + /** + * Alias for {@link Vec3.divide} + * @category Methods + */ + div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec3.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b) { + this[0] *= b; + this[1] *= b; + this[2] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + this[2] += b[2] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b) { + return _Vec3.distance(this, b); + } + /** + * Alias for {@link Vec3.distance} + * @category Methods + */ + dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b) { + return _Vec3.squaredDistance(this, b); + } + /** + * Alias for {@link Vec3.squaredDistance} + * @category Methods + */ + sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec3.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate() { + this[0] *= -1; + this[1] *= -1; + this[2] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec3.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + this[2] = 1 / this[2]; + return this; + } + /** + * Sets each component of `this` to its absolute value. + * Equivalent to `Vec3.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + this[2] = Math.abs(this[2]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec3}. + * Equivalent to `Vec3.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b) { + return this[0] * b[0] + this[1] * b[1] + this[2] * b[2]; + } + /** + * Normalize `this`. + * Equivalent to `Vec3.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize() { + return _Vec3.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec3}. + */ + static get BYTE_LENGTH() { + return 3 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty vec3 + * @category Static + * + * @returns a new 3D vector + */ + static create() { + return new _Vec3(); + } + /** + * Creates a new vec3 initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 3D vector + */ + static clone(a) { + return new _Vec3(a); + } + /** + * Calculates the magnitude (length) of a {@link Vec3} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Creates a new vec3 initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns a new 3D vector + */ + static fromValues(x, y, z) { + return new _Vec3(x, y, z); + } + /** + * Copy the values from one vec3 to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + return out; + } + /** + * Set the components of a vec3 to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns `out` + */ + static set(out, x, y, z) { + out[0] = x; + out[1] = y; + out[2] = z; + return out; + } + /** + * Adds two {@link Vec3}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + return out; + } + /** + * Alias for {@link Vec3.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return [0, 0, 0]; + } + /** + * Multiplies two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + return out; + } + /** + * Alias for {@link Vec3.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return [0, 0, 0]; + } + /** + * Divides two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + out[2] = a[2] / b[2]; + return out; + } + /** + * Alias for {@link Vec3.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out, a, b) { + return [0, 0, 0]; + } + /** + * Math.ceil the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + out[2] = Math.ceil(a[2]); + return out; + } + /** + * Math.floor the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + out[2] = Math.floor(a[2]); + return out; + } + /** + * Returns the minimum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + return out; + } + /** + * Returns the maximum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + return out; + } + /** + * symmetric round the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + /* + static round(out: Vec3Like, a: Readonly): Vec3Like { + out[0] = glMatrix.round(a[0]); + out[1] = glMatrix.round(a[1]); + out[2] = glMatrix.round(a[2]); + return out; + }*/ + /** + * Scales a vec3 by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out, a, scale) { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + return out; + } + /** + * Adds two vec3's after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredDistance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a, b) { + return 0; + } + /** + * Calculates the squared length of a vec3 + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredLength} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrLen(a, b) { + return 0; + } + /** + * Negates the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + return out; + } + /** + * Returns the inverse of the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + out[2] = 1 / a[2]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec3} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + out[2] = Math.abs(a[2]); + return out; + } + /** + * Normalize a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out, a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + let len = x * x + y * y + z * z; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + out[2] = a[2] * len; + return out; + } + /** + * Calculates the dot product of two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; + } + /** + * Computes the cross product of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static cross(out, a, b) { + const ax = a[0], ay = a[1], az = a[2]; + const bx = b[0], by = b[1], bz = b[2]; + out[0] = ay * bz - az * by; + out[1] = az * bx - ax * bz; + out[2] = ax * by - ay * bx; + return out; + } + /** + * Performs a linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + return out; + } + /** + * Performs a spherical linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out, a, b, t) { + const angle = Math.acos(Math.min(Math.max(_Vec3.dot(a, b), -1), 1)); + const sinTotal = Math.sin(angle); + const ratioA = Math.sin((1 - t) * angle) / sinTotal; + const ratioB = Math.sin(t * angle) / sinTotal; + out[0] = ratioA * a[0] + ratioB * b[0]; + out[1] = ratioA * a[1] + ratioB * b[1]; + out[2] = ratioA * a[2] + ratioB * b[2]; + return out; + } + /** + * Performs a hermite interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static hermite(out, a, b, c, d, t) { + const factorTimes2 = t * t; + const factor1 = factorTimes2 * (2 * t - 3) + 1; + const factor2 = factorTimes2 * (t - 2) + t; + const factor3 = factorTimes2 * (t - 1); + const factor4 = factorTimes2 * (3 - 2 * t); + out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; + out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; + out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; + return out; + } + /** + * Performs a bezier interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static bezier(out, a, b, c, d, t) { + const inverseFactor = 1 - t; + const inverseFactorTimesTwo = inverseFactor * inverseFactor; + const factorTimes2 = t * t; + const factor1 = inverseFactorTimesTwo * inverseFactor; + const factor2 = 3 * t * inverseFactorTimesTwo; + const factor3 = 3 * factorTimes2 * inverseFactor; + const factor4 = factorTimes2 * t; + out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; + out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; + out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; + return out; + } + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned + * @returns `out` + */ + /* + static random(out: Vec3Like, scale) { + scale = scale === undefined ? 1.0 : scale; + + let r = glMatrix.RANDOM() * 2.0 * Math.PI; + let z = glMatrix.RANDOM() * 2.0 - 1.0; + let zScale = Math.sqrt(1.0 - z * z) * scale; + + out[0] = Math.cos(r) * zScale; + out[1] = Math.sin(r) * zScale; + out[2] = z * scale; + return out; + }*/ + /** + * Transforms the vec3 with a mat4. + * 4th vector component is implicitly '1' + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out, a, m) { + const x = a[0], y = a[1], z = a[2]; + const w = m[3] * x + m[7] * y + m[11] * z + m[15] || 1; + out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; + out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; + out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; + return out; + } + /** + * Transforms the vec3 with a mat3. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - the 3x3 matrix to transform with + * @returns `out` + */ + static transformMat3(out, a, m) { + const x = a[0], y = a[1], z = a[2]; + out[0] = x * m[0] + y * m[3] + z * m[6]; + out[1] = x * m[1] + y * m[4] + z * m[7]; + out[2] = x * m[2] + y * m[5] + z * m[8]; + return out; + } + /** + * Transforms the vec3 with a quat + * Can also be used for dual quaternions. (Multiply it with the real part) + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out, a, q) { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const w2 = q[3] * 2; + const x = a[0]; + const y = a[1]; + const z = a[2]; + const uvx = qy * z - qz * y; + const uvy = qz * x - qx * z; + const uvz = qx * y - qy * x; + const uuvx = (qy * uvz - qz * uvy) * 2; + const uuvy = (qz * uvx - qx * uvz) * 2; + const uuvz = (qx * uvy - qy * uvx) * 2; + out[0] = x + uvx * w2 + uuvx; + out[1] = y + uvy * w2 + uuvy; + out[2] = z + uvz * w2 + uuvz; + return out; + } + /** + * Rotate a 3D vector around the x-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateX(out, a, b, rad) { + const by = b[1]; + const bz = b[2]; + const py = a[1] - by; + const pz = a[2] - bz; + out[0] = a[0]; + out[1] = py * Math.cos(rad) - pz * Math.sin(rad) + by; + out[2] = py * Math.sin(rad) + pz * Math.cos(rad) + bz; + return out; + } + /** + * Rotate a 3D vector around the y-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateY(out, a, b, rad) { + const bx = b[0]; + const bz = b[2]; + const px = a[0] - bx; + const pz = a[2] - bz; + out[0] = pz * Math.sin(rad) + px * Math.cos(rad) + bx; + out[1] = a[1]; + out[2] = pz * Math.cos(rad) - px * Math.sin(rad) + bz; + return out; + } + /** + * Rotate a 3D vector around the z-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateZ(out, a, b, rad) { + const bx = b[0]; + const by = b[1]; + const px = a[0] - bx; + const py = a[1] - by; + out[0] = px * Math.cos(rad) - py * Math.sin(rad) + bx; + out[1] = px * Math.sin(rad) + py * Math.cos(rad) + by; + out[2] = b[2]; + return out; + } + /** + * Get the angle between two 3D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static 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 mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz)); + const cosine = mag && _Vec3.dot(a, b) / mag; + return Math.acos(Math.min(Math.max(cosine, -1), 1)); + } + /** + * Set the components of a vec3 to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + return out; + } + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Vec3(${a.join(", ")})`; + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)); + } +}; +Vec3.prototype.sub = Vec3.prototype.subtract; +Vec3.prototype.mul = Vec3.prototype.multiply; +Vec3.prototype.div = Vec3.prototype.divide; +Vec3.prototype.dist = Vec3.prototype.distance; +Vec3.prototype.sqrDist = Vec3.prototype.squaredDistance; +Vec3.sub = Vec3.subtract; +Vec3.mul = Vec3.multiply; +Vec3.div = Vec3.divide; +Vec3.dist = Vec3.distance; +Vec3.sqrDist = Vec3.squaredDistance; +Vec3.sqrLen = Vec3.squaredLength; +Vec3.mag = Vec3.magnitude; +Vec3.length = Vec3.magnitude; +Vec3.len = Vec3.magnitude; + +// src/_lib/f64/Vec4.ts +var Vec4 = class _Vec4 extends Float64Array { + /** + * Create a {@link Vec4}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 4: + super(values); + break; + case 2: + super(values[0], values[1], 4); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v, v]); + } else { + super(v, 0, 4); + } + break; + } + default: + super(4); + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z() { + return this[2]; + } + set z(value) { + this[2] = value; + } + /** + * The w component of the vector. Equivalent to `this[3];` + * @category Vector Components + */ + get w() { + return this[3]; + } + set w(value) { + this[3] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r() { + return this[0]; + } + set r(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g() { + return this[1]; + } + set g(value) { + this[1] = value; + } + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b() { + return this[2]; + } + set b(value) { + this[2] = value; + } + /** + * The a component of the vector. Equivalent to `this[3];` + * @category Color Components + */ + get a() { + return this[3]; + } + set a(value) { + this[3] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec4.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + const w = this[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Vec4.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec4.str(this);` + * + * @category Accessors + */ + get str() { + return _Vec4.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + super.set(a); + return this; + } + /** + * Adds a {@link Vec4} to `this`. + * Equivalent to `Vec4.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b) { + this[0] += b[0]; + this[1] += b[1]; + this[2] += b[2]; + this[3] += b[3]; + return this; + } + /** + * Subtracts a {@link Vec4} from `this`. + * Equivalent to `Vec4.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + this[2] -= b[2]; + this[3] -= b[3]; + return this; + } + /** + * Alias for {@link Vec4.subtract} + * @category Methods + */ + sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec4}. + * Equivalent to `Vec4.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + this[2] *= b[2]; + this[3] *= b[3]; + return this; + } + /** + * Alias for {@link Vec4.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec4}. + * Equivalent to `Vec4.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + this[2] /= b[2]; + this[3] /= b[3]; + return this; + } + /** + * Alias for {@link Vec4.divide} + * @category Methods + */ + div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec4.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b) { + this[0] *= b; + this[1] *= b; + this[2] *= b; + this[3] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + this[2] += b[2] * scale; + this[3] += b[3] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b) { + return _Vec4.distance(this, b); + } + /** + * Alias for {@link Vec4.distance} + * @category Methods + */ + dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b) { + return _Vec4.squaredDistance(this, b); + } + /** + * Alias for {@link Vec4.squaredDistance} + * @category Methods + */ + sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec4.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate() { + this[0] *= -1; + this[1] *= -1; + this[2] *= -1; + this[3] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec4.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + this[2] = 1 / this[2]; + this[3] = 1 / this[3]; + return this; + } + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec4.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + this[2] = Math.abs(this[2]); + this[3] = Math.abs(this[3]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec4}. + * Equivalent to `Vec4.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b) { + return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3]; + } + /** + * Normalize `this`. + * Equivalent to `Vec4.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize() { + return _Vec4.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec4}. + */ + static get BYTE_LENGTH() { + return 4 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty {@link Vec4} + * @category Static + * + * @returns a new 4D vector + */ + static create() { + return new _Vec4(); + } + /** + * Creates a new {@link Vec4} initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 4D vector + */ + static clone(a) { + return new _Vec4(a); + } + /** + * Creates a new {@link Vec4} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new 4D vector + */ + static fromValues(x, y, z, w) { + return new _Vec4(x, y, z, w); + } + /** + * Copy the values from one {@link Vec4} to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Vec4} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + static set(out, x, y, z, w) { + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = w; + return out; + } + /** + * Adds two {@link Vec4}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + return out; + } + /** + * Alias for {@link Vec4.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + out[3] = a[3] * b[3]; + return out; + } + /** + * Alias for {@link Vec4.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Divides two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + out[2] = a[2] / b[2]; + out[3] = a[3] / b[3]; + return out; + } + /** + * Alias for {@link Vec4.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out, a, b) { + return out; + } + /** + * Math.ceil the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + out[2] = Math.ceil(a[2]); + out[3] = Math.ceil(a[3]); + return out; + } + /** + * Math.floor the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + out[2] = Math.floor(a[2]); + out[3] = Math.floor(a[3]); + return out; + } + /** + * Returns the minimum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + out[3] = Math.min(a[3], b[3]); + return out; + } + /** + * Returns the maximum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + out[3] = Math.max(a[3], b[3]); + return out; + } + /** + * Math.round the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + static round(out, a) { + out[0] = Math.round(a[0]); + out[1] = Math.round(a[1]); + out[2] = Math.round(a[2]); + out[3] = Math.round(a[3]); + return out; + } + /** + * Scales a {@link Vec4} by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out, a, scale) { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + out[3] = a[3] * scale; + return out; + } + /** + * Adds two {@link Vec4}'s after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + const w = b[3] - a[3]; + return Math.hypot(x, y, z, w); + } + /** + * Alias for {@link Vec4.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + const w = b[3] - a[3]; + return x * x + y * y + z * z + w * w; + } + /** + * Alias for {@link Vec4.squaredDistance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a, b) { + return 0; + } + /** + * Calculates the magnitude (length) of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate length of + * @returns length of `a` + */ + static magnitude(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Vec4.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + return x * x + y * y + z * z + w * w; + } + /** + * Alias for {@link Vec4.squaredLength} + * @category Static + */ + static sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = -a[3]; + return out; + } + /** + * Returns the inverse of the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + out[2] = 1 / a[2]; + out[3] = 1 / a[3]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec4} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + out[2] = Math.abs(a[2]); + out[3] = Math.abs(a[3]); + return out; + } + /** + * Normalize a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out, a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + let len = x * x + y * y + z * z + w * w; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = x * len; + out[1] = y * len; + out[2] = z * len; + out[3] = w * len; + return out; + } + /** + * Calculates the dot product of two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + /** + * Returns the cross-product of three vectors in a 4-dimensional space + * @category Static + * + * @param out the receiving vector + * @param u - the first vector + * @param v - the second vector + * @param w - the third vector + * @returns result + */ + static cross(out, u, v, w) { + const a = v[0] * w[1] - v[1] * w[0]; + const b = v[0] * w[2] - v[2] * w[0]; + const c = v[0] * w[3] - v[3] * w[0]; + const d = v[1] * w[2] - v[2] * w[1]; + const e = v[1] * w[3] - v[3] * w[1]; + const f = v[2] * w[3] - v[3] * w[2]; + const g = u[0]; + const h = u[1]; + const i = u[2]; + const j = u[3]; + out[0] = h * f - i * e + j * d; + out[1] = -(g * f) + i * c - j * b; + out[2] = g * e - h * c + j * a; + out[3] = -(g * d) + h * b - i * a; + return out; + } + /** + * Performs a linear interpolation between two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + out[3] = aw + t * (b[3] - aw); + return out; + } + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns `out` + */ + /* + static random(out: Vec4Like, scale): Vec4Like { + scale = scale || 1.0; + + // Marsaglia, George. Choosing a Point from the Surface of a + // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646. + // http://projecteuclid.org/euclid.aoms/1177692644; + var v1, v2, v3, v4; + var s1, s2; + do { + v1 = glMatrix.RANDOM() * 2 - 1; + v2 = glMatrix.RANDOM() * 2 - 1; + s1 = v1 * v1 + v2 * v2; + } while (s1 >= 1); + do { + v3 = glMatrix.RANDOM() * 2 - 1; + v4 = glMatrix.RANDOM() * 2 - 1; + s2 = v3 * v3 + v4 * v4; + } while (s2 >= 1); + + var d = Math.sqrt((1 - s1) / s2); + out[0] = scale * v1; + out[1] = scale * v2; + out[2] = scale * v3 * d; + out[3] = scale * v4 * d; + return out; + }*/ + /** + * Transforms the {@link Vec4} with a {@link Mat4}. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out, a, m) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; + out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; + out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; + out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; + return out; + } + /** + * Transforms the {@link Vec4} with a {@link Quat} + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out, a, q) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + const ix = qw * x + qy * z - qz * y; + const iy = qw * y + qz * x - qx * z; + const iz = qw * z + qx * y - qy * x; + const iw = -qx * x - qy * y - qz * z; + out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy; + out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz; + out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Vec4} to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 0; + return out; + } + /** + * Returns a string representation of a {@link Vec4} + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Vec4(${a.join(", ")})`; + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)); + } +}; +Vec4.prototype.sub = Vec4.prototype.subtract; +Vec4.prototype.mul = Vec4.prototype.multiply; +Vec4.prototype.div = Vec4.prototype.divide; +Vec4.prototype.dist = Vec4.prototype.distance; +Vec4.prototype.sqrDist = Vec4.prototype.squaredDistance; +Vec4.sub = Vec4.subtract; +Vec4.mul = Vec4.multiply; +Vec4.div = Vec4.divide; +Vec4.dist = Vec4.distance; +Vec4.sqrDist = Vec4.squaredDistance; +Vec4.sqrLen = Vec4.squaredLength; +Vec4.mag = Vec4.magnitude; +Vec4.length = Vec4.magnitude; +Vec4.len = Vec4.magnitude; + +// src/_lib/f64/Quat.ts +var Quat = class _Quat extends Float64Array { + static #DEFAULT_ANGLE_ORDER = "zyx"; + // Temporary variables to prevent repeated allocations in the algorithms within Quat. + // These are declared as TypedArrays to aid in tree-shaking. + static #TMP_QUAT1 = new Float64Array(4); + static #TMP_QUAT2 = new Float64Array(4); + static #TMP_MAT3 = new Float64Array(9); + static #TMP_VEC3 = new Float64Array(3); + static #X_UNIT_VEC3 = new Float64Array([1, 0, 0]); + static #Y_UNIT_VEC3 = new Float64Array([0, 1, 0]); + /** + * Create a {@link Quat}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 4: + super(values); + break; + case 2: + super(values[0], values[1], 4); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v, v]); + } else { + super(v, 0, 4); + } + break; + } + default: + super(4); + this[3] = 1; + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the quaternion. Equivalent to `this[0];` + * @category Quaternion Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the quaternion. Equivalent to `this[1];` + * @category Quaternion Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + /** + * The z component of the quaternion. Equivalent to `this[2];` + * @category Quaternion Components + */ + get z() { + return this[2]; + } + set z(value) { + this[2] = value; + } + /** + * The w component of the quaternion. Equivalent to `this[3];` + * @category Quaternion Components + */ + get w() { + return this[3]; + } + set w(value) { + this[3] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Quat.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + const w = this[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Quat.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * A string representation of `this` + * Equivalent to `Quat.str(this);` + * + * @category Accessors + */ + get str() { + return _Quat.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Quat} into `this`. + * @category Methods + * + * @param a the source quaternion + * @returns `this` + */ + copy(a) { + super.set(a); + return this; + } + /** + * Set `this` to the identity quaternion + * Equivalent to Quat.identity(this) + * @category Methods + * + * @returns `this` + */ + identity() { + this[0] = 0; + this[1] = 0; + this[2] = 0; + this[3] = 1; + return this; + } + /** + * Multiplies `this` by a {@link Quat}. + * Equivalent to `Quat.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + return _Quat.multiply(this, this, b); + } + /** + * Alias for {@link Quat.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Rotates `this` by the given angle about the X axis + * Equivalent to `Quat.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateX(rad) { + return _Quat.rotateX(this, this, rad); + } + /** + * Rotates `this` by the given angle about the Y axis + * Equivalent to `Quat.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateY(rad) { + return _Quat.rotateY(this, this, rad); + } + /** + * Rotates `this` by the given angle about the Z axis + * Equivalent to `Quat.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateZ(rad) { + return _Quat.rotateZ(this, this, rad); + } + /** + * Inverts `this` + * Equivalent to `Quat.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + return _Quat.invert(this, this); + } + /** + * Scales `this` by a scalar number + * Equivalent to `Quat.scale(this, this, scale);` + * @category Methods + * + * @param scale - amount to scale the vector by + * @returns `this` + */ + scale(scale) { + this[0] *= scale; + this[1] *= scale; + this[2] *= scale; + this[3] *= scale; + return this; + } + /** + * Calculates the dot product of `this` and another {@link Quat} + * Equivalent to `Quat.dot(this, b);` + * @category Methods + * + * @param b - the second operand + * @returns dot product of `this` and b + */ + dot(b) { + return _Quat.dot(this, b); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat}. + */ + static get BYTE_LENGTH() { + return 4 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new identity quat + * @category Static + * + * @returns a new quaternion + */ + static create() { + return new _Quat(); + } + /** + * Set a quat to the identity quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + static identity(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * @category Static + * + * @param out - the receiving quaternion + * @param axis - the axis around which to rotate + * @param rad - the angle in radians + * @returns `out` + **/ + static setAxisAngle(out, axis, rad) { + rad *= 0.5; + const s = Math.sin(rad); + out[0] = s * axis[0]; + out[1] = s * axis[1]; + out[2] = s * axis[2]; + out[3] = Math.cos(rad); + return out; + } + /** + * Gets the rotation axis and angle for a given + * quaternion. If a quaternion is created with + * setAxisAngle, this method will return the same + * values as provided in the original parameter list + * OR functionally equivalent values. + * Example: The quaternion formed by axis [0, 0, 1] and + * angle -90 is the same as the quaternion formed by + * [0, 0, 1] and 270. This method favors the latter. + * @category Static + * + * @param out_axis - Vector receiving the axis of rotation + * @param q - Quaternion to be decomposed + * @return Angle, in radians, of the rotation + */ + static getAxisAngle(out_axis, q) { + const rad = Math.acos(q[3]) * 2; + const s = Math.sin(rad / 2); + if (s > GLM_EPSILON) { + out_axis[0] = q[0] / s; + out_axis[1] = q[1] / s; + out_axis[2] = q[2] / s; + } else { + out_axis[0] = 1; + out_axis[1] = 0; + out_axis[2] = 0; + } + return rad; + } + /** + * Gets the angular distance between two unit quaternions + * @category Static + * + * @param {ReadonlyQuat} a Origin unit quaternion + * @param {ReadonlyQuat} b Destination unit quaternion + * @return {Number} Angle, in radians, between the two quaternions + */ + static getAngle(a, b) { + const dotproduct = _Quat.dot(a, b); + return Math.acos(2 * dotproduct * dotproduct - 1); + } + /** + * Multiplies two quaternions. + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out, a, b) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bx = b[0]; + const by = b[1]; + const bz = b[2]; + const bw = b[3]; + out[0] = ax * bw + aw * bx + ay * bz - az * by; + out[1] = ay * bw + aw * by + az * bx - ax * bz; + out[2] = az * bw + aw * bz + ax * by - ay * bx; + out[3] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + /** + * Rotates a quaternion by the given angle about the X axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out, a, rad) { + rad *= 0.5; + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bx = Math.sin(rad); + const bw = Math.cos(rad); + out[0] = ax * bw + aw * bx; + out[1] = ay * bw + az * bx; + out[2] = az * bw - ay * bx; + out[3] = aw * bw - ax * bx; + return out; + } + /** + * Rotates a quaternion by the given angle about the Y axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out, a, rad) { + rad *= 0.5; + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const by = Math.sin(rad); + const bw = Math.cos(rad); + out[0] = ax * bw - az * by; + out[1] = ay * bw + aw * by; + out[2] = az * bw + ax * by; + out[3] = aw * bw - ay * by; + return out; + } + /** + * Rotates a quaternion by the given angle about the Z axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out, a, rad) { + rad *= 0.5; + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bz = Math.sin(rad); + const bw = Math.cos(rad); + out[0] = ax * bw + ay * bz; + out[1] = ay * bw - ax * bz; + out[2] = az * bw + aw * bz; + out[3] = aw * bw - az * bz; + return out; + } + /** + * Calculates the W component of a quat from the X, Y, and Z components. + * Assumes that quaternion is 1 unit in length. + * Any existing W component will be ignored. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate W component of + * @returns `out` + */ + static calculateW(out, a) { + const x = a[0], y = a[1], z = a[2]; + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = Math.sqrt(Math.abs(1 - x * x - y * y - z * z)); + return out; + } + /** + * Calculate the exponential of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static exp(out, a) { + const x = a[0], y = a[1], z = a[2], w = a[3]; + const r = Math.sqrt(x * x + y * y + z * z); + const et = Math.exp(w); + const s = r > 0 ? et * Math.sin(r) / r : 0; + out[0] = x * s; + out[1] = y * s; + out[2] = z * s; + out[3] = et * Math.cos(r); + return out; + } + /** + * Calculate the natural logarithm of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static ln(out, a) { + const x = a[0], y = a[1], z = a[2], w = a[3]; + const r = Math.sqrt(x * x + y * y + z * z); + const t = r > 0 ? Math.atan2(r, w) / r : 0; + out[0] = x * t; + out[1] = y * t; + out[2] = z * t; + out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w); + return out; + } + /** + * Calculate the scalar power of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @param b - amount to scale the quaternion by + * @returns `out` + */ + static pow(out, a, b) { + _Quat.ln(out, a); + _Quat.scale(out, out, b); + _Quat.exp(out, out); + return out; + } + /** + * Performs a spherical linear interpolation between two quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out, a, b, t) { + const ax = a[0], ay = a[1], az = a[2], aw = a[3]; + let bx = b[0], by = b[1], bz = b[2], bw = b[3]; + let scale0; + let scale1; + let cosom = ax * bx + ay * by + az * bz + aw * bw; + if (cosom < 0) { + cosom = -cosom; + bx = -bx; + by = -by; + bz = -bz; + bw = -bw; + } + if (1 - cosom > GLM_EPSILON) { + const omega = Math.acos(cosom); + const sinom = Math.sin(omega); + scale0 = Math.sin((1 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; + } else { + scale0 = 1 - t; + scale1 = t; + } + out[0] = scale0 * ax + scale1 * bx; + out[1] = scale0 * ay + scale1 * by; + out[2] = scale0 * az + scale1 * bz; + out[3] = scale0 * aw + scale1 * bw; + return out; + } + /** + * Generates a random unit quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + /* static random(out: QuatLike): QuatLike { + // Implementation of http://planning.cs.uiuc.edu/node198.html + // TODO: Calling random 3 times is probably not the fastest solution + let u1 = glMatrix.RANDOM(); + let u2 = glMatrix.RANDOM(); + let u3 = glMatrix.RANDOM(); + + let sqrt1MinusU1 = Math.sqrt(1 - u1); + let sqrtU1 = Math.sqrt(u1); + + out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2); + out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2); + out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3); + out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3); + return out; + }*/ + /** + * Calculates the inverse of a quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate inverse of + * @returns `out` + */ + static invert(out, a) { + const a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; + const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; + const invDot = dot ? 1 / dot : 0; + out[0] = -a0 * invDot; + out[1] = -a1 * invDot; + out[2] = -a2 * invDot; + out[3] = a3 * invDot; + return out; + } + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate conjugate of + * @returns `out` + */ + static conjugate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + return out; + } + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to re-normalize the quaternion yourself where necessary. + * @category Static + * + * @param out - the receiving quaternion + * @param m - rotation matrix + * @returns `out` + */ + static fromMat3(out, m) { + const fTrace = m[0] + m[4] + m[8]; + let fRoot; + if (fTrace > 0) { + fRoot = Math.sqrt(fTrace + 1); + out[3] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[0] = (m[5] - m[7]) * fRoot; + out[1] = (m[6] - m[2]) * fRoot; + out[2] = (m[1] - m[3]) * fRoot; + } else { + let i = 0; + if (m[4] > m[0]) { + i = 1; + } + if (m[8] > m[i * 3 + i]) { + i = 2; + } + const j = (i + 1) % 3; + const k = (i + 2) % 3; + fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1); + out[i] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot; + out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; + out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + } + return out; + } + /** + * Creates a quaternion from the given euler angle x, y, z. + * @category Static + * + * @param out - the receiving quaternion + * @param x - Angle to rotate around X axis in degrees. + * @param y - Angle to rotate around Y axis in degrees. + * @param z - Angle to rotate around Z axis in degrees. + * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx. + * @returns `out` + */ + static fromEuler(out, x, y, z, order = _Quat.#DEFAULT_ANGLE_ORDER) { + const halfToRad = 0.5 * Math.PI / 180; + x *= halfToRad; + y *= halfToRad; + z *= halfToRad; + const sx = Math.sin(x); + const cx = Math.cos(x); + const sy = Math.sin(y); + const cy = Math.cos(y); + const sz = Math.sin(z); + const cz = Math.cos(z); + switch (order) { + case "xyz": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "xzy": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + case "yxz": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + case "yzx": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "zxy": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "zyx": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + default: + throw new Error(`Unknown angle order ${order}`); + } + return out; + } + /** + * Returns a string representation of a quatenion + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Quat(${a.join(", ")})`; + } + /** + * Creates a new quat initialized with values from an existing quaternion + * @category Static + * + * @param a - quaternion to clone + * @returns a new quaternion + */ + static clone(a) { + return new _Quat(a); + } + /** + * Creates a new quat initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new quaternion + */ + static fromValues(x, y, z, w) { + return new _Quat(x, y, z, w); + } + /** + * Copy the values from one quat to another + * @category Static + * + * @param out - the receiving quaternion + * @param a - the source quaternion + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Quat} to the given values + * @category Static + * + * @param out - the receiving quaternion + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static set(out, x, y, z, w) { + return out; + } + /** + * Adds two {@link Quat}'s + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static add(out, a, b) { + return out; + } + /** + * Alias for {@link Quat.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Scales a quat by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param b - amount to scale the vector by + * @returns `out` + */ + static scale(out, a, scale) { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + out[3] = a[3] * scale; + return out; + } + /** + * Calculates the dot product of two quat's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + /** + * Performs a linear interpolation between two quat's + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static lerp(out, a, b, t) { + return out; + } + /** + * Calculates the magnitude (length) of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate length of + * @returns length of `a` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static magnitude(a) { + return 0; + } + /** + * Alias for {@link Quat.magnitude} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mag(a) { + return 0; + } + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate squared length of + * @returns squared length of a + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static squaredLength(a) { + return 0; + } + /** + * Alias for {@link Quat.squaredLength} + * @category Static + */ + static sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Normalize a {@link Quat} + * @category Static + * + * @param out - the receiving quaternion + * @param a - quaternion to normalize + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static normalize(out, a) { + return out; + } + /** + * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first quaternion. + * @param b - The second quaternion. + * @returns True if the vectors are equal, false otherwise. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static exactEquals(a, b) { + return false; + } + /** + * Returns whether the quaternions have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static equals(a, b) { + return false; + } + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * @category Static + * + * @param out - the receiving quaternion. + * @param a - the initial vector + * @param b - the destination vector + * @returns `out` + */ + static rotationTo(out, a, b) { + const dot = Vec3.dot(a, b); + if (dot < -0.999999) { + Vec3.cross(_Quat.#TMP_VEC3, _Quat.#X_UNIT_VEC3, a); + if (Vec3.mag(_Quat.#TMP_VEC3) < 1e-6) { + Vec3.cross(_Quat.#TMP_VEC3, _Quat.#Y_UNIT_VEC3, a); + } + Vec3.normalize(_Quat.#TMP_VEC3, _Quat.#TMP_VEC3); + _Quat.setAxisAngle(out, _Quat.#TMP_VEC3, Math.PI); + return out; + } else if (dot > 0.999999) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } else { + Vec3.cross(_Quat.#TMP_VEC3, a, b); + out[0] = _Quat.#TMP_VEC3[0]; + out[1] = _Quat.#TMP_VEC3[1]; + out[2] = _Quat.#TMP_VEC3[2]; + out[3] = 1 + dot; + return _Quat.normalize(out, out); + } + } + /** + * Performs a spherical linear interpolation with two control points + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static sqlerp(out, a, b, c, d, t) { + _Quat.slerp(_Quat.#TMP_QUAT1, a, d, t); + _Quat.slerp(_Quat.#TMP_QUAT2, b, c, t); + _Quat.slerp(out, _Quat.#TMP_QUAT1, _Quat.#TMP_QUAT2, 2 * t * (1 - t)); + return out; + } + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * @category Static + * + * @param out - The receiving quaternion + * @param view - the vector representing the viewing direction + * @param right - the vector representing the local `right` direction + * @param up - the vector representing the local `up` direction + * @returns `out` + */ + static setAxes(out, view, right, up) { + _Quat.#TMP_MAT3[0] = right[0]; + _Quat.#TMP_MAT3[3] = right[1]; + _Quat.#TMP_MAT3[6] = right[2]; + _Quat.#TMP_MAT3[1] = up[0]; + _Quat.#TMP_MAT3[4] = up[1]; + _Quat.#TMP_MAT3[7] = up[2]; + _Quat.#TMP_MAT3[2] = -view[0]; + _Quat.#TMP_MAT3[5] = -view[1]; + _Quat.#TMP_MAT3[8] = -view[2]; + return _Quat.normalize(out, _Quat.fromMat3(out, _Quat.#TMP_MAT3)); + } +}; +Quat.set = Vec4.set; +Quat.add = Vec4.add; +Quat.lerp = Vec4.lerp; +Quat.normalize = Vec4.normalize; +Quat.squaredLength = Vec4.squaredLength; +Quat.sqrLen = Vec4.squaredLength; +Quat.exactEquals = Vec4.exactEquals; +Quat.equals = Vec4.equals; +Quat.magnitude = Vec4.magnitude; +Quat.prototype.mul = Quat.prototype.multiply; +Quat.mul = Quat.multiply; +Quat.mag = Quat.magnitude; +Quat.length = Quat.magnitude; +Quat.len = Quat.magnitude; + +// src/_lib/f64/Quat2.ts +var Quat2 = class _Quat2 extends Float64Array { + // Temporary variables to prevent repeated allocations in the algorithms within Quat2. + // These are declared as TypedArrays to aid in tree-shaking. + static #TMP_QUAT = new Float64Array(4); + static #TMP_VEC3 = new Float64Array(3); + /** + * Create a {@link Quat2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 8: + super(values); + break; + case 2: + super(values[0], values[1], 8); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v, v, v, v, v, v]); + } else { + super(v, 0, 8); + } + break; + } + default: + super(8); + this[3] = 1; + break; + } + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Quat2.str(this);` + * + * @category Accessors + */ + get str() { + return _Quat2.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Quat2} into `this`. + * @category Methods + * + * @param a the source dual quaternion + * @returns `this` + */ + copy(a) { + super.set(a); + return this; + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat2}. + */ + static get BYTE_LENGTH() { + return 8 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new identity {@link Quat2} + * @category Static + * + * @returns a new dual quaternion [real -> rotation, dual -> translation] + */ + static create() { + return new _Quat2(); + } + /** + * Creates a {@link Quat2} quat initialized with values from an existing quaternion + * @category Static + * + * @param a - dual quaternion to clone + * @returns a new dual quaternion + */ + static clone(a) { + return new _Quat2(a); + } + /** + * Creates a new {@link Quat2} initialized with the given values + * @category Static + * + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns a new dual quaternion + */ + static fromValues(x1, y1, z1, w1, x2, y2, z2, w2) { + return new _Quat2(x1, y1, z1, w1, x2, y2, z2, w2); + } + /** + * Creates a new {@link Quat2} from the given values (quat and translation) + * @category Static + * + * @param x1 - X component (rotation) + * @param y1 - Y component (rotation) + * @param z1 - Z component (rotation) + * @param w1 - W component (rotation) + * @param x2 - X component (translation) + * @param y2 - Y component (translation) + * @param z2 - Z component (translation) + * @returns a new dual quaternion + */ + static fromRotationTranslationValues(x1, y1, z1, w1, x2, y2, z2) { + const ax = x2 * 0.5; + const ay = y2 * 0.5; + const az = z2 * 0.5; + return new _Quat2( + x1, + y1, + z1, + w1, + ax * w1 + ay * z1 - az * y1, + ay * w1 + az * x1 - ax * z1, + az * w1 + ax * y1 - ay * x1, + -ax * x1 - ay * y1 - az * z1 + ); + } + /** + * Sets a {@link Quat2} from a quaternion and a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @param t - translation vector + * @returns `out` + */ + static fromRotationTranslation(out, q, t) { + const ax = t[0] * 0.5; + const ay = t[1] * 0.5; + const az = t[2] * 0.5; + const bx = q[0]; + const by = q[1]; + const bz = q[2]; + const bw = q[3]; + out[0] = bx; + out[1] = by; + out[2] = bz; + out[3] = bw; + out[4] = ax * bw + ay * bz - az * by; + out[5] = ay * bw + az * bx - ax * bz; + out[6] = az * bw + ax * by - ay * bx; + out[7] = -ax * bx - ay * by - az * bz; + return out; + } + /** + * Sets a {@link Quat2} from a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param t - translation vector + * @returns `out` + */ + static fromTranslation(out, t) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = t[0] * 0.5; + out[5] = t[1] * 0.5; + out[6] = t[2] * 0.5; + out[7] = 0; + return out; + } + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @returns `out` + */ + static fromRotation(out, q) { + out[0] = q[0]; + out[1] = q[1]; + out[2] = q[2]; + out[3] = q[3]; + out[4] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + return out; + } + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param a - the matrix + * @returns `out` + */ + static fromMat4(out, a) { + Mat4.getRotation(_Quat2.#TMP_QUAT, a); + Mat4.getTranslation(_Quat2.#TMP_VEC3, a); + return _Quat2.fromRotationTranslation(out, _Quat2.#TMP_QUAT, _Quat2.#TMP_VEC3); + } + /** + * Copy the values from one {@link Quat2} to another + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the source dual quaternion + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + return out; + } + /** + * Set a {@link Quat2} to the identity dual quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @returns `out` + */ + static identity(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + return out; + } + /** + * Set the components of a {@link Quat2} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns `out` + */ + static set(out, x1, y1, z1, w1, x2, y2, z2, w2) { + out[0] = x1; + out[1] = y1; + out[2] = z1; + out[3] = w1; + out[4] = x2; + out[5] = y2; + out[6] = z2; + out[7] = w2; + return out; + } + /** + * Gets the real part of a dual quat + * @category Static + * + * @param out - real part + * @param a - Dual Quaternion + * @return `out` + */ + static getReal(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Gets the dual part of a dual quat + * @category Static + * + * @param out - dual part + * @param a - Dual Quaternion + * @return `out` + */ + static getDual(out, a) { + out[0] = a[4]; + out[1] = a[5]; + out[2] = a[6]; + out[3] = a[7]; + return out; + } + /** + * Set the real component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the real part + * @return `out` + */ + static setReal(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the dual component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the dual part + * @return `out` + */ + static setDual(out, a) { + out[4] = a[0]; + out[5] = a[1]; + out[6] = a[2]; + out[7] = a[3]; + return out; + } + /** + * Gets the translation of a normalized {@link Quat2} + * @category Static + * + * @param out - the receiving translation vector + * @param a - Dual Quaternion to be decomposed + * @return `out` + */ + static getTranslation(out, a) { + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const bx = -a[0]; + const by = -a[1]; + const bz = -a[2]; + const bw = a[3]; + out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; + out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; + out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + return out; + } + /** + * Translates a {@link Quat2} by the given vector + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const ax1 = a[0]; + const ay1 = a[1]; + const az1 = a[2]; + const aw1 = a[3]; + const bx1 = v[0] * 0.5; + const by1 = v[1] * 0.5; + const bz1 = v[2] * 0.5; + const ax2 = a[4]; + const ay2 = a[5]; + const az2 = a[6]; + const aw2 = a[7]; + out[0] = ax1; + out[1] = ay1; + out[2] = az1; + out[3] = aw1; + out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2; + out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2; + out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2; + out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2; + return out; + } + /** + * Rotates a {@link Quat2} around the X axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out, a, rad) { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateX(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} around the Y axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out, a, rad) { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateY(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} around the Z axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out, a, rad) { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateZ(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} by a given quaternion (a * q) + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param q - quaternion to rotate by + * @returns `out` + */ + static rotateByQuatAppend(out, a, q) { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + let ax = a[0]; + let ay = a[1]; + let az = a[2]; + let aw = a[3]; + out[0] = ax * qw + aw * qx + ay * qz - az * qy; + out[1] = ay * qw + aw * qy + az * qx - ax * qz; + out[2] = az * qw + aw * qz + ax * qy - ay * qx; + out[3] = aw * qw - ax * qx - ay * qy - az * qz; + ax = a[4]; + ay = a[5]; + az = a[6]; + aw = a[7]; + out[4] = ax * qw + aw * qx + ay * qz - az * qy; + out[5] = ay * qw + aw * qy + az * qx - ax * qz; + out[6] = az * qw + aw * qz + ax * qy - ay * qx; + out[7] = aw * qw - ax * qx - ay * qy - az * qz; + return out; + } + /** + * Rotates a {@link Quat2} by a given quaternion (q * a) + * @category Static + * + * @param out - the receiving dual quaternion + * @param q - quaternion to rotate by + * @param a - the dual quaternion to rotate + * @returns `out` + */ + static rotateByQuatPrepend(out, q, a) { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + let bx = a[0]; + let by = a[1]; + let bz = a[2]; + let bw = a[3]; + out[0] = qx * bw + qw * bx + qy * bz - qz * by; + out[1] = qy * bw + qw * by + qz * bx - qx * bz; + out[2] = qz * bw + qw * bz + qx * by - qy * bx; + out[3] = qw * bw - qx * bx - qy * by - qz * bz; + bx = a[4]; + by = a[5]; + bz = a[6]; + bw = a[7]; + out[4] = qx * bw + qw * bx + qy * bz - qz * by; + out[5] = qy * bw + qw * by + qz * bx - qx * bz; + out[6] = qz * bw + qw * bz + qx * by - qy * bx; + out[7] = qw * bw - qx * bx - qy * by - qz * bz; + return out; + } + /** + * Rotates a {@link Quat2} around a given axis. Does the normalization automatically + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param axis - the axis to rotate around + * @param rad - how far the rotation should be + * @returns `out` + */ + static rotateAroundAxis(out, a, axis, rad) { + if (Math.abs(rad) < GLM_EPSILON) { + return _Quat2.copy(out, a); + } + const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]); + rad *= 0.5; + const s = Math.sin(rad); + const bx = s * axis[0] / axisLength; + const by = s * axis[1] / axisLength; + const bz = s * axis[2] / axisLength; + const bw = Math.cos(rad); + const ax1 = a[0]; + const ay1 = a[1]; + const az1 = a[2]; + const aw1 = a[3]; + out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + out[4] = ax * bw + aw * bx + ay * bz - az * by; + out[5] = ay * bw + aw * by + az * bx - ax * bz; + out[6] = az * bw + aw * bz + ax * by - ay * bx; + out[7] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + /** + * Adds two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + return out; + } + /** + * Multiplies two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns {quat2} out + */ + static multiply(out, a, b) { + const ax0 = a[0]; + const ay0 = a[1]; + const az0 = a[2]; + const aw0 = a[3]; + const bx1 = b[4]; + const by1 = b[5]; + const bz1 = b[6]; + const bw1 = b[7]; + const ax1 = a[4]; + const ay1 = a[5]; + const az1 = a[6]; + const aw1 = a[7]; + const bx0 = b[0]; + const by0 = b[1]; + const bz0 = b[2]; + const bw0 = b[3]; + out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0; + out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0; + out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0; + out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0; + out[4] = ax0 * bw1 + aw0 * bx1 + ay0 * bz1 - az0 * by1 + ax1 * bw0 + aw1 * bx0 + ay1 * bz0 - az1 * by0; + out[5] = ay0 * bw1 + aw0 * by1 + az0 * bx1 - ax0 * bz1 + ay1 * bw0 + aw1 * by0 + az1 * bx0 - ax1 * bz0; + out[6] = az0 * bw1 + aw0 * bz1 + ax0 * by1 - ay0 * bx1 + az1 * bw0 + aw1 * bz0 + ax1 * by0 - ay1 * bx0; + out[7] = aw0 * bw1 - ax0 * bx1 - ay0 * by1 - az0 * bz1 + aw1 * bw0 - ax1 * bx0 - ay1 * by0 - az1 * bz0; + return out; + } + /** + * Alias for {@link Quat2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return out; + } + /** + * Scales a {@link Quat2} by a scalar value + * @category Static + * + * @param out - the receiving dual quaterion + * @param a - the dual quaternion to scale + * @param b - scalar value to scale the dual quaterion by + * @returns `out` + */ + static scale(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + return out; + } + /** + * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts) + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dot(a, b) { + return 0; + } + /** + * Performs a linear interpolation between two {@link Quat2}s + * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`) + * @category Static + * + * @param out - the receiving dual quat + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const mt = 1 - t; + if (_Quat2.dot(a, b) < 0) { + t = -t; + } + out[0] = a[0] * mt + b[0] * t; + out[1] = a[1] * mt + b[1] * t; + out[2] = a[2] * mt + b[2] * t; + out[3] = a[3] * mt + b[3] * t; + out[4] = a[4] * mt + b[4] * t; + out[5] = a[5] * mt + b[5] * t; + out[6] = a[6] * mt + b[6] * t; + out[7] = a[7] * mt + b[7] * t; + return out; + } + /** + * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quat to calculate inverse of + * @returns `out` + */ + static invert(out, a) { + const sqlen = _Quat2.squaredLength(a); + out[0] = -a[0] / sqlen; + out[1] = -a[1] / sqlen; + out[2] = -a[2] / sqlen; + out[3] = a[3] / sqlen; + out[4] = -a[4] / sqlen; + out[5] = -a[5] / sqlen; + out[6] = -a[6] / sqlen; + out[7] = a[7] / sqlen; + return out; + } + /** + * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than + * {@link Quat2.invert} and produces the same result. + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to calculate conjugate of + * @returns `out` + */ + static conjugate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + out[4] = -a[4]; + out[5] = -a[5]; + out[6] = -a[6]; + out[7] = a[7]; + return out; + } + /** + * Calculates the magnitude (length) of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate length of + * @returns length of `a` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static magnitude(a) { + return 0; + } + /** + * Alias for {@link Quat2.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate squared length of + * @returns squared length of a + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static squaredLength(a) { + return 0; + } + /** + * Alias for {@link Quat2.squaredLength} + * @category Static + */ + static sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Normalize a {@link Quat2} + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to normalize + * @returns `out` + */ + static normalize(out, a) { + let magnitude = _Quat2.squaredLength(a); + if (magnitude > 0) { + magnitude = Math.sqrt(magnitude); + const a0 = a[0] / magnitude; + const a1 = a[1] / magnitude; + const a2 = a[2] / magnitude; + const a3 = a[3] / magnitude; + const b0 = a[4]; + const b1 = a[5]; + const b2 = a[6]; + const b3 = a[7]; + const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3; + out[0] = a0; + out[1] = a1; + out[2] = a2; + out[3] = a3; + out[4] = (b0 - a0 * a_dot_b) / magnitude; + out[5] = (b1 - a1 * a_dot_b) / magnitude; + out[6] = (b2 - a2 * a_dot_b) / magnitude; + out[7] = (b3 - a3 * a_dot_b) / magnitude; + } + return out; + } + /** + * Returns a string representation of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Quat2(${a.join(", ")})`; + } + /** + * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7]; + } + /** + * Returns whether the {@link Quat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)); + } +}; +Quat2.dot = Quat.dot; +Quat2.squaredLength = Quat.squaredLength; +Quat2.sqrLen = Quat.squaredLength; +Quat2.mag = Quat.magnitude; +Quat2.length = Quat.magnitude; +Quat2.len = Quat.magnitude; +Quat2.mul = Quat2.multiply; + +// src/_lib/f64/Vec2.ts +var Vec2 = class _Vec2 extends Float64Array { + /** + * Create a {@link Vec2}. + * + * @category Constructor + */ + constructor(...values) { + switch (values.length) { + case 2: { + const v = values[0]; + if (typeof v === "number") { + super([v, values[1]]); + } else { + super(v, values[1], 2); + } + break; + } + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v]); + } else { + super(v, 0, 2); + } + break; + } + default: + super(2); + break; + } + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r() { + return this[0]; + } + set r(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g() { + return this[1]; + } + set g(value) { + this[1] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec2.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude() { + return Math.hypot(this[0], this[1]); + } + /** + * Alias for {@link Vec2.magnitude} + * + * @category Accessors + */ + get mag() { + return this.magnitude; + } + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec2.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude() { + const x = this[0]; + const y = this[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag() { + return this.squaredMagnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec2.str(this);` + * + * @category Accessors + */ + get str() { + return _Vec2.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec2} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + // Instead of zero(), use a.fill(0) for instances; + /** + * Adds a {@link Vec2} to `this`. + * Equivalent to `Vec2.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b) { + this[0] += b[0]; + this[1] += b[1]; + return this; + } + /** + * Subtracts a {@link Vec2} from `this`. + * Equivalent to `Vec2.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + return this; + } + /** + * Alias for {@link Vec2.subtract} + * @category Methods + */ + sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec2}. + * Equivalent to `Vec2.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + return this; + } + /** + * Alias for {@link Vec2.multiply} + * @category Methods + */ + mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec2}. + * Equivalent to `Vec2.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + return this; + } + /** + * Alias for {@link Vec2.divide} + * @category Methods + */ + div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec2.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b) { + this[0] *= b; + this[1] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b) { + return _Vec2.distance(this, b); + } + /** + * Alias for {@link Vec2.distance} + * @category Methods + */ + dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b) { + return _Vec2.squaredDistance(this, b); + } + /** + * Alias for {@link Vec2.squaredDistance} + * @category Methods + */ + sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec2.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate() { + this[0] *= -1; + this[1] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec2.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + return this; + } + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec2.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec2}. + * Equivalent to `Vec2.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b) { + return this[0] * b[0] + this[1] * b[1]; + } + /** + * Normalize `this`. + * Equivalent to `Vec2.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize() { + return _Vec2.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec2}. + */ + static get BYTE_LENGTH() { + return 2 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty {@link Vec2} + * @category Static + * + * @returns A new 2D vector + */ + static create() { + return new _Vec2(); + } + /** + * Creates a new {@link Vec2} initialized with values from an existing vector + * @category Static + * + * @param a - Vector to clone + * @returns A new 2D vector + */ + static clone(a) { + return new _Vec2(a); + } + /** + * Creates a new {@link Vec2} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @returns A new 2D vector + */ + static fromValues(x, y) { + return new _Vec2(x, y); + } + /** + * Copy the values from one {@link Vec2} to another + * @category Static + * + * @param out - the receiving vector + * @param a - The source vector + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + return out; + } + /** + * Set the components of a {@link Vec2} to the given values + * @category Static + * + * @param out - The receiving vector + * @param x - X component + * @param y - Y component + * @returns `out` + */ + static set(out, x, y) { + out[0] = x; + out[1] = y; + return out; + } + /** + * Adds two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + return out; + } + /** + * Alias for {@link Vec2.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out, a, b) { + return [0, 0]; + } + /** + * Multiplies two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + return out; + } + /** + * Alias for {@link Vec2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out, a, b) { + return [0, 0]; + } + /** + * Divides two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + return out; + } + /** + * Alias for {@link Vec2.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out, a, b) { + return [0, 0]; + } + /** + * Math.ceil the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to ceil + * @returns `out` + */ + static ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + return out; + } + /** + * Math.floor the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to floor + * @returns `out` + */ + static floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + return out; + } + /** + * Returns the minimum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + return out; + } + /** + * Returns the maximum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + return out; + } + /** + * Math.round the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to round + * @returns `out` + */ + static round(out, a) { + out[0] = Math.round(a[0]); + out[1] = Math.round(a[1]); + return out; + } + /** + * Scales a {@link Vec2} by a scalar number + * @category Static + * + * @param out - The receiving vector + * @param a - The vector to scale + * @param b - Amount to scale the vector by + * @returns `out` + */ + static scale(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + return out; + } + /** + * Adds two Vec2's after scaling the second operand by a scalar value + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param scale - The amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns distance between `a` and `b` + */ + static distance(a, b) { + return Math.hypot(b[0] - a[0], b[1] - a[1]); + } + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Squared distance between `a` and `b` + */ + static squaredDistance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a, b) { + return 0; + } + /** + * Calculates the magnitude (length) of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a) { + const x = a[0]; + const y = a[1]; + return Math.sqrt(x * x + y * y); + } + /** + * Alias for {@link Vec2.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + // Length conflicts with Function.length + static length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.mag} + */ + static len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate squared length of + * @returns Squared length of a + */ + static squaredLength(a) { + const x = a[0]; + const y = a[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.squaredLength} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrLen(a, b) { + return 0; + } + /** + * Negates the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to negate + * @returns `out` + */ + static negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + return out; + } + /** + * Returns the inverse of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to invert + * @returns `out` + */ + static inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + return out; + } + /** + * Normalize a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to normalize + * @returns `out` + */ + static normalize(out, a) { + const x = a[0]; + const y = a[1]; + let len = x * x + y * y; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + return out; + } + /** + * Calculates the dot product of two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Dot product of `a` and `b` + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1]; + } + /** + * Computes the cross product of two {@link Vec2}s + * Note that the cross product must by definition produce a 3D vector. + * For this reason there is also not instance equivalent for this function. + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static cross(out, a, b) { + const z = a[0] * b[1] - a[1] * b[0]; + out[0] = out[1] = 0; + out[2] = z; + return out; + } + /** + * Performs a linear interpolation between two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param t - Interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const ax = a[0]; + const ay = a[1]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat2} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[2] * y; + out[1] = m[1] * x + m[3] * y; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat2d} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2d(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[2] * y + m[4]; + out[1] = m[1] * x + m[3] * y + m[5]; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat3} + * 3rd vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat3(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[3] * y + m[6]; + out[1] = m[1] * x + m[4] * y + m[7]; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat4} + * 3rd vector component is implicitly '0' + * 4th vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat4(out, a, m) { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[4] * y + m[12]; + out[1] = m[1] * x + m[5] * y + m[13]; + return out; + } + /** + * Rotate a 2D vector + * @category Static + * + * @param out - The receiving {@link Vec2} + * @param a - The {@link Vec2} point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotate(out, a, b, rad) { + const p0 = a[0] - b[0]; + const p1 = a[1] - b[1]; + const sinC = Math.sin(rad); + const cosC = Math.cos(rad); + out[0] = p0 * cosC - p1 * sinC + b[0]; + out[1] = p0 * sinC + p1 * cosC + b[1]; + return out; + } + /** + * Get the angle between two 2D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static angle(a, b) { + const x1 = a[0]; + const y1 = a[1]; + const x2 = b[0]; + const y2 = b[1]; + const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2); + const cosine = mag && (x1 * x2 + y1 * y2) / mag; + return Math.acos(Math.min(Math.max(cosine, -1), 1)); + } + /** + * Set the components of a {@link Vec2} to zero + * @category Static + * + * @param out - The receiving vector + * @returns `out` + */ + static zero(out) { + out[0] = 0; + out[1] = 0; + return out; + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors components are ===, `false` otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors are approximately equal, `false` otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const b0 = b[0]; + const b1 = b[1]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)); + } + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - Vector to represent as a string + * @returns String representation of the vector + */ + static str(a) { + return `Vec2(${a.join(", ")})`; + } +}; +Vec2.prototype.sub = Vec2.prototype.subtract; +Vec2.prototype.mul = Vec2.prototype.multiply; +Vec2.prototype.div = Vec2.prototype.divide; +Vec2.prototype.dist = Vec2.prototype.distance; +Vec2.prototype.sqrDist = Vec2.prototype.squaredDistance; +Vec2.sub = Vec2.subtract; +Vec2.mul = Vec2.multiply; +Vec2.div = Vec2.divide; +Vec2.dist = Vec2.distance; +Vec2.sqrDist = Vec2.squaredDistance; +Vec2.sqrLen = Vec2.squaredLength; +Vec2.mag = Vec2.magnitude; +Vec2.length = Vec2.magnitude; +Vec2.len = Vec2.magnitude; + +// src/swizzle/f64/index.ts +var GLM_SWIZZLES_ENABLED_F64 = false; +function EnableSwizzlesF64() { + if (GLM_SWIZZLES_ENABLED_F64) { + return; + } + const VEC2_SWIZZLES = ["xx", "xy", "yx", "yy", "xxx", "xxy", "xyx", "xyy", "yxx", "yxy", "yyx", "yyy", "xxxx", "xxxy", "xxyx", "xxyy", "xyxx", "xyxy", "xyyx", "xyyy", "yxxx", "yxxy", "yxyx", "yxyy", "yyxx", "yyxy", "yyyx", "yyyy", "rr", "rg", "gr", "gg", "rrr", "rrg", "rgr", "rgg", "grr", "grg", "ggr", "ggg", "rrrr", "rrrg", "rrgr", "rrgg", "rgrr", "rgrg", "rggr", "rggg", "grrr", "grrg", "grgr", "grgg", "ggrr", "ggrg", "gggr", "gggg"]; + const VEC3_SWIZZLES = ["xz", "yz", "zx", "zy", "zz", "xxz", "xyz", "xzx", "xzy", "xzz", "yxz", "yyz", "yzx", "yzy", "yzz", "zxx", "zxy", "zxz", "zyx", "zyy", "zyz", "zzx", "zzy", "zzz", "xxxz", "xxyz", "xxzx", "xxzy", "xxzz", "xyxz", "xyyz", "xyzx", "xyzy", "xyzz", "xzxx", "xzxy", "xzxz", "xzyx", "xzyy", "xzyz", "xzzx", "xzzy", "xzzz", "yxxz", "yxyz", "yxzx", "yxzy", "yxzz", "yyxz", "yyyz", "yyzx", "yyzy", "yyzz", "yzxx", "yzxy", "yzxz", "yzyx", "yzyy", "yzyz", "yzzx", "yzzy", "yzzz", "zxxx", "zxxy", "zxxz", "zxyx", "zxyy", "zxyz", "zxzx", "zxzy", "zxzz", "zyxx", "zyxy", "zyxz", "zyyx", "zyyy", "zyyz", "zyzx", "zyzy", "zyzz", "zzxx", "zzxy", "zzxz", "zzyx", "zzyy", "zzyz", "zzzx", "zzzy", "zzzz", "rb", "gb", "br", "bg", "bb", "rrb", "rgb", "rbr", "rbg", "rbb", "grb", "ggb", "gbr", "gbg", "gbb", "brr", "brg", "brb", "bgr", "bgg", "bgb", "bbr", "bbg", "bbb", "rrrb", "rrgb", "rrbr", "rrbg", "rrbb", "rgrb", "rggb", "rgbr", "rgbg", "rgbb", "rbrr", "rbrg", "rbrb", "rbgr", "rbgg", "rbgb", "rbbr", "rbbg", "rbbb", "grrb", "grgb", "grbr", "grbg", "grbb", "ggrb", "gggb", "ggbr", "ggbg", "ggbb", "gbrr", "gbrg", "gbrb", "gbgr", "gbgg", "gbgb", "gbbr", "gbbg", "gbbb", "brrr", "brrg", "brrb", "brgr", "brgg", "brgb", "brbr", "brbg", "brbb", "bgrr", "bgrg", "bgrb", "bggr", "bggg", "bggb", "bgbr", "bgbg", "bgbb", "bbrr", "bbrg", "bbrb", "bbgr", "bbgg", "bbgb", "bbbr", "bbbg", "bbbb"]; + const VEC4_SWIZZLES = ["xw", "yw", "zw", "wx", "wy", "wz", "ww", "xxw", "xyw", "xzw", "xwx", "xwy", "xwz", "xww", "yxw", "yyw", "yzw", "ywx", "ywy", "ywz", "yww", "zxw", "zyw", "zzw", "zwx", "zwy", "zwz", "zww", "wxx", "wxy", "wxz", "wxw", "wyx", "wyy", "wyz", "wyw", "wzx", "wzy", "wzz", "wzw", "wwx", "wwy", "wwz", "www", "xxxw", "xxyw", "xxzw", "xxwx", "xxwy", "xxwz", "xxww", "xyxw", "xyyw", "xyzw", "xywx", "xywy", "xywz", "xyww", "xzxw", "xzyw", "xzzw", "xzwx", "xzwy", "xzwz", "xzww", "xwxx", "xwxy", "xwxz", "xwxw", "xwyx", "xwyy", "xwyz", "xwyw", "xwzx", "xwzy", "xwzz", "xwzw", "xwwx", "xwwy", "xwwz", "xwww", "yxxw", "yxyw", "yxzw", "yxwx", "yxwy", "yxwz", "yxww", "yyxw", "yyyw", "yyzw", "yywx", "yywy", "yywz", "yyww", "yzxw", "yzyw", "yzzw", "yzwx", "yzwy", "yzwz", "yzww", "ywxx", "ywxy", "ywxz", "ywxw", "ywyx", "ywyy", "ywyz", "ywyw", "ywzx", "ywzy", "ywzz", "ywzw", "ywwx", "ywwy", "ywwz", "ywww", "zxxw", "zxyw", "zxzw", "zxwx", "zxwy", "zxwz", "zxww", "zyxw", "zyyw", "zyzw", "zywx", "zywy", "zywz", "zyww", "zzxw", "zzyw", "zzzw", "zzwx", "zzwy", "zzwz", "zzww", "zwxx", "zwxy", "zwxz", "zwxw", "zwyx", "zwyy", "zwyz", "zwyw", "zwzx", "zwzy", "zwzz", "zwzw", "zwwx", "zwwy", "zwwz", "zwww", "wxxx", "wxxy", "wxxz", "wxxw", "wxyx", "wxyy", "wxyz", "wxyw", "wxzx", "wxzy", "wxzz", "wxzw", "wxwx", "wxwy", "wxwz", "wxww", "wyxx", "wyxy", "wyxz", "wyxw", "wyyx", "wyyy", "wyyz", "wyyw", "wyzx", "wyzy", "wyzz", "wyzw", "wywx", "wywy", "wywz", "wyww", "wzxx", "wzxy", "wzxz", "wzxw", "wzyx", "wzyy", "wzyz", "wzyw", "wzzx", "wzzy", "wzzz", "wzzw", "wzwx", "wzwy", "wzwz", "wzww", "wwxx", "wwxy", "wwxz", "wwxw", "wwyx", "wwyy", "wwyz", "wwyw", "wwzx", "wwzy", "wwzz", "wwzw", "wwwx", "wwwy", "wwwz", "wwww", "ra", "ga", "ba", "ar", "ag", "ab", "aa", "rra", "rga", "rba", "rar", "rag", "rab", "raa", "gra", "gga", "gba", "gar", "gag", "gab", "gaa", "bra", "bga", "bba", "bar", "bag", "bab", "baa", "arr", "arg", "arb", "ara", "agr", "agg", "agb", "aga", "abr", "abg", "abb", "aba", "aar", "aag", "aab", "aaa", "rrra", "rrga", "rrba", "rrar", "rrag", "rrab", "rraa", "rgra", "rgga", "rgba", "rgar", "rgag", "rgab", "rgaa", "rbra", "rbga", "rbba", "rbar", "rbag", "rbab", "rbaa", "rarr", "rarg", "rarb", "rara", "ragr", "ragg", "ragb", "raga", "rabr", "rabg", "rabb", "raba", "raar", "raag", "raab", "raaa", "grra", "grga", "grba", "grar", "grag", "grab", "graa", "ggra", "ggga", "ggba", "ggar", "ggag", "ggab", "ggaa", "gbra", "gbga", "gbba", "gbar", "gbag", "gbab", "gbaa", "garr", "garg", "garb", "gara", "gagr", "gagg", "gagb", "gaga", "gabr", "gabg", "gabb", "gaba", "gaar", "gaag", "gaab", "gaaa", "brra", "brga", "brba", "brar", "brag", "brab", "braa", "bgra", "bgga", "bgba", "bgar", "bgag", "bgab", "bgaa", "bbra", "bbga", "bbba", "bbar", "bbag", "bbab", "bbaa", "barr", "barg", "barb", "bara", "bagr", "bagg", "bagb", "baga", "babr", "babg", "babb", "baba", "baar", "baag", "baab", "baaa", "arrr", "arrg", "arrb", "arra", "argr", "argg", "argb", "arga", "arbr", "arbg", "arbb", "arba", "arar", "arag", "arab", "araa", "agrr", "agrg", "agrb", "agra", "aggr", "aggg", "aggb", "agga", "agbr", "agbg", "agbb", "agba", "agar", "agag", "agab", "agaa", "abrr", "abrg", "abrb", "abra", "abgr", "abgg", "abgb", "abga", "abbr", "abbg", "abbb", "abba", "abar", "abag", "abab", "abaa", "aarr", "aarg", "aarb", "aara", "aagr", "aagg", "aagb", "aaga", "aabr", "aabg", "aabb", "aaba", "aaar", "aaag", "aaab", "aaaa"]; + const SWIZZLE_INDEX = { + x: 0, + r: 0, + y: 1, + g: 1, + z: 2, + b: 2, + w: 3, + a: 3 + }; + function getSwizzleImpl(swizzle) { + switch (swizzle.length) { + case 2: + return function() { + return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]); + }; + case 3: + return function() { + return new Vec3( + this[SWIZZLE_INDEX[swizzle[0]]], + this[SWIZZLE_INDEX[swizzle[1]]], + this[SWIZZLE_INDEX[swizzle[2]]] + ); + }; + case 4: + return function() { + return new Vec4( + this[SWIZZLE_INDEX[swizzle[0]]], + this[SWIZZLE_INDEX[swizzle[1]]], + this[SWIZZLE_INDEX[swizzle[2]]], + this[SWIZZLE_INDEX[swizzle[3]]] + ); + }; + } + throw new Error("Illegal swizzle length"); + } + for (const swizzle of VEC2_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec2.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec3.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + for (const swizzle of VEC3_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec3.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + for (const swizzle of VEC4_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + GLM_SWIZZLES_ENABLED_F64 = true; +} + +// src/util/angleConversion.ts +var GLM_DEG_TO_RAD = Math.PI / 180; +var GLM_RAD_TO_DEG = 180 / Math.PI; +function toDegree(value) { + return value * GLM_RAD_TO_DEG; +} +function toRadian(value) { + return value * GLM_DEG_TO_RAD; +} +export { + EnableSwizzlesF64, + Mat2, + Mat2d, + Mat3, + Mat4, + Quat, + Quat2, + Vec2, + Vec3, + Vec4, + toDegree, + toRadian +}; +//# sourceMappingURL=gl-matrix-f64.js.map diff --git a/dist-cdn/esm/2022/gl-matrix-f64.js.map b/dist-cdn/esm/2022/gl-matrix-f64.js.map new file mode 100644 index 00000000..812a35d2 --- /dev/null +++ b/dist-cdn/esm/2022/gl-matrix-f64.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../../../src/common/index.ts", "../../../src/_lib/f64/Mat2.ts", "../../../src/_lib/f64/Mat2d.ts", "../../../src/_lib/f64/Mat3.ts", "../../../src/_lib/f64/Mat4.ts", "../../../src/_lib/f64/Vec3.ts", "../../../src/_lib/f64/Vec4.ts", "../../../src/_lib/f64/Quat.ts", "../../../src/_lib/f64/Quat2.ts", "../../../src/_lib/f64/Vec2.ts", "../../../src/swizzle/f64/index.ts", "../../../src/util/angleConversion.ts"], + "sourcesContent": ["/**\r\n * Provides common resources and constants shared across `gl-matrix`.\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\n/**\r\n * A small constant used to determine the acceptable error margin in floating-point calculations.\r\n */\r\nexport const GLM_EPSILON = 0.000001;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x2 Matrix\r\n */\r\nexport class Mat2 extends Float64Array {\r\n static #IDENTITY_2X2 = new Float64Array([\r\n 1, 0,\r\n 0, 1\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n default:\r\n super(Mat2.#IDENTITY_2X2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2} into `this`.\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2.identity(this)\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n identity(): this {\r\n this.set(Mat2.#IDENTITY_2X2);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2} against another one\r\n * Equivalent to `Mat2.multiply(this, this, b);`\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat2}\r\n * Equivalent to `Mat2.transpose(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n transpose(): this {\r\n return Mat2.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat2}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n invert(): this {\r\n return Mat2.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2.scale(this, this, v);`\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2} by the given angle around the given axis\r\n * Equivalent to `Mat2.rotate(this, this, rad);`\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n rotate(rad: number): this {\r\n return Mat2.rotate(this, this, rad) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2}\r\n */\r\n static create(): Mat2 {\r\n return new Mat2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2}\r\n */\r\n static clone(a: Readonly): Mat2 {\r\n return new Mat2(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2Like, a: Readonly): Mat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2}\r\n */\r\n static fromValues(...values: number[]): Mat2 {\r\n return new Mat2(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2Like, ...values: number[]): Mat2Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2Like): Mat2Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat2Like, a: Readonly): Mat2Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache\r\n // some values\r\n if (out === a) {\r\n const a1 = a[1];\r\n out[1] = a[2];\r\n out[2] = a1;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[2];\r\n out[2] = a[1];\r\n out[3] = a[3];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2Like, a: Mat2Like): Mat2Like | null {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n // Calculate the determinant\r\n let det = a0 * a3 - a2 * a1;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = a3 * det;\r\n out[1] = -a1 * det;\r\n out[2] = -a2 * det;\r\n out[3] = a0 * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat2Like, a: Mat2Like): Mat2Like {\r\n // Caching this value is necessary if out == a\r\n const a0 = a[0];\r\n out[0] = a[3];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[2] * a[1];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n return out;\r\n }\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Rotates a {@link Mat2} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2Like, a: Readonly, rad: number): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2Like, a: Readonly, v: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2Like, rad: number): Mat2Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2Like, v: Readonly): Mat2Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2Like, a: Readonly, b: number): Mat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2Like, a: Readonly, b: Readonly, scale: number): Mat2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\r\n * @category Static\r\n *\r\n * @param L - the lower triangular matrix\r\n * @param D - the diagonal matrix\r\n * @param U - the upper triangular matrix\r\n * @param a - the input matrix to factorize\r\n */\r\n\r\n static LDU(L: Mat2Like, D: Readonly, U: Mat2Like, a: Readonly):\r\n [Mat2Like, Readonly, Mat2Like] {\r\n L[2] = a[2] / a[0];\r\n U[0] = a[0];\r\n U[1] = a[1];\r\n U[3] = a[3] - L[2] * U[1];\r\n return [L, D, U];\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat2.prototype.mul = Mat2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat2.mul = Mat2.multiply;\r\nMat2.sub = Mat2.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x3 Matrix\r\n */\r\nexport class Mat2d extends Float64Array {\r\n static #IDENTITY_2X3 = new Float64Array([\r\n 1, 0,\r\n 0, 1,\r\n 0, 0,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 6:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 6); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 6);\r\n }\r\n break;\r\n default:\r\n super(Mat2d.#IDENTITY_2X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2d.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2d.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2d} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2d.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat2d.#IDENTITY_2X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2d} against another one\r\n * Equivalent to `Mat2d.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2d.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Translate this {@link Mat2d} by the given vector\r\n * Equivalent to `Mat2d.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat2d.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2d} by the given angle around the given axis\r\n * Equivalent to `Mat2d.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat2d.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2d.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2d.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2d}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 6 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2d}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2d}\r\n */\r\n static create(): Mat2d {\r\n return new Mat2d();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2d} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2d}\r\n */\r\n static clone(a: Readonly): Mat2d {\r\n return new Mat2d(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2d} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2dLike, a: Readonly): Mat2dLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2d} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2d}\r\n */\r\n static fromValues(...values: number[]): Mat2d {\r\n return new Mat2d(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2d} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2dLike, ...values: number[]): Mat2dLike {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2d} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2dLike): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2dLike, a: Mat2dLike): Mat2dLike | null {\r\n const aa = a[0];\r\n const ab = a[1];\r\n const ac = a[2];\r\n const ad = a[3];\r\n const atx = a[4];\r\n const aty = a[5];\r\n\r\n let det = aa * ad - ab * ac;\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = ad * det;\r\n out[1] = -ab * det;\r\n out[2] = -ac * det;\r\n out[3] = aa * det;\r\n out[4] = (ac * aty - ad * atx) * det;\r\n out[5] = (ab * atx - aa * aty) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[1] * a[2];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2d}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n out[4] = a0 * b4 + a2 * b5 + a4;\r\n out[5] = a1 * b4 + a3 * b5 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat2d} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n out[4] = a0 * v0 + a2 * v1 + a4;\r\n out[5] = a1 * v0 + a3 * v1 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat2d} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2dLike, a: Readonly, rad: number): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n // TODO: Got to fromRotation\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = v[0];\r\n out[5] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2dLike, rad: number): Mat2dLike {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2d} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2dLike, a: Readonly, b: number): Mat2dLike {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2dLike, a: Readonly, b: Readonly, scale: number):\r\n Mat2dLike {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2d(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Static method alias assignments\r\nMat2d.mul = Mat2d.multiply;\r\nMat2d.sub = Mat2d.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Mat3Like, Mat4Like, Vec2Like, QuatLike } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 3x3 Matrix\r\n */\r\nexport class Mat3 extends Float64Array {\r\n static #IDENTITY_3X3 = new Float64Array([\r\n 1, 0, 0,\r\n 0, 1, 0,\r\n 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 9:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 9); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v,\r\n v, v, v,\r\n v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 9);\r\n }\r\n break;\r\n default:\r\n super(Mat3.#IDENTITY_3X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat3.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat3.#IDENTITY_3X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat3} against another one\r\n * Equivalent to `Mat3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat3.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat3}\r\n * Equivalent to `Mat3.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat3.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat3}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat3.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat3} by the given vector\r\n * Equivalent to `Mat3.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat3.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat3} by the given angle around the given axis\r\n * Equivalent to `Mat3.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat3.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat3.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat3.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 9 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat3}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat3}\r\n */\r\n static create(): Mat3 {\r\n return new Mat3();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat3} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat3}\r\n */\r\n static clone(a: Readonly): Mat3 {\r\n return new Mat3(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat3} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat3} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat3}\r\n */\r\n static fromValues(...values: number[]): Mat3 {\r\n return new Mat3(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat3} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat3Like, ...values: number[]): Mat3Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat3} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat3Like): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat3Like, a: Readonly): Mat3Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a12 = a[5];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a01;\r\n out[5] = a[7];\r\n out[6] = a02;\r\n out[7] = a12;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a[1];\r\n out[4] = a[4];\r\n out[5] = a[7];\r\n out[6] = a[2];\r\n out[7] = a[5];\r\n out[8] = a[8];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat3Like, a: Mat3Like): Mat3Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2];\r\n const a10 = a[3],\r\n a11 = a[4],\r\n a12 = a[5];\r\n const a20 = a[6],\r\n a21 = a[7],\r\n a22 = a[8];\r\n\r\n const b01 = a22 * a11 - a12 * a21;\r\n const b11 = -a22 * a10 + a12 * a20;\r\n const b21 = a21 * a10 - a11 * a20;\r\n\r\n // Calculate the determinant\r\n let det = a00 * b01 + a01 * b11 + a02 * b21;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = b01 * det;\r\n out[1] = (-a22 * a01 + a02 * a21) * det;\r\n out[2] = (a12 * a01 - a02 * a11) * det;\r\n out[3] = b11 * det;\r\n out[4] = (a22 * a00 - a02 * a20) * det;\r\n out[5] = (-a12 * a00 + a02 * a10) * det;\r\n out[6] = b21 * det;\r\n out[7] = (-a21 * a00 + a01 * a20) * det;\r\n out[8] = (a11 * a00 - a01 * a10) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat3Like, a: Mat3Like): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n out[0] = a11 * a22 - a12 * a21;\r\n out[1] = a02 * a21 - a01 * a22;\r\n out[2] = a01 * a12 - a02 * a11;\r\n out[3] = a12 * a20 - a10 * a22;\r\n out[4] = a00 * a22 - a02 * a20;\r\n out[5] = a02 * a10 - a00 * a12;\r\n out[6] = a10 * a21 - a11 * a20;\r\n out[7] = a01 * a20 - a00 * a21;\r\n out[8] = a00 * a11 - a01 * a10;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n return (\r\n a00 * (a22 * a11 - a12 * a21) +\r\n a01 * (-a22 * a10 + a12 * a20) +\r\n a02 * (a21 * a10 - a11 * a20)\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[3];\r\n b1 = b[4];\r\n b2 = b[5];\r\n out[3] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[4] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[5] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[6];\r\n b1 = b[7];\r\n b2 = b[8];\r\n out[6] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[7] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[8] = b0 * a02 + b1 * a12 + b2 * a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat3} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n\r\n out[3] = a10;\r\n out[4] = a11;\r\n out[5] = a12;\r\n\r\n out[6] = x * a00 + y * a10 + a20;\r\n out[7] = x * a01 + y * a11 + a21;\r\n out[8] = x * a02 + y * a12 + a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat3} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat3Like, a: Readonly, rad: number): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c * a00 + s * a10;\r\n out[1] = c * a01 + s * a11;\r\n out[2] = c * a02 + s * a12;\r\n\r\n out[3] = c * a10 - s * a00;\r\n out[4] = c * a11 - s * a01;\r\n out[5] = c * a12 - s * a02;\r\n\r\n out[6] = a20;\r\n out[7] = a21;\r\n out[8] = a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat3} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = x * a[0];\r\n out[1] = x * a[1];\r\n out[2] = x * a[2];\r\n\r\n out[3] = y * a[3];\r\n out[4] = y * a[4];\r\n out[5] = y * a[5];\r\n\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = v[0];\r\n out[7] = v[1];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.rotate(dest, dest, rad);\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat3Like, rad: number): Mat3Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n\r\n out[3] = -s;\r\n out[4] = c;\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n\r\n out[3] = 0;\r\n out[4] = v[1];\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat2d} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 2x3 matrix\r\n * @returns `out`\r\n */\r\n static fromMat2d(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = 0;\r\n\r\n out[3] = a[2];\r\n out[4] = a[3];\r\n out[5] = 0;\r\n\r\n out[6] = a[4];\r\n out[7] = a[5];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param q - {@link Quat} to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat3Like, q: Readonly): Mat3Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[3] = yx - wz;\r\n out[6] = zx + wy;\r\n\r\n out[1] = yx + wz;\r\n out[4] = 1 - xx - zz;\r\n out[7] = zy - wx;\r\n\r\n out[2] = zx - wy;\r\n out[5] = zy + wx;\r\n out[8] = 1 - xx - yy;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat4} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 4x4 matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[4];\r\n out[4] = a[5];\r\n out[5] = a[6];\r\n out[6] = a[8];\r\n out[7] = a[9];\r\n out[8] = a[10];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\r\n * @category Static\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat3Like, a: Readonly): Mat3Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n\r\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n\r\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat3Like, a: Readonly): Mat3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n\r\n out[3] = cy * az - cz * ay;\r\n out[4] = cz * ax - cx * az;\r\n out[5] = cx * ay - cy * ax;\r\n\r\n out[6] = ay * bz - az * by;\r\n out[7] = az * bx - ax * bz;\r\n out[8] = ax * by - ay * bx;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a 2D projection matrix with the given bounds\r\n * @category Static\r\n *\r\n * @param out mat3 frustum matrix will be written into\r\n * @param width Width of your gl context\r\n * @param height Height of gl context\r\n * @returns `out`\r\n */\r\n static projection(out: Mat3Like, width: number, height: number): Mat3Like {\r\n out[0] = 2 / width;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -2 / height;\r\n out[5] = 0;\r\n out[6] = -1;\r\n out[7] = 1;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8]\r\n );\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat3} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat3Like, a: Readonly, b: number): Mat3Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat3Like, a: Readonly, b: Readonly, scale: number): Mat3Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat3(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat3.prototype.mul = Mat3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat3.mul = Mat3.multiply;\r\nMat3.sub = Mat3.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 4x4 Matrix\r\n */\r\nexport class Mat4 extends Float64Array {\r\n static #IDENTITY_4X4 = new Float64Array([\r\n 1, 0, 0, 0,\r\n 0, 1, 0, 0,\r\n 0, 0, 1, 0,\r\n 0, 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Temporary variable to prevent repeated allocations in the algorithms within Mat4.\r\n * These are declared as TypedArrays to aid in tree-shaking.\r\n */\r\n static #TMP_VEC3 = new Float64Array(3);\r\n\r\n /**\r\n * Create a {@link Mat4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 16:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 16); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 16);\r\n }\r\n break;\r\n default:\r\n super(Mat4.#IDENTITY_4X4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat4.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat4.#IDENTITY_4X4);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat4} against another one\r\n * Equivalent to `Mat4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat4.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat4}\r\n * Equivalent to `Mat4.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat4.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat4}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat4.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat4} by the given vector\r\n * Equivalent to `Mat4.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat4.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the given axis\r\n * Equivalent to `Mat4.rotate(this, this, rad, axis);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `this`\r\n */\r\n rotate(rad: number, axis: Readonly): this {\r\n return Mat4.rotate(this, this, rad, axis) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat4.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat4.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the X axis\r\n * Equivalent to `Mat4.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Mat4.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Y axis\r\n * Equivalent to `Mat4.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Mat4.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Z axis\r\n * Equivalent to `Mat4.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Mat4.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveNO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveNO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveZO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveZO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoNO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoNO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoZO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoZO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 16 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat4}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat4}\r\n */\r\n static create(): Mat4 {\r\n return new Mat4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat4} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat4}\r\n */\r\n static clone(a: Readonly): Mat4 {\r\n return new Mat4(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat4} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat4Like, a: Readonly): Mat4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new mat4 with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat4}\r\n */\r\n static fromValues(...values: number[]): Mat4 {\r\n return new Mat4(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a mat4 to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat4Like, ...values: number[]): Mat4Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n out[9] = values[9];\r\n out[10] = values[10];\r\n out[11] = values[11];\r\n out[12] = values[12];\r\n out[13] = values[13];\r\n out[14] = values[14];\r\n out[15] = values[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat4} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat4Like): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat4Like, a: Readonly): Mat4Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a12 = a[6],\r\n a13 = a[7];\r\n const a23 = a[11];\r\n\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a01;\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a02;\r\n out[9] = a12;\r\n out[11] = a[14];\r\n out[12] = a03;\r\n out[13] = a13;\r\n out[14] = a23;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a[1];\r\n out[5] = a[5];\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a[2];\r\n out[9] = a[6];\r\n out[10] = a[10];\r\n out[11] = a[14];\r\n out[12] = a[3];\r\n out[13] = a[7];\r\n out[14] = a[11];\r\n out[15] = a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat4Like, a: Mat4Like): Mat4Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\r\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\r\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\r\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\r\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\r\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\r\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat4Like, a: Mat4Like): Mat4Like {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n out[0] = a11 * b11 - a12 * b10 + a13 * b09;\r\n out[1] = a02 * b10 - a01 * b11 - a03 * b09;\r\n out[2] = a31 * b05 - a32 * b04 + a33 * b03;\r\n out[3] = a22 * b04 - a21 * b05 - a23 * b03;\r\n out[4] = a12 * b08 - a10 * b11 - a13 * b07;\r\n out[5] = a00 * b11 - a02 * b08 + a03 * b07;\r\n out[6] = a32 * b02 - a30 * b05 - a33 * b01;\r\n out[7] = a20 * b05 - a22 * b02 + a23 * b01;\r\n out[8] = a10 * b10 - a11 * b08 + a13 * b06;\r\n out[9] = a01 * b08 - a00 * b10 - a03 * b06;\r\n out[10] = a30 * b04 - a31 * b02 + a33 * b00;\r\n out[11] = a21 * b02 - a20 * b04 - a23 * b00;\r\n out[12] = a11 * b07 - a10 * b09 - a12 * b06;\r\n out[13] = a00 * b09 - a01 * b07 + a02 * b06;\r\n out[14] = a31 * b01 - a30 * b03 - a32 * b00;\r\n out[15] = a20 * b03 - a21 * b01 + a22 * b00;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b0 = a00 * a11 - a01 * a10;\r\n const b1 = a00 * a12 - a02 * a10;\r\n const b2 = a01 * a12 - a02 * a11;\r\n const b3 = a20 * a31 - a21 * a30;\r\n const b4 = a20 * a32 - a22 * a30;\r\n const b5 = a21 * a32 - a22 * a31;\r\n const b6 = a00 * b5 - a01 * b4 + a02 * b3;\r\n const b7 = a10 * b5 - a11 * b4 + a12 * b3;\r\n const b8 = a20 * b2 - a21 * b1 + a22 * b0;\r\n const b9 = a30 * b2 - a31 * b1 + a32 * b0;\r\n\r\n // Calculate the determinant\r\n return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Mat4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n // Cache only the current line of the second matrix\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n let b3 = b[3];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[4];\r\n b1 = b[5];\r\n b2 = b[6];\r\n b3 = b[7];\r\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[8];\r\n b1 = b[9];\r\n b2 = b[10];\r\n b3 = b[11];\r\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[12];\r\n b1 = b[13];\r\n b2 = b[14];\r\n b3 = b[15];\r\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat4} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n if (a === out) {\r\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\r\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\r\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\r\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\r\n } else {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n out[3] = a03;\r\n out[4] = a10;\r\n out[5] = a11;\r\n out[6] = a12;\r\n out[7] = a13;\r\n out[8] = a20;\r\n out[9] = a21;\r\n out[10] = a22;\r\n out[11] = a23;\r\n\r\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\r\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\r\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\r\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec3} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n out[0] = a[0] * x;\r\n out[1] = a[1] * x;\r\n out[2] = a[2] * x;\r\n out[3] = a[3] * x;\r\n out[4] = a[4] * y;\r\n out[5] = a[5] * y;\r\n out[6] = a[6] * y;\r\n out[7] = a[7] * y;\r\n out[8] = a[8] * z;\r\n out[9] = a[9] * z;\r\n out[10] = a[10] * z;\r\n out[11] = a[11] * z;\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat4} by the given angle around the given axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if axis has a length of 0\r\n */\r\n static rotate(out: Mat4Like, a: Readonly, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n // Construct the elements of the rotation matrix\r\n const b00 = x * x * t + c;\r\n const b01 = y * x * t + z * s;\r\n const b02 = z * x * t - y * s;\r\n const b10 = x * y * t - z * s;\r\n const b11 = y * y * t + c;\r\n const b12 = z * y * t + x * s;\r\n const b20 = x * z * t + y * s;\r\n const b21 = y * z * t - x * s;\r\n const b22 = z * z * t + c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\r\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\r\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\r\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\r\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\r\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\r\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\r\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\r\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\r\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\r\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\r\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateX(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[4] = a10 * c + a20 * s;\r\n out[5] = a11 * c + a21 * s;\r\n out[6] = a12 * c + a22 * s;\r\n out[7] = a13 * c + a23 * s;\r\n out[8] = a20 * c - a10 * s;\r\n out[9] = a21 * c - a11 * s;\r\n out[10] = a22 * c - a12 * s;\r\n out[11] = a23 * c - a13 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateY(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c - a20 * s;\r\n out[1] = a01 * c - a21 * s;\r\n out[2] = a02 * c - a22 * s;\r\n out[3] = a03 * c - a23 * s;\r\n out[8] = a00 * s + a20 * c;\r\n out[9] = a01 * s + a21 * c;\r\n out[10] = a02 * s + a22 * c;\r\n out[11] = a03 * s + a23 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c + a10 * s;\r\n out[1] = a01 * c + a11 * s;\r\n out[2] = a02 * c + a12 * s;\r\n out[3] = a03 * c + a13 * s;\r\n out[4] = a10 * c - a00 * s;\r\n out[5] = a11 * c - a01 * s;\r\n out[6] = a12 * c - a02 * s;\r\n out[7] = a13 * c - a03 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = v[1];\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = v[2];\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotate(dest, dest, rad, axis);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if `axis` has a length of 0\r\n */\r\n static fromRotation(out: Mat4Like, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = x * x * t + c;\r\n out[1] = y * x * t + z * s;\r\n out[2] = z * x * t - y * s;\r\n out[3] = 0;\r\n out[4] = x * y * t - z * s;\r\n out[5] = y * y * t + c;\r\n out[6] = z * y * t + x * s;\r\n out[7] = 0;\r\n out[8] = x * z * t + y * s;\r\n out[9] = y * z * t - x * s;\r\n out[10] = z * z * t + c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the X axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateX(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromXRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = c;\r\n out[6] = s;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = -s;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Y axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateY(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromYRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = 0;\r\n out[2] = -s;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = s;\r\n out[9] = 0;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Z axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateZ(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromZRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -s;\r\n out[5] = c;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation and vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Mat4Like, q: Readonly, v: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - (yy + zz);\r\n out[1] = xy + wz;\r\n out[2] = xz - wy;\r\n out[3] = 0;\r\n out[4] = xy - wz;\r\n out[5] = 1 - (xx + zz);\r\n out[6] = yz + wx;\r\n out[7] = 0;\r\n out[8] = xz + wy;\r\n out[9] = yz - wx;\r\n out[10] = 1 - (xx + yy);\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Mat4} from a {@link Quat2}.\r\n * @category Static\r\n *\r\n * @param out - Matrix\r\n * @param a - Dual Quaternion\r\n * @returns `out`\r\n */\r\n static fromQuat2(out: Mat4Like, a: Quat2Like): Mat4Like {\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n\r\n const magnitude = bx * bx + by * by + bz * bz + bw * bw;\r\n\r\n // Only scale if it makes sense\r\n if (magnitude > 0) {\r\n Mat4.#TMP_VEC3[0] = ((ax * bw + aw * bx + ay * bz - az * by) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[1] = ((ay * bw + aw * by + az * bx - ax * bz) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[2] = ((az * bw + aw * bz + ax * by - ay * bx) * 2) / magnitude;\r\n } else {\r\n Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n }\r\n Mat4.fromRotationTranslation(out, a as QuatLike, Mat4.#TMP_VEC3);\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat4Like, a: Readonly): Mat4Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[3] = 0;\r\n\r\n out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[7] = 0;\r\n\r\n out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat4Like, a: Readonly): Mat4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n out[3] = 0;\r\n\r\n out[4] = cy * az - cz * ay;\r\n out[5] = cz * ax - cx * az;\r\n out[6] = cx * ay - cy * ax;\r\n out[7] = 0;\r\n\r\n out[8] = ay * bz - az * by;\r\n out[9] = az * bx - ax * bz;\r\n out[10] = ax * by - ay * bx;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the translation vector component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslation,\r\n * the returned vector will be the same as the translation vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive translation component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getTranslation(out: Vec3Like, mat: Readonly): Vec3Like {\r\n out[0] = mat[12];\r\n out[1] = mat[13];\r\n out[2] = mat[14];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the scaling factor component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslationScale\r\n * with a normalized Quaternion parameter, the returned vector will be\r\n * the same as the scaling vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive scaling factor component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getScaling(out: Vec3Like, mat: Readonly): Vec3Like {\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a quaternion representing the rotational component\r\n * of a transformation matrix. If a matrix is built with\r\n * fromRotationTranslation, the returned quaternion will be the\r\n * same as the quaternion originally supplied.\r\n * @category Static\r\n *\r\n * @param out - Quaternion to receive the rotation component\r\n * @param mat - Matrix to be decomposed (input)\r\n * @return `out`\r\n */\r\n static getRotation(out: QuatLike, mat: Readonly): QuatLike {\r\n Mat4.getScaling(Mat4.#TMP_VEC3, mat);\r\n\r\n const is1 = 1 / Mat4.#TMP_VEC3[0];\r\n const is2 = 1 / Mat4.#TMP_VEC3[1];\r\n const is3 = 1 / Mat4.#TMP_VEC3[2];\r\n\r\n const sm11 = mat[0] * is1;\r\n const sm12 = mat[1] * is2;\r\n const sm13 = mat[2] * is3;\r\n const sm21 = mat[4] * is1;\r\n const sm22 = mat[5] * is2;\r\n const sm23 = mat[6] * is3;\r\n const sm31 = mat[8] * is1;\r\n const sm32 = mat[9] * is2;\r\n const sm33 = mat[10] * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out[3] = 0.25 * S;\r\n out[0] = (sm23 - sm32) / S;\r\n out[1] = (sm31 - sm13) / S;\r\n out[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out[3] = (sm23 - sm32) / S;\r\n out[0] = 0.25 * S;\r\n out[1] = (sm12 + sm21) / S;\r\n out[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out[3] = (sm31 - sm13) / S;\r\n out[0] = (sm12 + sm21) / S;\r\n out[1] = 0.25 * S;\r\n out[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out[3] = (sm12 - sm21) / S;\r\n out[0] = (sm31 + sm13) / S;\r\n out[1] = (sm23 + sm32) / S;\r\n out[2] = 0.25 * S;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Decomposes a transformation matrix into its rotation, translation\r\n * and scale components. Returns only the rotation component\r\n * @category Static\r\n *\r\n * @param out_r - Quaternion to receive the rotation component\r\n * @param out_t - Vector to receive the translation vector\r\n * @param out_s - Vector to receive the scaling factor\r\n * @param mat - Matrix to be decomposed (input)\r\n * @returns `out_r`\r\n */\r\n static decompose(out_r: QuatLike, out_t: Vec3Like, out_s: Vec3Like, mat: Readonly): QuatLike {\r\n out_t[0] = mat[12];\r\n out_t[1] = mat[13];\r\n out_t[2] = mat[14];\r\n\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n const is1 = 1 / out_s[0];\r\n const is2 = 1 / out_s[1];\r\n const is3 = 1 / out_s[2];\r\n\r\n const sm11 = m11 * is1;\r\n const sm12 = m12 * is2;\r\n const sm13 = m13 * is3;\r\n const sm21 = m21 * is1;\r\n const sm22 = m22 * is2;\r\n const sm23 = m23 * is3;\r\n const sm31 = m31 * is1;\r\n const sm32 = m32 * is2;\r\n const sm33 = m33 * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out_r[3] = 0.25 * S;\r\n out_r[0] = (sm23 - sm32) / S;\r\n out_r[1] = (sm31 - sm13) / S;\r\n out_r[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out_r[3] = (sm23 - sm32) / S;\r\n out_r[0] = 0.25 * S;\r\n out_r[1] = (sm12 + sm21) / S;\r\n out_r[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out_r[3] = (sm31 - sm13) / S;\r\n out_r[0] = (sm12 + sm21) / S;\r\n out_r[1] = 0.25 * S;\r\n out_r[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out_r[3] = (sm12 - sm21) / S;\r\n out_r[0] = (sm31 + sm13) / S;\r\n out_r[1] = (sm23 + sm32) / S;\r\n out_r[2] = 0.25 * S;\r\n }\r\n\r\n return out_r;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScale(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n out[0] = (1 - (yy + zz)) * sx;\r\n out[1] = (xy + wz) * sx;\r\n out[2] = (xz - wy) * sx;\r\n out[3] = 0;\r\n out[4] = (xy - wz) * sy;\r\n out[5] = (1 - (xx + zz)) * sy;\r\n out[6] = (yz + wx) * sy;\r\n out[7] = 0;\r\n out[8] = (xz + wy) * sz;\r\n out[9] = (yz - wx) * sz;\r\n out[10] = (1 - (xx + yy)) * sz;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the\r\n * given origin. This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * mat4.translate(dest, origin);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n * mat4.translate(dest, negativeOrigin);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @param o - The origin vector around which to scale and rotate\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScaleOrigin(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly, o: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n const ox = o[0];\r\n const oy = o[1];\r\n const oz = o[2];\r\n\r\n const out0 = (1 - (yy + zz)) * sx;\r\n const out1 = (xy + wz) * sx;\r\n const out2 = (xz - wy) * sx;\r\n const out4 = (xy - wz) * sy;\r\n const out5 = (1 - (xx + zz)) * sy;\r\n const out6 = (yz + wx) * sy;\r\n const out8 = (xz + wy) * sz;\r\n const out9 = (yz - wx) * sz;\r\n const out10 = (1 - (xx + yy)) * sz;\r\n\r\n out[0] = out0;\r\n out[1] = out1;\r\n out[2] = out2;\r\n out[3] = 0;\r\n out[4] = out4;\r\n out[5] = out5;\r\n out[6] = out6;\r\n out[7] = 0;\r\n out[8] = out8;\r\n out[9] = out9;\r\n out[10] = out10;\r\n out[11] = 0;\r\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\r\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\r\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 4x4 matrix from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Quaternion to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat4Like, q: Readonly): Mat4Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[1] = yx + wz;\r\n out[2] = zx - wy;\r\n out[3] = 0;\r\n\r\n out[4] = yx - wz;\r\n out[5] = 1 - xx - zz;\r\n out[6] = zy + wx;\r\n out[7] = 0;\r\n\r\n out[8] = zx + wy;\r\n out[9] = zy - wx;\r\n out[10] = 1 - xx - yy;\r\n out[11] = 0;\r\n\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.frustumNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly\r\n */\r\n static frustum(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like { return out; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveNO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.perspectiveNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static perspective(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveZO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating\r\n * projection matrices to be used with the still experimental WebVR API.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n * @deprecated\r\n */\r\n static perspectiveFromFieldOfView(out: Mat4Like,\r\n fov: { upDegrees: number, downDegrees: number, leftDegrees: number, rightDegrees: number }, near: number,\r\n far: number): Mat4Like {\r\n\r\n const upTan = Math.tan((fov.upDegrees * Math.PI) / 180.0);\r\n const downTan = Math.tan((fov.downDegrees * Math.PI) / 180.0);\r\n const leftTan = Math.tan((fov.leftDegrees * Math.PI) / 180.0);\r\n const rightTan = Math.tan((fov.rightDegrees * Math.PI) / 180.0);\r\n const xScale = 2.0 / (leftTan + rightTan);\r\n const yScale = 2.0 / (upTan + downTan);\r\n\r\n out[0] = xScale;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n out[4] = 0.0;\r\n out[5] = yScale;\r\n out[6] = 0.0;\r\n out[7] = 0.0;\r\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\r\n out[9] = (upTan - downTan) * yScale * 0.5;\r\n out[10] = far / (near - far);\r\n out[11] = -1.0;\r\n out[12] = 0.0;\r\n out[13] = 0.0;\r\n out[14] = (far * near) / (near - far);\r\n out[15] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 2 * nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = (far + near) * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.orthoNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static ortho(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, far: number):\r\n Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = near * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that\r\n * actually makes an object look at another object, you should use targetTo instead.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param center - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static lookAt(out: Mat4Like, eye: Readonly, center: Readonly, up: Readonly): Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n const centerx = center[0];\r\n const centery = center[1];\r\n const centerz = center[2];\r\n\r\n if (\r\n Math.abs(eyex - centerx) < GLM_EPSILON &&\r\n Math.abs(eyey - centery) < GLM_EPSILON &&\r\n Math.abs(eyez - centerz) < GLM_EPSILON\r\n ) {\r\n return Mat4.identity(out);\r\n }\r\n\r\n let z0 = eyex - centerx;\r\n let z1 = eyey - centery;\r\n let z2 = eyez - centerz;\r\n\r\n let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\r\n if (!len) {\r\n x0 = 0;\r\n x1 = 0;\r\n x2 = 0;\r\n } else {\r\n len = 1 / len;\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n let y0 = z1 * x2 - z2 * x1;\r\n let y1 = z2 * x0 - z0 * x2;\r\n let y2 = z0 * x1 - z1 * x0;\r\n\r\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\r\n if (!len) {\r\n y0 = 0;\r\n y1 = 0;\r\n y2 = 0;\r\n } else {\r\n len = 1 / len;\r\n y0 *= len;\r\n y1 *= len;\r\n y2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = y0;\r\n out[2] = z0;\r\n out[3] = 0;\r\n out[4] = x1;\r\n out[5] = y1;\r\n out[6] = z1;\r\n out[7] = 0;\r\n out[8] = x2;\r\n out[9] = y2;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\r\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\r\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a matrix that makes something look at something else.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param target - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static targetTo(out: Mat4Like, eye: Readonly, target: Readonly, up: Readonly):\r\n Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n\r\n let z0 = eyex - target[0];\r\n let z1 = eyey - target[1];\r\n let z2 = eyez - target[2];\r\n\r\n let len = z0 * z0 + z1 * z1 + z2 * z2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n }\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n\r\n len = x0 * x0 + x1 * x1 + x2 * x2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = x1;\r\n out[2] = x2;\r\n out[3] = 0;\r\n out[4] = z1 * x2 - z2 * x1;\r\n out[5] = z2 * x0 - z0 * x2;\r\n out[6] = z0 * x1 - z1 * x0;\r\n out[7] = 0;\r\n out[8] = z0;\r\n out[9] = z1;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = eyex;\r\n out[13] = eyey;\r\n out[14] = eyez;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8] +\r\n a[9] * a[9] +\r\n a[10] * a[10] +\r\n a[11] * a[11] +\r\n a[12] * a[12] +\r\n a[13] * a[13] +\r\n a[14] * a[14] +\r\n a[15] * a[15]\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n out[9] = a[9] + b[9];\r\n out[10] = a[10] + b[10];\r\n out[11] = a[11] + b[11];\r\n out[12] = a[12] + b[12];\r\n out[13] = a[13] + b[13];\r\n out[14] = a[14] + b[14];\r\n out[15] = a[15] + b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n out[9] = a[9] - b[9];\r\n out[10] = a[10] - b[10];\r\n out[11] = a[11] - b[11];\r\n out[12] = a[12] - b[12];\r\n out[13] = a[13] - b[13];\r\n out[14] = a[14] - b[14];\r\n out[15] = a[15] - b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Multiply each element of the matrix by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat4Like, a: Readonly, b: number): Mat4Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n out[9] = a[9] * b;\r\n out[10] = a[10] * b;\r\n out[11] = a[11] * b;\r\n out[12] = a[12] * b;\r\n out[13] = a[13] * b;\r\n out[14] = a[14] * b;\r\n out[15] = a[15] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat4Like, a: Readonly, b: Readonly, scale: number): Mat4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n out[9] = a[9] + b[9] * scale;\r\n out[10] = a[10] + b[10] * scale;\r\n out[11] = a[11] + b[11] * scale;\r\n out[12] = a[12] + b[12] * scale;\r\n out[13] = a[13] + b[13] * scale;\r\n out[14] = a[14] + b[14] * scale;\r\n out[15] = a[15] + b[15] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8] &&\r\n a[9] === b[9] &&\r\n a[10] === b[10] &&\r\n a[11] === b[11] &&\r\n a[12] === b[12] &&\r\n a[13] === b[13] &&\r\n a[14] === b[14] &&\r\n a[15] === b[15]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n const a9 = a[9];\r\n const a10 = a[10];\r\n const a11 = a[11];\r\n const a12 = a[12];\r\n const a13 = a[13];\r\n const a14 = a[14];\r\n const a15 = a[15];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n const b9 = b[9];\r\n const b10 = b[10];\r\n const b11 = b[11];\r\n const b12 = b[12];\r\n const b13 = b[13];\r\n const b14 = b[14];\r\n const b15 = b[15];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) &&\r\n Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) &&\r\n Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) &&\r\n Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) &&\r\n Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) &&\r\n Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) &&\r\n Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) &&\r\n Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat4(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat4.prototype.mul = Mat4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat4.sub = Mat4.subtract;\r\nMat4.mul = Mat4.multiply;\r\nMat4.frustum = Mat4.frustumNO;\r\nMat4.perspective = Mat4.perspectiveNO;\r\nMat4.ortho = Mat4.orthoNO;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, Mat4Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 3 Dimensional Vector\r\n */\r\nexport class Vec3 extends Float64Array {\r\n /**\r\n * Create a {@link Vec3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 3:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 3); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 3);\r\n }\r\n break;\r\n }\r\n default:\r\n super(3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec3.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec3.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec3} to `this`.\r\n * Equivalent to `Vec3.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec3} from `this`.\r\n * Equivalent to `Vec3.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec3.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec3.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec3.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec3.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec3.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to its absolute value.\r\n * Equivalent to `Vec3.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec3}.\r\n * Equivalent to `Vec3.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec3.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec3.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 3 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty vec3\r\n * @category Static\r\n *\r\n * @returns a new 3D vector\r\n */\r\n static create(): Vec3 {\r\n return new Vec3();\r\n }\r\n\r\n /**\r\n * Creates a new vec3 initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 3D vector\r\n */\r\n static clone(a: Readonly): Vec3 {\r\n return new Vec3(a);\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Creates a new vec3 initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns a new 3D vector\r\n */\r\n static fromValues(x: number, y: number, z: number): Vec3 {\r\n return new Vec3(x, y, z);\r\n }\r\n\r\n /**\r\n * Copy the values from one vec3 to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns `out`\r\n */\r\n static set(out: Vec3Like, x: number, y: number, z: number): Vec3Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Multiplies two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; }\r\n\r\n /**\r\n * Divides two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Math.ceil the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * symmetric round the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n /*\r\n static round(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = glMatrix.round(a[0]);\r\n out[1] = glMatrix.round(a[1]);\r\n out[2] = glMatrix.round(a[2]);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Scales a vec3 by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec3Like, a: Readonly, scale: number): Vec3Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two vec3's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec3Like, a: Readonly, b: Readonly, scale: number) {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared length of a vec3\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec3Like, a: Readonly): Vec3Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n let len = x * x + y * y + z * z;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n out[2] = a[2] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2];\r\n const bx = b[0],\r\n by = b[1],\r\n bz = b[2];\r\n\r\n out[0] = ay * bz - az * by;\r\n out[1] = az * bx - ax * bz;\r\n out[2] = ax * by - ay * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const angle = Math.acos(Math.min(Math.max(Vec3.dot(a, b), -1), 1));\r\n const sinTotal = Math.sin(angle);\r\n\r\n const ratioA = Math.sin((1 - t) * angle) / sinTotal;\r\n const ratioB = Math.sin(t * angle) / sinTotal;\r\n out[0] = ratioA * a[0] + ratioB * b[0];\r\n out[1] = ratioA * a[1] + ratioB * b[1];\r\n out[2] = ratioA * a[2] + ratioB * b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a hermite interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static hermite(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const factorTimes2 = t * t;\r\n const factor1 = factorTimes2 * (2 * t - 3) + 1;\r\n const factor2 = factorTimes2 * (t - 2) + t;\r\n const factor3 = factorTimes2 * (t - 1);\r\n const factor4 = factorTimes2 * (3 - 2 * t);\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a bezier interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static bezier(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const inverseFactor = 1 - t;\r\n const inverseFactorTimesTwo = inverseFactor * inverseFactor;\r\n const factorTimes2 = t * t;\r\n const factor1 = inverseFactorTimesTwo * inverseFactor;\r\n const factor2 = 3 * t * inverseFactorTimesTwo;\r\n const factor3 = 3 * factorTimes2 * inverseFactor;\r\n const factor4 = factorTimes2 * t;\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec3Like, scale) {\r\n scale = scale === undefined ? 1.0 : scale;\r\n\r\n let r = glMatrix.RANDOM() * 2.0 * Math.PI;\r\n let z = glMatrix.RANDOM() * 2.0 - 1.0;\r\n let zScale = Math.sqrt(1.0 - z * z) * scale;\r\n\r\n out[0] = Math.cos(r) * zScale;\r\n out[1] = Math.sin(r) * zScale;\r\n out[2] = z * scale;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the vec3 with a mat4.\r\n * 4th vector component is implicitly '1'\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec3Like, a: Readonly, m: Readonly): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1.0;\r\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\r\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\r\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a mat3.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - the 3x3 matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat3(out: Vec3Like, a: Vec3Like, m: Mat3Like): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n out[0] = x * m[0] + y * m[3] + z * m[6];\r\n out[1] = x * m[1] + y * m[4] + z * m[7];\r\n out[2] = x * m[2] + y * m[5] + z * m[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a quat\r\n * Can also be used for dual quaternions. (Multiply it with the real part)\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec3Like, a: Readonly, q: Readonly): Vec3Like {\r\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const w2 = q[3] * 2;\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n // var qvec = [qx, qy, qz];\r\n // var uv = vec3.cross([], qvec, a);\r\n const uvx = (qy * z - qz * y);\r\n const uvy = (qz * x - qx * z);\r\n const uvz = (qx * y - qy * x);\r\n // var uuv = vec3.cross([], qvec, uv);\r\n // vec3.scale(uuv, uuv, 2);\r\n const uuvx = (qy * uvz - qz * uvy) * 2;\r\n const uuvy = (qz * uvx - qx * uvz) * 2;\r\n const uuvz = (qx * uvy - qy * uvx) * 2;\r\n // vec3.scale(uv, uv, 2 * w);\r\n // return vec3.add(out, a, vec3.add(out, uv, uuv));\r\n out[0] = x + (uvx * w2) + uuvx;\r\n out[1] = y + (uvy * w2) + uuvy;\r\n out[2] = z + (uvz * w2) + uuvz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the x-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateX(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const by = b[1];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const py = a[1] - by;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = a[0];\r\n out[1] = (py * Math.cos(rad) - pz * Math.sin(rad)) + by;\r\n out[2] = (py * Math.sin(rad) + pz * Math.cos(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the y-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateY(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (pz * Math.sin(rad) + px * Math.cos(rad)) + bx;\r\n out[1] = a[1];\r\n out[2] = (pz * Math.cos(rad) - px * Math.sin(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the z-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const by = b[1];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const py = a[1] - by;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (px * Math.cos(rad) - py * Math.sin(rad)) + bx;\r\n out[1] = (px * Math.sin(rad) + py * Math.cos(rad)) + by;\r\n out[2] = b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 3D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly) {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz));\r\n const cosine = mag && Vec3.dot(a, b) / mag;\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec3Like): Vec3Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec3(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec3.prototype.sub = Vec3.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.mul = Vec3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.div = Vec3.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.dist = Vec3.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.sqrDist = Vec3.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec3.sub = Vec3.subtract;\r\nVec3.mul = Vec3.multiply;\r\nVec3.div = Vec3.divide;\r\nVec3.dist = Vec3.distance;\r\nVec3.sqrDist = Vec3.squaredDistance;\r\nVec3.sqrLen = Vec3.squaredLength;\r\nVec3.mag = Vec3.magnitude;\r\nVec3.length = Vec3.magnitude;\r\nVec3.len = Vec3.magnitude;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Vec4Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 4 Dimensional Vector\r\n */\r\nexport class Vec4 extends Float64Array {\r\n /**\r\n * Create a {@link Vec4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the vector. Equivalent to `this[3];`\r\n * @category Vector Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The a component of the vector. Equivalent to `this[3];`\r\n * @category Color Components\r\n */\r\n get a(): number { return this[3]; }\r\n set a(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec4.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec4} to `this`.\r\n * Equivalent to `Vec4.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n this[3] += b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec4} from `this`.\r\n * Equivalent to `Vec4.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n this[3] -= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n this[3] *= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n this[3] /= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec4.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n this[3] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n this[3] += b[3] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec4.distance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec4.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec4.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n this[3] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec4.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n this[3] = 1.0 / this[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec4.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n this[3] = Math.abs(this[3]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec4}.\r\n * Equivalent to `Vec4.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec4.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec4.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec4}\r\n * @category Static\r\n *\r\n * @returns a new 4D vector\r\n */\r\n static create(): Vec4 {\r\n return new Vec4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 4D vector\r\n */\r\n static clone(a: Vec4Like): Vec4 {\r\n return new Vec4(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new 4D vector\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Vec4 {\r\n return new Vec4(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec4} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n static set(out: Vec4Like, x: number, y: number, z: number, w: number): Vec4Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n out[3] = a[3] * b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Divides two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n out[3] = a[3] / b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n out[3] = Math.ceil(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n out[3] = Math.floor(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n out[3] = Math.min(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n out[3] = Math.max(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n out[2] = Math.round(a[2]);\r\n out[3] = Math.round(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec4} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec4Like, a: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}'s after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec4Like, a: Readonly, b: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return Math.hypot(x, y, z, w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of `a`\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = -a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n out[3] = 1.0 / a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n out[3] = Math.abs(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec4Like, a: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n let len = x * x + y * y + z * z + w * w;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = x * len;\r\n out[1] = y * len;\r\n out[2] = z * len;\r\n out[3] = w * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Returns the cross-product of three vectors in a 4-dimensional space\r\n * @category Static\r\n *\r\n * @param out the receiving vector\r\n * @param u - the first vector\r\n * @param v - the second vector\r\n * @param w - the third vector\r\n * @returns result\r\n */\r\n static cross(out: Vec4Like, u: Readonly, v: Readonly, w: Readonly): Vec4Like {\r\n const a = v[0] * w[1] - v[1] * w[0];\r\n const b = v[0] * w[2] - v[2] * w[0];\r\n const c = v[0] * w[3] - v[3] * w[0];\r\n const d = v[1] * w[2] - v[2] * w[1];\r\n const e = v[1] * w[3] - v[3] * w[1];\r\n const f = v[2] * w[3] - v[3] * w[2];\r\n const g = u[0];\r\n const h = u[1];\r\n const i = u[2];\r\n const j = u[3];\r\n\r\n out[0] = h * f - i * e + j * d;\r\n out[1] = -(g * f) + i * c - j * b;\r\n out[2] = g * e - h * c + j * a;\r\n out[3] = -(g * d) + h * b - i * a;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec4Like, a: Readonly, b: Readonly, t: number): Vec4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n out[3] = aw + t * (b[3] - aw);\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec4Like, scale): Vec4Like {\r\n scale = scale || 1.0;\r\n\r\n // Marsaglia, George. Choosing a Point from the Surface of a\r\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\r\n // http://projecteuclid.org/euclid.aoms/1177692644;\r\n var v1, v2, v3, v4;\r\n var s1, s2;\r\n do {\r\n v1 = glMatrix.RANDOM() * 2 - 1;\r\n v2 = glMatrix.RANDOM() * 2 - 1;\r\n s1 = v1 * v1 + v2 * v2;\r\n } while (s1 >= 1);\r\n do {\r\n v3 = glMatrix.RANDOM() * 2 - 1;\r\n v4 = glMatrix.RANDOM() * 2 - 1;\r\n s2 = v3 * v3 + v4 * v4;\r\n } while (s2 >= 1);\r\n\r\n var d = Math.sqrt((1 - s1) / s2);\r\n out[0] = scale * v1;\r\n out[1] = scale * v2;\r\n out[2] = scale * v3 * d;\r\n out[3] = scale * v4 * d;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Mat4}.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec4Like, a: Readonly, m: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\r\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\r\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\r\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec4Like, a: Readonly, q: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n\r\n // calculate quat * vec\r\n const ix = qw * x + qy * z - qz * y;\r\n const iy = qw * y + qz * x - qx * z;\r\n const iz = qw * z + qx * y - qy * x;\r\n const iw = -qx * x - qy * y - qz * z;\r\n\r\n // calculate result * inverse quat\r\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\r\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\r\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec4Like): Vec4Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec4(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec4.prototype.sub = Vec4.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.mul = Vec4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.div = Vec4.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.dist = Vec4.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.sqrDist = Vec4.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec4.sub = Vec4.subtract;\r\nVec4.mul = Vec4.multiply;\r\nVec4.div = Vec4.divide;\r\nVec4.dist = Vec4.distance;\r\nVec4.sqrDist = Vec4.squaredDistance;\r\nVec4.sqrLen = Vec4.squaredLength;\r\nVec4.mag = Vec4.magnitude;\r\nVec4.length = Vec4.magnitude;\r\nVec4.len = Vec4.magnitude;\r\n", "import { Vec3 } from './Vec3.js';\r\nimport { Vec4 } from './Vec4.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Quaternion\r\n */\r\nexport class Quat extends Float64Array {\r\n static #DEFAULT_ANGLE_ORDER = 'zyx';\r\n\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT1 = new Float64Array(4);\r\n static #TMP_QUAT2 = new Float64Array(4);\r\n static #TMP_MAT3 = new Float64Array(9);\r\n\r\n static #TMP_VEC3 = new Float64Array(3);\r\n static #X_UNIT_VEC3 = new Float64Array([1, 0, 0]);\r\n static #Y_UNIT_VEC3 = new Float64Array([0, 1, 0]);\r\n\r\n /**\r\n * Create a {@link Quat}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the quaternion. Equivalent to `this[0];`\r\n * @category Quaternion Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the quaternion. Equivalent to `this[1];`\r\n * @category Quaternion Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the quaternion. Equivalent to `this[2];`\r\n * @category Quaternion Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the quaternion. Equivalent to `this[3];`\r\n * @category Quaternion Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Quat.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity quaternion\r\n * Equivalent to Quat.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this[0] = 0;\r\n this[1] = 0;\r\n this[2] = 0;\r\n this[3] = 1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies `this` by a {@link Quat}.\r\n * Equivalent to `Quat.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Quat.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Rotates `this` by the given angle about the X axis\r\n * Equivalent to `Quat.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Quat.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Y axis\r\n * Equivalent to `Quat.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Quat.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Z axis\r\n * Equivalent to `Quat.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Quat.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Inverts `this`\r\n * Equivalent to `Quat.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Quat.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales `this` by a scalar number\r\n * Equivalent to `Quat.scale(this, this, scale);`\r\n * @category Methods\r\n *\r\n * @param scale - amount to scale the vector by\r\n * @returns `this`\r\n */\r\n scale(scale: number): QuatLike {\r\n this[0] *= scale;\r\n this[1] *= scale;\r\n this[2] *= scale;\r\n this[3] *= scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of `this` and another {@link Quat}\r\n * Equivalent to `Quat.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - the second operand\r\n * @returns dot product of `this` and b\r\n */\r\n dot(b: Readonly): number {\r\n return Quat.dot(this, b);\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity quat\r\n * @category Static\r\n *\r\n * @returns a new quaternion\r\n */\r\n static create(): Quat {\r\n return new Quat();\r\n }\r\n\r\n /**\r\n * Set a quat to the identity quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a quat from the given angle and rotation axis,\r\n * then returns it.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param axis - the axis around which to rotate\r\n * @param rad - the angle in radians\r\n * @returns `out`\r\n **/\r\n static setAxisAngle(out: QuatLike, axis: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n out[0] = s * axis[0];\r\n out[1] = s * axis[1];\r\n out[2] = s * axis[2];\r\n out[3] = Math.cos(rad);\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the rotation axis and angle for a given\r\n * quaternion. If a quaternion is created with\r\n * setAxisAngle, this method will return the same\r\n * values as provided in the original parameter list\r\n * OR functionally equivalent values.\r\n * Example: The quaternion formed by axis [0, 0, 1] and\r\n * angle -90 is the same as the quaternion formed by\r\n * [0, 0, 1] and 270. This method favors the latter.\r\n * @category Static\r\n *\r\n * @param out_axis - Vector receiving the axis of rotation\r\n * @param q - Quaternion to be decomposed\r\n * @return Angle, in radians, of the rotation\r\n */\r\n static getAxisAngle(out_axis: Vec3Like, q: Readonly): number {\r\n const rad = Math.acos(q[3]) * 2.0;\r\n const s = Math.sin(rad / 2.0);\r\n if (s > GLM_EPSILON) {\r\n out_axis[0] = q[0] / s;\r\n out_axis[1] = q[1] / s;\r\n out_axis[2] = q[2] / s;\r\n } else {\r\n // If s is zero, return any axis (no rotation - axis does not matter)\r\n out_axis[0] = 1;\r\n out_axis[1] = 0;\r\n out_axis[2] = 0;\r\n }\r\n return rad;\r\n }\r\n\r\n /**\r\n * Gets the angular distance between two unit quaternions\r\n * @category Static\r\n *\r\n * @param {ReadonlyQuat} a Origin unit quaternion\r\n * @param {ReadonlyQuat} b Destination unit quaternion\r\n * @return {Number} Angle, in radians, between the two quaternions\r\n */\r\n static getAngle(a: Readonly, b: Readonly): number {\r\n const dotproduct = Quat.dot(a, b);\r\n\r\n return Math.acos(2 * dotproduct * dotproduct - 1);\r\n }\r\n\r\n /**\r\n * Multiplies two quaternions.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const bw = b[3];\r\n\r\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the X axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + aw * bx;\r\n out[1] = ay * bw + az * bx;\r\n out[2] = az * bw - ay * bx;\r\n out[3] = aw * bw - ax * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Y axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const by = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw - az * by;\r\n out[1] = ay * bw + aw * by;\r\n out[2] = az * bw + ax * by;\r\n out[3] = aw * bw - ay * by;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Z axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bz = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + ay * bz;\r\n out[1] = ay * bw - ax * bz;\r\n out[2] = az * bw + aw * bz;\r\n out[3] = aw * bw - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the W component of a quat from the X, Y, and Z components.\r\n * Assumes that quaternion is 1 unit in length.\r\n * Any existing W component will be ignored.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate W component of\r\n * @returns `out`\r\n */\r\n static calculateW(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the exponential of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static exp(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const et = Math.exp(w);\r\n const s = r > 0 ? (et * Math.sin(r)) / r : 0;\r\n\r\n out[0] = x * s;\r\n out[1] = y * s;\r\n out[2] = z * s;\r\n out[3] = et * Math.cos(r);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the natural logarithm of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static ln(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const t = r > 0 ? Math.atan2(r, w) / r : 0;\r\n\r\n out[0] = x * t;\r\n out[1] = y * t;\r\n out[2] = z * t;\r\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the scalar power of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @param b - amount to scale the quaternion by\r\n * @returns `out`\r\n */\r\n static pow(out: QuatLike, a: Readonly, b: number): QuatLike {\r\n Quat.ln(out, a);\r\n Quat.scale(out, out, b);\r\n Quat.exp(out, out);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike {\r\n // benchmarks:\r\n // http://jsperf.com/quaternion-slerp-implementations\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2],\r\n aw = a[3];\r\n let bx = b[0],\r\n by = b[1],\r\n bz = b[2],\r\n bw = b[3];\r\n\r\n let scale0: number;\r\n let scale1: number;\r\n\r\n // calc cosine\r\n let cosom = ax * bx + ay * by + az * bz + aw * bw;\r\n // adjust signs (if necessary)\r\n if (cosom < 0.0) {\r\n cosom = -cosom;\r\n bx = -bx;\r\n by = -by;\r\n bz = -bz;\r\n bw = -bw;\r\n }\r\n // calculate coefficients\r\n if (1.0 - cosom > GLM_EPSILON) {\r\n // standard case (slerp)\r\n const omega = Math.acos(cosom);\r\n const sinom = Math.sin(omega);\r\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\r\n scale1 = Math.sin(t * omega) / sinom;\r\n } else {\r\n // \"from\" and \"to\" quaternions are very close\r\n // ... so we can do a linear interpolation\r\n scale0 = 1.0 - t;\r\n scale1 = t;\r\n }\r\n // calculate final values\r\n out[0] = scale0 * ax + scale1 * bx;\r\n out[1] = scale0 * ay + scale1 * by;\r\n out[2] = scale0 * az + scale1 * bz;\r\n out[3] = scale0 * aw + scale1 * bw;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random unit quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n /* static random(out: QuatLike): QuatLike {\r\n // Implementation of http://planning.cs.uiuc.edu/node198.html\r\n // TODO: Calling random 3 times is probably not the fastest solution\r\n let u1 = glMatrix.RANDOM();\r\n let u2 = glMatrix.RANDOM();\r\n let u3 = glMatrix.RANDOM();\r\n\r\n let sqrt1MinusU1 = Math.sqrt(1 - u1);\r\n let sqrtU1 = Math.sqrt(u1);\r\n\r\n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\r\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\r\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\r\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Calculates the inverse of a quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: QuatLike, a: Readonly): QuatLike {\r\n const a0 = a[0],\r\n a1 = a[1],\r\n a2 = a[2],\r\n a3 = a[3];\r\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\r\n const invDot = dot ? 1.0 / dot : 0;\r\n\r\n // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\r\n\r\n out[0] = -a0 * invDot;\r\n out[1] = -a1 * invDot;\r\n out[2] = -a2 * invDot;\r\n out[3] = a3 * invDot;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a quat\r\n * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given 3x3 rotation matrix.\r\n *\r\n * NOTE: The resultant quaternion is not normalized, so you should be sure\r\n * to re-normalize the quaternion yourself where necessary.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param m - rotation matrix\r\n * @returns `out`\r\n */\r\n static fromMat3(out: QuatLike, m: Readonly): QuatLike {\r\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\r\n // article \"Quaternion Calculus and Fast Animation\".\r\n const fTrace = m[0] + m[4] + m[8];\r\n let fRoot: number;\r\n\r\n if (fTrace > 0.0) {\r\n // |w| > 1/2, may as well choose w > 1/2\r\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\r\n out[3] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot; // 1/(4w)\r\n out[0] = (m[5] - m[7]) * fRoot;\r\n out[1] = (m[6] - m[2]) * fRoot;\r\n out[2] = (m[1] - m[3]) * fRoot;\r\n } else {\r\n // |w| <= 1/2\r\n let i = 0;\r\n if (m[4] > m[0]) { i = 1; }\r\n if (m[8] > m[i * 3 + i]) { i = 2; }\r\n const j = (i + 1) % 3;\r\n const k = (i + 2) % 3;\r\n\r\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\r\n out[i] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot;\r\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\r\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\r\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given euler angle x, y, z.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - Angle to rotate around X axis in degrees.\r\n * @param y - Angle to rotate around Y axis in degrees.\r\n * @param z - Angle to rotate around Z axis in degrees.\r\n * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx.\r\n * @returns `out`\r\n */\r\n static fromEuler(out: QuatLike, x: number, y: number, z: number, order = Quat.#DEFAULT_ANGLE_ORDER): QuatLike {\r\n const halfToRad = (0.5 * Math.PI) / 180.0;\r\n x *= halfToRad;\r\n y *= halfToRad;\r\n z *= halfToRad;\r\n\r\n const sx = Math.sin(x);\r\n const cx = Math.cos(x);\r\n const sy = Math.sin(y);\r\n const cy = Math.cos(y);\r\n const sz = Math.sin(z);\r\n const cz = Math.cos(z);\r\n\r\n switch (order) {\r\n case 'xyz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'xzy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yxz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yzx':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zxy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zyx':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n default:\r\n throw new Error(`Unknown angle order ${order}`);\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a quatenion\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - quaternion to clone\r\n * @returns a new quaternion\r\n */\r\n static clone(a: Readonly): Quat {\r\n return new Quat(a);\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new quaternion\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Quat {\r\n return new Quat(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one quat to another\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the source quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static set(out: QuatLike, x: number, y: number, z: number, w: number): QuatLike { return out; }\r\n\r\n /**\r\n * Adds two {@link Quat}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static add(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Scales a quat by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param b - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: QuatLike, a: Readonly, scale: number): QuatLike {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two quat's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two quat's\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static lerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike { return out; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mag(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quaternion to normalize\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static normalize(out: QuatLike, a: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first quaternion.\r\n * @param b - The second quaternion.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static exactEquals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Returns whether the quaternions have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static equals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Sets a quaternion to represent the shortest rotation from one\r\n * vector to another.\r\n *\r\n * Both vectors are assumed to be unit length.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion.\r\n * @param a - the initial vector\r\n * @param b - the destination vector\r\n * @returns `out`\r\n */\r\n static rotationTo(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const dot = Vec3.dot(a, b);\r\n\r\n if (dot < -0.999999) {\r\n Vec3.cross(Quat.#TMP_VEC3, Quat.#X_UNIT_VEC3, a);\r\n if (Vec3.mag(Quat.#TMP_VEC3) < 0.000001) { Vec3.cross(Quat.#TMP_VEC3, Quat.#Y_UNIT_VEC3, a); }\r\n Vec3.normalize(Quat.#TMP_VEC3, Quat.#TMP_VEC3);\r\n Quat.setAxisAngle(out, Quat.#TMP_VEC3, Math.PI);\r\n return out;\r\n } else if (dot > 0.999999) {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n } else {\r\n Vec3.cross(Quat.#TMP_VEC3, a, b);\r\n out[0] = Quat.#TMP_VEC3[0];\r\n out[1] = Quat.#TMP_VEC3[1];\r\n out[2] = Quat.#TMP_VEC3[2];\r\n out[3] = 1 + dot;\r\n return Quat.normalize(out, out);\r\n }\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static sqlerp(out: QuatLike, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): QuatLike {\r\n Quat.slerp(Quat.#TMP_QUAT1, a, d, t);\r\n Quat.slerp(Quat.#TMP_QUAT2, b, c, t);\r\n Quat.slerp(out, Quat.#TMP_QUAT1, Quat.#TMP_QUAT2, 2 * t * (1 - t));\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets the specified quaternion with values corresponding to the given\r\n * axes. Each axis is a vec3 and is expected to be unit length and\r\n * perpendicular to all other specified axes.\r\n * @category Static\r\n *\r\n * @param out - The receiving quaternion\r\n * @param view - the vector representing the viewing direction\r\n * @param right - the vector representing the local `right` direction\r\n * @param up - the vector representing the local `up` direction\r\n * @returns `out`\r\n */\r\n static setAxes(out: QuatLike, view: Readonly, right: Readonly, up: Readonly): QuatLike {\r\n Quat.#TMP_MAT3[0] = right[0];\r\n Quat.#TMP_MAT3[3] = right[1];\r\n Quat.#TMP_MAT3[6] = right[2];\r\n\r\n Quat.#TMP_MAT3[1] = up[0];\r\n Quat.#TMP_MAT3[4] = up[1];\r\n Quat.#TMP_MAT3[7] = up[2];\r\n\r\n Quat.#TMP_MAT3[2] = -view[0];\r\n Quat.#TMP_MAT3[5] = -view[1];\r\n Quat.#TMP_MAT3[8] = -view[2];\r\n\r\n return Quat.normalize(out, Quat.fromMat3(out, Quat.#TMP_MAT3));\r\n }\r\n}\r\n\r\n// Methods which re-use the Vec4 implementation\r\nQuat.set = Vec4.set;\r\nQuat.add = Vec4.add;\r\nQuat.lerp = Vec4.lerp;\r\nQuat.normalize = Vec4.normalize;\r\nQuat.squaredLength = Vec4.squaredLength;\r\nQuat.sqrLen = Vec4.squaredLength;\r\nQuat.exactEquals = Vec4.exactEquals;\r\nQuat.equals = Vec4.equals;\r\nQuat.magnitude = Vec4.magnitude;\r\n\r\n// Instance method alias assignments\r\nQuat.prototype.mul = Quat.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nQuat.mul = Quat.multiply;\r\nQuat.mag = Quat.magnitude;\r\nQuat.length = Quat.magnitude;\r\nQuat.len = Quat.magnitude;\r\n", "import { Mat4 } from './Mat4.js';\r\nimport { Quat } from './Quat.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Dual Quaternion\r\n */\r\nexport class Quat2 extends Float64Array {\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat2.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT = new Float64Array(4);\r\n static #TMP_VEC3 = new Float64Array(3);\r\n\r\n /**\r\n * Create a {@link Quat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 8:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 8); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v, v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 8);\r\n }\r\n break;\r\n }\r\n default:\r\n super(8);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source dual quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 8 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity {@link Quat2}\r\n * @category Static\r\n *\r\n * @returns a new dual quaternion [real -> rotation, dual -> translation]\r\n */\r\n static create(): Quat2 {\r\n return new Quat2();\r\n }\r\n\r\n /**\r\n * Creates a {@link Quat2} quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to clone\r\n * @returns a new dual quaternion\r\n */\r\n static clone(a: Quat2Like): Quat2 {\r\n return new Quat2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns a new dual quaternion\r\n */\r\n static fromValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2 {\r\n return new Quat2(x1, y1, z1, w1, x2, y2, z2, w2);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} from the given values (quat and translation)\r\n * @category Static\r\n *\r\n * @param x1 - X component (rotation)\r\n * @param y1 - Y component (rotation)\r\n * @param z1 - Z component (rotation)\r\n * @param w1 - W component (rotation)\r\n * @param x2 - X component (translation)\r\n * @param y2 - Y component (translation)\r\n * @param z2 - Z component (translation)\r\n * @returns a new dual quaternion\r\n */\r\n static fromRotationTranslationValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number): Quat2 {\r\n const ax = x2 * 0.5;\r\n const ay = y2 * 0.5;\r\n const az = z2 * 0.5;\r\n\r\n return new Quat2(x1, y1, z1, w1,\r\n ax * w1 + ay * z1 - az * y1,\r\n ay * w1 + az * x1 - ax * z1,\r\n az * w1 + ax * y1 - ay * x1,\r\n -ax * x1 - ay * y1 - az * z1);\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion and a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Quat2Like, q: Readonly, t: Readonly): Quat2Like {\r\n const ax = t[0] * 0.5;\r\n const ay = t[1] * 0.5;\r\n const az = t[2] * 0.5;\r\n const bx = q[0];\r\n const by = q[1];\r\n const bz = q[2];\r\n const bw = q[3];\r\n out[0] = bx;\r\n out[1] = by;\r\n out[2] = bz;\r\n out[3] = bw;\r\n out[4] = ax * bw + ay * bz - az * by;\r\n out[5] = ay * bw + az * bx - ax * bz;\r\n out[6] = az * bw + ax * by - ay * bx;\r\n out[7] = -ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Quat2Like, t: Readonly): Quat2Like {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = t[0] * 0.5;\r\n out[5] = t[1] * 0.5;\r\n out[6] = t[2] * 0.5;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Quat2Like, q: Readonly): Quat2Like {\r\n out[0] = q[0];\r\n out[1] = q[1];\r\n out[2] = q[2];\r\n out[3] = q[3];\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param a - the matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Quat2Like, a: Readonly): Quat2Like {\r\n Mat4.getRotation(Quat2.#TMP_QUAT, a);\r\n Mat4.getTranslation(Quat2.#TMP_VEC3, a);\r\n return Quat2.fromRotationTranslation(out, Quat2.#TMP_QUAT, Quat2.#TMP_VEC3);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Quat2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the source dual quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Quat2} to the identity dual quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns `out`\r\n */\r\n static set(out: Quat2Like, x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2Like {\r\n out[0] = x1;\r\n out[1] = y1;\r\n out[2] = z1;\r\n out[3] = w1;\r\n out[4] = x2;\r\n out[5] = y2;\r\n out[6] = z2;\r\n out[7] = w2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the real part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - real part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getReal(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Gets the dual part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - dual part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getDual(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[4];\r\n out[1] = a[5];\r\n out[2] = a[6];\r\n out[3] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the real component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the real part\r\n * @return `out`\r\n */\r\n static setReal(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Set the dual component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the dual part\r\n * @return `out`\r\n */\r\n static setDual(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[4] = a[0];\r\n out[5] = a[1];\r\n out[6] = a[2];\r\n out[7] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the translation of a normalized {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving translation vector\r\n * @param a - Dual Quaternion to be decomposed\r\n * @return `out`\r\n */\r\n static getTranslation(out: Vec3Like, a: Readonly): Vec3Like {\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Translates a {@link Quat2} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Quat2Like, a: Readonly, v: Readonly): Quat2Like {\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n const bx1 = v[0] * 0.5;\r\n const by1 = v[1] * 0.5;\r\n const bz1 = v[2] * 0.5;\r\n const ax2 = a[4];\r\n const ay2 = a[5];\r\n const az2 = a[6];\r\n const aw2 = a[7];\r\n out[0] = ax1;\r\n out[1] = ay1;\r\n out[2] = az1;\r\n out[3] = aw1;\r\n out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2;\r\n out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2;\r\n out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2;\r\n out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateX(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateY(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateZ(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (a * q)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param q - quaternion to rotate by\r\n * @returns `out`\r\n */\r\n static rotateByQuatAppend(out: Quat2Like, a: Readonly, q: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let ax = a[0];\r\n let ay = a[1];\r\n let az = a[2];\r\n let aw = a[3];\r\n\r\n out[0] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[1] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[2] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[3] = aw * qw - ax * qx - ay * qy - az * qz;\r\n ax = a[4];\r\n ay = a[5];\r\n az = a[6];\r\n aw = a[7];\r\n out[4] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[5] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[6] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[7] = aw * qw - ax * qx - ay * qy - az * qz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (q * a)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param q - quaternion to rotate by\r\n * @param a - the dual quaternion to rotate\r\n * @returns `out`\r\n */\r\n static rotateByQuatPrepend(out: Quat2Like, q: Readonly, a: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let bx = a[0];\r\n let by = a[1];\r\n let bz = a[2];\r\n let bw = a[3];\r\n\r\n out[0] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[1] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[2] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[3] = qw * bw - qx * bx - qy * by - qz * bz;\r\n bx = a[4];\r\n by = a[5];\r\n bz = a[6];\r\n bw = a[7];\r\n out[4] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[5] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[6] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[7] = qw * bw - qx * bx - qy * by - qz * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around a given axis. Does the normalization automatically\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param axis - the axis to rotate around\r\n * @param rad - how far the rotation should be\r\n * @returns `out`\r\n */\r\n static rotateAroundAxis(out: Quat2Like, a: Readonly, axis: Readonly, rad: number): Quat2Like {\r\n // Special case for rad = 0\r\n if (Math.abs(rad) < GLM_EPSILON) {\r\n return Quat2.copy(out, a);\r\n }\r\n const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);\r\n\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n const bx = (s * axis[0]) / axisLength;\r\n const by = (s * axis[1]) / axisLength;\r\n const bz = (s * axis[2]) / axisLength;\r\n const bw = Math.cos(rad);\r\n\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n out[4] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[5] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[6] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[7] = aw * bw - ax * bx - ay * by - az * bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns {quat2} out\r\n */\r\n static multiply(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n const ax0 = a[0];\r\n const ay0 = a[1];\r\n const az0 = a[2];\r\n const aw0 = a[3];\r\n const bx1 = b[4];\r\n const by1 = b[5];\r\n const bz1 = b[6];\r\n const bw1 = b[7];\r\n const ax1 = a[4];\r\n const ay1 = a[5];\r\n const az1 = a[6];\r\n const aw1 = a[7];\r\n const bx0 = b[0];\r\n const by0 = b[1];\r\n const bz0 = b[2];\r\n const bw0 = b[3];\r\n out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0;\r\n out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0;\r\n out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0;\r\n out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0;\r\n out[4] =\r\n ax0 * bw1 +\r\n aw0 * bx1 +\r\n ay0 * bz1 -\r\n az0 * by1 +\r\n ax1 * bw0 +\r\n aw1 * bx0 +\r\n ay1 * bz0 -\r\n az1 * by0;\r\n out[5] =\r\n ay0 * bw1 +\r\n aw0 * by1 +\r\n az0 * bx1 -\r\n ax0 * bz1 +\r\n ay1 * bw0 +\r\n aw1 * by0 +\r\n az1 * bx0 -\r\n ax1 * bz0;\r\n out[6] =\r\n az0 * bw1 +\r\n aw0 * bz1 +\r\n ax0 * by1 -\r\n ay0 * bx1 +\r\n az1 * bw0 +\r\n aw1 * bz0 +\r\n ax1 * by0 -\r\n ay1 * bx0;\r\n out[7] =\r\n aw0 * bw1 -\r\n ax0 * bx1 -\r\n ay0 * by1 -\r\n az0 * bz1 +\r\n aw1 * bw0 -\r\n ax1 * bx0 -\r\n ay1 * by0 -\r\n az1 * bz0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like { return out; }\r\n\r\n /**\r\n * Scales a {@link Quat2} by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaterion\r\n * @param a - the dual quaternion to scale\r\n * @param b - scalar value to scale the dual quaterion by\r\n * @returns `out`\r\n */\r\n static scale(out: Quat2Like, a: Readonly, b: number): Quat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts)\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dot(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Quat2}s\r\n * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quat\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Quat2Like, a: Readonly, b: Readonly, t: number): Quat2Like {\r\n const mt = 1 - t;\r\n if (Quat2.dot(a, b) < 0) { t = -t; }\r\n\r\n out[0] = a[0] * mt + b[0] * t;\r\n out[1] = a[1] * mt + b[1] * t;\r\n out[2] = a[2] * mt + b[2] * t;\r\n out[3] = a[3] * mt + b[3] * t;\r\n out[4] = a[4] * mt + b[4] * t;\r\n out[5] = a[5] * mt + b[5] * t;\r\n out[6] = a[6] * mt + b[6] * t;\r\n out[7] = a[7] * mt + b[7] * t;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: Quat2Like, a: Readonly): Quat2Like {\r\n const sqlen = Quat2.squaredLength(a);\r\n out[0] = -a[0] / sqlen;\r\n out[1] = -a[1] / sqlen;\r\n out[2] = -a[2] / sqlen;\r\n out[3] = a[3] / sqlen;\r\n out[4] = -a[4] / sqlen;\r\n out[5] = -a[5] / sqlen;\r\n out[6] = -a[6] / sqlen;\r\n out[7] = a[7] / sqlen;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than\r\n * {@link Quat2.invert} and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n out[4] = -a[4];\r\n out[5] = -a[5];\r\n out[6] = -a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Quat2Like, a: Readonly): Quat2Like {\r\n let magnitude = Quat2.squaredLength(a);\r\n if (magnitude > 0) {\r\n magnitude = Math.sqrt(magnitude);\r\n\r\n const a0 = a[0] / magnitude;\r\n const a1 = a[1] / magnitude;\r\n const a2 = a[2] / magnitude;\r\n const a3 = a[3] / magnitude;\r\n\r\n const b0 = a[4];\r\n const b1 = a[5];\r\n const b2 = a[6];\r\n const b3 = a[7];\r\n\r\n const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3;\r\n\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n\r\n out[4] = (b0 - a0 * a_dot_b) / magnitude;\r\n out[5] = (b1 - a1 * a_dot_b) / magnitude;\r\n out[6] = (b2 - a2 * a_dot_b) / magnitude;\r\n out[7] = (b3 - a3 * a_dot_b) / magnitude;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat2(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7))\r\n );\r\n }\r\n}\r\n\r\n// Methods which re-use the Quat implementation\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.dot = Quat.dot;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.squaredLength = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.sqrLen = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.mag = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.length = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.len = Quat.magnitude;\r\n\r\n// Static method alias assignments\r\nQuat2.mul = Quat2.multiply;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Mat2dLike, Mat3Like, Mat4Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 2 Dimensional Vector\r\n */\r\nexport class Vec2 extends Float64Array {\r\n /**\r\n * Create a {@link Vec2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 2:{\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, values[1]!]);\r\n } else {\r\n super(v as ArrayBufferLike, values[1], 2);\r\n }\r\n break;\r\n }\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 2);\r\n }\r\n break;\r\n }\r\n default:\r\n super(2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec2.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n return Math.hypot(this[0], this[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec2.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n // Instead of zero(), use a.fill(0) for instances;\r\n\r\n /**\r\n * Adds a {@link Vec2} to `this`.\r\n * Equivalent to `Vec2.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec2} from `this`.\r\n * Equivalent to `Vec2.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec2.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec2.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec2.squaredDistance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec2.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec2.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec2.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec2}.\r\n * Equivalent to `Vec2.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec2.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec2.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 2 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec2}\r\n * @category Static\r\n *\r\n * @returns A new 2D vector\r\n */\r\n static create(): Vec2 {\r\n return new Vec2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - Vector to clone\r\n * @returns A new 2D vector\r\n */\r\n static clone(a: Readonly): Vec2 {\r\n return new Vec2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns A new 2D vector\r\n */\r\n static fromValues(x: number, y: number): Vec2 {\r\n return new Vec2(x, y);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - The source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns `out`\r\n */\r\n static set(out: Vec2Like, x: number, y: number): Vec2Like {\r\n out[0] = x;\r\n out[1] = y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Multiplies two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Divides two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec2} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to scale\r\n * @param b - Amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec2Like, a: Readonly, b: number): Vec2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two Vec2's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param scale - The amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec2Like, a: Readonly, b: Readonly, scale: number): Vec2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns distance between `a` and `b`\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n return Math.hypot(b[0] - a[0], b[1] - a[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Squared distance between `a` and `b`\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return Math.sqrt(x * x + y * y);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate squared length of\r\n * @returns Squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec2Like, a: Readonly) {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec2Like, a: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n let len = x * x + y * y;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Dot product of `a` and `b`\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two {@link Vec2}s\r\n * Note that the cross product must by definition produce a 3D vector.\r\n * For this reason there is also not instance equivalent for this function.\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n const z = a[0] * b[1] - a[1] * b[0];\r\n out[0] = out[1] = 0;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param t - Interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec2Like, a: Readonly, b: Readonly, t: number): Vec2Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y;\r\n out[1] = m[1] * x + m[3] * y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2d}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2d(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y + m[4];\r\n out[1] = m[1] * x + m[3] * y + m[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat3}\r\n * 3rd vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat3(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[3] * y + m[6];\r\n out[1] = m[1] * x + m[4] * y + m[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat4}\r\n * 3rd vector component is implicitly '0'\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat4(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[4] * y + m[12];\r\n out[1] = m[1] * x + m[5] * y + m[13];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 2D vector\r\n * @category Static\r\n *\r\n * @param out - The receiving {@link Vec2}\r\n * @param a - The {@link Vec2} point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotate(out: Vec2Like, a: Readonly, b: Readonly, rad: number): Vec2Like {\r\n // Translate point to the origin\r\n const p0 = a[0] - b[0];\r\n const p1 = a[1] - b[1];\r\n const sinC = Math.sin(rad);\r\n const cosC = Math.cos(rad);\r\n\r\n // perform rotation and translate to correct position\r\n out[0] = p0 * cosC - p1 * sinC + b[0];\r\n out[1] = p0 * sinC + p1 * cosC + b[1];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 2D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly): number {\r\n const x1 = a[0];\r\n const y1 = a[1];\r\n const x2 = b[0];\r\n const y2 = b[1];\r\n // mag is the product of the magnitudes of a and b\r\n const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2);\r\n // mag &&.. short circuits if mag == 0\r\n const cosine = mag && (x1 * x2 + y1 * y2) / mag;\r\n // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to zero\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec2Like): Vec2Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors components are ===, `false` otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors are approximately equal, `false` otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - Vector to represent as a string\r\n * @returns String representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec2.prototype.sub = Vec2.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.mul = Vec2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.div = Vec2.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.dist = Vec2.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.sqrDist = Vec2.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec2.sub = Vec2.subtract;\r\nVec2.mul = Vec2.multiply;\r\nVec2.div = Vec2.divide;\r\nVec2.dist = Vec2.distance;\r\nVec2.sqrDist = Vec2.squaredDistance;\r\nVec2.sqrLen = Vec2.squaredLength;\r\nVec2.mag = Vec2.magnitude;\r\nVec2.length = Vec2.magnitude;\r\nVec2.len = Vec2.magnitude;\r\n", "/**\r\n * To enable additional swizzle accessors for vector classes (64-bit) invoke the {@link EnableSwizzlesF64} function from\r\n * the `gl-matrix/swizzle/f64` sub-path export. To enable ambient module declarations for IDE / Typescript support\r\n * please see {@link gl-matrix/types/swizzle/f64}.\r\n *\r\n * To enable swizzling for the 32-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle}.\r\n *\r\n * @example\r\n * ```ts\r\n * import { Vec3 } from 'gl-matrix/f64';\r\n * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64';\r\n *\r\n * EnableSwizzlesF64();\r\n *\r\n * const vec = new Vec3(0, 1, 2);\r\n * const vecSwizzled = vec.zyx; // Returns a new Vec3(2, 1, 0).\r\n * ```\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\nimport { Vec2, Vec3, Vec4 } from '#gl-matrix/f64';\r\n\r\n/**\r\n * Internal `gl-matrix` variable tracking if swizzling is enabled (64-bit).\r\n */\r\nlet GLM_SWIZZLES_ENABLED_F64 = false;\r\n\r\n/**\r\n * Enables Swizzle operations on {@link gl-matrix/f64.Vec2 | Vec2} / {@link gl-matrix/f64.Vec3 | Vec3} /\r\n * {@link gl-matrix/f64.Vec4 | Vec4} types from {@link gl-matrix/f64} (64-bit).\r\n *\r\n * Swizzle operations are performed by using the `.` operator in conjunction with any combination\r\n * of between two and four component names, either from the set `xyzw` or `rgbw` (though not intermixed).\r\n * They return a new vector with the same number of components as specified in the swizzle attribute.\r\n *\r\n * @example\r\n * ```js\r\n * import { Vec3 } from 'gl-matrix/f64';\r\n * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64';\r\n *\r\n * EnableSwizzlesF64();\r\n *\r\n * let v = new Vec3(0, 1, 2);\r\n *\r\n * v.yx; // returns new Vec2(1, 0)\r\n * v.xzy; // returns new Vec3(0, 2, 1)\r\n * v.zyxz; // returns new Vec4(2, 1, 0, 2)\r\n *\r\n * v.rgb; // returns new Vec3(0, 1, 2)\r\n * v.rbg; // returns new Vec3(0, 2, 1)\r\n * v.gg; // returns new Vec2(1, 1)\r\n * ```\r\n */\r\nexport function EnableSwizzlesF64(): void {\r\n /* v8 ignore next 1 */\r\n if (GLM_SWIZZLES_ENABLED_F64) { return; }\r\n\r\n /* eslint-disable comma-spacing, max-len */\r\n\r\n // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should\r\n // not be modified by hand.\r\n // [Swizzle Autogen]\r\n\r\n const VEC2_SWIZZLES = ['xx','xy','yx','yy','xxx','xxy','xyx','xyy','yxx','yxy','yyx','yyy','xxxx','xxxy','xxyx','xxyy','xyxx','xyxy','xyyx','xyyy','yxxx','yxxy','yxyx','yxyy','yyxx','yyxy','yyyx','yyyy','rr','rg','gr','gg','rrr','rrg','rgr','rgg','grr','grg','ggr','ggg','rrrr','rrrg','rrgr','rrgg','rgrr','rgrg','rggr','rggg','grrr','grrg','grgr','grgg','ggrr','ggrg','gggr','gggg'];\r\n const VEC3_SWIZZLES = ['xz','yz','zx','zy','zz','xxz','xyz','xzx','xzy','xzz','yxz','yyz','yzx','yzy','yzz','zxx','zxy','zxz','zyx','zyy','zyz','zzx','zzy','zzz','xxxz','xxyz','xxzx','xxzy','xxzz','xyxz','xyyz','xyzx','xyzy','xyzz','xzxx','xzxy','xzxz','xzyx','xzyy','xzyz','xzzx','xzzy','xzzz','yxxz','yxyz','yxzx','yxzy','yxzz','yyxz','yyyz','yyzx','yyzy','yyzz','yzxx','yzxy','yzxz','yzyx','yzyy','yzyz','yzzx','yzzy','yzzz','zxxx','zxxy','zxxz','zxyx','zxyy','zxyz','zxzx','zxzy','zxzz','zyxx','zyxy','zyxz','zyyx','zyyy','zyyz','zyzx','zyzy','zyzz','zzxx','zzxy','zzxz','zzyx','zzyy','zzyz','zzzx','zzzy','zzzz','rb','gb','br','bg','bb','rrb','rgb','rbr','rbg','rbb','grb','ggb','gbr','gbg','gbb','brr','brg','brb','bgr','bgg','bgb','bbr','bbg','bbb','rrrb','rrgb','rrbr','rrbg','rrbb','rgrb','rggb','rgbr','rgbg','rgbb','rbrr','rbrg','rbrb','rbgr','rbgg','rbgb','rbbr','rbbg','rbbb','grrb','grgb','grbr','grbg','grbb','ggrb','gggb','ggbr','ggbg','ggbb','gbrr','gbrg','gbrb','gbgr','gbgg','gbgb','gbbr','gbbg','gbbb','brrr','brrg','brrb','brgr','brgg','brgb','brbr','brbg','brbb','bgrr','bgrg','bgrb','bggr','bggg','bggb','bgbr','bgbg','bgbb','bbrr','bbrg','bbrb','bbgr','bbgg','bbgb','bbbr','bbbg','bbbb'];\r\n const VEC4_SWIZZLES = ['xw','yw','zw','wx','wy','wz','ww','xxw','xyw','xzw','xwx','xwy','xwz','xww','yxw','yyw','yzw','ywx','ywy','ywz','yww','zxw','zyw','zzw','zwx','zwy','zwz','zww','wxx','wxy','wxz','wxw','wyx','wyy','wyz','wyw','wzx','wzy','wzz','wzw','wwx','wwy','wwz','www','xxxw','xxyw','xxzw','xxwx','xxwy','xxwz','xxww','xyxw','xyyw','xyzw','xywx','xywy','xywz','xyww','xzxw','xzyw','xzzw','xzwx','xzwy','xzwz','xzww','xwxx','xwxy','xwxz','xwxw','xwyx','xwyy','xwyz','xwyw','xwzx','xwzy','xwzz','xwzw','xwwx','xwwy','xwwz','xwww','yxxw','yxyw','yxzw','yxwx','yxwy','yxwz','yxww','yyxw','yyyw','yyzw','yywx','yywy','yywz','yyww','yzxw','yzyw','yzzw','yzwx','yzwy','yzwz','yzww','ywxx','ywxy','ywxz','ywxw','ywyx','ywyy','ywyz','ywyw','ywzx','ywzy','ywzz','ywzw','ywwx','ywwy','ywwz','ywww','zxxw','zxyw','zxzw','zxwx','zxwy','zxwz','zxww','zyxw','zyyw','zyzw','zywx','zywy','zywz','zyww','zzxw','zzyw','zzzw','zzwx','zzwy','zzwz','zzww','zwxx','zwxy','zwxz','zwxw','zwyx','zwyy','zwyz','zwyw','zwzx','zwzy','zwzz','zwzw','zwwx','zwwy','zwwz','zwww','wxxx','wxxy','wxxz','wxxw','wxyx','wxyy','wxyz','wxyw','wxzx','wxzy','wxzz','wxzw','wxwx','wxwy','wxwz','wxww','wyxx','wyxy','wyxz','wyxw','wyyx','wyyy','wyyz','wyyw','wyzx','wyzy','wyzz','wyzw','wywx','wywy','wywz','wyww','wzxx','wzxy','wzxz','wzxw','wzyx','wzyy','wzyz','wzyw','wzzx','wzzy','wzzz','wzzw','wzwx','wzwy','wzwz','wzww','wwxx','wwxy','wwxz','wwxw','wwyx','wwyy','wwyz','wwyw','wwzx','wwzy','wwzz','wwzw','wwwx','wwwy','wwwz','wwww','ra','ga','ba','ar','ag','ab','aa','rra','rga','rba','rar','rag','rab','raa','gra','gga','gba','gar','gag','gab','gaa','bra','bga','bba','bar','bag','bab','baa','arr','arg','arb','ara','agr','agg','agb','aga','abr','abg','abb','aba','aar','aag','aab','aaa','rrra','rrga','rrba','rrar','rrag','rrab','rraa','rgra','rgga','rgba','rgar','rgag','rgab','rgaa','rbra','rbga','rbba','rbar','rbag','rbab','rbaa','rarr','rarg','rarb','rara','ragr','ragg','ragb','raga','rabr','rabg','rabb','raba','raar','raag','raab','raaa','grra','grga','grba','grar','grag','grab','graa','ggra','ggga','ggba','ggar','ggag','ggab','ggaa','gbra','gbga','gbba','gbar','gbag','gbab','gbaa','garr','garg','garb','gara','gagr','gagg','gagb','gaga','gabr','gabg','gabb','gaba','gaar','gaag','gaab','gaaa','brra','brga','brba','brar','brag','brab','braa','bgra','bgga','bgba','bgar','bgag','bgab','bgaa','bbra','bbga','bbba','bbar','bbag','bbab','bbaa','barr','barg','barb','bara','bagr','bagg','bagb','baga','babr','babg','babb','baba','baar','baag','baab','baaa','arrr','arrg','arrb','arra','argr','argg','argb','arga','arbr','arbg','arbb','arba','arar','arag','arab','araa','agrr','agrg','agrb','agra','aggr','aggg','aggb','agga','agbr','agbg','agbb','agba','agar','agag','agab','agaa','abrr','abrg','abrb','abra','abgr','abgg','abgb','abga','abbr','abbg','abbb','abba','abar','abag','abab','abaa','aarr','aarg','aarb','aara','aagr','aagg','aagb','aaga','aabr','aabg','aabb','aaba','aaar','aaag','aaab','aaaa'];\r\n\r\n // [/Swizzle Autogen]\r\n\r\n /* eslint-enable comma-spacing, max-len */\r\n\r\n /**\r\n * Internal swizzle index table for `gl-matrix`.\r\n */\r\n const SWIZZLE_INDEX: Record = {\r\n x: 0, r: 0,\r\n y: 1, g: 1,\r\n z: 2, b: 2,\r\n w: 3, a: 3,\r\n };\r\n\r\n /**\r\n * Internal helper function to convert and return a `gl-matrix` vector by swizzle format.\r\n *\r\n * @param swizzle - Swizzle format to apply.\r\n * @returns {Vec2 | Vec3 | Vec4} New swizzled vector instance.\r\n */\r\n function getSwizzleImpl(swizzle: string): () => Vec2 | Vec3 | Vec4 {\r\n switch (swizzle.length) {\r\n case 2:\r\n return function(this: Float64Array) {\r\n return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]);\r\n };\r\n case 3:\r\n return function(this: Float64Array) {\r\n return new Vec3(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]]);\r\n };\r\n case 4:\r\n return function(this: Float64Array) {\r\n return new Vec4(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]], this[SWIZZLE_INDEX[swizzle[3]]]);\r\n };\r\n }\r\n\r\n throw new Error('Illegal swizzle length');\r\n }\r\n\r\n for (const swizzle of VEC2_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec2.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC3_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC4_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n GLM_SWIZZLES_ENABLED_F64 = true;\r\n}\r\n", "/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_DEG_TO_RAD: number = Math.PI / 180;\r\n\r\n/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_RAD_TO_DEG: number = 180 / Math.PI;\r\n\r\n/**\r\n * Convert `radians` to `degrees`.\r\n *\r\n * @param value - Angle in `radians`.\r\n * @returns Angle in `degrees`.\r\n */\r\nexport function toDegree(value: number): number {\r\n return value * GLM_RAD_TO_DEG;\r\n}\r\n\r\n/**\r\n * Convert `degrees` to `radians`.\r\n *\r\n * @param value - Angle in `degrees`.\r\n * @returns Angle in `radians`.\r\n */\r\nexport function toRadian(value: number): number {\r\n return value * GLM_DEG_TO_RAD;\r\n}\r\n"], + "mappings": ";;;;;;AASO,IAAM,cAAc;;;ACFpB,IAAM,OAAN,MAAM,cAAa,aAAa;AAAA,EACrC,OAAO,gBAAgB,IAAI,aAAa;AAAA,IACtC;AAAA,IAAG;AAAA,IACH;AAAA,IAAG;AAAA,EACL,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOD,eAAe,QAAoE;AACjF,YAAQ,OAAO,QAAQ;AAAA,MACrB,KAAK;AACH,cAAM,MAAM;AAAG;AAAA,MACjB,KAAK;AACH,cAAM,OAAO,CAAC,GAAsB,OAAO,CAAC,GAAG,CAAC;AAAG;AAAA,MACrD,KAAK;AACH,cAAM,IAAI,OAAO,CAAC;AAClB,YAAI,OAAO,MAAM,UAAU;AACzB,gBAAM;AAAA,YACJ;AAAA,YAAG;AAAA,YACH;AAAA,YAAG;AAAA,UAAC,CAAC;AAAA,QACT,OAAO;AACL,gBAAM,GAAsB,GAAG,CAAC;AAAA,QAClC;AACA;AAAA,MACF;AACE,cAAM,MAAK,aAAa;AAAG;AAAA,IAC/B;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,IAAI,MAAc;AAChB,WAAO,MAAK,IAAI,IAAI;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaA,KAAK,GAA6B;AAChC,SAAK,IAAI,CAAC;AACV,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,WAAiB;AACf,SAAK,IAAI,MAAK,aAAa;AAC3B,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,SAAS,GAA6B;AACpC,WAAO,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-cdn/esm/2022/gl-matrix-f64.min.js @@ -0,0 +1,6 @@ +// gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library. +// @author Brandon Jones +// @author Colin MacKenzie IV +// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md) +var Z=class b extends Float64Array{static#t=new Float64Array([1,0,0,1]);constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t]):super(t,0,4);break;default:super(b.#t);break}}get str(){return b.str(this)}copy(e){return this.set(e),this}identity(){return this.set(b.#t),this}multiply(e){return b.multiply(this,this,e)}mul(e){return this}transpose(){return b.transpose(this,this)}invert(){return b.invert(this,this)}scale(e){return b.scale(this,this,e)}rotate(e){return b.rotate(this,this,e)}static get BYTE_LENGTH(){return 4*Float64Array.BYTES_PER_ELEMENT}static create(){return new b}static clone(e){return new b(e)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static fromValues(...e){return new b(...e)}static set(e,...t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}static transpose(e,t){if(e===t){let n=t[1];e[1]=t[2],e[2]=n}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*a-r*s;return i?(i=1/i,e[0]=a*i,e[1]=-s*i,e[2]=-r*i,e[3]=n*i,e):null}static adjoint(e,t){let n=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=n,e}static determinant(e){return e[0]*e[3]-e[2]*e[1]}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*c+a*y,e[1]=r*c+i*y,e[2]=s*L+a*k,e[3]=r*L+i*k,e}static mul(e,t,n){return e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+a*c,e[1]=r*y+i*c,e[2]=s*-c+a*y,e[3]=r*-c+i*y,e}static scale(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1];return e[0]=s*c,e[1]=r*c,e[2]=a*y,e[3]=i*y,e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=-n,e[3]=s,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3])}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e}static LDU(e,t,n,s){return e[2]=s[2]/s[0],n[0]=s[0],n[1]=s[1],n[3]=s[3]-e[2]*n[1],[e,t,n]}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=t[0],c=t[1],y=t[2],L=t[3];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(a-L)<=1e-6*Math.max(1,Math.abs(a),Math.abs(L))}static str(e){return`Mat2(${e.join(", ")})`}};Z.prototype.mul=Z.prototype.multiply;Z.mul=Z.multiply;Z.sub=Z.subtract;var j=class b extends Float64Array{static#t=new Float64Array([1,0,0,1,0,0]);constructor(...e){switch(e.length){case 6:super(e);break;case 2:super(e[0],e[1],6);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t,t,t]):super(t,0,6);break;default:super(b.#t);break}}get str(){return b.str(this)}copy(e){return this.set(e),this}identity(){return this.set(b.#t),this}multiply(e){return b.multiply(this,this,e)}mul(e){return this}translate(e){return b.translate(this,this,e)}rotate(e){return b.rotate(this,this,e)}scale(e){return b.scale(this,this,e)}static get BYTE_LENGTH(){return 6*Float64Array.BYTES_PER_ELEMENT}static create(){return new b}static clone(e){return new b(e)}static copy(e,t){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}static fromValues(...e){return new b(...e)}static set(e,...t){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}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=n*a-s*r;return y?(y=1/y,e[0]=a*y,e[1]=-s*y,e[2]=-r*y,e[3]=n*y,e[4]=(r*c-a*i)*y,e[5]=(s*i-n*c)*y,e):null}static determinant(e){return e[0]*e[3]-e[1]*e[2]}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1],l=n[2],M=n[3],h=n[4],d=n[5];return e[0]=s*L+a*k,e[1]=r*L+i*k,e[2]=s*l+a*M,e[3]=r*l+i*M,e[4]=s*h+a*d+c,e[5]=r*h+i*d+y,e}static mul(e,t,n){return e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=s*L+a*k+c,e[5]=r*L+i*k+y,e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=Math.sin(n),k=Math.cos(n);return e[0]=s*k+a*L,e[1]=r*k+i*L,e[2]=s*-L+a*k,e[3]=r*-L+i*k,e[4]=c,e[5]=y,e}static scale(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1];return e[0]=s*L,e[1]=r*L,e[2]=a*k,e[3]=i*k,e[4]=c,e[5]=y,e}static fromTranslation(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0],e[5]=t[1],e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=-n,e[3]=s,e[4]=0,e[5]=0,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e[4]=0,e[5]=0,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+1)}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=t[0],L=t[1],k=t[2],l=t[3],M=t[4],h=t[5];return Math.abs(n-y)<=1e-6*Math.max(1,Math.abs(n),Math.abs(y))&&Math.abs(s-L)<=1e-6*Math.max(1,Math.abs(s),Math.abs(L))&&Math.abs(r-k)<=1e-6*Math.max(1,Math.abs(r),Math.abs(k))&&Math.abs(a-l)<=1e-6*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(i-M)<=1e-6*Math.max(1,Math.abs(i),Math.abs(M))&&Math.abs(c-h)<=1e-6*Math.max(1,Math.abs(c),Math.abs(h))}static str(e){return`Mat2d(${e.join(", ")})`}};j.mul=j.multiply;j.sub=j.subtract;var G=class b extends Float64Array{static#t=new Float64Array([1,0,0,0,1,0,0,0,1]);constructor(...e){switch(e.length){case 9:super(e);break;case 2:super(e[0],e[1],9);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t,t,t,t,t,t]):super(t,0,9);break;default:super(b.#t);break}}get str(){return b.str(this)}copy(e){return this.set(e),this}identity(){return this.set(b.#t),this}multiply(e){return b.multiply(this,this,e)}mul(e){return this}transpose(){return b.transpose(this,this)}invert(){return b.invert(this,this)}translate(e){return b.translate(this,this,e)}rotate(e){return b.rotate(this,this,e)}scale(e){return b.scale(this,this,e)}static get BYTE_LENGTH(){return 9*Float64Array.BYTES_PER_ELEMENT}static create(){return new b}static clone(e){return new b(e)}static copy(e,t){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}static fromValues(...e){return new b(...e)}static set(e,...t){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}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static transpose(e,t){if(e===t){let n=t[1],s=t[2],r=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=s,e[7]=r}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=k*i-c*L,M=-k*a+c*y,h=L*a-i*y,d=n*l+s*M+r*h;return d?(d=1/d,e[0]=l*d,e[1]=(-k*s+r*L)*d,e[2]=(c*s-r*i)*d,e[3]=M*d,e[4]=(k*n-r*y)*d,e[5]=(-c*n+r*a)*d,e[6]=h*d,e[7]=(-L*n+s*y)*d,e[8]=(i*n-s*a)*d,e):null}static adjoint(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8];return e[0]=i*k-c*L,e[1]=r*L-s*k,e[2]=s*c-r*i,e[3]=c*y-a*k,e[4]=n*k-r*y,e[5]=r*a-n*c,e[6]=a*L-i*y,e[7]=s*y-n*L,e[8]=n*i-s*a,e}static determinant(e){let t=e[0],n=e[1],s=e[2],r=e[3],a=e[4],i=e[5],c=e[6],y=e[7],L=e[8];return t*(L*a-i*y)+n*(-L*r+i*c)+s*(y*r-a*c)}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=n[0],h=n[1],d=n[2];return e[0]=M*s+h*i+d*L,e[1]=M*r+h*c+d*k,e[2]=M*a+h*y+d*l,M=n[3],h=n[4],d=n[5],e[3]=M*s+h*i+d*L,e[4]=M*r+h*c+d*k,e[5]=M*a+h*y+d*l,M=n[6],h=n[7],d=n[8],e[6]=M*s+h*i+d*L,e[7]=M*r+h*c+d*k,e[8]=M*a+h*y+d*l,e}static mul(e,t,n){return e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=n[0],h=n[1];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=c,e[5]=y,e[6]=M*s+h*i+L,e[7]=M*r+h*c+k,e[8]=M*a+h*y+l,e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=Math.sin(n),h=Math.cos(n);return e[0]=h*s+M*i,e[1]=h*r+M*c,e[2]=h*a+M*y,e[3]=h*i-M*s,e[4]=h*c-M*r,e[5]=h*y-M*a,e[6]=L,e[7]=k,e[8]=l,e}static scale(e,t,n){let s=n[0],r=n[1];return e[0]=s*t[0],e[1]=s*t[1],e[2]=s*t[2],e[3]=r*t[3],e[4]=r*t[4],e[5]=r*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}static fromTranslation(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=0,e[3]=-n,e[4]=s,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static fromMat2d(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}static fromQuat(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n+n,c=s+s,y=r+r,L=n*i,k=s*i,l=s*c,M=r*i,h=r*c,d=r*y,m=a*i,o=a*c,x=a*y;return e[0]=1-l-d,e[3]=k-x,e[6]=M+o,e[1]=k+x,e[4]=1-L-d,e[7]=h-m,e[2]=M-o,e[5]=h+m,e[8]=1-L-l,e}static fromMat4(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}static normalFromMat4(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],M=t[10],h=t[11],d=t[12],m=t[13],o=t[14],x=t[15],z=n*c-s*i,R=n*y-r*i,g=n*L-a*i,w=s*y-r*c,V=s*L-a*c,T=r*L-a*y,A=k*m-l*d,D=k*o-M*d,f=k*x-h*d,I=l*o-M*m,S=l*x-h*m,F=M*x-h*o,Q=z*F-R*S+g*I+w*f-V*D+T*A;return Q?(Q=1/Q,e[0]=(c*F-y*S+L*I)*Q,e[1]=(y*f-i*F-L*D)*Q,e[2]=(i*S-c*f+L*A)*Q,e[3]=(r*S-s*F-a*I)*Q,e[4]=(n*F-r*f+a*D)*Q,e[5]=(s*f-n*S-a*A)*Q,e[6]=(m*T-o*V+x*w)*Q,e[7]=(o*g-d*T-x*R)*Q,e[8]=(d*V-m*g+x*z)*Q,e):null}static normalFromMat4Fast(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=i*k-k*L,e[1]=c*y-y*k,e[2]=a*L-L*y,e[3]=L*r-k*s,e[4]=k*n-y*r,e[5]=y*s-L*n,e[6]=s*c-r*i,e[7]=r*a-n*c,e[8]=n*i-s*a,e}static projection(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8])}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e[6]=t[6]+n[6]*s,e[7]=t[7]+n[7]*s,e[8]=t[8]+n[8]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=e[8],l=t[0],M=t[1],h=t[2],d=t[3],m=t[4],o=t[5],x=t[6],z=t[7],R=t[8];return Math.abs(n-l)<=1e-6*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(s-M)<=1e-6*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(r-h)<=1e-6*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(a-d)<=1e-6*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(i-m)<=1e-6*Math.max(1,Math.abs(i),Math.abs(m))&&Math.abs(c-o)<=1e-6*Math.max(1,Math.abs(c),Math.abs(o))&&Math.abs(y-x)<=1e-6*Math.max(1,Math.abs(y),Math.abs(x))&&Math.abs(L-z)<=1e-6*Math.max(1,Math.abs(L),Math.abs(z))&&Math.abs(k-R)<=1e-6*Math.max(1,Math.abs(k),Math.abs(R))}static str(e){return`Mat3(${e.join(", ")})`}};G.prototype.mul=G.prototype.multiply;G.mul=G.multiply;G.sub=G.subtract;var P=class b extends Float64Array{static#t=new Float64Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);static#e=new Float64Array(3);constructor(...e){switch(e.length){case 16:super(e);break;case 2:super(e[0],e[1],16);break;case 1:let t=e[0];typeof t=="number"?super([t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t]):super(t,0,16);break;default:super(b.#t);break}}get str(){return b.str(this)}copy(e){return this.set(e),this}identity(){return this.set(b.#t),this}multiply(e){return b.multiply(this,this,e)}mul(e){return this}transpose(){return b.transpose(this,this)}invert(){return b.invert(this,this)}translate(e){return b.translate(this,this,e)}rotate(e,t){return b.rotate(this,this,e,t)}scale(e){return b.scale(this,this,e)}rotateX(e){return b.rotateX(this,this,e)}rotateY(e){return b.rotateY(this,this,e)}rotateZ(e){return b.rotateZ(this,this,e)}perspectiveNO(e,t,n,s){return b.perspectiveNO(this,e,t,n,s)}perspectiveZO(e,t,n,s){return b.perspectiveZO(this,e,t,n,s)}orthoNO(e,t,n,s,r,a){return b.orthoNO(this,e,t,n,s,r,a)}orthoZO(e,t,n,s,r,a){return b.orthoZO(this,e,t,n,s,r,a)}static get BYTE_LENGTH(){return 16*Float64Array.BYTES_PER_ELEMENT}static create(){return new b}static clone(e){return new b(e)}static copy(e,t){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}static fromValues(...e){return new b(...e)}static set(e,...t){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}static identity(e){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}static transpose(e,t){if(e===t){let n=t[1],s=t[2],r=t[3],a=t[6],i=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=s,e[9]=a,e[11]=t[14],e[12]=r,e[13]=i,e[14]=c}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],M=t[10],h=t[11],d=t[12],m=t[13],o=t[14],x=t[15],z=n*c-s*i,R=n*y-r*i,g=n*L-a*i,w=s*y-r*c,V=s*L-a*c,T=r*L-a*y,A=k*m-l*d,D=k*o-M*d,f=k*x-h*d,I=l*o-M*m,S=l*x-h*m,F=M*x-h*o,Q=z*F-R*S+g*I+w*f-V*D+T*A;return Q?(Q=1/Q,e[0]=(c*F-y*S+L*I)*Q,e[1]=(r*S-s*F-a*I)*Q,e[2]=(m*T-o*V+x*w)*Q,e[3]=(M*V-l*T-h*w)*Q,e[4]=(y*f-i*F-L*D)*Q,e[5]=(n*F-r*f+a*D)*Q,e[6]=(o*g-d*T-x*R)*Q,e[7]=(k*T-M*g+h*R)*Q,e[8]=(i*S-c*f+L*A)*Q,e[9]=(s*f-n*S-a*A)*Q,e[10]=(d*V-m*g+x*z)*Q,e[11]=(l*g-k*V-h*z)*Q,e[12]=(c*D-i*I-y*A)*Q,e[13]=(n*I-s*D+r*A)*Q,e[14]=(m*R-d*w-o*z)*Q,e[15]=(k*w-l*R+M*z)*Q,e):null}static adjoint(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],M=t[10],h=t[11],d=t[12],m=t[13],o=t[14],x=t[15],z=n*c-s*i,R=n*y-r*i,g=n*L-a*i,w=s*y-r*c,V=s*L-a*c,T=r*L-a*y,A=k*m-l*d,D=k*o-M*d,f=k*x-h*d,I=l*o-M*m,S=l*x-h*m,F=M*x-h*o;return e[0]=c*F-y*S+L*I,e[1]=r*S-s*F-a*I,e[2]=m*T-o*V+x*w,e[3]=M*V-l*T-h*w,e[4]=y*f-i*F-L*D,e[5]=n*F-r*f+a*D,e[6]=o*g-d*T-x*R,e[7]=k*T-M*g+h*R,e[8]=i*S-c*f+L*A,e[9]=s*f-n*S-a*A,e[10]=d*V-m*g+x*z,e[11]=l*g-k*V-h*z,e[12]=c*D-i*I-y*A,e[13]=n*I-s*D+r*A,e[14]=m*R-d*w-o*z,e[15]=k*w-l*R+M*z,e}static determinant(e){let t=e[0],n=e[1],s=e[2],r=e[3],a=e[4],i=e[5],c=e[6],y=e[7],L=e[8],k=e[9],l=e[10],M=e[11],h=e[12],d=e[13],m=e[14],o=e[15],x=t*i-n*a,z=t*c-s*a,R=n*c-s*i,g=L*d-k*h,w=L*m-l*h,V=k*m-l*d,T=t*V-n*w+s*g,A=a*V-i*w+c*g,D=L*R-k*z+l*x,f=h*R-d*z+m*x;return y*T-r*A+o*D-M*f}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=t[9],h=t[10],d=t[11],m=t[12],o=t[13],x=t[14],z=t[15],R=n[0],g=n[1],w=n[2],V=n[3];return e[0]=R*s+g*c+w*l+V*m,e[1]=R*r+g*y+w*M+V*o,e[2]=R*a+g*L+w*h+V*x,e[3]=R*i+g*k+w*d+V*z,R=n[4],g=n[5],w=n[6],V=n[7],e[4]=R*s+g*c+w*l+V*m,e[5]=R*r+g*y+w*M+V*o,e[6]=R*a+g*L+w*h+V*x,e[7]=R*i+g*k+w*d+V*z,R=n[8],g=n[9],w=n[10],V=n[11],e[8]=R*s+g*c+w*l+V*m,e[9]=R*r+g*y+w*M+V*o,e[10]=R*a+g*L+w*h+V*x,e[11]=R*i+g*k+w*d+V*z,R=n[12],g=n[13],w=n[14],V=n[15],e[12]=R*s+g*c+w*l+V*m,e[13]=R*r+g*y+w*M+V*o,e[14]=R*a+g*L+w*h+V*x,e[15]=R*i+g*k+w*d+V*z,e}static mul(e,t,n){return e}static translate(e,t,n){let s=n[0],r=n[1],a=n[2];if(t===e)e[12]=t[0]*s+t[4]*r+t[8]*a+t[12],e[13]=t[1]*s+t[5]*r+t[9]*a+t[13],e[14]=t[2]*s+t[6]*r+t[10]*a+t[14],e[15]=t[3]*s+t[7]*r+t[11]*a+t[15];else{let i=t[0],c=t[1],y=t[2],L=t[3],k=t[4],l=t[5],M=t[6],h=t[7],d=t[8],m=t[9],o=t[10],x=t[11];e[0]=i,e[1]=c,e[2]=y,e[3]=L,e[4]=k,e[5]=l,e[6]=M,e[7]=h,e[8]=d,e[9]=m,e[10]=o,e[11]=x,e[12]=i*s+k*r+d*a+t[12],e[13]=c*s+l*r+m*a+t[13],e[14]=y*s+M*r+o*a+t[14],e[15]=L*s+h*r+x*a+t[15]}return e}static scale(e,t,n){let s=n[0],r=n[1],a=n[2];return e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e[3]=t[3]*s,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}static rotate(e,t,n,s){let r=s[0],a=s[1],i=s[2],c=Math.sqrt(r*r+a*a+i*i);if(c<1e-6)return null;c=1/c,r*=c,a*=c,i*=c;let y=Math.sin(n),L=Math.cos(n),k=1-L,l=t[0],M=t[1],h=t[2],d=t[3],m=t[4],o=t[5],x=t[6],z=t[7],R=t[8],g=t[9],w=t[10],V=t[11],T=r*r*k+L,A=a*r*k+i*y,D=i*r*k-a*y,f=r*a*k-i*y,I=a*a*k+L,S=i*a*k+r*y,F=r*i*k+a*y,Q=a*i*k-r*y,Y=i*i*k+L;return e[0]=l*T+m*A+R*D,e[1]=M*T+o*A+g*D,e[2]=h*T+x*A+w*D,e[3]=d*T+z*A+V*D,e[4]=l*f+m*I+R*S,e[5]=M*f+o*I+g*S,e[6]=h*f+x*I+w*S,e[7]=d*f+z*I+V*S,e[8]=l*F+m*Q+R*Y,e[9]=M*F+o*Q+g*Y,e[10]=h*F+x*Q+w*Y,e[11]=d*F+z*Q+V*Y,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e}static rotateX(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[4],i=t[5],c=t[6],y=t[7],L=t[8],k=t[9],l=t[10],M=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*r+L*s,e[5]=i*r+k*s,e[6]=c*r+l*s,e[7]=y*r+M*s,e[8]=L*r-a*s,e[9]=k*r-i*s,e[10]=l*r-c*s,e[11]=M*r-y*s,e}static rotateY(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[0],i=t[1],c=t[2],y=t[3],L=t[8],k=t[9],l=t[10],M=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*r-L*s,e[1]=i*r-k*s,e[2]=c*r-l*s,e[3]=y*r-M*s,e[8]=a*s+L*r,e[9]=i*s+k*r,e[10]=c*s+l*r,e[11]=y*s+M*r,e}static rotateZ(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[0],i=t[1],c=t[2],y=t[3],L=t[4],k=t[5],l=t[6],M=t[7];return t!==e&&(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[0]=a*r+L*s,e[1]=i*r+k*s,e[2]=c*r+l*s,e[3]=y*r+M*s,e[4]=L*r-a*s,e[5]=k*r-i*s,e[6]=l*r-c*s,e[7]=M*r-y*s,e}static fromTranslation(e,t){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]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromRotation(e,t,n){let s=n[0],r=n[1],a=n[2],i=Math.sqrt(s*s+r*r+a*a);if(i<1e-6)return null;i=1/i,s*=i,r*=i,a*=i;let c=Math.sin(t),y=Math.cos(t),L=1-y;return e[0]=s*s*L+y,e[1]=r*s*L+a*c,e[2]=a*s*L-r*c,e[3]=0,e[4]=s*r*L-a*c,e[5]=r*r*L+y,e[6]=a*r*L+s*c,e[7]=0,e[8]=s*a*L+r*c,e[9]=r*a*L-s*c,e[10]=a*a*L+y,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromXRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=n,e[7]=0,e[8]=0,e[9]=-n,e[10]=s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromYRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromZRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=0,e[3]=0,e[4]=-n,e[5]=s,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}static fromRotationTranslation(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=s+s,y=r+r,L=a+a,k=s*c,l=s*y,M=s*L,h=r*y,d=r*L,m=a*L,o=i*c,x=i*y,z=i*L;return e[0]=1-(h+m),e[1]=l+z,e[2]=M-x,e[3]=0,e[4]=l-z,e[5]=1-(k+m),e[6]=d+o,e[7]=0,e[8]=M+x,e[9]=d-o,e[10]=1-(k+h),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}static fromQuat2(e,t){let n=-t[0],s=-t[1],r=-t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=n*n+s*s+r*r+a*a;return k>0?(b.#e[0]=(i*a+L*n+c*r-y*s)*2/k,b.#e[1]=(c*a+L*s+y*n-i*r)*2/k,b.#e[2]=(y*a+L*r+i*s-c*n)*2/k):(b.#e[0]=(i*a+L*n+c*r-y*s)*2,b.#e[1]=(c*a+L*s+y*n-i*r)*2,b.#e[2]=(y*a+L*r+i*s-c*n)*2),b.fromRotationTranslation(e,t,b.#e),e}static normalFromMat4(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],M=t[10],h=t[11],d=t[12],m=t[13],o=t[14],x=t[15],z=n*c-s*i,R=n*y-r*i,g=n*L-a*i,w=s*y-r*c,V=s*L-a*c,T=r*L-a*y,A=k*m-l*d,D=k*o-M*d,f=k*x-h*d,I=l*o-M*m,S=l*x-h*m,F=M*x-h*o,Q=z*F-R*S+g*I+w*f-V*D+T*A;return Q?(Q=1/Q,e[0]=(c*F-y*S+L*I)*Q,e[1]=(y*f-i*F-L*D)*Q,e[2]=(i*S-c*f+L*A)*Q,e[3]=0,e[4]=(r*S-s*F-a*I)*Q,e[5]=(n*F-r*f+a*D)*Q,e[6]=(s*f-n*S-a*A)*Q,e[7]=0,e[8]=(m*T-o*V+x*w)*Q,e[9]=(o*g-d*T-x*R)*Q,e[10]=(d*V-m*g+x*z)*Q,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):null}static normalFromMat4Fast(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=i*k-k*L,e[1]=c*y-y*k,e[2]=a*L-L*y,e[3]=0,e[4]=L*r-k*s,e[5]=k*n-y*r,e[6]=y*s-L*n,e[7]=0,e[8]=s*c-r*i,e[9]=r*a-n*c,e[10]=n*i-s*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static getTranslation(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}static getScaling(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=Math.sqrt(n*n+s*s+r*r),e[1]=Math.sqrt(a*a+i*i+c*c),e[2]=Math.sqrt(y*y+L*L+k*k),e}static getRotation(e,t){b.getScaling(b.#e,t);let n=1/b.#e[0],s=1/b.#e[1],r=1/b.#e[2],a=t[0]*n,i=t[1]*s,c=t[2]*r,y=t[4]*n,L=t[5]*s,k=t[6]*r,l=t[8]*n,M=t[9]*s,h=t[10]*r,d=a+L+h,m=0;return d>0?(m=Math.sqrt(d+1)*2,e[3]=.25*m,e[0]=(k-M)/m,e[1]=(l-c)/m,e[2]=(i-y)/m):a>L&&a>h?(m=Math.sqrt(1+a-L-h)*2,e[3]=(k-M)/m,e[0]=.25*m,e[1]=(i+y)/m,e[2]=(l+c)/m):L>h?(m=Math.sqrt(1+L-a-h)*2,e[3]=(l-c)/m,e[0]=(i+y)/m,e[1]=.25*m,e[2]=(k+M)/m):(m=Math.sqrt(1+h-a-L)*2,e[3]=(i-y)/m,e[0]=(l+c)/m,e[1]=(k+M)/m,e[2]=.25*m),e}static decompose(e,t,n,s){t[0]=s[12],t[1]=s[13],t[2]=s[14];let r=s[0],a=s[1],i=s[2],c=s[4],y=s[5],L=s[6],k=s[8],l=s[9],M=s[10];n[0]=Math.sqrt(r*r+a*a+i*i),n[1]=Math.sqrt(c*c+y*y+L*L),n[2]=Math.sqrt(k*k+l*l+M*M);let h=1/n[0],d=1/n[1],m=1/n[2],o=r*h,x=a*d,z=i*m,R=c*h,g=y*d,w=L*m,V=k*h,T=l*d,A=M*m,D=o+g+A,f=0;return D>0?(f=Math.sqrt(D+1)*2,e[3]=.25*f,e[0]=(w-T)/f,e[1]=(V-z)/f,e[2]=(x-R)/f):o>g&&o>A?(f=Math.sqrt(1+o-g-A)*2,e[3]=(w-T)/f,e[0]=.25*f,e[1]=(x+R)/f,e[2]=(V+z)/f):g>A?(f=Math.sqrt(1+g-o-A)*2,e[3]=(V-z)/f,e[0]=(x+R)/f,e[1]=.25*f,e[2]=(w+T)/f):(f=Math.sqrt(1+A-o-g)*2,e[3]=(x-R)/f,e[0]=(V+z)/f,e[1]=(w+T)/f,e[2]=.25*f),e}static fromRotationTranslationScale(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3],y=r+r,L=a+a,k=i+i,l=r*y,M=r*L,h=r*k,d=a*L,m=a*k,o=i*k,x=c*y,z=c*L,R=c*k,g=s[0],w=s[1],V=s[2];return e[0]=(1-(d+o))*g,e[1]=(M+R)*g,e[2]=(h-z)*g,e[3]=0,e[4]=(M-R)*w,e[5]=(1-(l+o))*w,e[6]=(m+x)*w,e[7]=0,e[8]=(h+z)*V,e[9]=(m-x)*V,e[10]=(1-(l+d))*V,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}static fromRotationTranslationScaleOrigin(e,t,n,s,r){let a=t[0],i=t[1],c=t[2],y=t[3],L=a+a,k=i+i,l=c+c,M=a*L,h=a*k,d=a*l,m=i*k,o=i*l,x=c*l,z=y*L,R=y*k,g=y*l,w=s[0],V=s[1],T=s[2],A=r[0],D=r[1],f=r[2],I=(1-(m+x))*w,S=(h+g)*w,F=(d-R)*w,Q=(h-g)*V,Y=(1-(M+x))*V,X=(o+z)*V,C=(d+R)*T,$=(o-z)*T,H=(1-(M+m))*T;return e[0]=I,e[1]=S,e[2]=F,e[3]=0,e[4]=Q,e[5]=Y,e[6]=X,e[7]=0,e[8]=C,e[9]=$,e[10]=H,e[11]=0,e[12]=n[0]+A-(I*A+Q*D+C*f),e[13]=n[1]+D-(S*A+Y*D+$*f),e[14]=n[2]+f-(F*A+X*D+H*f),e[15]=1,e}static fromQuat(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n+n,c=s+s,y=r+r,L=n*i,k=s*i,l=s*c,M=r*i,h=r*c,d=r*y,m=a*i,o=a*c,x=a*y;return e[0]=1-l-d,e[1]=k+x,e[2]=M-o,e[3]=0,e[4]=k-x,e[5]=1-L-d,e[6]=h+m,e[7]=0,e[8]=M+o,e[9]=h-m,e[10]=1-L-l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static frustumNO(e,t,n,s,r,a,i=1/0){let c=1/(n-t),y=1/(r-s);if(e[0]=a*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*y,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(r+s)*y,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let L=1/(a-i);e[10]=(i+a)*L,e[14]=2*i*a*L}else e[10]=-1,e[14]=-2*a;return e}static frustum(e,t,n,s,r,a,i=1/0){return e}static frustumZO(e,t,n,s,r,a,i=1/0){let c=1/(n-t),y=1/(r-s);if(e[0]=a*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*y,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(r+s)*y,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let L=1/(a-i);e[10]=i*L,e[14]=i*a*L}else e[10]=-1,e[14]=-a;return e}static perspectiveNO(e,t,n,s,r=1/0){let a=1/Math.tan(t/2);if(e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,r!=null&&r!==1/0){let i=1/(s-r);e[10]=(r+s)*i,e[14]=2*r*s*i}else e[10]=-1,e[14]=-2*s;return e}static perspective(e,t,n,s,r=1/0){return e}static perspectiveZO(e,t,n,s,r=1/0){let a=1/Math.tan(t/2);if(e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,r!=null&&r!==1/0){let i=1/(s-r);e[10]=r*i,e[14]=r*s*i}else e[10]=-1,e[14]=-s;return e}static perspectiveFromFieldOfView(e,t,n,s){let r=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),i=Math.tan(t.leftDegrees*Math.PI/180),c=Math.tan(t.rightDegrees*Math.PI/180),y=2/(i+c),L=2/(r+a);return e[0]=y,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=L,e[6]=0,e[7]=0,e[8]=-((i-c)*y*.5),e[9]=(r-a)*L*.5,e[10]=s/(n-s),e[11]=-1,e[12]=0,e[13]=0,e[14]=s*n/(n-s),e[15]=0,e}static orthoNO(e,t,n,s,r,a,i){let c=1/(t-n),y=1/(s-r),L=1/(a-i);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*L,e[11]=0,e[12]=(t+n)*c,e[13]=(r+s)*y,e[14]=(i+a)*L,e[15]=1,e}static ortho(e,t,n,s,r,a,i){return e}static orthoZO(e,t,n,s,r,a,i){let c=1/(t-n),y=1/(s-r),L=1/(a-i);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=L,e[11]=0,e[12]=(t+n)*c,e[13]=(r+s)*y,e[14]=a*L,e[15]=1,e}static lookAt(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=s[0],y=s[1],L=s[2],k=n[0],l=n[1],M=n[2];if(Math.abs(r-k)<1e-6&&Math.abs(a-l)<1e-6&&Math.abs(i-M)<1e-6)return b.identity(e);let h=r-k,d=a-l,m=i-M,o=1/Math.sqrt(h*h+d*d+m*m);h*=o,d*=o,m*=o;let x=y*m-L*d,z=L*h-c*m,R=c*d-y*h;o=Math.sqrt(x*x+z*z+R*R),o?(o=1/o,x*=o,z*=o,R*=o):(x=0,z=0,R=0);let g=d*R-m*z,w=m*x-h*R,V=h*z-d*x;return o=Math.sqrt(g*g+w*w+V*V),o?(o=1/o,g*=o,w*=o,V*=o):(g=0,w=0,V=0),e[0]=x,e[1]=g,e[2]=h,e[3]=0,e[4]=z,e[5]=w,e[6]=d,e[7]=0,e[8]=R,e[9]=V,e[10]=m,e[11]=0,e[12]=-(x*r+z*a+R*i),e[13]=-(g*r+w*a+V*i),e[14]=-(h*r+d*a+m*i),e[15]=1,e}static targetTo(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=s[0],y=s[1],L=s[2],k=r-n[0],l=a-n[1],M=i-n[2],h=k*k+l*l+M*M;h>0&&(h=1/Math.sqrt(h),k*=h,l*=h,M*=h);let d=y*M-L*l,m=L*k-c*M,o=c*l-y*k;return h=d*d+m*m+o*o,h>0&&(h=1/Math.sqrt(h),d*=h,m*=h,o*=h),e[0]=d,e[1]=m,e[2]=o,e[3]=0,e[4]=l*o-M*m,e[5]=M*d-k*o,e[6]=k*m-l*d,e[7]=0,e[8]=k,e[9]=l,e[10]=M,e[11]=0,e[12]=r,e[13]=a,e[14]=i,e[15]=1,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8]+e[9]*e[9]+e[10]*e[10]+e[11]*e[11]+e[12]*e[12]+e[13]*e[13]+e[14]*e[14]+e[15]*e[15])}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}static sub(e,t,n){return e}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e[6]=t[6]+n[6]*s,e[7]=t[7]+n[7]*s,e[8]=t[8]+n[8]*s,e[9]=t[9]+n[9]*s,e[10]=t[10]+n[10]*s,e[11]=t[11]+n[11]*s,e[12]=t[12]+n[12]*s,e[13]=t[13]+n[13]*s,e[14]=t[14]+n[14]*s,e[15]=t[15]+n[15]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=e[8],l=e[9],M=e[10],h=e[11],d=e[12],m=e[13],o=e[14],x=e[15],z=t[0],R=t[1],g=t[2],w=t[3],V=t[4],T=t[5],A=t[6],D=t[7],f=t[8],I=t[9],S=t[10],F=t[11],Q=t[12],Y=t[13],X=t[14],C=t[15];return Math.abs(n-z)<=1e-6*Math.max(1,Math.abs(n),Math.abs(z))&&Math.abs(s-R)<=1e-6*Math.max(1,Math.abs(s),Math.abs(R))&&Math.abs(r-g)<=1e-6*Math.max(1,Math.abs(r),Math.abs(g))&&Math.abs(a-w)<=1e-6*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(i-V)<=1e-6*Math.max(1,Math.abs(i),Math.abs(V))&&Math.abs(c-T)<=1e-6*Math.max(1,Math.abs(c),Math.abs(T))&&Math.abs(y-A)<=1e-6*Math.max(1,Math.abs(y),Math.abs(A))&&Math.abs(L-D)<=1e-6*Math.max(1,Math.abs(L),Math.abs(D))&&Math.abs(k-f)<=1e-6*Math.max(1,Math.abs(k),Math.abs(f))&&Math.abs(l-I)<=1e-6*Math.max(1,Math.abs(l),Math.abs(I))&&Math.abs(M-S)<=1e-6*Math.max(1,Math.abs(M),Math.abs(S))&&Math.abs(h-F)<=1e-6*Math.max(1,Math.abs(h),Math.abs(F))&&Math.abs(d-Q)<=1e-6*Math.max(1,Math.abs(d),Math.abs(Q))&&Math.abs(m-Y)<=1e-6*Math.max(1,Math.abs(m),Math.abs(Y))&&Math.abs(o-X)<=1e-6*Math.max(1,Math.abs(o),Math.abs(X))&&Math.abs(x-C)<=1e-6*Math.max(1,Math.abs(x),Math.abs(C))}static str(e){return`Mat4(${e.join(", ")})`}};P.prototype.mul=P.prototype.multiply;P.sub=P.subtract;P.mul=P.multiply;P.frustum=P.frustumNO;P.perspective=P.perspectiveNO;P.ortho=P.orthoNO;var q=class b extends Float64Array{constructor(...e){switch(e.length){case 3:super(e);break;case 2:super(e[0],e[1],3);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t]):super(t,0,3);break}default:super(3);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get b(){return this[2]}set b(e){this[2]=e}get magnitude(){let e=this[0],t=this[1],n=this[2];return Math.sqrt(e*e+t*t+n*n)}get mag(){return this.magnitude}get squaredMagnitude(){let e=this[0],t=this[1],n=this[2];return e*e+t*t+n*n}get sqrMag(){return this.squaredMagnitude}get str(){return b.str(this)}copy(e){return this.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this[2]+=e[2],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this[2]-=e[2],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this[2]*=e[2],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this[2]/=e[2],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this[2]+=e[2]*t,this}distance(e){return b.distance(this,e)}dist(e){return 0}squaredDistance(e){return b.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this[2]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this[2]=1/this[2],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this[2]=Math.abs(this[2]),this}dot(e){return this[0]*e[0]+this[1]*e[1]+this[2]*e[2]}normalize(){return b.normalize(this,this)}static get BYTE_LENGTH(){return 3*Float64Array.BYTES_PER_ELEMENT}static create(){return new b}static clone(e){return new b(e)}static magnitude(e){let t=e[0],n=e[1],s=e[2];return Math.sqrt(t*t+n*n+s*s)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static fromValues(e,t,n){return new b(e,t,n)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}static set(e,t,n,s){return e[0]=t,e[1]=n,e[2]=s,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}static sub(e,t,n){return[0,0,0]}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}static mul(e,t,n){return[0,0,0]}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e}static div(e,t,n){return[0,0,0]}static ceil(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}static floor(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e}static distance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2];return Math.sqrt(n*n+s*s+r*r)}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2];return n*n+s*s+r*r}static sqrDist(e,t){return 0}static squaredLength(e){let t=e[0],n=e[1],s=e[2];return t*t+n*n+s*s}static sqrLen(e,t){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e}static normalize(e,t){let n=t[0],s=t[1],r=t[2],a=n*n+s*s+r*r;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}static cross(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[0],c=n[1],y=n[2];return e[0]=r*y-a*c,e[1]=a*i-s*y,e[2]=s*c-r*i,e}static lerp(e,t,n,s){let r=t[0],a=t[1],i=t[2];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e[2]=i+s*(n[2]-i),e}static slerp(e,t,n,s){let r=Math.acos(Math.min(Math.max(b.dot(t,n),-1),1)),a=Math.sin(r),i=Math.sin((1-s)*r)/a,c=Math.sin(s*r)/a;return e[0]=i*t[0]+c*n[0],e[1]=i*t[1]+c*n[1],e[2]=i*t[2]+c*n[2],e}static hermite(e,t,n,s,r,a){let i=a*a,c=i*(2*a-3)+1,y=i*(a-2)+a,L=i*(a-1),k=i*(3-2*a);return e[0]=t[0]*c+n[0]*y+s[0]*L+r[0]*k,e[1]=t[1]*c+n[1]*y+s[1]*L+r[1]*k,e[2]=t[2]*c+n[2]*y+s[2]*L+r[2]*k,e}static bezier(e,t,n,s,r,a){let i=1-a,c=i*i,y=a*a,L=c*i,k=3*a*c,l=3*y*i,M=y*a;return e[0]=t[0]*L+n[0]*k+s[0]*l+r[0]*M,e[1]=t[1]*L+n[1]*k+s[1]*l+r[1]*M,e[2]=t[2]*L+n[2]*k+s[2]*l+r[2]*M,e}static transformMat4(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[3]*s+n[7]*r+n[11]*a+n[15]||1;return e[0]=(n[0]*s+n[4]*r+n[8]*a+n[12])/i,e[1]=(n[1]*s+n[5]*r+n[9]*a+n[13])/i,e[2]=(n[2]*s+n[6]*r+n[10]*a+n[14])/i,e}static transformMat3(e,t,n){let s=t[0],r=t[1],a=t[2];return e[0]=s*n[0]+r*n[3]+a*n[6],e[1]=s*n[1]+r*n[4]+a*n[7],e[2]=s*n[2]+r*n[5]+a*n[8],e}static transformQuat(e,t,n){let s=n[0],r=n[1],a=n[2],i=n[3]*2,c=t[0],y=t[1],L=t[2],k=r*L-a*y,l=a*c-s*L,M=s*y-r*c,h=(r*M-a*l)*2,d=(a*k-s*M)*2,m=(s*l-r*k)*2;return e[0]=c+k*i+h,e[1]=y+l*i+d,e[2]=L+M*i+m,e}static rotateX(e,t,n,s){let r=n[1],a=n[2],i=t[1]-r,c=t[2]-a;return e[0]=t[0],e[1]=i*Math.cos(s)-c*Math.sin(s)+r,e[2]=i*Math.sin(s)+c*Math.cos(s)+a,e}static rotateY(e,t,n,s){let r=n[0],a=n[2],i=t[0]-r,c=t[2]-a;return e[0]=c*Math.sin(s)+i*Math.cos(s)+r,e[1]=t[1],e[2]=c*Math.cos(s)-i*Math.sin(s)+a,e}static rotateZ(e,t,n,s){let r=n[0],a=n[1],i=t[0]-r,c=t[1]-a;return e[0]=i*Math.cos(s)-c*Math.sin(s)+r,e[1]=i*Math.sin(s)+c*Math.cos(s)+a,e[2]=n[2],e}static angle(e,t){let n=e[0],s=e[1],r=e[2],a=t[0],i=t[1],c=t[2],y=Math.sqrt((n*n+s*s+r*r)*(a*a+i*i+c*c)),L=y&&b.dot(e,t)/y;return Math.acos(Math.min(Math.max(L,-1),1))}static zero(e){return e[0]=0,e[1]=0,e[2]=0,e}static str(e){return`Vec3(${e.join(", ")})`}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=t[0],i=t[1],c=t[2];return Math.abs(n-a)<=1e-6*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(s-i)<=1e-6*Math.max(1,Math.abs(s),Math.abs(i))&&Math.abs(r-c)<=1e-6*Math.max(1,Math.abs(r),Math.abs(c))}};q.prototype.sub=q.prototype.subtract;q.prototype.mul=q.prototype.multiply;q.prototype.div=q.prototype.divide;q.prototype.dist=q.prototype.distance;q.prototype.sqrDist=q.prototype.squaredDistance;q.sub=q.subtract;q.mul=q.multiply;q.div=q.divide;q.dist=q.distance;q.sqrDist=q.squaredDistance;q.sqrLen=q.squaredLength;q.mag=q.magnitude;q.length=q.magnitude;q.len=q.magnitude;var E=class b extends Float64Array{constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t,t]):super(t,0,4);break}default:super(4);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get w(){return this[3]}set w(e){this[3]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get b(){return this[2]}set b(e){this[2]=e}get a(){return this[3]}set a(e){this[3]=e}get magnitude(){let e=this[0],t=this[1],n=this[2],s=this[3];return Math.sqrt(e*e+t*t+n*n+s*s)}get mag(){return this.magnitude}get str(){return b.str(this)}copy(e){return super.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this[2]+=e[2],this[3]+=e[3],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this[2]-=e[2],this[3]-=e[3],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this[2]*=e[2],this[3]*=e[3],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this[2]/=e[2],this[3]/=e[3],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this[3]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this[2]+=e[2]*t,this[3]+=e[3]*t,this}distance(e){return b.distance(this,e)}dist(e){return 0}squaredDistance(e){return b.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this[2]*=-1,this[3]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this[2]=1/this[2],this[3]=1/this[3],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this[2]=Math.abs(this[2]),this[3]=Math.abs(this[3]),this}dot(e){return this[0]*e[0]+this[1]*e[1]+this[2]*e[2]+this[3]*e[3]}normalize(){return b.normalize(this,this)}static get BYTE_LENGTH(){return 4*Float64Array.BYTES_PER_ELEMENT}static create(){return new b}static clone(e){return new b(e)}static fromValues(e,t,n,s){return new b(e,t,n,s)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static set(e,t,n,s,r){return e[0]=t,e[1]=n,e[2]=s,e[3]=r,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}static sub(e,t,n){return e}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e[3]=t[3]*n[3],e}static mul(e,t,n){return e}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e[3]=t[3]/n[3],e}static div(e,t,n){return e}static ceil(e,t){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}static floor(e,t){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}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e[3]=Math.min(t[3],n[3]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e[3]=Math.max(t[3],n[3]),e}static round(e,t){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}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e}static distance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2],a=t[3]-e[3];return Math.hypot(n,s,r,a)}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2],a=t[3]-e[3];return n*n+s*s+r*r+a*a}static sqrDist(e,t){return 0}static magnitude(e){let t=e[0],n=e[1],s=e[2],r=e[3];return Math.sqrt(t*t+n*n+s*s+r*r)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){let t=e[0],n=e[1],s=e[2],r=e[3];return t*t+n*n+s*s+r*r}static sqrLen(e){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e}static normalize(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*n+s*s+r*r+a*a;return i>0&&(i=1/Math.sqrt(i)),e[0]=n*i,e[1]=s*i,e[2]=r*i,e[3]=a*i,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}static cross(e,t,n,s){let r=n[0]*s[1]-n[1]*s[0],a=n[0]*s[2]-n[2]*s[0],i=n[0]*s[3]-n[3]*s[0],c=n[1]*s[2]-n[2]*s[1],y=n[1]*s[3]-n[3]*s[1],L=n[2]*s[3]-n[3]*s[2],k=t[0],l=t[1],M=t[2],h=t[3];return e[0]=l*L-M*y+h*c,e[1]=-(k*L)+M*i-h*a,e[2]=k*y-l*i+h*r,e[3]=-(k*c)+l*a-M*r,e}static lerp(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e[2]=i+s*(n[2]-i),e[3]=c+s*(n[3]-c),e}static transformMat4(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3];return e[0]=n[0]*s+n[4]*r+n[8]*a+n[12]*i,e[1]=n[1]*s+n[5]*r+n[9]*a+n[13]*i,e[2]=n[2]*s+n[6]*r+n[10]*a+n[14]*i,e[3]=n[3]*s+n[7]*r+n[11]*a+n[15]*i,e}static transformQuat(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[0],c=n[1],y=n[2],L=n[3],k=L*s+c*a-y*r,l=L*r+y*s-i*a,M=L*a+i*r-c*s,h=-i*s-c*r-y*a;return e[0]=k*L+h*-i+l*-y-M*-c,e[1]=l*L+h*-c+M*-i-k*-y,e[2]=M*L+h*-y+k*-c-l*-i,e[3]=t[3],e}static zero(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}static str(e){return`Vec4(${e.join(", ")})`}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=t[0],c=t[1],y=t[2],L=t[3];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(a-L)<=1e-6*Math.max(1,Math.abs(a),Math.abs(L))}};E.prototype.sub=E.prototype.subtract;E.prototype.mul=E.prototype.multiply;E.prototype.div=E.prototype.divide;E.prototype.dist=E.prototype.distance;E.prototype.sqrDist=E.prototype.squaredDistance;E.sub=E.subtract;E.mul=E.multiply;E.div=E.divide;E.dist=E.distance;E.sqrDist=E.squaredDistance;E.sqrLen=E.squaredLength;E.mag=E.magnitude;E.length=E.magnitude;E.len=E.magnitude;var N=class b extends Float64Array{static#t="zyx";static#e=new Float64Array(4);static#r=new Float64Array(4);static#n=new Float64Array(9);static#s=new Float64Array(3);static#a=new Float64Array([1,0,0]);static#i=new Float64Array([0,1,0]);constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t,t]):super(t,0,4);break}default:super(4),this[3]=1;break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get w(){return this[3]}set w(e){this[3]=e}get magnitude(){let e=this[0],t=this[1],n=this[2],s=this[3];return Math.sqrt(e*e+t*t+n*n+s*s)}get mag(){return this.magnitude}get str(){return b.str(this)}copy(e){return super.set(e),this}identity(){return this[0]=0,this[1]=0,this[2]=0,this[3]=1,this}multiply(e){return b.multiply(this,this,e)}mul(e){return this}rotateX(e){return b.rotateX(this,this,e)}rotateY(e){return b.rotateY(this,this,e)}rotateZ(e){return b.rotateZ(this,this,e)}invert(){return b.invert(this,this)}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this[3]*=e,this}dot(e){return b.dot(this,e)}static get BYTE_LENGTH(){return 4*Float64Array.BYTES_PER_ELEMENT}static create(){return new b}static identity(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}static setAxisAngle(e,t,n){n*=.5;let s=Math.sin(n);return e[0]=s*t[0],e[1]=s*t[1],e[2]=s*t[2],e[3]=Math.cos(n),e}static getAxisAngle(e,t){let n=Math.acos(t[3])*2,s=Math.sin(n/2);return s>1e-6?(e[0]=t[0]/s,e[1]=t[1]/s,e[2]=t[2]/s):(e[0]=1,e[1]=0,e[2]=0),n}static getAngle(e,t){let n=b.dot(e,t);return Math.acos(2*n*n-1)}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*k+i*c+r*L-a*y,e[1]=r*k+i*y+a*c-s*L,e[2]=a*k+i*L+s*y-r*c,e[3]=i*k-s*c-r*y-a*L,e}static rotateX(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+i*c,e[1]=r*y+a*c,e[2]=a*y-r*c,e[3]=i*y-s*c,e}static rotateY(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y-a*c,e[1]=r*y+i*c,e[2]=a*y+s*c,e[3]=i*y-r*c,e}static rotateZ(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+r*c,e[1]=r*y-s*c,e[2]=a*y+i*c,e[3]=i*y-a*c,e}static calculateW(e,t){let n=t[0],s=t[1],r=t[2];return e[0]=n,e[1]=s,e[2]=r,e[3]=Math.sqrt(Math.abs(1-n*n-s*s-r*r)),e}static exp(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=Math.sqrt(n*n+s*s+r*r),c=Math.exp(a),y=i>0?c*Math.sin(i)/i:0;return e[0]=n*y,e[1]=s*y,e[2]=r*y,e[3]=c*Math.cos(i),e}static ln(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=Math.sqrt(n*n+s*s+r*r),c=i>0?Math.atan2(i,a)/i:0;return e[0]=n*c,e[1]=s*c,e[2]=r*c,e[3]=.5*Math.log(n*n+s*s+r*r+a*a),e}static pow(e,t,n){return b.ln(e,t),b.scale(e,e,n),b.exp(e,e),e}static slerp(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3],y=n[0],L=n[1],k=n[2],l=n[3],M,h,d=r*y+a*L+i*k+c*l;if(d<0&&(d=-d,y=-y,L=-L,k=-k,l=-l),1-d>1e-6){let m=Math.acos(d),o=Math.sin(m);M=Math.sin((1-s)*m)/o,h=Math.sin(s*m)/o}else M=1-s,h=s;return e[0]=M*r+h*y,e[1]=M*a+h*L,e[2]=M*i+h*k,e[3]=M*c+h*l,e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*n+s*s+r*r+a*a,c=i?1/i:0;return e[0]=-n*c,e[1]=-s*c,e[2]=-r*c,e[3]=a*c,e}static conjugate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}static fromMat3(e,t){let n=t[0]+t[4]+t[8],s;if(n>0)s=Math.sqrt(n+1),e[3]=.5*s,s=.5/s,e[0]=(t[5]-t[7])*s,e[1]=(t[6]-t[2])*s,e[2]=(t[1]-t[3])*s;else{let r=0;t[4]>t[0]&&(r=1),t[8]>t[r*3+r]&&(r=2);let a=(r+1)%3,i=(r+2)%3;s=Math.sqrt(t[r*3+r]-t[a*3+a]-t[i*3+i]+1),e[r]=.5*s,s=.5/s,e[3]=(t[a*3+i]-t[i*3+a])*s,e[a]=(t[a*3+r]+t[r*3+a])*s,e[i]=(t[i*3+r]+t[r*3+i])*s}return e}static fromEuler(e,t,n,s,r=b.#t){let a=.5*Math.PI/180;t*=a,n*=a,s*=a;let i=Math.sin(t),c=Math.cos(t),y=Math.sin(n),L=Math.cos(n),k=Math.sin(s),l=Math.cos(s);switch(r){case"xyz":e[0]=i*L*l+c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l-i*y*k;break;case"xzy":e[0]=i*L*l-c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l+i*y*k;break;case"yxz":e[0]=i*L*l+c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l+i*y*k;break;case"yzx":e[0]=i*L*l+c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l-i*y*k;break;case"zxy":e[0]=i*L*l-c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l-i*y*k;break;case"zyx":e[0]=i*L*l-c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l+i*y*k;break;default:throw new Error(`Unknown angle order ${r}`)}return e}static str(e){return`Quat(${e.join(", ")})`}static clone(e){return new b(e)}static fromValues(e,t,n,s){return new b(e,t,n,s)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static set(e,t,n,s,r){return e}static add(e,t,n){return e}static mul(e,t,n){return e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}static lerp(e,t,n,s){return e}static magnitude(e){return 0}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){return 0}static sqrLen(e){return 0}static normalize(e,t){return e}static exactEquals(e,t){return!1}static equals(e,t){return!1}static rotationTo(e,t,n){let s=q.dot(t,n);return s<-.999999?(q.cross(b.#s,b.#a,t),q.mag(b.#s)<1e-6&&q.cross(b.#s,b.#i,t),q.normalize(b.#s,b.#s),b.setAxisAngle(e,b.#s,Math.PI),e):s>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(q.cross(b.#s,t,n),e[0]=b.#s[0],e[1]=b.#s[1],e[2]=b.#s[2],e[3]=1+s,b.normalize(e,e))}static sqlerp(e,t,n,s,r,a){return b.slerp(b.#e,t,r,a),b.slerp(b.#r,n,s,a),b.slerp(e,b.#e,b.#r,2*a*(1-a)),e}static setAxes(e,t,n,s){return b.#n[0]=n[0],b.#n[3]=n[1],b.#n[6]=n[2],b.#n[1]=s[0],b.#n[4]=s[1],b.#n[7]=s[2],b.#n[2]=-t[0],b.#n[5]=-t[1],b.#n[8]=-t[2],b.normalize(e,b.fromMat3(e,b.#n))}};N.set=E.set;N.add=E.add;N.lerp=E.lerp;N.normalize=E.normalize;N.squaredLength=E.squaredLength;N.sqrLen=E.squaredLength;N.exactEquals=E.exactEquals;N.equals=E.equals;N.magnitude=E.magnitude;N.prototype.mul=N.prototype.multiply;N.mul=N.multiply;N.mag=N.magnitude;N.length=N.magnitude;N.len=N.magnitude;var O=class b extends Float64Array{static#t=new Float64Array(4);static#e=new Float64Array(3);constructor(...e){switch(e.length){case 8:super(e);break;case 2:super(e[0],e[1],8);break;case 1:{let t=e[0];typeof t=="number"?super([t,t,t,t,t,t,t,t]):super(t,0,8);break}default:super(8),this[3]=1;break}}get str(){return b.str(this)}copy(e){return super.set(e),this}static get BYTE_LENGTH(){return 8*Float64Array.BYTES_PER_ELEMENT}static create(){return new b}static clone(e){return new b(e)}static fromValues(e,t,n,s,r,a,i,c){return new b(e,t,n,s,r,a,i,c)}static fromRotationTranslationValues(e,t,n,s,r,a,i){let c=r*.5,y=a*.5,L=i*.5;return new b(e,t,n,s,c*s+y*n-L*t,y*s+L*e-c*n,L*s+c*t-y*e,-c*e-y*t-L*n)}static fromRotationTranslation(e,t,n){let s=n[0]*.5,r=n[1]*.5,a=n[2]*.5,i=t[0],c=t[1],y=t[2],L=t[3];return e[0]=i,e[1]=c,e[2]=y,e[3]=L,e[4]=s*L+r*y-a*c,e[5]=r*L+a*i-s*y,e[6]=a*L+s*c-r*i,e[7]=-s*i-r*c-a*y,e}static fromTranslation(e,t){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0]*.5,e[5]=t[1]*.5,e[6]=t[2]*.5,e[7]=0,e}static fromRotation(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=0,e[5]=0,e[6]=0,e[7]=0,e}static fromMat4(e,t){return P.getRotation(b.#t,t),P.getTranslation(b.#e,t),b.fromRotationTranslation(e,b.#t,b.#e)}static copy(e,t){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}static identity(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e}static set(e,t,n,s,r,a,i,c,y){return e[0]=t,e[1]=n,e[2]=s,e[3]=r,e[4]=a,e[5]=i,e[6]=c,e[7]=y,e}static getReal(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static getDual(e,t){return e[0]=t[4],e[1]=t[5],e[2]=t[6],e[3]=t[7],e}static setReal(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static setDual(e,t){return e[4]=t[0],e[5]=t[1],e[6]=t[2],e[7]=t[3],e}static getTranslation(e,t){let n=t[4],s=t[5],r=t[6],a=t[7],i=-t[0],c=-t[1],y=-t[2],L=t[3];return e[0]=(n*L+a*i+s*y-r*c)*2,e[1]=(s*L+a*c+r*i-n*y)*2,e[2]=(r*L+a*y+n*c-s*i)*2,e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0]*.5,y=n[1]*.5,L=n[2]*.5,k=t[4],l=t[5],M=t[6],h=t[7];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=i*c+r*L-a*y+k,e[5]=i*y+a*c-s*L+l,e[6]=i*L+s*y-r*c+M,e[7]=-s*c-r*y-a*L+h,e}static rotateX(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,M=y*i+k*r+L*s-c*a,h=L*i+k*a+c*r-y*s,d=k*i-c*s-y*r-L*a;return N.rotateX(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+d*s+M*a-h*r,e[5]=M*i+d*r+h*s-l*a,e[6]=h*i+d*a+l*r-M*s,e[7]=d*i-l*s-M*r-h*a,e}static rotateY(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,M=y*i+k*r+L*s-c*a,h=L*i+k*a+c*r-y*s,d=k*i-c*s-y*r-L*a;return N.rotateY(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+d*s+M*a-h*r,e[5]=M*i+d*r+h*s-l*a,e[6]=h*i+d*a+l*r-M*s,e[7]=d*i-l*s-M*r-h*a,e}static rotateZ(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,M=y*i+k*r+L*s-c*a,h=L*i+k*a+c*r-y*s,d=k*i-c*s-y*r-L*a;return N.rotateZ(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+d*s+M*a-h*r,e[5]=M*i+d*r+h*s-l*a,e[6]=h*i+d*a+l*r-M*s,e[7]=d*i-l*s-M*r-h*a,e}static rotateByQuatAppend(e,t,n){let s=n[0],r=n[1],a=n[2],i=n[3],c=t[0],y=t[1],L=t[2],k=t[3];return e[0]=c*i+k*s+y*a-L*r,e[1]=y*i+k*r+L*s-c*a,e[2]=L*i+k*a+c*r-y*s,e[3]=k*i-c*s-y*r-L*a,c=t[4],y=t[5],L=t[6],k=t[7],e[4]=c*i+k*s+y*a-L*r,e[5]=y*i+k*r+L*s-c*a,e[6]=L*i+k*a+c*r-y*s,e[7]=k*i-c*s-y*r-L*a,e}static rotateByQuatPrepend(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*k+i*c+r*L-a*y,e[1]=r*k+i*y+a*c-s*L,e[2]=a*k+i*L+s*y-r*c,e[3]=i*k-s*c-r*y-a*L,c=n[4],y=n[5],L=n[6],k=n[7],e[4]=s*k+i*c+r*L-a*y,e[5]=r*k+i*y+a*c-s*L,e[6]=a*k+i*L+s*y-r*c,e[7]=i*k-s*c-r*y-a*L,e}static rotateAroundAxis(e,t,n,s){if(Math.abs(s)<1e-6)return b.copy(e,t);let r=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);s*=.5;let a=Math.sin(s),i=a*n[0]/r,c=a*n[1]/r,y=a*n[2]/r,L=Math.cos(s),k=t[0],l=t[1],M=t[2],h=t[3];e[0]=k*L+h*i+l*y-M*c,e[1]=l*L+h*c+M*i-k*y,e[2]=M*L+h*y+k*c-l*i,e[3]=h*L-k*i-l*c-M*y;let d=t[4],m=t[5],o=t[6],x=t[7];return e[4]=d*L+x*i+m*y-o*c,e[5]=m*L+x*c+o*i-d*y,e[6]=o*L+x*y+d*c-m*i,e[7]=x*L-d*i-m*c-o*y,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[4],y=n[5],L=n[6],k=n[7],l=t[4],M=t[5],h=t[6],d=t[7],m=n[0],o=n[1],x=n[2],z=n[3];return e[0]=s*z+i*m+r*x-a*o,e[1]=r*z+i*o+a*m-s*x,e[2]=a*z+i*x+s*o-r*m,e[3]=i*z-s*m-r*o-a*x,e[4]=s*k+i*c+r*L-a*y+l*z+d*m+M*x-h*o,e[5]=r*k+i*y+a*c-s*L+M*z+d*o+h*m-l*x,e[6]=a*k+i*L+s*y-r*c+h*z+d*x+l*o-M*m,e[7]=i*k-s*c-r*y-a*L+d*z-l*m-M*o-h*x,e}static mul(e,t,n){return e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e}static dot(e,t){return 0}static lerp(e,t,n,s){let r=1-s;return b.dot(t,n)<0&&(s=-s),e[0]=t[0]*r+n[0]*s,e[1]=t[1]*r+n[1]*s,e[2]=t[2]*r+n[2]*s,e[3]=t[3]*r+n[3]*s,e[4]=t[4]*r+n[4]*s,e[5]=t[5]*r+n[5]*s,e[6]=t[6]*r+n[6]*s,e[7]=t[7]*r+n[7]*s,e}static invert(e,t){let n=b.squaredLength(t);return e[0]=-t[0]/n,e[1]=-t[1]/n,e[2]=-t[2]/n,e[3]=t[3]/n,e[4]=-t[4]/n,e[5]=-t[5]/n,e[6]=-t[6]/n,e[7]=t[7]/n,e}static conjugate(e,t){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}static magnitude(e){return 0}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){return 0}static sqrLen(e){return 0}static normalize(e,t){let n=b.squaredLength(t);if(n>0){n=Math.sqrt(n);let s=t[0]/n,r=t[1]/n,a=t[2]/n,i=t[3]/n,c=t[4],y=t[5],L=t[6],k=t[7],l=s*c+r*y+a*L+i*k;e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=(c-s*l)/n,e[5]=(y-r*l)/n,e[6]=(L-a*l)/n,e[7]=(k-i*l)/n}return e}static str(e){return`Quat2(${e.join(", ")})`}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=t[0],l=t[1],M=t[2],h=t[3],d=t[4],m=t[5],o=t[6],x=t[7];return Math.abs(n-k)<=1e-6*Math.max(1,Math.abs(n),Math.abs(k))&&Math.abs(s-l)<=1e-6*Math.max(1,Math.abs(s),Math.abs(l))&&Math.abs(r-M)<=1e-6*Math.max(1,Math.abs(r),Math.abs(M))&&Math.abs(a-h)<=1e-6*Math.max(1,Math.abs(a),Math.abs(h))&&Math.abs(i-d)<=1e-6*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(c-m)<=1e-6*Math.max(1,Math.abs(c),Math.abs(m))&&Math.abs(y-o)<=1e-6*Math.max(1,Math.abs(y),Math.abs(o))&&Math.abs(L-x)<=1e-6*Math.max(1,Math.abs(L),Math.abs(x))}};O.dot=N.dot;O.squaredLength=N.squaredLength;O.sqrLen=N.squaredLength;O.mag=N.magnitude;O.length=N.magnitude;O.len=N.magnitude;O.mul=O.multiply;var B=class b extends Float64Array{constructor(...e){switch(e.length){case 2:{let t=e[0];typeof t=="number"?super([t,e[1]]):super(t,e[1],2);break}case 1:{let t=e[0];typeof t=="number"?super([t,t]):super(t,0,2);break}default:super(2);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get magnitude(){return Math.hypot(this[0],this[1])}get mag(){return this.magnitude}get squaredMagnitude(){let e=this[0],t=this[1];return e*e+t*t}get sqrMag(){return this.squaredMagnitude}get str(){return b.str(this)}copy(e){return this.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this}distance(e){return b.distance(this,e)}dist(e){return 0}squaredDistance(e){return b.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this}dot(e){return this[0]*e[0]+this[1]*e[1]}normalize(){return b.normalize(this,this)}static get BYTE_LENGTH(){return 2*Float64Array.BYTES_PER_ELEMENT}static create(){return new b}static clone(e){return new b(e)}static fromValues(e,t){return new b(e,t)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e}static set(e,t,n){return e[0]=t,e[1]=n,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}static sub(e,t,n){return[0,0]}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e}static mul(e,t,n){return[0,0]}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e}static div(e,t,n){return[0,0]}static ceil(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}static floor(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e}static round(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e}static distance(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1])}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1];return n*n+s*s}static sqrDist(e,t){return 0}static magnitude(e){let t=e[0],n=e[1];return Math.sqrt(t*t+n*n)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){let t=e[0],n=e[1];return t*t+n*n}static sqrLen(e,t){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e}static normalize(e,t){let n=t[0],s=t[1],r=n*n+s*s;return r>0&&(r=1/Math.sqrt(r)),e[0]=t[0]*r,e[1]=t[1]*r,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]}static cross(e,t,n){let s=t[0]*n[1]-t[1]*n[0];return e[0]=e[1]=0,e[2]=s,e}static lerp(e,t,n,s){let r=t[0],a=t[1];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e}static transformMat2(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[2]*r,e[1]=n[1]*s+n[3]*r,e}static transformMat2d(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[2]*r+n[4],e[1]=n[1]*s+n[3]*r+n[5],e}static transformMat3(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[3]*r+n[6],e[1]=n[1]*s+n[4]*r+n[7],e}static transformMat4(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[4]*r+n[12],e[1]=n[1]*s+n[5]*r+n[13],e}static rotate(e,t,n,s){let r=t[0]-n[0],a=t[1]-n[1],i=Math.sin(s),c=Math.cos(s);return e[0]=r*c-a*i+n[0],e[1]=r*i+a*c+n[1],e}static angle(e,t){let n=e[0],s=e[1],r=t[0],a=t[1],i=Math.sqrt(n*n+s*s)*Math.sqrt(r*r+a*a),c=i&&(n*r+s*a)/i;return Math.acos(Math.min(Math.max(c,-1),1))}static zero(e){return e[0]=0,e[1]=0,e}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]}static equals(e,t){let n=e[0],s=e[1],r=t[0],a=t[1];return Math.abs(n-r)<=1e-6*Math.max(1,Math.abs(n),Math.abs(r))&&Math.abs(s-a)<=1e-6*Math.max(1,Math.abs(s),Math.abs(a))}static str(e){return`Vec2(${e.join(", ")})`}};B.prototype.sub=B.prototype.subtract;B.prototype.mul=B.prototype.multiply;B.prototype.div=B.prototype.divide;B.prototype.dist=B.prototype.distance;B.prototype.sqrDist=B.prototype.squaredDistance;B.sub=B.subtract;B.mul=B.multiply;B.div=B.divide;B.dist=B.distance;B.sqrDist=B.squaredDistance;B.sqrLen=B.squaredLength;B.mag=B.magnitude;B.length=B.magnitude;B.len=B.magnitude;var W=!1;function ge(){if(W)return;let b=["xx","xy","yx","yy","xxx","xxy","xyx","xyy","yxx","yxy","yyx","yyy","xxxx","xxxy","xxyx","xxyy","xyxx","xyxy","xyyx","xyyy","yxxx","yxxy","yxyx","yxyy","yyxx","yyxy","yyyx","yyyy","rr","rg","gr","gg","rrr","rrg","rgr","rgg","grr","grg","ggr","ggg","rrrr","rrrg","rrgr","rrgg","rgrr","rgrg","rggr","rggg","grrr","grrg","grgr","grgg","ggrr","ggrg","gggr","gggg"],e=["xz","yz","zx","zy","zz","xxz","xyz","xzx","xzy","xzz","yxz","yyz","yzx","yzy","yzz","zxx","zxy","zxz","zyx","zyy","zyz","zzx","zzy","zzz","xxxz","xxyz","xxzx","xxzy","xxzz","xyxz","xyyz","xyzx","xyzy","xyzz","xzxx","xzxy","xzxz","xzyx","xzyy","xzyz","xzzx","xzzy","xzzz","yxxz","yxyz","yxzx","yxzy","yxzz","yyxz","yyyz","yyzx","yyzy","yyzz","yzxx","yzxy","yzxz","yzyx","yzyy","yzyz","yzzx","yzzy","yzzz","zxxx","zxxy","zxxz","zxyx","zxyy","zxyz","zxzx","zxzy","zxzz","zyxx","zyxy","zyxz","zyyx","zyyy","zyyz","zyzx","zyzy","zyzz","zzxx","zzxy","zzxz","zzyx","zzyy","zzyz","zzzx","zzzy","zzzz","rb","gb","br","bg","bb","rrb","rgb","rbr","rbg","rbb","grb","ggb","gbr","gbg","gbb","brr","brg","brb","bgr","bgg","bgb","bbr","bbg","bbb","rrrb","rrgb","rrbr","rrbg","rrbb","rgrb","rggb","rgbr","rgbg","rgbb","rbrr","rbrg","rbrb","rbgr","rbgg","rbgb","rbbr","rbbg","rbbb","grrb","grgb","grbr","grbg","grbb","ggrb","gggb","ggbr","ggbg","ggbb","gbrr","gbrg","gbrb","gbgr","gbgg","gbgb","gbbr","gbbg","gbbb","brrr","brrg","brrb","brgr","brgg","brgb","brbr","brbg","brbb","bgrr","bgrg","bgrb","bggr","bggg","bggb","bgbr","bgbg","bgbb","bbrr","bbrg","bbrb","bbgr","bbgg","bbgb","bbbr","bbbg","bbbb"],t=["xw","yw","zw","wx","wy","wz","ww","xxw","xyw","xzw","xwx","xwy","xwz","xww","yxw","yyw","yzw","ywx","ywy","ywz","yww","zxw","zyw","zzw","zwx","zwy","zwz","zww","wxx","wxy","wxz","wxw","wyx","wyy","wyz","wyw","wzx","wzy","wzz","wzw","wwx","wwy","wwz","www","xxxw","xxyw","xxzw","xxwx","xxwy","xxwz","xxww","xyxw","xyyw","xyzw","xywx","xywy","xywz","xyww","xzxw","xzyw","xzzw","xzwx","xzwy","xzwz","xzww","xwxx","xwxy","xwxz","xwxw","xwyx","xwyy","xwyz","xwyw","xwzx","xwzy","xwzz","xwzw","xwwx","xwwy","xwwz","xwww","yxxw","yxyw","yxzw","yxwx","yxwy","yxwz","yxww","yyxw","yyyw","yyzw","yywx","yywy","yywz","yyww","yzxw","yzyw","yzzw","yzwx","yzwy","yzwz","yzww","ywxx","ywxy","ywxz","ywxw","ywyx","ywyy","ywyz","ywyw","ywzx","ywzy","ywzz","ywzw","ywwx","ywwy","ywwz","ywww","zxxw","zxyw","zxzw","zxwx","zxwy","zxwz","zxww","zyxw","zyyw","zyzw","zywx","zywy","zywz","zyww","zzxw","zzyw","zzzw","zzwx","zzwy","zzwz","zzww","zwxx","zwxy","zwxz","zwxw","zwyx","zwyy","zwyz","zwyw","zwzx","zwzy","zwzz","zwzw","zwwx","zwwy","zwwz","zwww","wxxx","wxxy","wxxz","wxxw","wxyx","wxyy","wxyz","wxyw","wxzx","wxzy","wxzz","wxzw","wxwx","wxwy","wxwz","wxww","wyxx","wyxy","wyxz","wyxw","wyyx","wyyy","wyyz","wyyw","wyzx","wyzy","wyzz","wyzw","wywx","wywy","wywz","wyww","wzxx","wzxy","wzxz","wzxw","wzyx","wzyy","wzyz","wzyw","wzzx","wzzy","wzzz","wzzw","wzwx","wzwy","wzwz","wzww","wwxx","wwxy","wwxz","wwxw","wwyx","wwyy","wwyz","wwyw","wwzx","wwzy","wwzz","wwzw","wwwx","wwwy","wwwz","wwww","ra","ga","ba","ar","ag","ab","aa","rra","rga","rba","rar","rag","rab","raa","gra","gga","gba","gar","gag","gab","gaa","bra","bga","bba","bar","bag","bab","baa","arr","arg","arb","ara","agr","agg","agb","aga","abr","abg","abb","aba","aar","aag","aab","aaa","rrra","rrga","rrba","rrar","rrag","rrab","rraa","rgra","rgga","rgba","rgar","rgag","rgab","rgaa","rbra","rbga","rbba","rbar","rbag","rbab","rbaa","rarr","rarg","rarb","rara","ragr","ragg","ragb","raga","rabr","rabg","rabb","raba","raar","raag","raab","raaa","grra","grga","grba","grar","grag","grab","graa","ggra","ggga","ggba","ggar","ggag","ggab","ggaa","gbra","gbga","gbba","gbar","gbag","gbab","gbaa","garr","garg","garb","gara","gagr","gagg","gagb","gaga","gabr","gabg","gabb","gaba","gaar","gaag","gaab","gaaa","brra","brga","brba","brar","brag","brab","braa","bgra","bgga","bgba","bgar","bgag","bgab","bgaa","bbra","bbga","bbba","bbar","bbag","bbab","bbaa","barr","barg","barb","bara","bagr","bagg","bagb","baga","babr","babg","babb","baba","baar","baag","baab","baaa","arrr","arrg","arrb","arra","argr","argg","argb","arga","arbr","arbg","arbb","arba","arar","arag","arab","araa","agrr","agrg","agrb","agra","aggr","aggg","aggb","agga","agbr","agbg","agbb","agba","agar","agag","agab","agaa","abrr","abrg","abrb","abra","abgr","abgg","abgb","abga","abbr","abbg","abbb","abba","abar","abag","abab","abaa","aarr","aarg","aarb","aara","aagr","aagg","aagb","aaga","aabr","aabg","aabb","aaba","aaar","aaag","aaab","aaaa"],n={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};function s(r){switch(r.length){case 2:return function(){return new B(this[n[r[0]]],this[n[r[1]]])};case 3:return function(){return new q(this[n[r[0]]],this[n[r[1]]],this[n[r[2]]])};case 4:return function(){return new E(this[n[r[0]]],this[n[r[1]]],this[n[r[2]]],this[n[r[3]]])}}throw new Error("Illegal swizzle length")}for(let r of b){let a=s(r);Object.defineProperty(B.prototype,r,{get:a}),Object.defineProperty(q.prototype,r,{get:a}),Object.defineProperty(E.prototype,r,{get:a})}for(let r of e){let a=s(r);Object.defineProperty(q.prototype,r,{get:a}),Object.defineProperty(E.prototype,r,{get:a})}for(let r of t){let a=s(r);Object.defineProperty(E.prototype,r,{get:a})}W=!0}var U=Math.PI/180,J=180/Math.PI;function ze(b){return b*J}function we(b){return b*U}export{ge as EnableSwizzlesF64,Z as Mat2,j as Mat2d,G as Mat3,P as Mat4,N as Quat,O as Quat2,B as Vec2,q as Vec3,E as Vec4,ze as toDegree,we as toRadian}; +//# sourceMappingURL=gl-matrix-f64.min.js.map diff --git a/dist-cdn/esm/2022/gl-matrix-f64.min.js.map b/dist-cdn/esm/2022/gl-matrix-f64.min.js.map new file mode 100644 index 00000000..f433c6ac --- /dev/null +++ b/dist-cdn/esm/2022/gl-matrix-f64.min.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../../../src/_lib/f64/Mat2.ts", "../../../src/_lib/f64/Mat2d.ts", "../../../src/_lib/f64/Mat3.ts", "../../../src/_lib/f64/Mat4.ts", "../../../src/_lib/f64/Vec3.ts", "../../../src/_lib/f64/Vec4.ts", "../../../src/_lib/f64/Quat.ts", "../../../src/_lib/f64/Quat2.ts", "../../../src/_lib/f64/Vec2.ts", "../../../src/swizzle/f64/index.ts", "../../../src/util/angleConversion.ts"], + "sourcesContent": ["import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x2 Matrix\r\n */\r\nexport class Mat2 extends Float64Array {\r\n static #IDENTITY_2X2 = new Float64Array([\r\n 1, 0,\r\n 0, 1\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n default:\r\n super(Mat2.#IDENTITY_2X2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2} into `this`.\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2.identity(this)\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n identity(): this {\r\n this.set(Mat2.#IDENTITY_2X2);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2} against another one\r\n * Equivalent to `Mat2.multiply(this, this, b);`\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat2}\r\n * Equivalent to `Mat2.transpose(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n transpose(): this {\r\n return Mat2.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat2}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n *\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n invert(): this {\r\n return Mat2.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2.scale(this, this, v);`\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2} by the given angle around the given axis\r\n * Equivalent to `Mat2.rotate(this, this, rad);`\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n * @category Methods\r\n */\r\n rotate(rad: number): this {\r\n return Mat2.rotate(this, this, rad) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2}\r\n */\r\n static create(): Mat2 {\r\n return new Mat2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2}\r\n */\r\n static clone(a: Readonly): Mat2 {\r\n return new Mat2(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2Like, a: Readonly): Mat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2}\r\n */\r\n static fromValues(...values: number[]): Mat2 {\r\n return new Mat2(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2Like, ...values: number[]): Mat2Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2Like): Mat2Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat2Like, a: Readonly): Mat2Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache\r\n // some values\r\n if (out === a) {\r\n const a1 = a[1];\r\n out[1] = a[2];\r\n out[2] = a1;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[2];\r\n out[2] = a[1];\r\n out[3] = a[3];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2Like, a: Mat2Like): Mat2Like | null {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n // Calculate the determinant\r\n let det = a0 * a3 - a2 * a1;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = a3 * det;\r\n out[1] = -a1 * det;\r\n out[2] = -a2 * det;\r\n out[3] = a0 * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat2Like, a: Mat2Like): Mat2Like {\r\n // Caching this value is necessary if out == a\r\n const a0 = a[0];\r\n out[0] = a[3];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[2] * a[1];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n return out;\r\n }\r\n /**\r\n * Alias for {@link Mat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; }\r\n\r\n /**\r\n * Rotates a {@link Mat2} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2Like, a: Readonly, rad: number): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2Like, a: Readonly, v: Readonly): Mat2Like {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2Like, rad: number): Mat2Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat2.identity(dest);\r\n * mat2.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2Like, v: Readonly): Mat2Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2Like, a: Readonly, b: number): Mat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2Like, a: Readonly, b: Readonly, scale: number): Mat2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\r\n * @category Static\r\n *\r\n * @param L - the lower triangular matrix\r\n * @param D - the diagonal matrix\r\n * @param U - the upper triangular matrix\r\n * @param a - the input matrix to factorize\r\n */\r\n\r\n static LDU(L: Mat2Like, D: Readonly, U: Mat2Like, a: Readonly):\r\n [Mat2Like, Readonly, Mat2Like] {\r\n L[2] = a[2] / a[0];\r\n U[0] = a[0];\r\n U[1] = a[1];\r\n U[3] = a[3] - L[2] * U[1];\r\n return [L, D, U];\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat2.prototype.mul = Mat2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat2.mul = Mat2.multiply;\r\nMat2.sub = Mat2.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 2x3 Matrix\r\n */\r\nexport class Mat2d extends Float64Array {\r\n static #IDENTITY_2X3 = new Float64Array([\r\n 1, 0,\r\n 0, 1,\r\n 0, 0,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 6:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 6); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v,\r\n v, v,\r\n v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 6);\r\n }\r\n break;\r\n default:\r\n super(Mat2d.#IDENTITY_2X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat2d.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat2d.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat2d} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat2d.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat2d.#IDENTITY_2X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat2d} against another one\r\n * Equivalent to `Mat2d.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat2d.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Translate this {@link Mat2d} by the given vector\r\n * Equivalent to `Mat2d.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat2d.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat2d} by the given angle around the given axis\r\n * Equivalent to `Mat2d.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat2d.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat2d.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat2d.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat2d}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 6 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat2d}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat2d}\r\n */\r\n static create(): Mat2d {\r\n return new Mat2d();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat2d} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat2d}\r\n */\r\n static clone(a: Readonly): Mat2d {\r\n return new Mat2d(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat2d} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat2dLike, a: Readonly): Mat2dLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat2d} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat2d}\r\n */\r\n static fromValues(...values: number[]): Mat2d {\r\n return new Mat2d(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat2d} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat2dLike, ...values: number[]): Mat2dLike {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat2d} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat2dLike): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat2dLike, a: Mat2dLike): Mat2dLike | null {\r\n const aa = a[0];\r\n const ab = a[1];\r\n const ac = a[2];\r\n const ad = a[3];\r\n const atx = a[4];\r\n const aty = a[5];\r\n\r\n let det = aa * ad - ab * ac;\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = ad * det;\r\n out[1] = -ab * det;\r\n out[2] = -ac * det;\r\n out[3] = aa * det;\r\n out[4] = (ac * aty - ad * atx) * det;\r\n out[5] = (ab * atx - aa * aty) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n return a[0] * a[3] - a[1] * a[2];\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat2d}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n out[0] = a0 * b0 + a2 * b1;\r\n out[1] = a1 * b0 + a3 * b1;\r\n out[2] = a0 * b2 + a2 * b3;\r\n out[3] = a1 * b2 + a3 * b3;\r\n out[4] = a0 * b4 + a2 * b5 + a4;\r\n out[5] = a1 * b4 + a3 * b5 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat2d.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat2d} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n out[4] = a0 * v0 + a2 * v1 + a4;\r\n out[5] = a1 * v0 + a3 * v1 + a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat2d} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat2dLike, a: Readonly, rad: number): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = a0 * c + a2 * s;\r\n out[1] = a1 * c + a3 * s;\r\n out[2] = a0 * -s + a2 * c;\r\n out[3] = a1 * -s + a3 * c;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const v0 = v[0];\r\n const v1 = v[1];\r\n out[0] = a0 * v0;\r\n out[1] = a1 * v0;\r\n out[2] = a2 * v1;\r\n out[3] = a3 * v1;\r\n out[4] = a4;\r\n out[5] = a5;\r\n return out;\r\n }\r\n\r\n // TODO: Got to fromRotation\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = v[0];\r\n out[5] = v[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.rotate(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat2dLike, rad: number): Mat2dLike {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = -s;\r\n out[3] = c;\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat2d} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * Mat2d.identity(dest);\r\n * Mat2d.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat2d} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat2dLike, v: Readonly): Mat2dLike {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = v[1];\r\n out[4] = 0;\r\n out[5] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1);\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat2d} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat2dLike, a: Readonly, b: number): Mat2dLike {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat2dLike, a: Readonly, b: Readonly, scale: number):\r\n Mat2dLike {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat2d}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat2d}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat2d(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Static method alias assignments\r\nMat2d.mul = Mat2d.multiply;\r\nMat2d.sub = Mat2d.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2dLike, Mat3Like, Mat4Like, Vec2Like, QuatLike } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 3x3 Matrix\r\n */\r\nexport class Mat3 extends Float64Array {\r\n static #IDENTITY_3X3 = new Float64Array([\r\n 1, 0, 0,\r\n 0, 1, 0,\r\n 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Create a {@link Mat3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 9:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 9); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v,\r\n v, v, v,\r\n v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 9);\r\n }\r\n break;\r\n default:\r\n super(Mat3.#IDENTITY_3X3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat3.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat3.#IDENTITY_3X3);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat3} against another one\r\n * Equivalent to `Mat3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat3.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat3}\r\n * Equivalent to `Mat3.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat3.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat3}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat3.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat3} by the given vector\r\n * Equivalent to `Mat3.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat3.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat3} by the given angle around the given axis\r\n * Equivalent to `Mat3.rotate(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotate(rad: number): this {\r\n return Mat3.rotate(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat3.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec2} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat3.scale(this, this, v) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 9 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat3}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat3}\r\n */\r\n static create(): Mat3 {\r\n return new Mat3();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat3} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat3}\r\n */\r\n static clone(a: Readonly): Mat3 {\r\n return new Mat3(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat3} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new {@link Mat3} with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat3}\r\n */\r\n static fromValues(...values: number[]): Mat3 {\r\n return new Mat3(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Mat3} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat3Like, ...values: number[]): Mat3Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat3} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat3Like): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat3Like, a: Readonly): Mat3Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a12 = a[5];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a01;\r\n out[5] = a[7];\r\n out[6] = a02;\r\n out[7] = a12;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[3];\r\n out[2] = a[6];\r\n out[3] = a[1];\r\n out[4] = a[4];\r\n out[5] = a[7];\r\n out[6] = a[2];\r\n out[7] = a[5];\r\n out[8] = a[8];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat3Like, a: Mat3Like): Mat3Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2];\r\n const a10 = a[3],\r\n a11 = a[4],\r\n a12 = a[5];\r\n const a20 = a[6],\r\n a21 = a[7],\r\n a22 = a[8];\r\n\r\n const b01 = a22 * a11 - a12 * a21;\r\n const b11 = -a22 * a10 + a12 * a20;\r\n const b21 = a21 * a10 - a11 * a20;\r\n\r\n // Calculate the determinant\r\n let det = a00 * b01 + a01 * b11 + a02 * b21;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = b01 * det;\r\n out[1] = (-a22 * a01 + a02 * a21) * det;\r\n out[2] = (a12 * a01 - a02 * a11) * det;\r\n out[3] = b11 * det;\r\n out[4] = (a22 * a00 - a02 * a20) * det;\r\n out[5] = (-a12 * a00 + a02 * a10) * det;\r\n out[6] = b21 * det;\r\n out[7] = (-a21 * a00 + a01 * a20) * det;\r\n out[8] = (a11 * a00 - a01 * a10) * det;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat3Like, a: Mat3Like): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n out[0] = a11 * a22 - a12 * a21;\r\n out[1] = a02 * a21 - a01 * a22;\r\n out[2] = a01 * a12 - a02 * a11;\r\n out[3] = a12 * a20 - a10 * a22;\r\n out[4] = a00 * a22 - a02 * a20;\r\n out[5] = a02 * a10 - a00 * a12;\r\n out[6] = a10 * a21 - a11 * a20;\r\n out[7] = a01 * a20 - a00 * a21;\r\n out[8] = a00 * a11 - a01 * a10;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n return (\r\n a00 * (a22 * a11 - a12 * a21) +\r\n a01 * (-a22 * a10 + a12 * a20) +\r\n a02 * (a21 * a10 - a11 * a20)\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Mat3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[3];\r\n b1 = b[4];\r\n b2 = b[5];\r\n out[3] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[4] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[5] = b0 * a02 + b1 * a12 + b2 * a22;\r\n\r\n b0 = b[6];\r\n b1 = b[7];\r\n b2 = b[8];\r\n out[6] = b0 * a00 + b1 * a10 + b2 * a20;\r\n out[7] = b0 * a01 + b1 * a11 + b2 * a21;\r\n out[8] = b0 * a02 + b1 * a12 + b2 * a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat3} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n\r\n out[3] = a10;\r\n out[4] = a11;\r\n out[5] = a12;\r\n\r\n out[6] = x * a00 + y * a10 + a20;\r\n out[7] = x * a01 + y * a11 + a21;\r\n out[8] = x * a02 + y * a12 + a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat3} by the given angle\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotate(out: Mat3Like, a: Readonly, rad: number): Mat3Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a10 = a[3];\r\n const a11 = a[4];\r\n const a12 = a[5];\r\n const a20 = a[6];\r\n const a21 = a[7];\r\n const a22 = a[8];\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c * a00 + s * a10;\r\n out[1] = c * a01 + s * a11;\r\n out[2] = c * a02 + s * a12;\r\n\r\n out[3] = c * a10 - s * a00;\r\n out[4] = c * a11 - s * a01;\r\n out[5] = c * a12 - s * a02;\r\n\r\n out[6] = a20;\r\n out[7] = a21;\r\n out[8] = a22;\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat3} by the dimensions in the given {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec2} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like {\r\n const x = v[0];\r\n const y = v[1];\r\n\r\n out[0] = x * a[0];\r\n out[1] = x * a[1];\r\n out[2] = x * a[2];\r\n\r\n out[3] = y * a[3];\r\n out[4] = y * a[4];\r\n out[5] = y * a[5];\r\n\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 1;\r\n out[5] = 0;\r\n out[6] = v[0];\r\n out[7] = v[1];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.rotate(dest, dest, rad);\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Mat3Like, rad: number): Mat3Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n\r\n out[3] = -s;\r\n out[4] = c;\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat3} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat3.identity(dest);\r\n * mat3.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat3Like, v: Readonly): Mat3Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n\r\n out[3] = 0;\r\n out[4] = v[1];\r\n out[5] = 0;\r\n\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat2d} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 2x3 matrix\r\n * @returns `out`\r\n */\r\n static fromMat2d(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = 0;\r\n\r\n out[3] = a[2];\r\n out[4] = a[3];\r\n out[5] = 0;\r\n\r\n out[6] = a[4];\r\n out[7] = a[5];\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - {@link Mat3} receiving operation result\r\n * @param q - {@link Quat} to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat3Like, q: Readonly): Mat3Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[3] = yx - wz;\r\n out[6] = zx + wy;\r\n\r\n out[1] = yx + wz;\r\n out[4] = 1 - xx - zz;\r\n out[7] = zy - wx;\r\n\r\n out[2] = zx - wy;\r\n out[5] = zy + wx;\r\n out[8] = 1 - xx - yy;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Copies the upper-left 3x3 values of a {@link Mat4} into the given\r\n * {@link Mat3}.\r\n * @category Static\r\n *\r\n * @param out - the receiving 3x3 matrix\r\n * @param a - the source 4x4 matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Mat3Like, a: Readonly): Mat3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[4];\r\n out[4] = a[5];\r\n out[5] = a[6];\r\n out[6] = a[8];\r\n out[7] = a[9];\r\n out[8] = a[10];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\r\n * @category Static\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat3Like, a: Readonly): Mat3Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n\r\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n\r\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat3Like, a: Readonly): Mat3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n\r\n out[3] = cy * az - cz * ay;\r\n out[4] = cz * ax - cx * az;\r\n out[5] = cx * ay - cy * ax;\r\n\r\n out[6] = ay * bz - az * by;\r\n out[7] = az * bx - ax * bz;\r\n out[8] = ax * by - ay * bx;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a 2D projection matrix with the given bounds\r\n * @category Static\r\n *\r\n * @param out mat3 frustum matrix will be written into\r\n * @param width Width of your gl context\r\n * @param height Height of gl context\r\n * @returns `out`\r\n */\r\n static projection(out: Mat3Like, width: number, height: number): Mat3Like {\r\n out[0] = 2 / width;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -2 / height;\r\n out[5] = 0;\r\n out[6] = -1;\r\n out[7] = 1;\r\n out[8] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8]\r\n );\r\n }\r\n\r\n /**\r\n * Multiply each element of a {@link Mat3} by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat3Like, a: Readonly, b: number): Mat3Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat3Like, a: Readonly, b: Readonly, scale: number): Mat3Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat3}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat3}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat3(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat3.prototype.mul = Mat3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat3.mul = Mat3.multiply;\r\nMat3.sub = Mat3.subtract;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * A 4x4 Matrix\r\n */\r\nexport class Mat4 extends Float64Array {\r\n static #IDENTITY_4X4 = new Float64Array([\r\n 1, 0, 0, 0,\r\n 0, 1, 0, 0,\r\n 0, 0, 1, 0,\r\n 0, 0, 0, 1,\r\n ]);\r\n\r\n /**\r\n * Temporary variable to prevent repeated allocations in the algorithms within Mat4.\r\n * These are declared as TypedArrays to aid in tree-shaking.\r\n */\r\n static #TMP_VEC3 = new Float64Array(3);\r\n\r\n /**\r\n * Create a {@link Mat4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 16:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 16); break;\r\n case 1:\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v,\r\n v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 16);\r\n }\r\n break;\r\n default:\r\n super(Mat4.#IDENTITY_4X4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Mat4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Mat4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instance methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Mat4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity matrix\r\n * Equivalent to Mat4.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this.set(Mat4.#IDENTITY_4X4);\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies this {@link Mat4} against another one\r\n * Equivalent to `Mat4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Mat4.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Transpose this {@link Mat4}\r\n * Equivalent to `Mat4.transpose(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n transpose(): this {\r\n return Mat4.transpose(this, this) as this;\r\n }\r\n\r\n /**\r\n * Inverts this {@link Mat4}\r\n * Equivalent to `Mat4.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Mat4.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Translate this {@link Mat4} by the given vector\r\n * Equivalent to `Mat4.translate(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to translate by\r\n * @returns `this`\r\n */\r\n translate(v: Readonly): this {\r\n return Mat4.translate(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the given axis\r\n * Equivalent to `Mat4.rotate(this, this, rad, axis);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `this`\r\n */\r\n rotate(rad: number, axis: Readonly): this {\r\n return Mat4.rotate(this, this, rad, axis) as this;\r\n }\r\n\r\n /**\r\n * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization\r\n * Equivalent to `Mat4.scale(this, this, v);`\r\n * @category Methods\r\n *\r\n * @param v - The {@link Vec3} to scale the matrix by\r\n * @returns `this`\r\n */\r\n scale(v: Readonly): this {\r\n return Mat4.scale(this, this, v) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the X axis\r\n * Equivalent to `Mat4.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Mat4.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Y axis\r\n * Equivalent to `Mat4.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Mat4.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates this {@link Mat4} by the given angle around the Z axis\r\n * Equivalent to `Mat4.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Mat4.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveNO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveNO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);`\r\n * @category Methods\r\n *\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `this`\r\n */\r\n perspectiveZO(fovy: number, aspect: number, near: number, far: number): this {\r\n return Mat4.perspectiveZO(this, fovy, aspect, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoNO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoNO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);`\r\n * @category Methods\r\n *\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `this`\r\n */\r\n orthoZO(left: number, right: number, bottom: number, top: number, near: number, far: number): this {\r\n return Mat4.orthoZO(this, left, right, bottom, top, near, far) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Mat4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 16 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, identity {@link Mat4}\r\n * @category Static\r\n *\r\n * @returns A new {@link Mat4}\r\n */\r\n static create(): Mat4 {\r\n return new Mat4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Mat4} initialized with values from an existing matrix\r\n * @category Static\r\n *\r\n * @param a - Matrix to clone\r\n * @returns A new {@link Mat4}\r\n */\r\n static clone(a: Readonly): Mat4 {\r\n return new Mat4(a);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Mat4} to another\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - Matrix to copy\r\n * @returns `out`\r\n */\r\n static copy(out: Mat4Like, a: Readonly): Mat4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Create a new mat4 with the given values\r\n * @category Static\r\n *\r\n * @param values - Matrix components\r\n * @returns A new {@link Mat4}\r\n */\r\n static fromValues(...values: number[]): Mat4 {\r\n return new Mat4(...values);\r\n }\r\n\r\n /**\r\n * Set the components of a mat4 to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving matrix\r\n * @param values - Matrix components\r\n * @returns `out`\r\n */\r\n static set(out: Mat4Like, ...values: number[]): Mat4Like {\r\n out[0] = values[0];\r\n out[1] = values[1];\r\n out[2] = values[2];\r\n out[3] = values[3];\r\n out[4] = values[4];\r\n out[5] = values[5];\r\n out[6] = values[6];\r\n out[7] = values[7];\r\n out[8] = values[8];\r\n out[9] = values[9];\r\n out[10] = values[10];\r\n out[11] = values[11];\r\n out[12] = values[12];\r\n out[13] = values[13];\r\n out[14] = values[14];\r\n out[15] = values[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Mat4} to the identity matrix\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @returns `out`\r\n */\r\n static identity(out: Mat4Like): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transpose the values of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static transpose(out: Mat4Like, a: Readonly): Mat4Like {\r\n // If we are transposing ourselves we can skip a few steps but have to cache some values\r\n if (out === a) {\r\n const a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a12 = a[6],\r\n a13 = a[7];\r\n const a23 = a[11];\r\n\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a01;\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a02;\r\n out[9] = a12;\r\n out[11] = a[14];\r\n out[12] = a03;\r\n out[13] = a13;\r\n out[14] = a23;\r\n } else {\r\n out[0] = a[0];\r\n out[1] = a[4];\r\n out[2] = a[8];\r\n out[3] = a[12];\r\n out[4] = a[1];\r\n out[5] = a[5];\r\n out[6] = a[9];\r\n out[7] = a[13];\r\n out[8] = a[2];\r\n out[9] = a[6];\r\n out[10] = a[10];\r\n out[11] = a[14];\r\n out[12] = a[3];\r\n out[13] = a[7];\r\n out[14] = a[11];\r\n out[15] = a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Inverts a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static invert(out: Mat4Like, a: Mat4Like): Mat4Like | null {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\r\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\r\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\r\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\r\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\r\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\r\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the adjugate of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the source matrix\r\n * @returns `out`\r\n */\r\n static adjoint(out: Mat4Like, a: Mat4Like): Mat4Like {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n out[0] = a11 * b11 - a12 * b10 + a13 * b09;\r\n out[1] = a02 * b10 - a01 * b11 - a03 * b09;\r\n out[2] = a31 * b05 - a32 * b04 + a33 * b03;\r\n out[3] = a22 * b04 - a21 * b05 - a23 * b03;\r\n out[4] = a12 * b08 - a10 * b11 - a13 * b07;\r\n out[5] = a00 * b11 - a02 * b08 + a03 * b07;\r\n out[6] = a32 * b02 - a30 * b05 - a33 * b01;\r\n out[7] = a20 * b05 - a22 * b02 + a23 * b01;\r\n out[8] = a10 * b10 - a11 * b08 + a13 * b06;\r\n out[9] = a01 * b08 - a00 * b10 - a03 * b06;\r\n out[10] = a30 * b04 - a31 * b02 + a33 * b00;\r\n out[11] = a21 * b02 - a20 * b04 - a23 * b00;\r\n out[12] = a11 * b07 - a10 * b09 - a12 * b06;\r\n out[13] = a00 * b09 - a01 * b07 + a02 * b06;\r\n out[14] = a31 * b01 - a30 * b03 - a32 * b00;\r\n out[15] = a20 * b03 - a21 * b01 + a22 * b00;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the determinant of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the source matrix\r\n * @returns determinant of a\r\n */\r\n static determinant(a: Readonly): number {\r\n const a00 = a[0],\r\n a01 = a[1],\r\n a02 = a[2],\r\n a03 = a[3];\r\n const a10 = a[4],\r\n a11 = a[5],\r\n a12 = a[6],\r\n a13 = a[7];\r\n const a20 = a[8],\r\n a21 = a[9],\r\n a22 = a[10],\r\n a23 = a[11];\r\n const a30 = a[12],\r\n a31 = a[13],\r\n a32 = a[14],\r\n a33 = a[15];\r\n\r\n const b0 = a00 * a11 - a01 * a10;\r\n const b1 = a00 * a12 - a02 * a10;\r\n const b2 = a01 * a12 - a02 * a11;\r\n const b3 = a20 * a31 - a21 * a30;\r\n const b4 = a20 * a32 - a22 * a30;\r\n const b5 = a21 * a32 - a22 * a31;\r\n const b6 = a00 * b5 - a01 * b4 + a02 * b3;\r\n const b7 = a10 * b5 - a11 * b4 + a12 * b3;\r\n const b8 = a20 * b2 - a21 * b1 + a22 * b0;\r\n const b9 = a30 * b2 - a31 * b1 + a32 * b0;\r\n\r\n // Calculate the determinant\r\n return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Mat4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving Matrix\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n // Cache only the current line of the second matrix\r\n let b0 = b[0];\r\n let b1 = b[1];\r\n let b2 = b[2];\r\n let b3 = b[3];\r\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[4];\r\n b1 = b[5];\r\n b2 = b[6];\r\n b3 = b[7];\r\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[8];\r\n b1 = b[9];\r\n b2 = b[10];\r\n b3 = b[11];\r\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n\r\n b0 = b[12];\r\n b1 = b[13];\r\n b2 = b[14];\r\n b3 = b[15];\r\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\r\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\r\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\r\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Translate a {@link Mat4} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n if (a === out) {\r\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\r\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\r\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\r\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\r\n } else {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n out[0] = a00;\r\n out[1] = a01;\r\n out[2] = a02;\r\n out[3] = a03;\r\n out[4] = a10;\r\n out[5] = a11;\r\n out[6] = a12;\r\n out[7] = a13;\r\n out[8] = a20;\r\n out[9] = a21;\r\n out[10] = a22;\r\n out[11] = a23;\r\n\r\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\r\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\r\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\r\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param v - the {@link Vec3} to scale the matrix by\r\n * @returns `out`\r\n **/\r\n static scale(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like {\r\n const x = v[0];\r\n const y = v[1];\r\n const z = v[2];\r\n\r\n out[0] = a[0] * x;\r\n out[1] = a[1] * x;\r\n out[2] = a[2] * x;\r\n out[3] = a[3] * x;\r\n out[4] = a[4] * y;\r\n out[5] = a[5] * y;\r\n out[6] = a[6] * y;\r\n out[7] = a[7] * y;\r\n out[8] = a[8] * z;\r\n out[9] = a[9] * z;\r\n out[10] = a[10] * z;\r\n out[11] = a[11] * z;\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Mat4} by the given angle around the given axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if axis has a length of 0\r\n */\r\n static rotate(out: Mat4Like, a: Readonly, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n // Construct the elements of the rotation matrix\r\n const b00 = x * x * t + c;\r\n const b01 = y * x * t + z * s;\r\n const b02 = z * x * t - y * s;\r\n const b10 = x * y * t - z * s;\r\n const b11 = y * y * t + c;\r\n const b12 = z * y * t + x * s;\r\n const b20 = x * z * t + y * s;\r\n const b21 = y * z * t - x * s;\r\n const b22 = z * z * t + c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\r\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\r\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\r\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\r\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\r\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\r\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\r\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\r\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\r\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\r\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\r\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateX(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[4] = a10 * c + a20 * s;\r\n out[5] = a11 * c + a21 * s;\r\n out[6] = a12 * c + a22 * s;\r\n out[7] = a13 * c + a23 * s;\r\n out[8] = a20 * c - a10 * s;\r\n out[9] = a21 * c - a11 * s;\r\n out[10] = a22 * c - a12 * s;\r\n out[11] = a23 * c - a13 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateY(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged rows\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c - a20 * s;\r\n out[1] = a01 * c - a21 * s;\r\n out[2] = a02 * c - a22 * s;\r\n out[3] = a03 * c - a23 * s;\r\n out[8] = a00 * s + a20 * c;\r\n out[9] = a01 * s + a21 * c;\r\n out[10] = a02 * s + a22 * c;\r\n out[11] = a03 * s + a23 * c;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a matrix by the given angle around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to rotate\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Mat4Like, a: Readonly, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n\r\n if (a !== out) {\r\n // If the source and destination differ, copy the unchanged last row\r\n out[8] = a[8];\r\n out[9] = a[9];\r\n out[10] = a[10];\r\n out[11] = a[11];\r\n out[12] = a[12];\r\n out[13] = a[13];\r\n out[14] = a[14];\r\n out[15] = a[15];\r\n }\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = a00 * c + a10 * s;\r\n out[1] = a01 * c + a11 * s;\r\n out[2] = a02 * c + a12 * s;\r\n out[3] = a03 * c + a13 * s;\r\n out[4] = a10 * c - a00 * s;\r\n out[5] = a11 * c - a01 * s;\r\n out[6] = a12 * c - a02 * s;\r\n out[7] = a13 * c - a03 * s;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.scale(dest, dest, vec);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param v - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromScaling(out: Mat4Like, v: Readonly): Mat4Like {\r\n out[0] = v[0];\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = v[1];\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = v[2];\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a {@link Mat4} from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotate(dest, dest, rad, axis);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - {@link Mat4} receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @param axis - the axis to rotate around\r\n * @returns `out` or `null` if `axis` has a length of 0\r\n */\r\n static fromRotation(out: Mat4Like, rad: number, axis: Readonly): Mat4Like | null {\r\n let x = axis[0];\r\n let y = axis[1];\r\n let z = axis[2];\r\n let len = Math.sqrt(x * x + y * y + z * z);\r\n\r\n if (len < GLM_EPSILON) {\r\n return null;\r\n }\r\n\r\n len = 1 / len;\r\n x *= len;\r\n y *= len;\r\n z *= len;\r\n\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n const t = 1 - c;\r\n\r\n // Perform rotation-specific matrix multiplication\r\n out[0] = x * x * t + c;\r\n out[1] = y * x * t + z * s;\r\n out[2] = z * x * t - y * s;\r\n out[3] = 0;\r\n out[4] = x * y * t - z * s;\r\n out[5] = y * y * t + c;\r\n out[6] = z * y * t + x * s;\r\n out[7] = 0;\r\n out[8] = x * z * t + y * s;\r\n out[9] = y * z * t - x * s;\r\n out[10] = z * z * t + c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the X axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateX(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromXRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = 1;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = c;\r\n out[6] = s;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = -s;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Y axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateY(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromYRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = 0;\r\n out[2] = -s;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = 1;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = s;\r\n out[9] = 0;\r\n out[10] = c;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from the given angle around the Z axis\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.rotateZ(dest, dest, rad);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param rad - the angle to rotate the matrix by\r\n * @returns `out`\r\n */\r\n static fromZRotation(out: Mat4Like, rad: number): Mat4Like {\r\n const s = Math.sin(rad);\r\n const c = Math.cos(rad);\r\n\r\n // Perform axis-specific matrix multiplication\r\n out[0] = c;\r\n out[1] = s;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = -s;\r\n out[5] = c;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 1;\r\n out[11] = 0;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation and vector translation\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Mat4Like, q: Readonly, v: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - (yy + zz);\r\n out[1] = xy + wz;\r\n out[2] = xz - wy;\r\n out[3] = 0;\r\n out[4] = xy - wz;\r\n out[5] = 1 - (xx + zz);\r\n out[6] = yz + wx;\r\n out[7] = 0;\r\n out[8] = xz + wy;\r\n out[9] = yz - wx;\r\n out[10] = 1 - (xx + yy);\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Mat4} from a {@link Quat2}.\r\n * @category Static\r\n *\r\n * @param out - Matrix\r\n * @param a - Dual Quaternion\r\n * @returns `out`\r\n */\r\n static fromQuat2(out: Mat4Like, a: Quat2Like): Mat4Like {\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n\r\n const magnitude = bx * bx + by * by + bz * bz + bw * bw;\r\n\r\n // Only scale if it makes sense\r\n if (magnitude > 0) {\r\n Mat4.#TMP_VEC3[0] = ((ax * bw + aw * bx + ay * bz - az * by) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[1] = ((ay * bw + aw * by + az * bx - ax * bz) * 2) / magnitude;\r\n Mat4.#TMP_VEC3[2] = ((az * bw + aw * bz + ax * by - ay * bx) * 2) / magnitude;\r\n } else {\r\n Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n }\r\n Mat4.fromRotationTranslation(out, a as QuatLike, Mat4.#TMP_VEC3);\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out` or `null` if the matrix is not invertible\r\n */\r\n static normalFromMat4(out: Mat4Like, a: Readonly): Mat4Like | null {\r\n const a00 = a[0];\r\n const a01 = a[1];\r\n const a02 = a[2];\r\n const a03 = a[3];\r\n const a10 = a[4];\r\n const a11 = a[5];\r\n const a12 = a[6];\r\n const a13 = a[7];\r\n const a20 = a[8];\r\n const a21 = a[9];\r\n const a22 = a[10];\r\n const a23 = a[11];\r\n const a30 = a[12];\r\n const a31 = a[13];\r\n const a32 = a[14];\r\n const a33 = a[15];\r\n\r\n const b00 = a00 * a11 - a01 * a10;\r\n const b01 = a00 * a12 - a02 * a10;\r\n const b02 = a00 * a13 - a03 * a10;\r\n const b03 = a01 * a12 - a02 * a11;\r\n const b04 = a01 * a13 - a03 * a11;\r\n const b05 = a02 * a13 - a03 * a12;\r\n const b06 = a20 * a31 - a21 * a30;\r\n const b07 = a20 * a32 - a22 * a30;\r\n const b08 = a20 * a33 - a23 * a30;\r\n const b09 = a21 * a32 - a22 * a31;\r\n const b10 = a21 * a33 - a23 * a31;\r\n const b11 = a22 * a33 - a23 * a32;\r\n\r\n // Calculate the determinant\r\n let det =\r\n b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\r\n\r\n if (!det) {\r\n return null;\r\n }\r\n det = 1.0 / det;\r\n\r\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\r\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\r\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\r\n out[3] = 0;\r\n\r\n out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\r\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\r\n out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\r\n out[7] = 0;\r\n\r\n out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\r\n out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\r\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\r\n * This version omits the calculation of the constant factor (1/determinant), so\r\n * any normals transformed with it will need to be renormalized.\r\n * From https://stackoverflow.com/a/27616419/25968\r\n * @category Static\r\n *\r\n * @param out - Matrix receiving operation result\r\n * @param a - Mat4 to derive the normal matrix from\r\n * @returns `out`\r\n */\r\n static normalFromMat4Fast(out: Mat4Like, a: Readonly): Mat4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n\r\n const bx = a[4];\r\n const by = a[5];\r\n const bz = a[6];\r\n\r\n const cx = a[8];\r\n const cy = a[9];\r\n const cz = a[10];\r\n\r\n out[0] = by * cz - cz * cy;\r\n out[1] = bz * cx - cx * cz;\r\n out[2] = bx * cy - cy * cx;\r\n out[3] = 0;\r\n\r\n out[4] = cy * az - cz * ay;\r\n out[5] = cz * ax - cx * az;\r\n out[6] = cx * ay - cy * ax;\r\n out[7] = 0;\r\n\r\n out[8] = ay * bz - az * by;\r\n out[9] = az * bx - ax * bz;\r\n out[10] = ax * by - ay * bx;\r\n out[11] = 0;\r\n\r\n // No translation\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the translation vector component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslation,\r\n * the returned vector will be the same as the translation vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive translation component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getTranslation(out: Vec3Like, mat: Readonly): Vec3Like {\r\n out[0] = mat[12];\r\n out[1] = mat[13];\r\n out[2] = mat[14];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the scaling factor component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslationScale\r\n * with a normalized Quaternion parameter, the returned vector will be\r\n * the same as the scaling vector\r\n * originally supplied.\r\n * @category Static\r\n *\r\n * @param {vec3} out Vector to receive scaling factor component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\r\n static getScaling(out: Vec3Like, mat: Readonly): Vec3Like {\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a quaternion representing the rotational component\r\n * of a transformation matrix. If a matrix is built with\r\n * fromRotationTranslation, the returned quaternion will be the\r\n * same as the quaternion originally supplied.\r\n * @category Static\r\n *\r\n * @param out - Quaternion to receive the rotation component\r\n * @param mat - Matrix to be decomposed (input)\r\n * @return `out`\r\n */\r\n static getRotation(out: QuatLike, mat: Readonly): QuatLike {\r\n Mat4.getScaling(Mat4.#TMP_VEC3, mat);\r\n\r\n const is1 = 1 / Mat4.#TMP_VEC3[0];\r\n const is2 = 1 / Mat4.#TMP_VEC3[1];\r\n const is3 = 1 / Mat4.#TMP_VEC3[2];\r\n\r\n const sm11 = mat[0] * is1;\r\n const sm12 = mat[1] * is2;\r\n const sm13 = mat[2] * is3;\r\n const sm21 = mat[4] * is1;\r\n const sm22 = mat[5] * is2;\r\n const sm23 = mat[6] * is3;\r\n const sm31 = mat[8] * is1;\r\n const sm32 = mat[9] * is2;\r\n const sm33 = mat[10] * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out[3] = 0.25 * S;\r\n out[0] = (sm23 - sm32) / S;\r\n out[1] = (sm31 - sm13) / S;\r\n out[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out[3] = (sm23 - sm32) / S;\r\n out[0] = 0.25 * S;\r\n out[1] = (sm12 + sm21) / S;\r\n out[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out[3] = (sm31 - sm13) / S;\r\n out[0] = (sm12 + sm21) / S;\r\n out[1] = 0.25 * S;\r\n out[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out[3] = (sm12 - sm21) / S;\r\n out[0] = (sm31 + sm13) / S;\r\n out[1] = (sm23 + sm32) / S;\r\n out[2] = 0.25 * S;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Decomposes a transformation matrix into its rotation, translation\r\n * and scale components. Returns only the rotation component\r\n * @category Static\r\n *\r\n * @param out_r - Quaternion to receive the rotation component\r\n * @param out_t - Vector to receive the translation vector\r\n * @param out_s - Vector to receive the scaling factor\r\n * @param mat - Matrix to be decomposed (input)\r\n * @returns `out_r`\r\n */\r\n static decompose(out_r: QuatLike, out_t: Vec3Like, out_s: Vec3Like, mat: Readonly): QuatLike {\r\n out_t[0] = mat[12];\r\n out_t[1] = mat[13];\r\n out_t[2] = mat[14];\r\n\r\n const m11 = mat[0];\r\n const m12 = mat[1];\r\n const m13 = mat[2];\r\n const m21 = mat[4];\r\n const m22 = mat[5];\r\n const m23 = mat[6];\r\n const m31 = mat[8];\r\n const m32 = mat[9];\r\n const m33 = mat[10];\r\n\r\n out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\r\n out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\r\n out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\r\n\r\n const is1 = 1 / out_s[0];\r\n const is2 = 1 / out_s[1];\r\n const is3 = 1 / out_s[2];\r\n\r\n const sm11 = m11 * is1;\r\n const sm12 = m12 * is2;\r\n const sm13 = m13 * is3;\r\n const sm21 = m21 * is1;\r\n const sm22 = m22 * is2;\r\n const sm23 = m23 * is3;\r\n const sm31 = m31 * is1;\r\n const sm32 = m32 * is2;\r\n const sm33 = m33 * is3;\r\n\r\n const trace = sm11 + sm22 + sm33;\r\n let S = 0;\r\n\r\n if (trace > 0) {\r\n S = Math.sqrt(trace + 1.0) * 2;\r\n out_r[3] = 0.25 * S;\r\n out_r[0] = (sm23 - sm32) / S;\r\n out_r[1] = (sm31 - sm13) / S;\r\n out_r[2] = (sm12 - sm21) / S;\r\n } else if (sm11 > sm22 && sm11 > sm33) {\r\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\r\n out_r[3] = (sm23 - sm32) / S;\r\n out_r[0] = 0.25 * S;\r\n out_r[1] = (sm12 + sm21) / S;\r\n out_r[2] = (sm31 + sm13) / S;\r\n } else if (sm22 > sm33) {\r\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\r\n out_r[3] = (sm31 - sm13) / S;\r\n out_r[0] = (sm12 + sm21) / S;\r\n out_r[1] = 0.25 * S;\r\n out_r[2] = (sm23 + sm32) / S;\r\n } else {\r\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\r\n out_r[3] = (sm12 - sm21) / S;\r\n out_r[0] = (sm31 + sm13) / S;\r\n out_r[1] = (sm23 + sm32) / S;\r\n out_r[2] = 0.25 * S;\r\n }\r\n\r\n return out_r;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\r\n * This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScale(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n out[0] = (1 - (yy + zz)) * sx;\r\n out[1] = (xy + wz) * sx;\r\n out[2] = (xz - wy) * sx;\r\n out[3] = 0;\r\n out[4] = (xy - wz) * sy;\r\n out[5] = (1 - (xx + zz)) * sy;\r\n out[6] = (yz + wx) * sy;\r\n out[7] = 0;\r\n out[8] = (xz + wy) * sz;\r\n out[9] = (yz - wx) * sz;\r\n out[10] = (1 - (xx + yy)) * sz;\r\n out[11] = 0;\r\n out[12] = v[0];\r\n out[13] = v[1];\r\n out[14] = v[2];\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the\r\n * given origin. This is equivalent to (but much faster than):\r\n * ```js\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * mat4.translate(dest, origin);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n * mat4.translate(dest, negativeOrigin);\r\n * ```\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Rotation quaternion\r\n * @param v - Translation vector\r\n * @param s - Scaling vector\r\n * @param o - The origin vector around which to scale and rotate\r\n * @returns `out`\r\n */\r\n static fromRotationTranslationScaleOrigin(out: Mat4Like, q: Readonly, v: Readonly,\r\n s: Readonly, o: Readonly): Mat4Like {\r\n // Quaternion math\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const xy = x * y2;\r\n const xz = x * z2;\r\n const yy = y * y2;\r\n const yz = y * z2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n const sx = s[0];\r\n const sy = s[1];\r\n const sz = s[2];\r\n\r\n const ox = o[0];\r\n const oy = o[1];\r\n const oz = o[2];\r\n\r\n const out0 = (1 - (yy + zz)) * sx;\r\n const out1 = (xy + wz) * sx;\r\n const out2 = (xz - wy) * sx;\r\n const out4 = (xy - wz) * sy;\r\n const out5 = (1 - (xx + zz)) * sy;\r\n const out6 = (yz + wx) * sy;\r\n const out8 = (xz + wy) * sz;\r\n const out9 = (yz - wx) * sz;\r\n const out10 = (1 - (xx + yy)) * sz;\r\n\r\n out[0] = out0;\r\n out[1] = out1;\r\n out[2] = out2;\r\n out[3] = 0;\r\n out[4] = out4;\r\n out[5] = out5;\r\n out[6] = out6;\r\n out[7] = 0;\r\n out[8] = out8;\r\n out[9] = out9;\r\n out[10] = out10;\r\n out[11] = 0;\r\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\r\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\r\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates a 4x4 matrix from the given quaternion\r\n * @category Static\r\n *\r\n * @param out - mat4 receiving operation result\r\n * @param q - Quaternion to create matrix from\r\n * @returns `out`\r\n */\r\n static fromQuat(out: Mat4Like, q: Readonly): Mat4Like {\r\n const x = q[0];\r\n const y = q[1];\r\n const z = q[2];\r\n const w = q[3];\r\n const x2 = x + x;\r\n const y2 = y + y;\r\n const z2 = z + z;\r\n\r\n const xx = x * x2;\r\n const yx = y * x2;\r\n const yy = y * y2;\r\n const zx = z * x2;\r\n const zy = z * y2;\r\n const zz = z * z2;\r\n const wx = w * x2;\r\n const wy = w * y2;\r\n const wz = w * z2;\r\n\r\n out[0] = 1 - yy - zz;\r\n out[1] = yx + wz;\r\n out[2] = zx - wy;\r\n out[3] = 0;\r\n\r\n out[4] = yx - wz;\r\n out[5] = 1 - xx - zz;\r\n out[6] = zy + wx;\r\n out[7] = 0;\r\n\r\n out[8] = zx + wy;\r\n out[9] = zy - wx;\r\n out[10] = 1 - xx - yy;\r\n out[11] = 0;\r\n\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[14] = 0;\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.frustumNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly\r\n */\r\n static frustum(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like { return out; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Generates a frustum matrix with the given bounds\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static frustumZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far = Infinity): Mat4Like {\r\n const rl = 1 / (right - left);\r\n const tb = 1 / (top - bottom);\r\n out[0] = near * 2 * rl;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = near * 2 * tb;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = (right + left) * rl;\r\n out[9] = (top + bottom) * tb;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\r\n * which matches WebGL/OpenGL's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveNO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = (far + near) * nf;\r\n out[14] = 2 * far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -2 * near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.perspectiveNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static perspective(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\r\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\r\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fovy - Vertical field of view in radians\r\n * @param aspect - Aspect ratio. typically viewport width/height\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum, can be null or Infinity\r\n * @returns `out`\r\n */\r\n static perspectiveZO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like {\r\n const f = 1.0 / Math.tan(fovy / 2);\r\n out[0] = f / aspect;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = f;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[11] = -1;\r\n out[12] = 0;\r\n out[13] = 0;\r\n out[15] = 0;\r\n if (far != null && far !== Infinity) {\r\n const nf = 1 / (near - far);\r\n out[10] = far * nf;\r\n out[14] = far * near * nf;\r\n } else {\r\n out[10] = -1;\r\n out[14] = -near;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating\r\n * projection matrices to be used with the still experimental WebVR API.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n * @deprecated\r\n */\r\n static perspectiveFromFieldOfView(out: Mat4Like,\r\n fov: { upDegrees: number, downDegrees: number, leftDegrees: number, rightDegrees: number }, near: number,\r\n far: number): Mat4Like {\r\n\r\n const upTan = Math.tan((fov.upDegrees * Math.PI) / 180.0);\r\n const downTan = Math.tan((fov.downDegrees * Math.PI) / 180.0);\r\n const leftTan = Math.tan((fov.leftDegrees * Math.PI) / 180.0);\r\n const rightTan = Math.tan((fov.rightDegrees * Math.PI) / 180.0);\r\n const xScale = 2.0 / (leftTan + rightTan);\r\n const yScale = 2.0 / (upTan + downTan);\r\n\r\n out[0] = xScale;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n out[4] = 0.0;\r\n out[5] = yScale;\r\n out[6] = 0.0;\r\n out[7] = 0.0;\r\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\r\n out[9] = (upTan - downTan) * yScale * 0.5;\r\n out[10] = far / (near - far);\r\n out[11] = -1.0;\r\n out[12] = 0.0;\r\n out[13] = 0.0;\r\n out[14] = (far * near) / (near - far);\r\n out[15] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = 2 * nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = (far + near) * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.orthoNO}\r\n * @category Static\r\n * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static ortho(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, far: number):\r\n Mat4Like {\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\r\n * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param left - Left bound of the frustum\r\n * @param right - Right bound of the frustum\r\n * @param bottom - Bottom bound of the frustum\r\n * @param top - Top bound of the frustum\r\n * @param near - Near bound of the frustum\r\n * @param far - Far bound of the frustum\r\n * @returns `out`\r\n */\r\n static orthoZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number,\r\n far: number): Mat4Like {\r\n const lr = 1 / (left - right);\r\n const bt = 1 / (bottom - top);\r\n const nf = 1 / (near - far);\r\n out[0] = -2 * lr;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 0;\r\n out[4] = 0;\r\n out[5] = -2 * bt;\r\n out[6] = 0;\r\n out[7] = 0;\r\n out[8] = 0;\r\n out[9] = 0;\r\n out[10] = nf;\r\n out[11] = 0;\r\n out[12] = (left + right) * lr;\r\n out[13] = (top + bottom) * bt;\r\n out[14] = near * nf;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that\r\n * actually makes an object look at another object, you should use targetTo instead.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param center - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static lookAt(out: Mat4Like, eye: Readonly, center: Readonly, up: Readonly): Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n const centerx = center[0];\r\n const centery = center[1];\r\n const centerz = center[2];\r\n\r\n if (\r\n Math.abs(eyex - centerx) < GLM_EPSILON &&\r\n Math.abs(eyey - centery) < GLM_EPSILON &&\r\n Math.abs(eyez - centerz) < GLM_EPSILON\r\n ) {\r\n return Mat4.identity(out);\r\n }\r\n\r\n let z0 = eyex - centerx;\r\n let z1 = eyey - centery;\r\n let z2 = eyez - centerz;\r\n\r\n let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\r\n if (!len) {\r\n x0 = 0;\r\n x1 = 0;\r\n x2 = 0;\r\n } else {\r\n len = 1 / len;\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n let y0 = z1 * x2 - z2 * x1;\r\n let y1 = z2 * x0 - z0 * x2;\r\n let y2 = z0 * x1 - z1 * x0;\r\n\r\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\r\n if (!len) {\r\n y0 = 0;\r\n y1 = 0;\r\n y2 = 0;\r\n } else {\r\n len = 1 / len;\r\n y0 *= len;\r\n y1 *= len;\r\n y2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = y0;\r\n out[2] = z0;\r\n out[3] = 0;\r\n out[4] = x1;\r\n out[5] = y1;\r\n out[6] = z1;\r\n out[7] = 0;\r\n out[8] = x2;\r\n out[9] = y2;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\r\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\r\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\r\n out[15] = 1;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a matrix that makes something look at something else.\r\n * @category Static\r\n *\r\n * @param out - mat4 frustum matrix will be written into\r\n * @param eye - Position of the viewer\r\n * @param target - Point the viewer is looking at\r\n * @param up - vec3 pointing up\r\n * @returns `out`\r\n */\r\n static targetTo(out: Mat4Like, eye: Readonly, target: Readonly, up: Readonly):\r\n Mat4Like {\r\n const eyex = eye[0];\r\n const eyey = eye[1];\r\n const eyez = eye[2];\r\n const upx = up[0];\r\n const upy = up[1];\r\n const upz = up[2];\r\n\r\n let z0 = eyex - target[0];\r\n let z1 = eyey - target[1];\r\n let z2 = eyez - target[2];\r\n\r\n let len = z0 * z0 + z1 * z1 + z2 * z2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n z0 *= len;\r\n z1 *= len;\r\n z2 *= len;\r\n }\r\n\r\n let x0 = upy * z2 - upz * z1;\r\n let x1 = upz * z0 - upx * z2;\r\n let x2 = upx * z1 - upy * z0;\r\n\r\n len = x0 * x0 + x1 * x1 + x2 * x2;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n x0 *= len;\r\n x1 *= len;\r\n x2 *= len;\r\n }\r\n\r\n out[0] = x0;\r\n out[1] = x1;\r\n out[2] = x2;\r\n out[3] = 0;\r\n out[4] = z1 * x2 - z2 * x1;\r\n out[5] = z2 * x0 - z0 * x2;\r\n out[6] = z0 * x1 - z1 * x0;\r\n out[7] = 0;\r\n out[8] = z0;\r\n out[9] = z1;\r\n out[10] = z2;\r\n out[11] = 0;\r\n out[12] = eyex;\r\n out[13] = eyey;\r\n out[14] = eyez;\r\n out[15] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns Frobenius norm of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - the matrix to calculate Frobenius norm of\r\n * @returns Frobenius norm\r\n */\r\n static frob(a: Readonly): number {\r\n return Math.sqrt(\r\n a[0] * a[0] +\r\n a[1] * a[1] +\r\n a[2] * a[2] +\r\n a[3] * a[3] +\r\n a[4] * a[4] +\r\n a[5] * a[5] +\r\n a[6] * a[6] +\r\n a[7] * a[7] +\r\n a[8] * a[8] +\r\n a[9] * a[9] +\r\n a[10] * a[10] +\r\n a[11] * a[11] +\r\n a[12] * a[12] +\r\n a[13] * a[13] +\r\n a[14] * a[14] +\r\n a[15] * a[15]\r\n );\r\n }\r\n\r\n /**\r\n * Adds two {@link Mat4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n out[8] = a[8] + b[8];\r\n out[9] = a[9] + b[9];\r\n out[10] = a[10] + b[10];\r\n out[11] = a[11] + b[11];\r\n out[12] = a[12] + b[12];\r\n out[13] = a[13] + b[13];\r\n out[14] = a[14] + b[14];\r\n out[15] = a[15] + b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts matrix b from matrix a\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n out[4] = a[4] - b[4];\r\n out[5] = a[5] - b[5];\r\n out[6] = a[6] - b[6];\r\n out[7] = a[7] - b[7];\r\n out[8] = a[8] - b[8];\r\n out[9] = a[9] - b[9];\r\n out[10] = a[10] - b[10];\r\n out[11] = a[11] - b[11];\r\n out[12] = a[12] - b[12];\r\n out[13] = a[13] - b[13];\r\n out[14] = a[14] - b[14];\r\n out[15] = a[15] - b[15];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Mat4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; }\r\n\r\n /**\r\n * Multiply each element of the matrix by a scalar.\r\n * @category Static\r\n *\r\n * @param out - the receiving matrix\r\n * @param a - the matrix to scale\r\n * @param b - amount to scale the matrix's elements by\r\n * @returns `out`\r\n */\r\n static multiplyScalar(out: Mat4Like, a: Readonly, b: number): Mat4Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n out[8] = a[8] * b;\r\n out[9] = a[9] * b;\r\n out[10] = a[10] * b;\r\n out[11] = a[11] * b;\r\n out[12] = a[12] * b;\r\n out[13] = a[13] * b;\r\n out[14] = a[14] * b;\r\n out[15] = a[15] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b's elements by before adding\r\n * @returns `out`\r\n */\r\n static multiplyScalarAndAdd(out: Mat4Like, a: Readonly, b: Readonly, scale: number): Mat4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n out[4] = a[4] + b[4] * scale;\r\n out[5] = a[5] + b[5] * scale;\r\n out[6] = a[6] + b[6] * scale;\r\n out[7] = a[7] + b[7] * scale;\r\n out[8] = a[8] + b[8] * scale;\r\n out[9] = a[9] + b[9] * scale;\r\n out[10] = a[10] + b[10] * scale;\r\n out[11] = a[11] + b[11] * scale;\r\n out[12] = a[12] + b[12] * scale;\r\n out[13] = a[13] + b[13] * scale;\r\n out[14] = a[14] + b[14] * scale;\r\n out[15] = a[15] + b[15] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===).\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7] &&\r\n a[8] === b[8] &&\r\n a[9] === b[9] &&\r\n a[10] === b[10] &&\r\n a[11] === b[11] &&\r\n a[12] === b[12] &&\r\n a[13] === b[13] &&\r\n a[14] === b[14] &&\r\n a[15] === b[15]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether two {@link Mat4}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first matrix.\r\n * @param b - The second matrix.\r\n * @returns True if the matrices are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const a8 = a[8];\r\n const a9 = a[9];\r\n const a10 = a[10];\r\n const a11 = a[11];\r\n const a12 = a[12];\r\n const a13 = a[13];\r\n const a14 = a[14];\r\n const a15 = a[15];\r\n\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n const b8 = b[8];\r\n const b9 = b[9];\r\n const b10 = b[10];\r\n const b11 = b[11];\r\n const b12 = b[12];\r\n const b13 = b[13];\r\n const b14 = b[14];\r\n const b15 = b[15];\r\n\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\r\n Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) &&\r\n Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) &&\r\n Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) &&\r\n Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) &&\r\n Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) &&\r\n Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) &&\r\n Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) &&\r\n Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Mat4}\r\n * @category Static\r\n *\r\n * @param a - matrix to represent as a string\r\n * @returns string representation of the matrix\r\n */\r\n static str(a: Readonly): string {\r\n return `Mat4(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nMat4.prototype.mul = Mat4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nMat4.sub = Mat4.subtract;\r\nMat4.mul = Mat4.multiply;\r\nMat4.frustum = Mat4.frustumNO;\r\nMat4.perspective = Mat4.perspectiveNO;\r\nMat4.ortho = Mat4.orthoNO;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, Mat4Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 3 Dimensional Vector\r\n */\r\nexport class Vec3 extends Float64Array {\r\n /**\r\n * Create a {@link Vec3}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 3:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 3); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 3);\r\n }\r\n break;\r\n }\r\n default:\r\n super(3); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec3.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec3.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec3.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec3.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec3} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec3} to `this`.\r\n * Equivalent to `Vec3.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec3} from `this`.\r\n * Equivalent to `Vec3.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec3}.\r\n * Equivalent to `Vec3.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec3.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec3.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec3} and `this`.\r\n * Equivalent to `Vec3.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec3.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec3.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec3.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to its absolute value.\r\n * Equivalent to `Vec3.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec3}.\r\n * Equivalent to `Vec3.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec3.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec3.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec3}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 3 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty vec3\r\n * @category Static\r\n *\r\n * @returns a new 3D vector\r\n */\r\n static create(): Vec3 {\r\n return new Vec3();\r\n }\r\n\r\n /**\r\n * Creates a new vec3 initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 3D vector\r\n */\r\n static clone(a: Readonly): Vec3 {\r\n return new Vec3(a);\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n /**\r\n * Alias for {@link Vec3.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec3.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Creates a new vec3 initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns a new 3D vector\r\n */\r\n static fromValues(x: number, y: number, z: number): Vec3 {\r\n return new Vec3(x, y, z);\r\n }\r\n\r\n /**\r\n * Copy the values from one vec3 to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @returns `out`\r\n */\r\n static set(out: Vec3Like, x: number, y: number, z: number): Vec3Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec3}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Multiplies two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; }\r\n\r\n /**\r\n * Divides two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; };\r\n\r\n /**\r\n * Math.ceil the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * symmetric round the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n /*\r\n static round(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = glMatrix.round(a[0]);\r\n out[1] = glMatrix.round(a[1]);\r\n out[2] = glMatrix.round(a[2]);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Scales a vec3 by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec3Like, a: Readonly, scale: number): Vec3Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two vec3's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec3Like, a: Readonly, b: Readonly, scale: number) {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return Math.sqrt(x * x + y * y + z * z);\r\n }\r\n /**\r\n * Alias for {@link Vec3.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared length of a vec3\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n return x * x + y * y + z * z;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec3.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec3}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec3Like, a: Readonly): Vec3Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a vec3\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec3Like, a: Readonly): Vec3Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n let len = x * x + y * y + z * z;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n out[2] = a[2] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two vec3's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like {\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2];\r\n const bx = b[0],\r\n by = b[1],\r\n bz = b[2];\r\n\r\n out[0] = ay * bz - az * by;\r\n out[1] = az * bx - ax * bz;\r\n out[2] = ax * by - ay * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two vec3's\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like {\r\n const angle = Math.acos(Math.min(Math.max(Vec3.dot(a, b), -1), 1));\r\n const sinTotal = Math.sin(angle);\r\n\r\n const ratioA = Math.sin((1 - t) * angle) / sinTotal;\r\n const ratioB = Math.sin(t * angle) / sinTotal;\r\n out[0] = ratioA * a[0] + ratioB * b[0];\r\n out[1] = ratioA * a[1] + ratioB * b[1];\r\n out[2] = ratioA * a[2] + ratioB * b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a hermite interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static hermite(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const factorTimes2 = t * t;\r\n const factor1 = factorTimes2 * (2 * t - 3) + 1;\r\n const factor2 = factorTimes2 * (t - 2) + t;\r\n const factor3 = factorTimes2 * (t - 1);\r\n const factor4 = factorTimes2 * (3 - 2 * t);\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a bezier interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static bezier(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): Vec3Like {\r\n const inverseFactor = 1 - t;\r\n const inverseFactorTimesTwo = inverseFactor * inverseFactor;\r\n const factorTimes2 = t * t;\r\n const factor1 = inverseFactorTimesTwo * inverseFactor;\r\n const factor2 = 3 * t * inverseFactorTimesTwo;\r\n const factor3 = 3 * factorTimes2 * inverseFactor;\r\n const factor4 = factorTimes2 * t;\r\n\r\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\r\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\r\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec3Like, scale) {\r\n scale = scale === undefined ? 1.0 : scale;\r\n\r\n let r = glMatrix.RANDOM() * 2.0 * Math.PI;\r\n let z = glMatrix.RANDOM() * 2.0 - 1.0;\r\n let zScale = Math.sqrt(1.0 - z * z) * scale;\r\n\r\n out[0] = Math.cos(r) * zScale;\r\n out[1] = Math.sin(r) * zScale;\r\n out[2] = z * scale;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the vec3 with a mat4.\r\n * 4th vector component is implicitly '1'\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec3Like, a: Readonly, m: Readonly): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1.0;\r\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\r\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\r\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a mat3.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - the 3x3 matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat3(out: Vec3Like, a: Vec3Like, m: Mat3Like): Vec3Like {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n out[0] = x * m[0] + y * m[3] + z * m[6];\r\n out[1] = x * m[1] + y * m[4] + z * m[7];\r\n out[2] = x * m[2] + y * m[5] + z * m[8];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the vec3 with a quat\r\n * Can also be used for dual quaternions. (Multiply it with the real part)\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec3Like, a: Readonly, q: Readonly): Vec3Like {\r\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const w2 = q[3] * 2;\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n // var qvec = [qx, qy, qz];\r\n // var uv = vec3.cross([], qvec, a);\r\n const uvx = (qy * z - qz * y);\r\n const uvy = (qz * x - qx * z);\r\n const uvz = (qx * y - qy * x);\r\n // var uuv = vec3.cross([], qvec, uv);\r\n // vec3.scale(uuv, uuv, 2);\r\n const uuvx = (qy * uvz - qz * uvy) * 2;\r\n const uuvy = (qz * uvx - qx * uvz) * 2;\r\n const uuvz = (qx * uvy - qy * uvx) * 2;\r\n // vec3.scale(uv, uv, 2 * w);\r\n // return vec3.add(out, a, vec3.add(out, uv, uuv));\r\n out[0] = x + (uvx * w2) + uuvx;\r\n out[1] = y + (uvy * w2) + uuvy;\r\n out[2] = z + (uvz * w2) + uuvz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the x-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateX(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const by = b[1];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const py = a[1] - by;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = a[0];\r\n out[1] = (py * Math.cos(rad) - pz * Math.sin(rad)) + by;\r\n out[2] = (py * Math.sin(rad) + pz * Math.cos(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the y-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateY(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const bz = b[2];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const pz = a[2] - bz;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (pz * Math.sin(rad) + px * Math.cos(rad)) + bx;\r\n out[1] = a[1];\r\n out[2] = (pz * Math.cos(rad) - px * Math.sin(rad)) + bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 3D vector around the z-axis\r\n * @category Static\r\n *\r\n * @param out - The receiving vec3\r\n * @param a - The vec3 point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like {\r\n const bx = b[0];\r\n const by = b[1];\r\n\r\n // Translate point to the origin\r\n const px = a[0] - bx;\r\n const py = a[1] - by;\r\n\r\n // perform rotation\r\n // translate to correct position\r\n out[0] = (px * Math.cos(rad) - py * Math.sin(rad)) + bx;\r\n out[1] = (px * Math.sin(rad) + py * Math.cos(rad)) + by;\r\n out[2] = b[2];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 3D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly) {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz));\r\n const cosine = mag && Vec3.dot(a, b) / mag;\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a vec3 to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec3Like): Vec3Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec3(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec3.prototype.sub = Vec3.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.mul = Vec3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.div = Vec3.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.dist = Vec3.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec3.prototype.sqrDist = Vec3.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec3.sub = Vec3.subtract;\r\nVec3.mul = Vec3.multiply;\r\nVec3.div = Vec3.divide;\r\nVec3.dist = Vec3.distance;\r\nVec3.sqrDist = Vec3.squaredDistance;\r\nVec3.sqrLen = Vec3.squaredLength;\r\nVec3.mag = Vec3.magnitude;\r\nVec3.length = Vec3.magnitude;\r\nVec3.len = Vec3.magnitude;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Vec4Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 4 Dimensional Vector\r\n */\r\nexport class Vec4 extends Float64Array {\r\n /**\r\n * Create a {@link Vec4}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the vector. Equivalent to `this[2];`\r\n * @category Vector Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the vector. Equivalent to `this[3];`\r\n * @category Vector Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The b component of the vector. Equivalent to `this[2];`\r\n * @category Color Components\r\n */\r\n get b(): number { return this[2]; }\r\n set b(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The a component of the vector. Equivalent to `this[3];`\r\n * @category Color Components\r\n */\r\n get a(): number { return this[3]; }\r\n set a(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec4.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec4.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec4.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec4} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a {@link Vec4} to `this`.\r\n * Equivalent to `Vec4.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n this[2] += b[2];\r\n this[3] += b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec4} from `this`.\r\n * Equivalent to `Vec4.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n this[2] -= b[2];\r\n this[3] -= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n this[2] *= b[2];\r\n this[3] *= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec4}.\r\n * Equivalent to `Vec4.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n this[2] /= b[2];\r\n this[3] /= b[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec4.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n this[2] *= b;\r\n this[3] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n this[2] += b[2] * scale;\r\n this[3] += b[3] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec4.distance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec4} and `this`.\r\n * Equivalent to `Vec4.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec4.squaredDistance(this, b);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec4.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n this[2] *= -1;\r\n this[3] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec4.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n this[2] = 1.0 / this[2];\r\n this[3] = 1.0 / this[3];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec4.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n this[2] = Math.abs(this[2]);\r\n this[3] = Math.abs(this[3]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec4}.\r\n * Equivalent to `Vec4.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec4.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec4.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec4}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec4}\r\n * @category Static\r\n *\r\n * @returns a new 4D vector\r\n */\r\n static create(): Vec4 {\r\n return new Vec4();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - vector to clone\r\n * @returns a new 4D vector\r\n */\r\n static clone(a: Vec4Like): Vec4 {\r\n return new Vec4(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec4} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new 4D vector\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Vec4 {\r\n return new Vec4(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec4} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n static set(out: Vec4Like, x: number, y: number, z: number, w: number): Vec4Like {\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n out[2] = a[2] - b[2];\r\n out[3] = a[3] - b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Multiplies two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n out[2] = a[2] * b[2];\r\n out[3] = a[3] * b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Divides two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n out[2] = a[2] / b[2];\r\n out[3] = a[3] / b[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n out[2] = Math.ceil(a[2]);\r\n out[3] = Math.ceil(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n out[2] = Math.floor(a[2]);\r\n out[3] = Math.floor(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n out[2] = Math.min(a[2], b[2]);\r\n out[3] = Math.min(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n out[2] = Math.max(a[2], b[2]);\r\n out[3] = Math.max(a[3], b[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n out[2] = Math.round(a[2]);\r\n out[3] = Math.round(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec4} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param scale - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec4Like, a: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec4}'s after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param scale - the amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec4Like, a: Readonly, b: Readonly, scale: number): Vec4Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n out[2] = a[2] + b[2] * scale;\r\n out[3] = a[3] + b[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns distance between a and b\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return Math.hypot(x, y, z, w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns squared distance between a and b\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n const z = b[2] - a[2];\r\n const w = b[3] - a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n /**\r\n * Alias for {@link Vec4.squaredDistance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of `a`\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec4.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec4.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n return x * x + y * y + z * z + w * w;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec4.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = -a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n out[2] = 1.0 / a[2];\r\n out[3] = 1.0 / a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec4Like, a: Readonly): Vec4Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n out[2] = Math.abs(a[2]);\r\n out[3] = Math.abs(a[3]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec4Like, a: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n let len = x * x + y * y + z * z + w * w;\r\n if (len > 0) {\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = x * len;\r\n out[1] = y * len;\r\n out[2] = z * len;\r\n out[3] = w * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Returns the cross-product of three vectors in a 4-dimensional space\r\n * @category Static\r\n *\r\n * @param out the receiving vector\r\n * @param u - the first vector\r\n * @param v - the second vector\r\n * @param w - the third vector\r\n * @returns result\r\n */\r\n static cross(out: Vec4Like, u: Readonly, v: Readonly, w: Readonly): Vec4Like {\r\n const a = v[0] * w[1] - v[1] * w[0];\r\n const b = v[0] * w[2] - v[2] * w[0];\r\n const c = v[0] * w[3] - v[3] * w[0];\r\n const d = v[1] * w[2] - v[2] * w[1];\r\n const e = v[1] * w[3] - v[3] * w[1];\r\n const f = v[2] * w[3] - v[3] * w[2];\r\n const g = u[0];\r\n const h = u[1];\r\n const i = u[2];\r\n const j = u[3];\r\n\r\n out[0] = h * f - i * e + j * d;\r\n out[1] = -(g * f) + i * c - j * b;\r\n out[2] = g * e - h * c + j * a;\r\n out[3] = -(g * d) + h * b - i * a;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec4}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec4Like, a: Readonly, b: Readonly, t: number): Vec4Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n out[2] = az + t * (b[2] - az);\r\n out[3] = aw + t * (b[3] - aw);\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random vector with the given scale\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns `out`\r\n */\r\n /*\r\n static random(out: Vec4Like, scale): Vec4Like {\r\n scale = scale || 1.0;\r\n\r\n // Marsaglia, George. Choosing a Point from the Surface of a\r\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\r\n // http://projecteuclid.org/euclid.aoms/1177692644;\r\n var v1, v2, v3, v4;\r\n var s1, s2;\r\n do {\r\n v1 = glMatrix.RANDOM() * 2 - 1;\r\n v2 = glMatrix.RANDOM() * 2 - 1;\r\n s1 = v1 * v1 + v2 * v2;\r\n } while (s1 >= 1);\r\n do {\r\n v3 = glMatrix.RANDOM() * 2 - 1;\r\n v4 = glMatrix.RANDOM() * 2 - 1;\r\n s2 = v3 * v3 + v4 * v4;\r\n } while (s2 >= 1);\r\n\r\n var d = Math.sqrt((1 - s1) / s2);\r\n out[0] = scale * v1;\r\n out[1] = scale * v2;\r\n out[2] = scale * v3 * d;\r\n out[3] = scale * v4 * d;\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Mat4}.\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param m - matrix to transform with\r\n * @returns `out`\r\n */\r\n static transformMat4(out: Vec4Like, a: Readonly, m: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const w = a[3];\r\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\r\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\r\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\r\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec4} with a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to transform\r\n * @param q - quaternion to transform with\r\n * @returns `out`\r\n */\r\n static transformQuat(out: Vec4Like, a: Readonly, q: Readonly): Vec4Like {\r\n const x = a[0];\r\n const y = a[1];\r\n const z = a[2];\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n\r\n // calculate quat * vec\r\n const ix = qw * x + qy * z - qz * y;\r\n const iy = qw * y + qz * x - qx * z;\r\n const iz = qw * z + qx * y - qy * x;\r\n const iw = -qx * x - qy * y - qz * z;\r\n\r\n // calculate result * inverse quat\r\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\r\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\r\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec4} to zero\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec4Like): Vec4Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n out[2] = 0.0;\r\n out[3] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Vec4}\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec4(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3))\r\n );\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec4.prototype.sub = Vec4.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.mul = Vec4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.div = Vec4.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.dist = Vec4.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec4.prototype.sqrDist = Vec4.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec4.sub = Vec4.subtract;\r\nVec4.mul = Vec4.multiply;\r\nVec4.div = Vec4.divide;\r\nVec4.dist = Vec4.distance;\r\nVec4.sqrDist = Vec4.squaredDistance;\r\nVec4.sqrLen = Vec4.squaredLength;\r\nVec4.mag = Vec4.magnitude;\r\nVec4.length = Vec4.magnitude;\r\nVec4.len = Vec4.magnitude;\r\n", "import { Vec3 } from './Vec3.js';\r\nimport { Vec4 } from './Vec4.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat3Like, QuatLike, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Quaternion\r\n */\r\nexport class Quat extends Float64Array {\r\n static #DEFAULT_ANGLE_ORDER = 'zyx';\r\n\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT1 = new Float64Array(4);\r\n static #TMP_QUAT2 = new Float64Array(4);\r\n static #TMP_MAT3 = new Float64Array(9);\r\n\r\n static #TMP_VEC3 = new Float64Array(3);\r\n static #X_UNIT_VEC3 = new Float64Array([1, 0, 0]);\r\n static #Y_UNIT_VEC3 = new Float64Array([0, 1, 0]);\r\n\r\n /**\r\n * Create a {@link Quat}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 4:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 4); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 4);\r\n }\r\n break;\r\n }\r\n default:\r\n super(4);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the quaternion. Equivalent to `this[0];`\r\n * @category Quaternion Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the quaternion. Equivalent to `this[1];`\r\n * @category Quaternion Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The z component of the quaternion. Equivalent to `this[2];`\r\n * @category Quaternion Components\r\n */\r\n get z(): number { return this[2]; }\r\n set z(value: number) { this[2] = value; }\r\n\r\n /**\r\n * The w component of the quaternion. Equivalent to `this[3];`\r\n * @category Quaternion Components\r\n */\r\n get w(): number { return this[3]; }\r\n set w(value: number) { this[3] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Quat.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n const z = this[2];\r\n const w = this[3];\r\n return Math.sqrt(x * x + y * y + z * z + w * w);\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n /**\r\n * Set `this` to the identity quaternion\r\n * Equivalent to Quat.identity(this)\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n identity(): this {\r\n this[0] = 0;\r\n this[1] = 0;\r\n this[2] = 0;\r\n this[3] = 1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Multiplies `this` by a {@link Quat}.\r\n * Equivalent to `Quat.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n return Quat.multiply(this, this, b) as this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Rotates `this` by the given angle about the X axis\r\n * Equivalent to `Quat.rotateX(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateX(rad: number): this {\r\n return Quat.rotateX(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Y axis\r\n * Equivalent to `Quat.rotateY(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateY(rad: number): this {\r\n return Quat.rotateY(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Rotates `this` by the given angle about the Z axis\r\n * Equivalent to `Quat.rotateZ(this, this, rad);`\r\n * @category Methods\r\n *\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `this`\r\n */\r\n rotateZ(rad: number): this {\r\n return Quat.rotateZ(this, this, rad) as this;\r\n }\r\n\r\n /**\r\n * Inverts `this`\r\n * Equivalent to `Quat.invert(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n return Quat.invert(this, this) as this;\r\n }\r\n\r\n /**\r\n * Scales `this` by a scalar number\r\n * Equivalent to `Quat.scale(this, this, scale);`\r\n * @category Methods\r\n *\r\n * @param scale - amount to scale the vector by\r\n * @returns `this`\r\n */\r\n scale(scale: number): QuatLike {\r\n this[0] *= scale;\r\n this[1] *= scale;\r\n this[2] *= scale;\r\n this[3] *= scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of `this` and another {@link Quat}\r\n * Equivalent to `Quat.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - the second operand\r\n * @returns dot product of `this` and b\r\n */\r\n dot(b: Readonly): number {\r\n return Quat.dot(this, b);\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 4 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity quat\r\n * @category Static\r\n *\r\n * @returns a new quaternion\r\n */\r\n static create(): Quat {\r\n return new Quat();\r\n }\r\n\r\n /**\r\n * Set a quat to the identity quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a quat from the given angle and rotation axis,\r\n * then returns it.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param axis - the axis around which to rotate\r\n * @param rad - the angle in radians\r\n * @returns `out`\r\n **/\r\n static setAxisAngle(out: QuatLike, axis: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n out[0] = s * axis[0];\r\n out[1] = s * axis[1];\r\n out[2] = s * axis[2];\r\n out[3] = Math.cos(rad);\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the rotation axis and angle for a given\r\n * quaternion. If a quaternion is created with\r\n * setAxisAngle, this method will return the same\r\n * values as provided in the original parameter list\r\n * OR functionally equivalent values.\r\n * Example: The quaternion formed by axis [0, 0, 1] and\r\n * angle -90 is the same as the quaternion formed by\r\n * [0, 0, 1] and 270. This method favors the latter.\r\n * @category Static\r\n *\r\n * @param out_axis - Vector receiving the axis of rotation\r\n * @param q - Quaternion to be decomposed\r\n * @return Angle, in radians, of the rotation\r\n */\r\n static getAxisAngle(out_axis: Vec3Like, q: Readonly): number {\r\n const rad = Math.acos(q[3]) * 2.0;\r\n const s = Math.sin(rad / 2.0);\r\n if (s > GLM_EPSILON) {\r\n out_axis[0] = q[0] / s;\r\n out_axis[1] = q[1] / s;\r\n out_axis[2] = q[2] / s;\r\n } else {\r\n // If s is zero, return any axis (no rotation - axis does not matter)\r\n out_axis[0] = 1;\r\n out_axis[1] = 0;\r\n out_axis[2] = 0;\r\n }\r\n return rad;\r\n }\r\n\r\n /**\r\n * Gets the angular distance between two unit quaternions\r\n * @category Static\r\n *\r\n * @param {ReadonlyQuat} a Origin unit quaternion\r\n * @param {ReadonlyQuat} b Destination unit quaternion\r\n * @return {Number} Angle, in radians, between the two quaternions\r\n */\r\n static getAngle(a: Readonly, b: Readonly): number {\r\n const dotproduct = Quat.dot(a, b);\r\n\r\n return Math.acos(2 * dotproduct * dotproduct - 1);\r\n }\r\n\r\n /**\r\n * Multiplies two quaternions.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = b[0];\r\n const by = b[1];\r\n const bz = b[2];\r\n const bw = b[3];\r\n\r\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the X axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bx = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + aw * bx;\r\n out[1] = ay * bw + az * bx;\r\n out[2] = az * bw - ay * bx;\r\n out[3] = aw * bw - ax * bx;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Y axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const by = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw - az * by;\r\n out[1] = ay * bw + aw * by;\r\n out[2] = az * bw + ax * by;\r\n out[3] = aw * bw - ay * by;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a quaternion by the given angle about the Z axis\r\n * @category Static\r\n *\r\n * @param out - quat receiving operation result\r\n * @param a - quat to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: QuatLike, a: Readonly, rad: number): QuatLike {\r\n rad *= 0.5;\r\n\r\n const ax = a[0];\r\n const ay = a[1];\r\n const az = a[2];\r\n const aw = a[3];\r\n const bz = Math.sin(rad);\r\n const bw = Math.cos(rad);\r\n\r\n out[0] = ax * bw + ay * bz;\r\n out[1] = ay * bw - ax * bz;\r\n out[2] = az * bw + aw * bz;\r\n out[3] = aw * bw - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the W component of a quat from the X, Y, and Z components.\r\n * Assumes that quaternion is 1 unit in length.\r\n * Any existing W component will be ignored.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate W component of\r\n * @returns `out`\r\n */\r\n static calculateW(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2];\r\n\r\n out[0] = x;\r\n out[1] = y;\r\n out[2] = z;\r\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the exponential of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static exp(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const et = Math.exp(w);\r\n const s = r > 0 ? (et * Math.sin(r)) / r : 0;\r\n\r\n out[0] = x * s;\r\n out[1] = y * s;\r\n out[2] = z * s;\r\n out[3] = et * Math.cos(r);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the natural logarithm of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @returns `out`\r\n */\r\n static ln(out: QuatLike, a: Readonly): QuatLike {\r\n const x = a[0],\r\n y = a[1],\r\n z = a[2],\r\n w = a[3];\r\n\r\n const r = Math.sqrt(x * x + y * y + z * z);\r\n const t = r > 0 ? Math.atan2(r, w) / r : 0;\r\n\r\n out[0] = x * t;\r\n out[1] = y * t;\r\n out[2] = z * t;\r\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculate the scalar power of a unit quaternion.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate the exponential of\r\n * @param b - amount to scale the quaternion by\r\n * @returns `out`\r\n */\r\n static pow(out: QuatLike, a: Readonly, b: number): QuatLike {\r\n Quat.ln(out, a);\r\n Quat.scale(out, out, b);\r\n Quat.exp(out, out);\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation between two quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static slerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike {\r\n // benchmarks:\r\n // http://jsperf.com/quaternion-slerp-implementations\r\n const ax = a[0],\r\n ay = a[1],\r\n az = a[2],\r\n aw = a[3];\r\n let bx = b[0],\r\n by = b[1],\r\n bz = b[2],\r\n bw = b[3];\r\n\r\n let scale0: number;\r\n let scale1: number;\r\n\r\n // calc cosine\r\n let cosom = ax * bx + ay * by + az * bz + aw * bw;\r\n // adjust signs (if necessary)\r\n if (cosom < 0.0) {\r\n cosom = -cosom;\r\n bx = -bx;\r\n by = -by;\r\n bz = -bz;\r\n bw = -bw;\r\n }\r\n // calculate coefficients\r\n if (1.0 - cosom > GLM_EPSILON) {\r\n // standard case (slerp)\r\n const omega = Math.acos(cosom);\r\n const sinom = Math.sin(omega);\r\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\r\n scale1 = Math.sin(t * omega) / sinom;\r\n } else {\r\n // \"from\" and \"to\" quaternions are very close\r\n // ... so we can do a linear interpolation\r\n scale0 = 1.0 - t;\r\n scale1 = t;\r\n }\r\n // calculate final values\r\n out[0] = scale0 * ax + scale1 * bx;\r\n out[1] = scale0 * ay + scale1 * by;\r\n out[2] = scale0 * az + scale1 * bz;\r\n out[3] = scale0 * aw + scale1 * bw;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Generates a random unit quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @returns `out`\r\n */\r\n /* static random(out: QuatLike): QuatLike {\r\n // Implementation of http://planning.cs.uiuc.edu/node198.html\r\n // TODO: Calling random 3 times is probably not the fastest solution\r\n let u1 = glMatrix.RANDOM();\r\n let u2 = glMatrix.RANDOM();\r\n let u3 = glMatrix.RANDOM();\r\n\r\n let sqrt1MinusU1 = Math.sqrt(1 - u1);\r\n let sqrtU1 = Math.sqrt(u1);\r\n\r\n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\r\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\r\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\r\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\r\n return out;\r\n }*/\r\n\r\n /**\r\n * Calculates the inverse of a quat\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: QuatLike, a: Readonly): QuatLike {\r\n const a0 = a[0],\r\n a1 = a[1],\r\n a2 = a[2],\r\n a3 = a[3];\r\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\r\n const invDot = dot ? 1.0 / dot : 0;\r\n\r\n // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\r\n\r\n out[0] = -a0 * invDot;\r\n out[1] = -a1 * invDot;\r\n out[2] = -a2 * invDot;\r\n out[3] = a3 * invDot;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a quat\r\n * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quat to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given 3x3 rotation matrix.\r\n *\r\n * NOTE: The resultant quaternion is not normalized, so you should be sure\r\n * to re-normalize the quaternion yourself where necessary.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param m - rotation matrix\r\n * @returns `out`\r\n */\r\n static fromMat3(out: QuatLike, m: Readonly): QuatLike {\r\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\r\n // article \"Quaternion Calculus and Fast Animation\".\r\n const fTrace = m[0] + m[4] + m[8];\r\n let fRoot: number;\r\n\r\n if (fTrace > 0.0) {\r\n // |w| > 1/2, may as well choose w > 1/2\r\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\r\n out[3] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot; // 1/(4w)\r\n out[0] = (m[5] - m[7]) * fRoot;\r\n out[1] = (m[6] - m[2]) * fRoot;\r\n out[2] = (m[1] - m[3]) * fRoot;\r\n } else {\r\n // |w| <= 1/2\r\n let i = 0;\r\n if (m[4] > m[0]) { i = 1; }\r\n if (m[8] > m[i * 3 + i]) { i = 2; }\r\n const j = (i + 1) % 3;\r\n const k = (i + 2) % 3;\r\n\r\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\r\n out[i] = 0.5 * fRoot;\r\n fRoot = 0.5 / fRoot;\r\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\r\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\r\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Creates a quaternion from the given euler angle x, y, z.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - Angle to rotate around X axis in degrees.\r\n * @param y - Angle to rotate around Y axis in degrees.\r\n * @param z - Angle to rotate around Z axis in degrees.\r\n * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx.\r\n * @returns `out`\r\n */\r\n static fromEuler(out: QuatLike, x: number, y: number, z: number, order = Quat.#DEFAULT_ANGLE_ORDER): QuatLike {\r\n const halfToRad = (0.5 * Math.PI) / 180.0;\r\n x *= halfToRad;\r\n y *= halfToRad;\r\n z *= halfToRad;\r\n\r\n const sx = Math.sin(x);\r\n const cx = Math.cos(x);\r\n const sy = Math.sin(y);\r\n const cy = Math.cos(y);\r\n const sz = Math.sin(z);\r\n const cz = Math.cos(z);\r\n\r\n switch (order) {\r\n case 'xyz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'xzy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yxz':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz - sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n case 'yzx':\r\n out[0] = sx * cy * cz + cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zxy':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz + sx * sy * cz;\r\n out[3] = cx * cy * cz - sx * sy * sz;\r\n break;\r\n\r\n case 'zyx':\r\n out[0] = sx * cy * cz - cx * sy * sz;\r\n out[1] = cx * sy * cz + sx * cy * sz;\r\n out[2] = cx * cy * sz - sx * sy * cz;\r\n out[3] = cx * cy * cz + sx * sy * sz;\r\n break;\r\n\r\n default:\r\n throw new Error(`Unknown angle order ${order}`);\r\n }\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a quatenion\r\n * @category Static\r\n *\r\n * @param a - vector to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - quaternion to clone\r\n * @returns a new quaternion\r\n */\r\n static clone(a: Readonly): Quat {\r\n return new Quat(a);\r\n }\r\n\r\n /**\r\n * Creates a new quat initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns a new quaternion\r\n */\r\n static fromValues(x: number, y: number, z: number, w: number): Quat {\r\n return new Quat(x, y, z, w);\r\n }\r\n\r\n /**\r\n * Copy the values from one quat to another\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the source quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param x - X component\r\n * @param y - Y component\r\n * @param z - Z component\r\n * @param w - W component\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static set(out: QuatLike, x: number, y: number, z: number, w: number): QuatLike { return out; }\r\n\r\n /**\r\n * Adds two {@link Quat}'s\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static add(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Alias for {@link Quat.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Scales a quat by a scalar number\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - the vector to scale\r\n * @param b - amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: QuatLike, a: Readonly, scale: number): QuatLike {\r\n out[0] = a[0] * scale;\r\n out[1] = a[1] * scale;\r\n out[2] = a[2] * scale;\r\n out[3] = a[3] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two quat's\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two quat's\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static lerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike { return out; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mag(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat}\r\n * @category Static\r\n *\r\n * @param a - quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat}\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - quaternion to normalize\r\n * @returns `out`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static normalize(out: QuatLike, a: Readonly): QuatLike { return out; }\r\n\r\n /**\r\n * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first quaternion.\r\n * @param b - The second quaternion.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static exactEquals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Returns whether the quaternions have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns True if the vectors are equal, false otherwise.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static equals(a: Readonly, b: Readonly): boolean { return false; }\r\n\r\n /**\r\n * Sets a quaternion to represent the shortest rotation from one\r\n * vector to another.\r\n *\r\n * Both vectors are assumed to be unit length.\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion.\r\n * @param a - the initial vector\r\n * @param b - the destination vector\r\n * @returns `out`\r\n */\r\n static rotationTo(out: QuatLike, a: Readonly, b: Readonly): QuatLike {\r\n const dot = Vec3.dot(a, b);\r\n\r\n if (dot < -0.999999) {\r\n Vec3.cross(Quat.#TMP_VEC3, Quat.#X_UNIT_VEC3, a);\r\n if (Vec3.mag(Quat.#TMP_VEC3) < 0.000001) { Vec3.cross(Quat.#TMP_VEC3, Quat.#Y_UNIT_VEC3, a); }\r\n Vec3.normalize(Quat.#TMP_VEC3, Quat.#TMP_VEC3);\r\n Quat.setAxisAngle(out, Quat.#TMP_VEC3, Math.PI);\r\n return out;\r\n } else if (dot > 0.999999) {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n return out;\r\n } else {\r\n Vec3.cross(Quat.#TMP_VEC3, a, b);\r\n out[0] = Quat.#TMP_VEC3[0];\r\n out[1] = Quat.#TMP_VEC3[1];\r\n out[2] = Quat.#TMP_VEC3[2];\r\n out[3] = 1 + dot;\r\n return Quat.normalize(out, out);\r\n }\r\n }\r\n\r\n /**\r\n * Performs a spherical linear interpolation with two control points\r\n * @category Static\r\n *\r\n * @param out - the receiving quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param c - the third operand\r\n * @param d - the fourth operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static sqlerp(out: QuatLike, a: Readonly, b: Readonly, c: Readonly,\r\n d: Readonly, t: number): QuatLike {\r\n Quat.slerp(Quat.#TMP_QUAT1, a, d, t);\r\n Quat.slerp(Quat.#TMP_QUAT2, b, c, t);\r\n Quat.slerp(out, Quat.#TMP_QUAT1, Quat.#TMP_QUAT2, 2 * t * (1 - t));\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets the specified quaternion with values corresponding to the given\r\n * axes. Each axis is a vec3 and is expected to be unit length and\r\n * perpendicular to all other specified axes.\r\n * @category Static\r\n *\r\n * @param out - The receiving quaternion\r\n * @param view - the vector representing the viewing direction\r\n * @param right - the vector representing the local `right` direction\r\n * @param up - the vector representing the local `up` direction\r\n * @returns `out`\r\n */\r\n static setAxes(out: QuatLike, view: Readonly, right: Readonly, up: Readonly): QuatLike {\r\n Quat.#TMP_MAT3[0] = right[0];\r\n Quat.#TMP_MAT3[3] = right[1];\r\n Quat.#TMP_MAT3[6] = right[2];\r\n\r\n Quat.#TMP_MAT3[1] = up[0];\r\n Quat.#TMP_MAT3[4] = up[1];\r\n Quat.#TMP_MAT3[7] = up[2];\r\n\r\n Quat.#TMP_MAT3[2] = -view[0];\r\n Quat.#TMP_MAT3[5] = -view[1];\r\n Quat.#TMP_MAT3[8] = -view[2];\r\n\r\n return Quat.normalize(out, Quat.fromMat3(out, Quat.#TMP_MAT3));\r\n }\r\n}\r\n\r\n// Methods which re-use the Vec4 implementation\r\nQuat.set = Vec4.set;\r\nQuat.add = Vec4.add;\r\nQuat.lerp = Vec4.lerp;\r\nQuat.normalize = Vec4.normalize;\r\nQuat.squaredLength = Vec4.squaredLength;\r\nQuat.sqrLen = Vec4.squaredLength;\r\nQuat.exactEquals = Vec4.exactEquals;\r\nQuat.equals = Vec4.equals;\r\nQuat.magnitude = Vec4.magnitude;\r\n\r\n// Instance method alias assignments\r\nQuat.prototype.mul = Quat.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nQuat.mul = Quat.multiply;\r\nQuat.mag = Quat.magnitude;\r\nQuat.length = Quat.magnitude;\r\nQuat.len = Quat.magnitude;\r\n", "import { Mat4 } from './Mat4.js';\r\nimport { Quat } from './Quat.js';\r\nimport { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * Dual Quaternion\r\n */\r\nexport class Quat2 extends Float64Array {\r\n // Temporary variables to prevent repeated allocations in the algorithms within Quat2.\r\n // These are declared as TypedArrays to aid in tree-shaking.\r\n\r\n static #TMP_QUAT = new Float64Array(4);\r\n static #TMP_VEC3 = new Float64Array(3);\r\n\r\n /**\r\n * Create a {@link Quat2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 8:\r\n super(values); break;\r\n case 2:\r\n super(values[0] as ArrayBufferLike, values[1], 8); break;\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v, v, v, v, v, v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 8);\r\n }\r\n break;\r\n }\r\n default:\r\n super(8);\r\n this[3] = 1;\r\n break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Quat2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Quat2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Quat2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source dual quaternion\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n super.set(a);\r\n return this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Quat2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 8 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new identity {@link Quat2}\r\n * @category Static\r\n *\r\n * @returns a new dual quaternion [real -> rotation, dual -> translation]\r\n */\r\n static create(): Quat2 {\r\n return new Quat2();\r\n }\r\n\r\n /**\r\n * Creates a {@link Quat2} quat initialized with values from an existing quaternion\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to clone\r\n * @returns a new dual quaternion\r\n */\r\n static clone(a: Quat2Like): Quat2 {\r\n return new Quat2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns a new dual quaternion\r\n */\r\n static fromValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2 {\r\n return new Quat2(x1, y1, z1, w1, x2, y2, z2, w2);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Quat2} from the given values (quat and translation)\r\n * @category Static\r\n *\r\n * @param x1 - X component (rotation)\r\n * @param y1 - Y component (rotation)\r\n * @param z1 - Z component (rotation)\r\n * @param w1 - W component (rotation)\r\n * @param x2 - X component (translation)\r\n * @param y2 - Y component (translation)\r\n * @param z2 - Z component (translation)\r\n * @returns a new dual quaternion\r\n */\r\n static fromRotationTranslationValues(x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number): Quat2 {\r\n const ax = x2 * 0.5;\r\n const ay = y2 * 0.5;\r\n const az = z2 * 0.5;\r\n\r\n return new Quat2(x1, y1, z1, w1,\r\n ax * w1 + ay * z1 - az * y1,\r\n ay * w1 + az * x1 - ax * z1,\r\n az * w1 + ax * y1 - ay * x1,\r\n -ax * x1 - ay * y1 - az * z1);\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion and a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromRotationTranslation(out: Quat2Like, q: Readonly, t: Readonly): Quat2Like {\r\n const ax = t[0] * 0.5;\r\n const ay = t[1] * 0.5;\r\n const az = t[2] * 0.5;\r\n const bx = q[0];\r\n const by = q[1];\r\n const bz = q[2];\r\n const bw = q[3];\r\n out[0] = bx;\r\n out[1] = by;\r\n out[2] = bz;\r\n out[3] = bw;\r\n out[4] = ax * bw + ay * bz - az * by;\r\n out[5] = ay * bw + az * bx - ax * bz;\r\n out[6] = az * bw + ax * by - ay * bx;\r\n out[7] = -ax * bx - ay * by - az * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a translation\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param t - translation vector\r\n * @returns `out`\r\n */\r\n static fromTranslation(out: Quat2Like, t: Readonly): Quat2Like {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = t[0] * 0.5;\r\n out[5] = t[1] * 0.5;\r\n out[6] = t[2] * 0.5;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param q - a normalized quaternion\r\n * @returns `out`\r\n */\r\n static fromRotation(out: Quat2Like, q: Readonly): Quat2Like {\r\n out[0] = q[0];\r\n out[1] = q[1];\r\n out[2] = q[2];\r\n out[3] = q[3];\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Sets a {@link Quat2} from a quaternion\r\n * @category Static\r\n *\r\n * @param out - dual quaternion receiving operation result\r\n * @param a - the matrix\r\n * @returns `out`\r\n */\r\n static fromMat4(out: Quat2Like, a: Readonly): Quat2Like {\r\n Mat4.getRotation(Quat2.#TMP_QUAT, a);\r\n Mat4.getTranslation(Quat2.#TMP_VEC3, a);\r\n return Quat2.fromRotationTranslation(out, Quat2.#TMP_QUAT, Quat2.#TMP_VEC3);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Quat2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the source dual quaternion\r\n * @returns `out`\r\n */\r\n static copy(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n out[4] = a[4];\r\n out[5] = a[5];\r\n out[6] = a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set a {@link Quat2} to the identity dual quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @returns `out`\r\n */\r\n static identity(out: QuatLike): QuatLike {\r\n out[0] = 0;\r\n out[1] = 0;\r\n out[2] = 0;\r\n out[3] = 1;\r\n out[4] = 0;\r\n out[5] = 0;\r\n out[6] = 0;\r\n out[7] = 0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Quat2} to the given values\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param x1 - 1st X component\r\n * @param y1 - 1st Y component\r\n * @param z1 - 1st Z component\r\n * @param w1 - 1st W component\r\n * @param x2 - 2nd X component\r\n * @param y2 - 2nd Y component\r\n * @param z2 - 2nd Z component\r\n * @param w2 - 2nd W component\r\n * @returns `out`\r\n */\r\n static set(out: Quat2Like, x1: number, y1: number, z1: number, w1: number,\r\n x2: number, y2: number, z2: number, w2: number): Quat2Like {\r\n out[0] = x1;\r\n out[1] = y1;\r\n out[2] = z1;\r\n out[3] = w1;\r\n out[4] = x2;\r\n out[5] = y2;\r\n out[6] = z2;\r\n out[7] = w2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the real part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - real part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getReal(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Gets the dual part of a dual quat\r\n * @category Static\r\n *\r\n * @param out - dual part\r\n * @param a - Dual Quaternion\r\n * @return `out`\r\n */\r\n static getDual(out: QuatLike, a: Readonly): QuatLike {\r\n out[0] = a[4];\r\n out[1] = a[5];\r\n out[2] = a[6];\r\n out[3] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the real component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the real part\r\n * @return `out`\r\n */\r\n static setReal(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n out[2] = a[2];\r\n out[3] = a[3];\r\n return out;\r\n };\r\n\r\n /**\r\n * Set the dual component of a {@link Quat2} to the given quaternion\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - a quaternion representing the dual part\r\n * @return `out`\r\n */\r\n static setDual(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[4] = a[0];\r\n out[5] = a[1];\r\n out[6] = a[2];\r\n out[7] = a[3];\r\n return out;\r\n }\r\n\r\n /**\r\n * Gets the translation of a normalized {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving translation vector\r\n * @param a - Dual Quaternion to be decomposed\r\n * @return `out`\r\n */\r\n static getTranslation(out: Vec3Like, a: Readonly): Vec3Like {\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const bx = -a[0];\r\n const by = -a[1];\r\n const bz = -a[2];\r\n const bw = a[3];\r\n out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\r\n out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\r\n out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Translates a {@link Quat2} by the given vector\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to translate\r\n * @param v - vector to translate by\r\n * @returns `out`\r\n */\r\n static translate(out: Quat2Like, a: Readonly, v: Readonly): Quat2Like {\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n const bx1 = v[0] * 0.5;\r\n const by1 = v[1] * 0.5;\r\n const bz1 = v[2] * 0.5;\r\n const ax2 = a[4];\r\n const ay2 = a[5];\r\n const az2 = a[6];\r\n const aw2 = a[7];\r\n out[0] = ax1;\r\n out[1] = ay1;\r\n out[2] = az1;\r\n out[3] = aw1;\r\n out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2;\r\n out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2;\r\n out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2;\r\n out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the X axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateX(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateX(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Y axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateY(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateY(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around the Z axis\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param rad - angle (in radians) to rotate\r\n * @returns `out`\r\n */\r\n static rotateZ(out: Quat2Like, a: Readonly, rad: number): Quat2Like {\r\n let bx = -a[0];\r\n let by = -a[1];\r\n let bz = -a[2];\r\n let bw = a[3];\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\r\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\r\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\r\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\r\n Quat.rotateZ(out as QuatLike, a as QuatLike, rad);\r\n bx = out[0];\r\n by = out[1];\r\n bz = out[2];\r\n bw = out[3];\r\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (a * q)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param q - quaternion to rotate by\r\n * @returns `out`\r\n */\r\n static rotateByQuatAppend(out: Quat2Like, a: Readonly, q: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let ax = a[0];\r\n let ay = a[1];\r\n let az = a[2];\r\n let aw = a[3];\r\n\r\n out[0] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[1] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[2] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[3] = aw * qw - ax * qx - ay * qy - az * qz;\r\n ax = a[4];\r\n ay = a[5];\r\n az = a[6];\r\n aw = a[7];\r\n out[4] = ax * qw + aw * qx + ay * qz - az * qy;\r\n out[5] = ay * qw + aw * qy + az * qx - ax * qz;\r\n out[6] = az * qw + aw * qz + ax * qy - ay * qx;\r\n out[7] = aw * qw - ax * qx - ay * qy - az * qz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} by a given quaternion (q * a)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param q - quaternion to rotate by\r\n * @param a - the dual quaternion to rotate\r\n * @returns `out`\r\n */\r\n static rotateByQuatPrepend(out: Quat2Like, q: Readonly, a: Readonly): Quat2Like {\r\n const qx = q[0];\r\n const qy = q[1];\r\n const qz = q[2];\r\n const qw = q[3];\r\n let bx = a[0];\r\n let by = a[1];\r\n let bz = a[2];\r\n let bw = a[3];\r\n\r\n out[0] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[1] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[2] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[3] = qw * bw - qx * bx - qy * by - qz * bz;\r\n bx = a[4];\r\n by = a[5];\r\n bz = a[6];\r\n bw = a[7];\r\n out[4] = qx * bw + qw * bx + qy * bz - qz * by;\r\n out[5] = qy * bw + qw * by + qz * bx - qx * bz;\r\n out[6] = qz * bw + qw * bz + qx * by - qy * bx;\r\n out[7] = qw * bw - qx * bx - qy * by - qz * bz;\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotates a {@link Quat2} around a given axis. Does the normalization automatically\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the dual quaternion to rotate\r\n * @param axis - the axis to rotate around\r\n * @param rad - how far the rotation should be\r\n * @returns `out`\r\n */\r\n static rotateAroundAxis(out: Quat2Like, a: Readonly, axis: Readonly, rad: number): Quat2Like {\r\n // Special case for rad = 0\r\n if (Math.abs(rad) < GLM_EPSILON) {\r\n return Quat2.copy(out, a);\r\n }\r\n const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);\r\n\r\n rad *= 0.5;\r\n const s = Math.sin(rad);\r\n const bx = (s * axis[0]) / axisLength;\r\n const by = (s * axis[1]) / axisLength;\r\n const bz = (s * axis[2]) / axisLength;\r\n const bw = Math.cos(rad);\r\n\r\n const ax1 = a[0];\r\n const ay1 = a[1];\r\n const az1 = a[2];\r\n const aw1 = a[3];\r\n out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\r\n out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\r\n out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\r\n out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\r\n\r\n const ax = a[4];\r\n const ay = a[5];\r\n const az = a[6];\r\n const aw = a[7];\r\n out[4] = ax * bw + aw * bx + ay * bz - az * by;\r\n out[5] = ay * bw + aw * by + az * bx - ax * bz;\r\n out[6] = az * bw + aw * bz + ax * by - ay * bx;\r\n out[7] = aw * bw - ax * bx - ay * by - az * bz;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns `out`\r\n */\r\n static add(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n out[2] = a[2] + b[2];\r\n out[3] = a[3] + b[3];\r\n out[4] = a[4] + b[4];\r\n out[5] = a[5] + b[5];\r\n out[6] = a[6] + b[6];\r\n out[7] = a[7] + b[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Multiplies two {@link Quat2}s\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns {quat2} out\r\n */\r\n static multiply(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like {\r\n const ax0 = a[0];\r\n const ay0 = a[1];\r\n const az0 = a[2];\r\n const aw0 = a[3];\r\n const bx1 = b[4];\r\n const by1 = b[5];\r\n const bz1 = b[6];\r\n const bw1 = b[7];\r\n const ax1 = a[4];\r\n const ay1 = a[5];\r\n const az1 = a[6];\r\n const aw1 = a[7];\r\n const bx0 = b[0];\r\n const by0 = b[1];\r\n const bz0 = b[2];\r\n const bw0 = b[3];\r\n out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0;\r\n out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0;\r\n out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0;\r\n out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0;\r\n out[4] =\r\n ax0 * bw1 +\r\n aw0 * bx1 +\r\n ay0 * bz1 -\r\n az0 * by1 +\r\n ax1 * bw0 +\r\n aw1 * bx0 +\r\n ay1 * bz0 -\r\n az1 * by0;\r\n out[5] =\r\n ay0 * bw1 +\r\n aw0 * by1 +\r\n az0 * bx1 -\r\n ax0 * bz1 +\r\n ay1 * bw0 +\r\n aw1 * by0 +\r\n az1 * bx0 -\r\n ax1 * bz0;\r\n out[6] =\r\n az0 * bw1 +\r\n aw0 * bz1 +\r\n ax0 * by1 -\r\n ay0 * bx1 +\r\n az1 * bw0 +\r\n aw1 * bz0 +\r\n ax1 * by0 -\r\n ay1 * bx0;\r\n out[7] =\r\n aw0 * bw1 -\r\n ax0 * bx1 -\r\n ay0 * by1 -\r\n az0 * bz1 +\r\n aw1 * bw0 -\r\n ax1 * bx0 -\r\n ay1 * by0 -\r\n az1 * bz0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Quat2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like { return out; }\r\n\r\n /**\r\n * Scales a {@link Quat2} by a scalar value\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaterion\r\n * @param a - the dual quaternion to scale\r\n * @param b - scalar value to scale the dual quaterion by\r\n * @returns `out`\r\n */\r\n static scale(out: Quat2Like, a: Readonly, b: number): Quat2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n out[2] = a[2] * b;\r\n out[3] = a[3] * b;\r\n out[4] = a[4] * b;\r\n out[5] = a[5] * b;\r\n out[6] = a[6] * b;\r\n out[7] = a[7] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts)\r\n * @category Static\r\n *\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @returns dot product of a and b\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dot(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Quat2}s\r\n * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`)\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quat\r\n * @param a - the first operand\r\n * @param b - the second operand\r\n * @param t - interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Quat2Like, a: Readonly, b: Readonly, t: number): Quat2Like {\r\n const mt = 1 - t;\r\n if (Quat2.dot(a, b) < 0) { t = -t; }\r\n\r\n out[0] = a[0] * mt + b[0] * t;\r\n out[1] = a[1] * mt + b[1] * t;\r\n out[2] = a[2] * mt + b[2] * t;\r\n out[3] = a[3] * mt + b[3] * t;\r\n out[4] = a[4] * mt + b[4] * t;\r\n out[5] = a[5] * mt + b[5] * t;\r\n out[6] = a[6] * mt + b[6] * t;\r\n out[7] = a[7] * mt + b[7] * t;\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quat to calculate inverse of\r\n * @returns `out`\r\n */\r\n static invert(out: Quat2Like, a: Readonly): Quat2Like {\r\n const sqlen = Quat2.squaredLength(a);\r\n out[0] = -a[0] / sqlen;\r\n out[1] = -a[1] / sqlen;\r\n out[2] = -a[2] / sqlen;\r\n out[3] = a[3] / sqlen;\r\n out[4] = -a[4] / sqlen;\r\n out[5] = -a[5] / sqlen;\r\n out[6] = -a[6] / sqlen;\r\n out[7] = a[7] / sqlen;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than\r\n * {@link Quat2.invert} and produces the same result.\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to calculate conjugate of\r\n * @returns `out`\r\n */\r\n static conjugate(out: Quat2Like, a: Readonly): Quat2Like {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n out[2] = -a[2];\r\n out[3] = a[3];\r\n out[4] = -a[4];\r\n out[5] = -a[5];\r\n out[6] = -a[6];\r\n out[7] = a[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate length of\r\n * @returns length of `a`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static magnitude(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Quat2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Quat2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to calculate squared length of\r\n * @returns squared length of a\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static squaredLength(a: Readonly): number { return 0; }\r\n\r\n /**\r\n * Alias for {@link Quat2.squaredLength}\r\n * @category Static\r\n */\r\n static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Normalize a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param out - the receiving dual quaternion\r\n * @param a - dual quaternion to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Quat2Like, a: Readonly): Quat2Like {\r\n let magnitude = Quat2.squaredLength(a);\r\n if (magnitude > 0) {\r\n magnitude = Math.sqrt(magnitude);\r\n\r\n const a0 = a[0] / magnitude;\r\n const a1 = a[1] / magnitude;\r\n const a2 = a[2] / magnitude;\r\n const a3 = a[3] / magnitude;\r\n\r\n const b0 = a[4];\r\n const b1 = a[5];\r\n const b2 = a[6];\r\n const b3 = a[7];\r\n\r\n const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3;\r\n\r\n out[0] = a0;\r\n out[1] = a1;\r\n out[2] = a2;\r\n out[3] = a3;\r\n\r\n out[4] = (b0 - a0 * a_dot_b) / magnitude;\r\n out[5] = (b1 - a1 * a_dot_b) / magnitude;\r\n out[6] = (b2 - a2 * a_dot_b) / magnitude;\r\n out[7] = (b3 - a3 * a_dot_b) / magnitude;\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns a string representation of a {@link Quat2}\r\n * @category Static\r\n *\r\n * @param a - dual quaternion to represent as a string\r\n * @returns string representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Quat2(${a.join(', ')})`;\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return (\r\n a[0] === b[0] &&\r\n a[1] === b[1] &&\r\n a[2] === b[2] &&\r\n a[3] === b[3] &&\r\n a[4] === b[4] &&\r\n a[5] === b[5] &&\r\n a[6] === b[6] &&\r\n a[7] === b[7]\r\n );\r\n }\r\n\r\n /**\r\n * Returns whether the {@link Quat2}s have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first dual quaternion.\r\n * @param b - The second dual quaternion.\r\n * @returns True if the dual quaternions are equal, false otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const a2 = a[2];\r\n const a3 = a[3];\r\n const a4 = a[4];\r\n const a5 = a[5];\r\n const a6 = a[6];\r\n const a7 = a[7];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n const b2 = b[2];\r\n const b3 = b[3];\r\n const b4 = b[4];\r\n const b5 = b[5];\r\n const b6 = b[6];\r\n const b7 = b[7];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\r\n Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\r\n Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&\r\n Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&\r\n Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) &&\r\n Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) &&\r\n Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7))\r\n );\r\n }\r\n}\r\n\r\n// Methods which re-use the Quat implementation\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.dot = Quat.dot;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.squaredLength = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.sqrLen = Quat.squaredLength;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.mag = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.length = Quat.magnitude;\r\n// @ts-expect-error: Ignore type error coercion.\r\nQuat2.len = Quat.magnitude;\r\n\r\n// Static method alias assignments\r\nQuat2.mul = Quat2.multiply;\r\n", "import { GLM_EPSILON } from '#gl-matrix/common';\r\n\r\nimport type { Mat2Like, Mat2dLike, Mat3Like, Mat4Like, Vec2Like } from '#gl-matrix/types';\r\n\r\n/**\r\n * 2 Dimensional Vector\r\n */\r\nexport class Vec2 extends Float64Array {\r\n /**\r\n * Create a {@link Vec2}.\r\n *\r\n * @category Constructor\r\n */\r\n constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) {\r\n switch (values.length) {\r\n case 2:{\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, values[1]!]);\r\n } else {\r\n super(v as ArrayBufferLike, values[1], 2);\r\n }\r\n break;\r\n }\r\n case 1: {\r\n const v = values[0];\r\n if (typeof v === 'number') {\r\n super([v, v]);\r\n } else {\r\n super(v as ArrayBufferLike, 0, 2);\r\n }\r\n break;\r\n }\r\n default:\r\n super(2); break;\r\n }\r\n }\r\n\r\n // ============\r\n // Accessors\r\n // ============\r\n\r\n // Getters and setters to make component access read better.\r\n // These are likely to be a little bit slower than direct array access.\r\n\r\n /**\r\n * The x component of the vector. Equivalent to `this[0];`\r\n * @category Vector Components\r\n */\r\n get x(): number { return this[0]; }\r\n set x(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The y component of the vector. Equivalent to `this[1];`\r\n * @category Vector Components\r\n */\r\n get y(): number { return this[1]; }\r\n set y(value: number) { this[1] = value; }\r\n\r\n // Alternate set of getters and setters in case this is being used to define\r\n // a color.\r\n\r\n /**\r\n * The r component of the vector. Equivalent to `this[0];`\r\n * @category Color Components\r\n */\r\n get r(): number { return this[0]; }\r\n set r(value: number) { this[0] = value; }\r\n\r\n /**\r\n * The g component of the vector. Equivalent to `this[1];`\r\n * @category Color Components\r\n */\r\n get g(): number { return this[1]; }\r\n set g(value: number) { this[1] = value; }\r\n\r\n /**\r\n * The magnitude (length) of this.\r\n * Equivalent to `Vec2.magnitude(this);`\r\n *\r\n * Magnitude is used because the `length` attribute is already defined by\r\n * TypedArrays to mean the number of elements in the array.\r\n *\r\n * @category Accessors\r\n */\r\n get magnitude(): number {\r\n return Math.hypot(this[0], this[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get mag(): number { return this.magnitude; }\r\n\r\n /**\r\n * The squared magnitude (length) of `this`.\r\n * Equivalent to `Vec2.squaredMagnitude(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get squaredMagnitude(): number {\r\n const x = this[0];\r\n const y = this[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredMagnitude}\r\n *\r\n * @category Accessors\r\n */\r\n get sqrMag(): number { return this.squaredMagnitude; }\r\n\r\n /**\r\n * A string representation of `this`\r\n * Equivalent to `Vec2.str(this);`\r\n *\r\n * @category Accessors\r\n */\r\n get str(): string {\r\n return Vec2.str(this);\r\n }\r\n\r\n // ===================\r\n // Instances methods\r\n // ===================\r\n\r\n /**\r\n * Copy the values from another {@link Vec2} into `this`.\r\n * @category Methods\r\n *\r\n * @param a the source vector\r\n * @returns `this`\r\n */\r\n copy(a: Readonly): this {\r\n this.set(a);\r\n return this;\r\n }\r\n\r\n // Instead of zero(), use a.fill(0) for instances;\r\n\r\n /**\r\n * Adds a {@link Vec2} to `this`.\r\n * Equivalent to `Vec2.add(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @returns `this`\r\n */\r\n add(b: Readonly): this {\r\n this[0] += b[0];\r\n this[1] += b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts a {@link Vec2} from `this`.\r\n * Equivalent to `Vec2.subtract(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to subtract from `this`\r\n * @returns `this`\r\n */\r\n subtract(b: Readonly): this {\r\n this[0] -= b[0];\r\n this[1] -= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Methods\r\n */\r\n sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Multiplies `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.multiply(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to multiply `this` by\r\n * @returns `this`\r\n */\r\n multiply(b: Readonly): this {\r\n this[0] *= b[0];\r\n this[1] *= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Methods\r\n */\r\n mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Divides `this` by a {@link Vec2}.\r\n * Equivalent to `Vec2.divide(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to divide `this` by\r\n * @returns `this`\r\n */\r\n divide(b: Readonly): this {\r\n this[0] /= b[0];\r\n this[1] /= b[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Methods\r\n */\r\n div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Scales `this` by a scalar number.\r\n * Equivalent to `Vec2.scale(this, this, b);`\r\n * @category Methods\r\n *\r\n * @param b - Amount to scale `this` by\r\n * @returns `this`\r\n */\r\n scale(b: number): this {\r\n this[0] *= b;\r\n this[1] *= b;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\r\n * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to add to `this`\r\n * @param scale - The amount to scale `b` by before adding\r\n * @returns `this`\r\n */\r\n scaleAndAdd(b: Readonly, scale: number): this {\r\n this[0] += b[0] * scale;\r\n this[1] += b[1] * scale;\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.distance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The vector to calculate the distance to\r\n * @returns Distance between `this` and `b`\r\n */\r\n distance(b: Readonly): number {\r\n return Vec2.distance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Methods\r\n */\r\n dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between another {@link Vec2} and `this`.\r\n * Equivalent to `Vec2.squaredDistance(this, b);`\r\n * @category Methods\r\n *\r\n * @param b The vector to calculate the squared distance to\r\n * @returns Squared distance between `this` and `b`\r\n */\r\n squaredDistance(b: Readonly): number {\r\n return Vec2.squaredDistance(this, b);\r\n }\r\n /**\r\n * Alias for {@link Vec2.squaredDistance}\r\n * @category Methods\r\n */\r\n sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Negates the components of `this`.\r\n * Equivalent to `Vec2.negate(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n negate(): this {\r\n this[0] *= -1;\r\n this[1] *= -1;\r\n return this;\r\n }\r\n\r\n /**\r\n * Inverts the components of `this`.\r\n * Equivalent to `Vec2.inverse(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n invert(): this {\r\n this[0] = 1.0 / this[0];\r\n this[1] = 1.0 / this[1];\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets each component of `this` to it's absolute value.\r\n * Equivalent to `Vec2.abs(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n abs(): this {\r\n this[0] = Math.abs(this[0]);\r\n this[1] = Math.abs(this[1]);\r\n return this;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of this and another {@link Vec2}.\r\n * Equivalent to `Vec2.dot(this, b);`\r\n * @category Methods\r\n *\r\n * @param b - The second operand\r\n * @returns Dot product of `this` and `b`\r\n */\r\n dot(b: Readonly): number {\r\n return this[0] * b[0] + this[1] * b[1];\r\n }\r\n\r\n /**\r\n * Normalize `this`.\r\n * Equivalent to `Vec2.normalize(this, this);`\r\n * @category Methods\r\n *\r\n * @returns `this`\r\n */\r\n normalize(): this {\r\n return Vec2.normalize(this, this) as this;\r\n }\r\n\r\n // ===================\r\n // Static accessors\r\n // ===================\r\n\r\n /**\r\n * @category Static\r\n *\r\n * @returns The number of bytes in a {@link Vec2}.\r\n */\r\n static get BYTE_LENGTH(): number {\r\n return 2 * Float64Array.BYTES_PER_ELEMENT;\r\n }\r\n\r\n // ===================\r\n // Static methods\r\n // ===================\r\n\r\n /**\r\n * Creates a new, empty {@link Vec2}\r\n * @category Static\r\n *\r\n * @returns A new 2D vector\r\n */\r\n static create(): Vec2 {\r\n return new Vec2();\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with values from an existing vector\r\n * @category Static\r\n *\r\n * @param a - Vector to clone\r\n * @returns A new 2D vector\r\n */\r\n static clone(a: Readonly): Vec2 {\r\n return new Vec2(a);\r\n }\r\n\r\n /**\r\n * Creates a new {@link Vec2} initialized with the given values\r\n * @category Static\r\n *\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns A new 2D vector\r\n */\r\n static fromValues(x: number, y: number): Vec2 {\r\n return new Vec2(x, y);\r\n }\r\n\r\n /**\r\n * Copy the values from one {@link Vec2} to another\r\n * @category Static\r\n *\r\n * @param out - the receiving vector\r\n * @param a - The source vector\r\n * @returns `out`\r\n */\r\n static copy(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = a[0];\r\n out[1] = a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to the given values\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param x - X component\r\n * @param y - Y component\r\n * @returns `out`\r\n */\r\n static set(out: Vec2Like, x: number, y: number): Vec2Like {\r\n out[0] = x;\r\n out[1] = y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static add(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] + b[0];\r\n out[1] = a[1] + b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Subtracts vector b from vector a\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static subtract(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] - b[0];\r\n out[1] = a[1] - b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.subtract}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sub(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Multiplies two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static multiply(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] * b[0];\r\n out[1] = a[1] * b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.multiply}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static mul(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Divides two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static divide(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = a[0] / b[0];\r\n out[1] = a[1] / b[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.divide}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static div(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; }\r\n\r\n /**\r\n * Math.ceil the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to ceil\r\n * @returns `out`\r\n */\r\n static ceil(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.ceil(a[0]);\r\n out[1] = Math.ceil(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.floor the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to floor\r\n * @returns `out`\r\n */\r\n static floor(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.floor(a[0]);\r\n out[1] = Math.floor(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the minimum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static min(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.min(a[0], b[0]);\r\n out[1] = Math.min(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the maximum of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static max(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n out[0] = Math.max(a[0], b[0]);\r\n out[1] = Math.max(a[1], b[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Math.round the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to round\r\n * @returns `out`\r\n */\r\n static round(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.round(a[0]);\r\n out[1] = Math.round(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Scales a {@link Vec2} by a scalar number\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to scale\r\n * @param b - Amount to scale the vector by\r\n * @returns `out`\r\n */\r\n static scale(out: Vec2Like, a: Readonly, b: number): Vec2Like {\r\n out[0] = a[0] * b;\r\n out[1] = a[1] * b;\r\n return out;\r\n }\r\n\r\n /**\r\n * Adds two Vec2's after scaling the second operand by a scalar value\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param scale - The amount to scale b by before adding\r\n * @returns `out`\r\n */\r\n static scaleAndAdd(out: Vec2Like, a: Readonly, b: Readonly, scale: number): Vec2Like {\r\n out[0] = a[0] + b[0] * scale;\r\n out[1] = a[1] + b[1] * scale;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns distance between `a` and `b`\r\n */\r\n static distance(a: Readonly, b: Readonly): number {\r\n return Math.hypot(b[0] - a[0], b[1] - a[1]);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static dist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the squared Euclidean distance between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Squared distance between `a` and `b`\r\n */\r\n static squaredDistance(a: Readonly, b: Readonly): number {\r\n const x = b[0] - a[0];\r\n const y = b[1] - a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.distance}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrDist(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Calculates the magnitude (length) of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate magnitude of\r\n * @returns Magnitude of a\r\n */\r\n static magnitude(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return Math.sqrt(x * x + y * y);\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n */\r\n static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs\r\n *\r\n * @param a - vector to calculate length of\r\n * @returns length of a\r\n */\r\n // Length conflicts with Function.length\r\n static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Alias for {@link Vec2.magnitude}\r\n * @category Static\r\n * @deprecated Use {@link Vec2.mag}\r\n */\r\n static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars\r\n\r\n /**\r\n * Calculates the squared length of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param a - Vector to calculate squared length of\r\n * @returns Squared length of a\r\n */\r\n static squaredLength(a: Readonly): number {\r\n const x = a[0];\r\n const y = a[1];\r\n return x * x + y * y;\r\n }\r\n\r\n /**\r\n * Alias for {@link Vec2.squaredLength}\r\n * @category Static\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n static sqrLen(a: Readonly, b: Readonly): number { return 0; }\r\n\r\n /**\r\n * Negates the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to negate\r\n * @returns `out`\r\n */\r\n static negate(out: Vec2Like, a: Readonly) {\r\n out[0] = -a[0];\r\n out[1] = -a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the inverse of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to invert\r\n * @returns `out`\r\n */\r\n static inverse(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = 1.0 / a[0];\r\n out[1] = 1.0 / a[1];\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns the absolute value of the components of a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to compute the absolute values of\r\n * @returns `out`\r\n */\r\n static abs(out: Vec2Like, a: Readonly): Vec2Like {\r\n out[0] = Math.abs(a[0]);\r\n out[1] = Math.abs(a[1]);\r\n return out;\r\n }\r\n\r\n /**\r\n * Normalize a {@link Vec2}\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - Vector to normalize\r\n * @returns `out`\r\n */\r\n static normalize(out: Vec2Like, a: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n let len = x * x + y * y;\r\n if (len > 0) {\r\n // TODO: evaluate use of glm_invsqrt here?\r\n len = 1 / Math.sqrt(len);\r\n }\r\n out[0] = a[0] * len;\r\n out[1] = a[1] * len;\r\n return out;\r\n }\r\n\r\n /**\r\n * Calculates the dot product of two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns Dot product of `a` and `b`\r\n */\r\n static dot(a: Readonly, b: Readonly): number {\r\n return a[0] * b[0] + a[1] * b[1];\r\n }\r\n\r\n /**\r\n * Computes the cross product of two {@link Vec2}s\r\n * Note that the cross product must by definition produce a 3D vector.\r\n * For this reason there is also not instance equivalent for this function.\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns `out`\r\n */\r\n static cross(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like {\r\n const z = a[0] * b[1] - a[1] * b[0];\r\n out[0] = out[1] = 0;\r\n out[2] = z;\r\n return out;\r\n }\r\n\r\n /**\r\n * Performs a linear interpolation between two {@link Vec2}s\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @param t - Interpolation amount, in the range [0-1], between the two inputs\r\n * @returns `out`\r\n */\r\n static lerp(out: Vec2Like, a: Readonly, b: Readonly, t: number): Vec2Like {\r\n const ax = a[0];\r\n const ay = a[1];\r\n out[0] = ax + t * (b[0] - ax);\r\n out[1] = ay + t * (b[1] - ay);\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y;\r\n out[1] = m[1] * x + m[3] * y;\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat2d}\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat2d(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[2] * y + m[4];\r\n out[1] = m[1] * x + m[3] * y + m[5];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat3}\r\n * 3rd vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat3(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[3] * y + m[6];\r\n out[1] = m[1] * x + m[4] * y + m[7];\r\n return out;\r\n }\r\n\r\n /**\r\n * Transforms the {@link Vec2} with a {@link Mat4}\r\n * 3rd vector component is implicitly '0'\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param out - The receiving vector\r\n * @param a - The vector to transform\r\n * @param m - Matrix to transform with\r\n * @returns `out`\r\n * @category Static\r\n */\r\n static transformMat4(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like {\r\n const x = a[0];\r\n const y = a[1];\r\n out[0] = m[0] * x + m[4] * y + m[12];\r\n out[1] = m[1] * x + m[5] * y + m[13];\r\n return out;\r\n }\r\n\r\n /**\r\n * Rotate a 2D vector\r\n * @category Static\r\n *\r\n * @param out - The receiving {@link Vec2}\r\n * @param a - The {@link Vec2} point to rotate\r\n * @param b - The origin of the rotation\r\n * @param rad - The angle of rotation in radians\r\n * @returns `out`\r\n */\r\n static rotate(out: Vec2Like, a: Readonly, b: Readonly, rad: number): Vec2Like {\r\n // Translate point to the origin\r\n const p0 = a[0] - b[0];\r\n const p1 = a[1] - b[1];\r\n const sinC = Math.sin(rad);\r\n const cosC = Math.cos(rad);\r\n\r\n // perform rotation and translate to correct position\r\n out[0] = p0 * cosC - p1 * sinC + b[0];\r\n out[1] = p0 * sinC + p1 * cosC + b[1];\r\n\r\n return out;\r\n }\r\n\r\n /**\r\n * Get the angle between two 2D vectors\r\n * @category Static\r\n *\r\n * @param a - The first operand\r\n * @param b - The second operand\r\n * @returns The angle in radians\r\n */\r\n static angle(a: Readonly, b: Readonly): number {\r\n const x1 = a[0];\r\n const y1 = a[1];\r\n const x2 = b[0];\r\n const y2 = b[1];\r\n // mag is the product of the magnitudes of a and b\r\n const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2);\r\n // mag &&.. short circuits if mag == 0\r\n const cosine = mag && (x1 * x2 + y1 * y2) / mag;\r\n // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1\r\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\r\n }\r\n\r\n /**\r\n * Set the components of a {@link Vec2} to zero\r\n * @category Static\r\n *\r\n * @param out - The receiving vector\r\n * @returns `out`\r\n */\r\n static zero(out: Vec2Like): Vec2Like {\r\n out[0] = 0.0;\r\n out[1] = 0.0;\r\n return out;\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors components are ===, `false` otherwise.\r\n */\r\n static exactEquals(a: Readonly, b: Readonly): boolean {\r\n return a[0] === b[0] && a[1] === b[1];\r\n }\r\n\r\n /**\r\n * Returns whether the vectors have approximately the same elements in the same position.\r\n * @category Static\r\n *\r\n * @param a - The first vector.\r\n * @param b - The second vector.\r\n * @returns `true` if the vectors are approximately equal, `false` otherwise.\r\n */\r\n static equals(a: Readonly, b: Readonly): boolean {\r\n const a0 = a[0];\r\n const a1 = a[1];\r\n const b0 = b[0];\r\n const b1 = b[1];\r\n return (\r\n Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\r\n Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1))\r\n );\r\n }\r\n\r\n /**\r\n * Returns a string representation of a vector\r\n * @category Static\r\n *\r\n * @param a - Vector to represent as a string\r\n * @returns String representation of the vector\r\n */\r\n static str(a: Readonly): string {\r\n return `Vec2(${a.join(', ')})`;\r\n }\r\n}\r\n\r\n// Instance method alias assignments\r\nVec2.prototype.sub = Vec2.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.mul = Vec2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.div = Vec2.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.dist = Vec2.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method\r\nVec2.prototype.sqrDist = Vec2.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method\r\n\r\n// Static method alias assignments\r\nVec2.sub = Vec2.subtract;\r\nVec2.mul = Vec2.multiply;\r\nVec2.div = Vec2.divide;\r\nVec2.dist = Vec2.distance;\r\nVec2.sqrDist = Vec2.squaredDistance;\r\nVec2.sqrLen = Vec2.squaredLength;\r\nVec2.mag = Vec2.magnitude;\r\nVec2.length = Vec2.magnitude;\r\nVec2.len = Vec2.magnitude;\r\n", "/**\r\n * To enable additional swizzle accessors for vector classes (64-bit) invoke the {@link EnableSwizzlesF64} function from\r\n * the `gl-matrix/swizzle/f64` sub-path export. To enable ambient module declarations for IDE / Typescript support\r\n * please see {@link gl-matrix/types/swizzle/f64}.\r\n *\r\n * To enable swizzling for the 32-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle}.\r\n *\r\n * @example\r\n * ```ts\r\n * import { Vec3 } from 'gl-matrix/f64';\r\n * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64';\r\n *\r\n * EnableSwizzlesF64();\r\n *\r\n * const vec = new Vec3(0, 1, 2);\r\n * const vecSwizzled = vec.zyx; // Returns a new Vec3(2, 1, 0).\r\n * ```\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\nimport { Vec2, Vec3, Vec4 } from '#gl-matrix/f64';\r\n\r\n/**\r\n * Internal `gl-matrix` variable tracking if swizzling is enabled (64-bit).\r\n */\r\nlet GLM_SWIZZLES_ENABLED_F64 = false;\r\n\r\n/**\r\n * Enables Swizzle operations on {@link gl-matrix/f64.Vec2 | Vec2} / {@link gl-matrix/f64.Vec3 | Vec3} /\r\n * {@link gl-matrix/f64.Vec4 | Vec4} types from {@link gl-matrix/f64} (64-bit).\r\n *\r\n * Swizzle operations are performed by using the `.` operator in conjunction with any combination\r\n * of between two and four component names, either from the set `xyzw` or `rgbw` (though not intermixed).\r\n * They return a new vector with the same number of components as specified in the swizzle attribute.\r\n *\r\n * @example\r\n * ```js\r\n * import { Vec3 } from 'gl-matrix/f64';\r\n * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64';\r\n *\r\n * EnableSwizzlesF64();\r\n *\r\n * let v = new Vec3(0, 1, 2);\r\n *\r\n * v.yx; // returns new Vec2(1, 0)\r\n * v.xzy; // returns new Vec3(0, 2, 1)\r\n * v.zyxz; // returns new Vec4(2, 1, 0, 2)\r\n *\r\n * v.rgb; // returns new Vec3(0, 1, 2)\r\n * v.rbg; // returns new Vec3(0, 2, 1)\r\n * v.gg; // returns new Vec2(1, 1)\r\n * ```\r\n */\r\nexport function EnableSwizzlesF64(): void {\r\n /* v8 ignore next 1 */\r\n if (GLM_SWIZZLES_ENABLED_F64) { return; }\r\n\r\n /* eslint-disable comma-spacing, max-len */\r\n\r\n // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should\r\n // not be modified by hand.\r\n // [Swizzle Autogen]\r\n\r\n const VEC2_SWIZZLES = ['xx','xy','yx','yy','xxx','xxy','xyx','xyy','yxx','yxy','yyx','yyy','xxxx','xxxy','xxyx','xxyy','xyxx','xyxy','xyyx','xyyy','yxxx','yxxy','yxyx','yxyy','yyxx','yyxy','yyyx','yyyy','rr','rg','gr','gg','rrr','rrg','rgr','rgg','grr','grg','ggr','ggg','rrrr','rrrg','rrgr','rrgg','rgrr','rgrg','rggr','rggg','grrr','grrg','grgr','grgg','ggrr','ggrg','gggr','gggg'];\r\n const VEC3_SWIZZLES = ['xz','yz','zx','zy','zz','xxz','xyz','xzx','xzy','xzz','yxz','yyz','yzx','yzy','yzz','zxx','zxy','zxz','zyx','zyy','zyz','zzx','zzy','zzz','xxxz','xxyz','xxzx','xxzy','xxzz','xyxz','xyyz','xyzx','xyzy','xyzz','xzxx','xzxy','xzxz','xzyx','xzyy','xzyz','xzzx','xzzy','xzzz','yxxz','yxyz','yxzx','yxzy','yxzz','yyxz','yyyz','yyzx','yyzy','yyzz','yzxx','yzxy','yzxz','yzyx','yzyy','yzyz','yzzx','yzzy','yzzz','zxxx','zxxy','zxxz','zxyx','zxyy','zxyz','zxzx','zxzy','zxzz','zyxx','zyxy','zyxz','zyyx','zyyy','zyyz','zyzx','zyzy','zyzz','zzxx','zzxy','zzxz','zzyx','zzyy','zzyz','zzzx','zzzy','zzzz','rb','gb','br','bg','bb','rrb','rgb','rbr','rbg','rbb','grb','ggb','gbr','gbg','gbb','brr','brg','brb','bgr','bgg','bgb','bbr','bbg','bbb','rrrb','rrgb','rrbr','rrbg','rrbb','rgrb','rggb','rgbr','rgbg','rgbb','rbrr','rbrg','rbrb','rbgr','rbgg','rbgb','rbbr','rbbg','rbbb','grrb','grgb','grbr','grbg','grbb','ggrb','gggb','ggbr','ggbg','ggbb','gbrr','gbrg','gbrb','gbgr','gbgg','gbgb','gbbr','gbbg','gbbb','brrr','brrg','brrb','brgr','brgg','brgb','brbr','brbg','brbb','bgrr','bgrg','bgrb','bggr','bggg','bggb','bgbr','bgbg','bgbb','bbrr','bbrg','bbrb','bbgr','bbgg','bbgb','bbbr','bbbg','bbbb'];\r\n const VEC4_SWIZZLES = ['xw','yw','zw','wx','wy','wz','ww','xxw','xyw','xzw','xwx','xwy','xwz','xww','yxw','yyw','yzw','ywx','ywy','ywz','yww','zxw','zyw','zzw','zwx','zwy','zwz','zww','wxx','wxy','wxz','wxw','wyx','wyy','wyz','wyw','wzx','wzy','wzz','wzw','wwx','wwy','wwz','www','xxxw','xxyw','xxzw','xxwx','xxwy','xxwz','xxww','xyxw','xyyw','xyzw','xywx','xywy','xywz','xyww','xzxw','xzyw','xzzw','xzwx','xzwy','xzwz','xzww','xwxx','xwxy','xwxz','xwxw','xwyx','xwyy','xwyz','xwyw','xwzx','xwzy','xwzz','xwzw','xwwx','xwwy','xwwz','xwww','yxxw','yxyw','yxzw','yxwx','yxwy','yxwz','yxww','yyxw','yyyw','yyzw','yywx','yywy','yywz','yyww','yzxw','yzyw','yzzw','yzwx','yzwy','yzwz','yzww','ywxx','ywxy','ywxz','ywxw','ywyx','ywyy','ywyz','ywyw','ywzx','ywzy','ywzz','ywzw','ywwx','ywwy','ywwz','ywww','zxxw','zxyw','zxzw','zxwx','zxwy','zxwz','zxww','zyxw','zyyw','zyzw','zywx','zywy','zywz','zyww','zzxw','zzyw','zzzw','zzwx','zzwy','zzwz','zzww','zwxx','zwxy','zwxz','zwxw','zwyx','zwyy','zwyz','zwyw','zwzx','zwzy','zwzz','zwzw','zwwx','zwwy','zwwz','zwww','wxxx','wxxy','wxxz','wxxw','wxyx','wxyy','wxyz','wxyw','wxzx','wxzy','wxzz','wxzw','wxwx','wxwy','wxwz','wxww','wyxx','wyxy','wyxz','wyxw','wyyx','wyyy','wyyz','wyyw','wyzx','wyzy','wyzz','wyzw','wywx','wywy','wywz','wyww','wzxx','wzxy','wzxz','wzxw','wzyx','wzyy','wzyz','wzyw','wzzx','wzzy','wzzz','wzzw','wzwx','wzwy','wzwz','wzww','wwxx','wwxy','wwxz','wwxw','wwyx','wwyy','wwyz','wwyw','wwzx','wwzy','wwzz','wwzw','wwwx','wwwy','wwwz','wwww','ra','ga','ba','ar','ag','ab','aa','rra','rga','rba','rar','rag','rab','raa','gra','gga','gba','gar','gag','gab','gaa','bra','bga','bba','bar','bag','bab','baa','arr','arg','arb','ara','agr','agg','agb','aga','abr','abg','abb','aba','aar','aag','aab','aaa','rrra','rrga','rrba','rrar','rrag','rrab','rraa','rgra','rgga','rgba','rgar','rgag','rgab','rgaa','rbra','rbga','rbba','rbar','rbag','rbab','rbaa','rarr','rarg','rarb','rara','ragr','ragg','ragb','raga','rabr','rabg','rabb','raba','raar','raag','raab','raaa','grra','grga','grba','grar','grag','grab','graa','ggra','ggga','ggba','ggar','ggag','ggab','ggaa','gbra','gbga','gbba','gbar','gbag','gbab','gbaa','garr','garg','garb','gara','gagr','gagg','gagb','gaga','gabr','gabg','gabb','gaba','gaar','gaag','gaab','gaaa','brra','brga','brba','brar','brag','brab','braa','bgra','bgga','bgba','bgar','bgag','bgab','bgaa','bbra','bbga','bbba','bbar','bbag','bbab','bbaa','barr','barg','barb','bara','bagr','bagg','bagb','baga','babr','babg','babb','baba','baar','baag','baab','baaa','arrr','arrg','arrb','arra','argr','argg','argb','arga','arbr','arbg','arbb','arba','arar','arag','arab','araa','agrr','agrg','agrb','agra','aggr','aggg','aggb','agga','agbr','agbg','agbb','agba','agar','agag','agab','agaa','abrr','abrg','abrb','abra','abgr','abgg','abgb','abga','abbr','abbg','abbb','abba','abar','abag','abab','abaa','aarr','aarg','aarb','aara','aagr','aagg','aagb','aaga','aabr','aabg','aabb','aaba','aaar','aaag','aaab','aaaa'];\r\n\r\n // [/Swizzle Autogen]\r\n\r\n /* eslint-enable comma-spacing, max-len */\r\n\r\n /**\r\n * Internal swizzle index table for `gl-matrix`.\r\n */\r\n const SWIZZLE_INDEX: Record = {\r\n x: 0, r: 0,\r\n y: 1, g: 1,\r\n z: 2, b: 2,\r\n w: 3, a: 3,\r\n };\r\n\r\n /**\r\n * Internal helper function to convert and return a `gl-matrix` vector by swizzle format.\r\n *\r\n * @param swizzle - Swizzle format to apply.\r\n * @returns {Vec2 | Vec3 | Vec4} New swizzled vector instance.\r\n */\r\n function getSwizzleImpl(swizzle: string): () => Vec2 | Vec3 | Vec4 {\r\n switch (swizzle.length) {\r\n case 2:\r\n return function(this: Float64Array) {\r\n return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]);\r\n };\r\n case 3:\r\n return function(this: Float64Array) {\r\n return new Vec3(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]]);\r\n };\r\n case 4:\r\n return function(this: Float64Array) {\r\n return new Vec4(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]],\r\n this[SWIZZLE_INDEX[swizzle[2]]], this[SWIZZLE_INDEX[swizzle[3]]]);\r\n };\r\n }\r\n\r\n throw new Error('Illegal swizzle length');\r\n }\r\n\r\n for (const swizzle of VEC2_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec2.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC3_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec3.prototype, swizzle, {\r\n get: impl\r\n });\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n for (const swizzle of VEC4_SWIZZLES) {\r\n const impl = getSwizzleImpl(swizzle);\r\n Object.defineProperty(Vec4.prototype, swizzle, {\r\n get: impl\r\n });\r\n }\r\n\r\n GLM_SWIZZLES_ENABLED_F64 = true;\r\n}\r\n", "/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_DEG_TO_RAD: number = Math.PI / 180;\r\n\r\n/**\r\n * Constant used in `gl-matrix` angle conversions.\r\n */\r\nconst GLM_RAD_TO_DEG: number = 180 / Math.PI;\r\n\r\n/**\r\n * Convert `radians` to `degrees`.\r\n *\r\n * @param value - Angle in `radians`.\r\n * @returns Angle in `degrees`.\r\n */\r\nexport function toDegree(value: number): number {\r\n return value * GLM_RAD_TO_DEG;\r\n}\r\n\r\n/**\r\n * Convert `degrees` to `radians`.\r\n *\r\n * @param value - Angle in `degrees`.\r\n * @returns Angle in `radians`.\r\n */\r\nexport function toRadian(value: number): number {\r\n return value * GLM_DEG_TO_RAD;\r\n}\r\n"], + "mappings": ";;;;AAOO,IAAMA,EAAN,MAAMC,UAAa,YAAa,CACrC,MAAOC,GAAgB,IAAI,aAAa,CACtC,EAAG,EACH,EAAG,CACL,CAAC,EAOD,eAAeC,EAAoE,CACjF,OAAQA,EAAO,OAAQ,CACrB,IAAK,GACH,MAAMA,CAAM,EAAG,MACjB,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AEAX,EAA2B,EAC7B,CCzIA,IAAMY,EAAyB,KAAK,GAAK,IAKnCC,EAAyB,IAAM,KAAK,GAQnC,SAASC,GAASC,EAAuB,CAC9C,OAAOA,EAAQF,CACjB,CAQO,SAASG,GAASD,EAAuB,CAC9C,OAAOA,EAAQH,CACjB", + "names": ["Mat2", "_Mat2", "#IDENTITY_2X2", "values", "v", "a", "b", "rad", "out", "a1", "a0", "a2", "a3", "det", "b0", "b1", "b2", "b3", "s", "c", "v0", "v1", "scale", "L", "D", "U", "Mat2d", "_Mat2d", "#IDENTITY_2X3", "values", "v", "a", "b", "rad", "out", "aa", "ab", "ac", "ad", "atx", "aty", "det", "a0", "a1", "a2", "a3", "a4", "a5", "b0", "b1", "b2", "b3", "b4", "b5", "v0", "v1", "s", "c", "scale", "Mat3", "_Mat3", "#IDENTITY_3X3", "values", "v", "a", "b", "rad", "out", "a01", "a02", "a12", "a00", "a10", "a11", "a20", "a21", "a22", "b01", "b11", "b21", "det", "b0", "b1", "b2", "x", "y", "s", "c", "q", "z", "w", "x2", "y2", "z2", "xx", "yx", "yy", "zx", "zy", "zz", "wx", "wy", "wz", "a03", "a13", "a23", "a30", "a31", "a32", "a33", "b00", "b02", "b03", "b04", "b05", "b06", "b07", "b08", "b09", "b10", "ax", "ay", "az", "bx", "by", "bz", "cx", "cy", "cz", "width", "height", "scale", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "b3", "b4", "b5", "b6", "b7", "b8", "Mat4", "_Mat4", "#IDENTITY_4X4", "#TMP_VEC3", "values", "v", "a", "b", "rad", "axis", "fovy", "aspect", "near", "far", "left", "right", "bottom", "top", "out", "a01", "a02", "a03", "a12", "a13", "a23", "a00", "a10", "a11", "a20", "a21", "a22", "a30", "a31", "a32", "a33", "b00", "b01", "b02", "b03", "b04", "b05", "b06", "b07", "b08", "b09", "b10", "b11", "det", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "x", "y", "z", "len", "s", "c", "t", "b12", "b20", "b21", "b22", "q", "w", "x2", "y2", "z2", "xx", "xy", "xz", "yy", "yz", "zz", "wx", "wy", "wz", "bx", "by", "bz", "bw", "ax", "ay", "az", "aw", "magnitude", "cx", "cy", "cz", "mat", "m11", "m12", "m13", "m21", "m22", "m23", "m31", "m32", "m33", "is1", "is2", "is3", "sm11", "sm12", "sm13", "sm21", "sm22", "sm23", "sm31", "sm32", "sm33", "trace", "S", "out_r", "out_t", "out_s", "sx", "sy", "sz", "o", "ox", "oy", "oz", "out0", "out1", "out2", "out4", "out5", "out6", "out8", "out9", "out10", "yx", "zx", "zy", "rl", "tb", "nf", "f", "fov", "upTan", "downTan", "leftTan", "rightTan", "xScale", "yScale", "lr", "bt", "eye", "center", "up", "eyex", "eyey", "eyez", "upx", "upy", "upz", "centerx", "centery", "centerz", "z0", "z1", "x0", "x1", "y0", "y1", "target", "scale", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a14", "a15", "b13", "b14", "b15", "Vec3", "_Vec3", "values", "v", "value", "x", "y", "z", "a", "b", "scale", "out", "len", "ax", "ay", "az", "bx", "by", "bz", "t", "angle", "sinTotal", "ratioA", "ratioB", "c", "d", "factorTimes2", "factor1", "factor2", "factor3", "factor4", "inverseFactor", "inverseFactorTimesTwo", "m", "w", "q", "qx", "qy", "qz", "w2", "uvx", "uvy", "uvz", "uuvx", "uuvy", "uuvz", "rad", "py", "pz", "px", "mag", "cosine", "a0", "a1", "a2", "b0", "b1", "b2", "Vec4", "_Vec4", "values", "v", "value", "x", "y", "z", "w", "a", "b", "scale", "out", "len", "u", "c", "d", "e", "f", "g", "h", "i", "j", "t", "ax", "ay", "az", "aw", "m", "q", "qx", "qy", "qz", "qw", "ix", "iy", "iz", "iw", "a0", "a1", "a2", "a3", "b0", "b1", "b2", "b3", "Quat", "_Quat", "#DEFAULT_ANGLE_ORDER", "#TMP_QUAT1", "#TMP_QUAT2", "#TMP_MAT3", "#TMP_VEC3", "#X_UNIT_VEC3", "#Y_UNIT_VEC3", "values", "v", "value", "x", "y", "z", "w", "a", "b", "rad", "scale", "out", "axis", "out_axis", "q", "dotproduct", "ax", "ay", "az", "aw", "bx", "by", "bz", "bw", "r", "et", "s", "t", "scale0", "scale1", "cosom", "omega", "sinom", "a0", "a1", "a2", "a3", "dot", "invDot", "m", "fTrace", "fRoot", "i", "j", "k", "order", "halfToRad", "sx", "cx", "sy", "cy", "sz", "cz", "Vec3", "c", "d", "view", "right", "up", "Vec4", "Quat2", "_Quat2", "#TMP_QUAT", "#TMP_VEC3", "values", "v", "a", "x1", "y1", "z1", "w1", "x2", "y2", "z2", "w2", "ax", "ay", "az", "out", "q", "t", "bx", "by", "bz", "bw", "Mat4", "aw", "ax1", "ay1", "az1", "aw1", "bx1", "by1", "bz1", "ax2", "ay2", "az2", "aw2", "rad", "Quat", "qx", "qy", "qz", "qw", "axis", "axisLength", "s", "b", "ax0", "ay0", "az0", "aw0", "bw1", "bx0", "by0", "bz0", "bw0", "mt", "sqlen", "magnitude", "a0", "a1", "a2", "a3", "b0", "b1", "b2", "b3", "a_dot_b", "a4", "a5", "a6", "a7", "b4", "b5", "b6", "b7", "Vec2", "_Vec2", "values", "v", "value", "x", "y", "a", "b", "scale", "out", "len", "z", "t", "ax", "ay", "m", "rad", "p0", "p1", "sinC", "cosC", "x1", "y1", "x2", "y2", "mag", "cosine", "a0", "a1", "b0", "b1", "GLM_SWIZZLES_ENABLED_F64", "EnableSwizzlesF64", "VEC2_SWIZZLES", "VEC3_SWIZZLES", "VEC4_SWIZZLES", "SWIZZLE_INDEX", "getSwizzleImpl", "swizzle", "Vec2", "Vec3", "Vec4", "impl", "GLM_DEG_TO_RAD", "GLM_RAD_TO_DEG", "toDegree", "value", "toRadian"] +} diff --git a/dist-cdn/types/gl-matrix-f32.d.cts b/dist-cdn/types/gl-matrix-f32.d.cts new file mode 100644 index 00000000..0e3da008 --- /dev/null +++ b/dist-cdn/types/gl-matrix-f32.d.cts @@ -0,0 +1,9911 @@ +/** + * Provides an all-inclusive ESM distribution of `gl-matrix` (32-bit). All library classes extends `Float32Array`. + * + * @packageDocumentation + */ + +/** + * Provides all common type declarations shared across `gl-matrix`. + * + * ```ts + * import { Vec3 } from 'gl-matrix'; + * import type { Vec3Like } from 'gl-matrix/types'; + * + * const vec: Vec3Like = new Vec3(0, 1, 2); + * ``` + * + * For JSDoc using the new Typescript 5.5 `@import` tag: + * ```js + * /** + * * @import { Vec3Like } from 'gl-matrix/types' + * *\/ + * ``` + * + * For JSDoc using the older `import types` Typescript mechanism: + * ```js + * /** + * * @type {import('gl-matrix/types').Vec3Like} + * *\/ + * ``` + * + * @packageDocumentation + */ +/** + * The floating-point typed arrays that can be used in place of a vector, matrix, or quaternion. + */ +type FloatArray = Float32Array | Float64Array; +/** + * A 2x2 Matrix given as a {@link Mat2}, a 4-element floating-point TypedArray, or an array of 4 numbers. + */ +type Mat2Like = [number, number, number, number] | FloatArray; +/** + * A 2x3 Matrix given as a {@link Mat2d}, a 6-element floating-point TypedArray, or an array of 6 numbers. + */ +type Mat2dLike = [number, number, number, number, number, number] | FloatArray; +/** + * A 3x3 Matrix given as a {@link Mat3}, a 9-element floating-point TypedArray, or an array of 9 numbers. + */ +type Mat3Like = [number, number, number, number, number, number, number, number, number] | FloatArray; +/** + * A 4x4 Matrix given as a {@link Mat4}, a 16-element floating-point TypedArray, or an array of 16 numbers. + */ +type Mat4Like = + | [ + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + ] + | FloatArray; +/** + * A Quaternion given as a {@link Quat}, a 4-element floating-point TypedArray, or an array of 4 numbers. + */ +type QuatLike = Vec4Like; +/** + * A Dual Quaternion given as a {@link Quat2}, an 8-element floating-point TypedArray, or an array of 8 numbers. + */ +type Quat2Like = [number, number, number, number, number, number, number, number] | FloatArray; +/** + * A 2-dimensional vector given as a {@link Vec2}, a 2-element floating-point TypedArray, or an array of 2 numbers. + */ +type Vec2Like = [number, number] | FloatArray; +/** + * A 3-dimensional vector given as a {@link Vec3}, a 3-element floating-point TypedArray, or an array of 3 numbers. + */ +type Vec3Like = [number, number, number] | FloatArray; +/** + * A 4-dimensional vector given as a {@link Vec4}, a 4-element floating-point TypedArray, or an array of 4 numbers. + */ +type Vec4Like = [number, number, number, number] | FloatArray; + +/** + * A 2x2 Matrix + */ +declare class Mat2 extends Float32Array { + #private; + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * A string representation of `this` + * Equivalent to `Mat2.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Mat2} into `this`. + * + * @param a the source vector + * @returns `this` + * @category Methods + */ + copy(a: Readonly): this; + /** + * Set `this` to the identity matrix + * Equivalent to Mat2.identity(this) + * + * @returns `this` + * @category Methods + */ + identity(): this; + /** + * Multiplies this {@link Mat2} against another one + * Equivalent to `Mat2.multiply(this, this, b);` + * + * @param b - The second operand + * @returns `this` + * @category Methods + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Mat2.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Transpose this {@link Mat2} + * Equivalent to `Mat2.transpose(this, this);` + * + * @returns `this` + * @category Methods + */ + transpose(): this; + /** + * Inverts this {@link Mat2} + * Equivalent to `Mat4.invert(this, this);` + * + * @returns `this` + * @category Methods + */ + invert(): this; + /** + * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2.scale(this, this, v);` + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + * @category Methods + */ + scale(v: Readonly): this; + /** + * Rotates this {@link Mat2} by the given angle around the given axis + * Equivalent to `Mat2.rotate(this, this, rad);` + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + * @category Methods + */ + rotate(rad: number): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, identity {@link Mat2} + * @category Static + * + * @returns A new {@link Mat2} + */ + static create(): Mat2; + /** + * Creates a new {@link Mat2} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2} + */ + static clone(a: Readonly): Mat2; + /** + * Copy the values from one {@link Mat2} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out: Mat2Like, a: Readonly): Mat2Like; + /** + * Create a new {@link Mat2} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2} + */ + static fromValues(...values: number[]): Mat2; + /** + * Set the components of a {@link Mat2} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out: Mat2Like, ...values: number[]): Mat2Like; + /** + * Set a {@link Mat2} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out: Mat2Like): Mat2Like; + /** + * Transpose the values of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out: Mat2Like, a: Readonly): Mat2Like; + /** + * Inverts a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out: Mat2Like, a: Mat2Like): Mat2Like | null; + /** + * Calculates the adjugate of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out: Mat2Like, a: Mat2Like): Mat2Like; + /** + * Calculates the determinant of a {@link Mat2} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a: Readonly): number; + /** + * Adds two {@link Mat2}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like; + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like; + /** + * Alias for {@link Mat2.subtract} + * @category Static + */ + static sub(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like; + /** + * Multiplies two {@link Mat2}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like; + /** + * Alias for {@link Mat2.multiply} + * @category Static + */ + static mul(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like; + /** + * Rotates a {@link Mat2} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out: Mat2Like, a: Readonly, rad: number): Mat2Like; + /** + * Scales the {@link Mat2} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out: Mat2Like, a: Readonly, v: Readonly): Mat2Like; + /** + * Creates a {@link Mat2} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out: Mat2Like, rad: number): Mat2Like; + /** + * Creates a {@link Mat2} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out: Mat2Like, v: Readonly): Mat2Like; + /** + * Returns Frobenius norm of a {@link Mat2} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a: Readonly): number; + /** + * Multiply each element of a {@link Mat2} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out: Mat2Like, a: Readonly, b: number): Mat2Like; + /** + * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out: Mat2Like, a: Readonly, b: Readonly, scale: number): Mat2Like; + /** + * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix + * @category Static + * + * @param L - the lower triangular matrix + * @param D - the diagonal matrix + * @param U - the upper triangular matrix + * @param a - the input matrix to factorize + */ + static LDU( + L: Mat2Like, + D: Readonly, + U: Mat2Like, + a: Readonly, + ): [Mat2Like, Readonly, Mat2Like]; + /** + * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether two {@link Mat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Returns a string representation of a {@link Mat2} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a: Readonly): string; +} + +/** + * A 2x3 Matrix + */ +declare class Mat2d extends Float32Array { + #private; + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * A string representation of `this` + * Equivalent to `Mat2d.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Mat2d} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Set `this` to the identity matrix + * Equivalent to Mat2d.identity(this) + * @category Methods + * + * @returns `this` + */ + identity(): this; + /** + * Multiplies this {@link Mat2d} against another one + * Equivalent to `Mat2d.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Mat2d.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Translate this {@link Mat2d} by the given vector + * Equivalent to `Mat2d.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v: Readonly): this; + /** + * Rotates this {@link Mat2d} by the given angle around the given axis + * Equivalent to `Mat2d.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad: number): this; + /** + * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2d.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v: Readonly): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2d}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, identity {@link Mat2d} + * @category Static + * + * @returns A new {@link Mat2d} + */ + static create(): Mat2d; + /** + * Creates a new {@link Mat2d} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2d} + */ + static clone(a: Readonly): Mat2d; + /** + * Copy the values from one {@link Mat2d} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out: Mat2dLike, a: Readonly): Mat2dLike; + /** + * Create a new {@link Mat2d} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2d} + */ + static fromValues(...values: number[]): Mat2d; + /** + * Set the components of a {@link Mat2d} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out: Mat2dLike, ...values: number[]): Mat2dLike; + /** + * Set a {@link Mat2d} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out: Mat2dLike): Mat2dLike; + /** + * Inverts a {@link Mat2d} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out: Mat2dLike, a: Mat2dLike): Mat2dLike | null; + /** + * Calculates the determinant of a {@link Mat2d} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a: Readonly): number; + /** + * Adds two {@link Mat2d}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike; + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike; + /** + * Alias for {@link Mat2d.subtract} + * @category Static + */ + static sub(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike; + /** + * Multiplies two {@link Mat2d}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike; + /** + * Alias for {@link Mat2d.multiply} + * @category Static + */ + static mul(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike; + /** + * Translate a {@link Mat2d} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike; + /** + * Rotates a {@link Mat2d} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out: Mat2dLike, a: Readonly, rad: number): Mat2dLike; + /** + * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike; + /** + * Creates a {@link Mat2d} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out: Mat2dLike, v: Readonly): Mat2dLike; + /** + * Creates a {@link Mat2d} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out: Mat2dLike, rad: number): Mat2dLike; + /** + * Creates a {@link Mat2d} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out: Mat2dLike, v: Readonly): Mat2dLike; + /** + * Returns Frobenius norm of a {@link Mat2d} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a: Readonly): number; + /** + * Multiply each element of a {@link Mat2d} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out: Mat2dLike, a: Readonly, b: number): Mat2dLike; + /** + * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out: Mat2dLike, a: Readonly, b: Readonly, scale: number): Mat2dLike; + /** + * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether two {@link Mat2d}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Returns a string representation of a {@link Mat2d} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a: Readonly): string; +} + +/** + * A 3x3 Matrix + */ +declare class Mat3 extends Float32Array { + #private; + /** + * Create a {@link Mat3}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * A string representation of `this` + * Equivalent to `Mat3.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Mat3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Set `this` to the identity matrix + * Equivalent to Mat3.identity(this) + * @category Methods + * + * @returns `this` + */ + identity(): this; + /** + * Multiplies this {@link Mat3} against another one + * Equivalent to `Mat3.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Mat3.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Transpose this {@link Mat3} + * Equivalent to `Mat3.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose(): this; + /** + * Inverts this {@link Mat3} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Translate this {@link Mat3} by the given vector + * Equivalent to `Mat3.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v: Readonly): this; + /** + * Rotates this {@link Mat3} by the given angle around the given axis + * Equivalent to `Mat3.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad: number): this; + /** + * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat3.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v: Readonly): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat3}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, identity {@link Mat3} + * @category Static + * + * @returns A new {@link Mat3} + */ + static create(): Mat3; + /** + * Creates a new {@link Mat3} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat3} + */ + static clone(a: Readonly): Mat3; + /** + * Copy the values from one {@link Mat3} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out: Mat3Like, a: Readonly): Mat3Like; + /** + * Create a new {@link Mat3} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat3} + */ + static fromValues(...values: number[]): Mat3; + /** + * Set the components of a {@link Mat3} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out: Mat3Like, ...values: number[]): Mat3Like; + /** + * Set a {@link Mat3} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out: Mat3Like): Mat3Like; + /** + * Transpose the values of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out: Mat3Like, a: Readonly): Mat3Like; + /** + * Inverts a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out: Mat3Like, a: Mat3Like): Mat3Like | null; + /** + * Calculates the adjugate of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out: Mat3Like, a: Mat3Like): Mat3Like; + /** + * Calculates the determinant of a {@link Mat3} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a: Readonly): number; + /** + * Adds two {@link Mat3}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like; + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like; + /** + * Alias for {@link Mat3.subtract} + * @category Static + */ + static sub(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like; + /** + * Multiplies two {@link Mat3}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like; + /** + * Alias for {@link Mat3.multiply} + * @category Static + */ + static mul(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like; + /** + * Translate a {@link Mat3} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like; + /** + * Rotates a {@link Mat3} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out: Mat3Like, a: Readonly, rad: number): Mat3Like; + /** + * Scales the {@link Mat3} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like; + /** + * Creates a {@link Mat3} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out: Mat3Like, v: Readonly): Mat3Like; + /** + * Creates a {@link Mat3} from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat3.identity(dest); + * mat3.rotate(dest, dest, rad); + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out: Mat3Like, rad: number): Mat3Like; + /** + * Creates a {@link Mat3} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out: Mat3Like, v: Readonly): Mat3Like; + /** + * Copies the upper-left 3x3 values of a {@link Mat2d} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 2x3 matrix + * @returns `out` + */ + static fromMat2d(out: Mat3Like, a: Readonly): Mat3Like; + /** + * Calculates a {@link Mat3} from the given quaternion + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param q - {@link Quat} to create matrix from + * @returns `out` + */ + static fromQuat(out: Mat3Like, q: Readonly): Mat3Like; + /** + * Copies the upper-left 3x3 values of a {@link Mat4} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 4x4 matrix + * @returns `out` + */ + static fromMat4(out: Mat3Like, a: Readonly): Mat3Like; + /** + * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix + * @category Static + * + * @param {mat3} out mat3 receiving operation result + * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out: Mat3Like, a: Readonly): Mat3Like | null; + /** + * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out: Mat3Like, a: Readonly): Mat3Like; + /** + * Generates a 2D projection matrix with the given bounds + * @category Static + * + * @param out mat3 frustum matrix will be written into + * @param width Width of your gl context + * @param height Height of gl context + * @returns `out` + */ + static projection(out: Mat3Like, width: number, height: number): Mat3Like; + /** + * Returns Frobenius norm of a {@link Mat3} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a: Readonly): number; + /** + * Multiply each element of a {@link Mat3} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out: Mat3Like, a: Readonly, b: number): Mat3Like; + /** + * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out: Mat3Like, a: Readonly, b: Readonly, scale: number): Mat3Like; + /** + * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether two {@link Mat3}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Returns a string representation of a {@link Mat3} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a: Readonly): string; +} + +/** + * A 4x4 Matrix + */ +declare class Mat4 extends Float32Array { + #private; + /** + * Create a {@link Mat4}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * A string representation of `this` + * Equivalent to `Mat4.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Mat4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Set `this` to the identity matrix + * Equivalent to Mat4.identity(this) + * @category Methods + * + * @returns `this` + */ + identity(): this; + /** + * Multiplies this {@link Mat4} against another one + * Equivalent to `Mat4.multiply(this, this, b);` + * @category Methods + * + * @param b - The second operand + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Mat4.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Transpose this {@link Mat4} + * Equivalent to `Mat4.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose(): this; + /** + * Inverts this {@link Mat4} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Translate this {@link Mat4} by the given vector + * Equivalent to `Mat4.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to translate by + * @returns `this` + */ + translate(v: Readonly): this; + /** + * Rotates this {@link Mat4} by the given angle around the given axis + * Equivalent to `Mat4.rotate(this, this, rad, axis);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `this` + */ + rotate(rad: number, axis: Readonly): this; + /** + * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat4.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to scale the matrix by + * @returns `this` + */ + scale(v: Readonly): this; + /** + * Rotates this {@link Mat4} by the given angle around the X axis + * Equivalent to `Mat4.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateX(rad: number): this; + /** + * Rotates this {@link Mat4} by the given angle around the Y axis + * Equivalent to `Mat4.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateY(rad: number): this; + /** + * Rotates this {@link Mat4} by the given angle around the Z axis + * Equivalent to `Mat4.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateZ(rad: number): this; + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveNO(fovy: number, aspect: number, near: number, far: number): this; + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveZO(fovy: number, aspect: number, near: number, far: number): this; + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoNO(left: number, right: number, bottom: number, top: number, near: number, far: number): this; + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoZO(left: number, right: number, bottom: number, top: number, near: number, far: number): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat4}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, identity {@link Mat4} + * @category Static + * + * @returns A new {@link Mat4} + */ + static create(): Mat4; + /** + * Creates a new {@link Mat4} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat4} + */ + static clone(a: Readonly): Mat4; + /** + * Copy the values from one {@link Mat4} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out: Mat4Like, a: Readonly): Mat4Like; + /** + * Create a new mat4 with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat4} + */ + static fromValues(...values: number[]): Mat4; + /** + * Set the components of a mat4 to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out: Mat4Like, ...values: number[]): Mat4Like; + /** + * Set a {@link Mat4} to the identity matrix + * @category Static + * + * @param out - The receiving Matrix + * @returns `out` + */ + static identity(out: Mat4Like): Mat4Like; + /** + * Transpose the values of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out: Mat4Like, a: Readonly): Mat4Like; + /** + * Inverts a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out: Mat4Like, a: Mat4Like): Mat4Like | null; + /** + * Calculates the adjugate of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out: Mat4Like, a: Mat4Like): Mat4Like; + /** + * Calculates the determinant of a {@link Mat4} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a: Readonly): number; + /** + * Multiplies two {@link Mat4}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like; + /** + * Alias for {@link Mat4.multiply} + * @category Static + */ + static mul(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like; + /** + * Translate a {@link Mat4} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like; + /** + * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec3} to scale the matrix by + * @returns `out` + **/ + static scale(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like; + /** + * Rotates a {@link Mat4} by the given angle around the given axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if axis has a length of 0 + */ + static rotate(out: Mat4Like, a: Readonly, rad: number, axis: Readonly): Mat4Like | null; + /** + * Rotates a matrix by the given angle around the X axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateX(out: Mat4Like, a: Readonly, rad: number): Mat4Like; + /** + * Rotates a matrix by the given angle around the Y axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateY(out: Mat4Like, a: Readonly, rad: number): Mat4Like; + /** + * Rotates a matrix by the given angle around the Z axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateZ(out: Mat4Like, a: Readonly, rad: number): Mat4Like; + /** + * Creates a {@link Mat4} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out: Mat4Like, v: Readonly): Mat4Like; + /** + * Creates a {@link Mat4} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out: Mat4Like, v: Readonly): Mat4Like; + /** + * Creates a {@link Mat4} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotate(dest, dest, rad, axis); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if `axis` has a length of 0 + */ + static fromRotation(out: Mat4Like, rad: number, axis: Readonly): Mat4Like | null; + /** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateX(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromXRotation(out: Mat4Like, rad: number): Mat4Like; + /** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateY(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromYRotation(out: Mat4Like, rad: number): Mat4Like; + /** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateZ(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromZRotation(out: Mat4Like, rad: number): Mat4Like; + /** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @returns `out` + */ + static fromRotationTranslation(out: Mat4Like, q: Readonly, v: Readonly): Mat4Like; + /** + * Sets a {@link Mat4} from a {@link Quat2}. + * @category Static + * + * @param out - Matrix + * @param a - Dual Quaternion + * @returns `out` + */ + static fromQuat2(out: Mat4Like, a: Quat2Like): Mat4Like; + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out: Mat4Like, a: Readonly): Mat4Like | null; + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out: Mat4Like, a: Readonly): Mat4Like; + /** + * Returns the translation vector component of a transformation + * matrix. If a matrix is built with fromRotationTranslation, + * the returned vector will be the same as the translation vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive translation component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getTranslation(out: Vec3Like, mat: Readonly): Vec3Like; + /** + * Returns the scaling factor component of a transformation + * matrix. If a matrix is built with fromRotationTranslationScale + * with a normalized Quaternion parameter, the returned vector will be + * the same as the scaling vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive scaling factor component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getScaling(out: Vec3Like, mat: Readonly): Vec3Like; + /** + * Returns a quaternion representing the rotational component + * of a transformation matrix. If a matrix is built with + * fromRotationTranslation, the returned quaternion will be the + * same as the quaternion originally supplied. + * @category Static + * + * @param out - Quaternion to receive the rotation component + * @param mat - Matrix to be decomposed (input) + * @return `out` + */ + static getRotation(out: QuatLike, mat: Readonly): QuatLike; + /** + * Decomposes a transformation matrix into its rotation, translation + * and scale components. Returns only the rotation component + * @category Static + * + * @param out_r - Quaternion to receive the rotation component + * @param out_t - Vector to receive the translation vector + * @param out_s - Vector to receive the scaling factor + * @param mat - Matrix to be decomposed (input) + * @returns `out_r` + */ + static decompose(out_r: QuatLike, out_t: Vec3Like, out_s: Vec3Like, mat: Readonly): QuatLike; + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @returns `out` + */ + static fromRotationTranslationScale( + out: Mat4Like, + q: Readonly, + v: Readonly, + s: Readonly, + ): Mat4Like; + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the + * given origin. This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * mat4.translate(dest, origin); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * mat4.translate(dest, negativeOrigin); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @param o - The origin vector around which to scale and rotate + * @returns `out` + */ + static fromRotationTranslationScaleOrigin( + out: Mat4Like, + q: Readonly, + v: Readonly, + s: Readonly, + o: Readonly, + ): Mat4Like; + /** + * Calculates a 4x4 matrix from the given quaternion + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Quaternion to create matrix from + * @returns `out` + */ + static fromQuat(out: Mat4Like, q: Readonly): Mat4Like; + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumNO( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far?: number, + ): Mat4Like; + /** + * Alias for {@link Mat4.frustumNO} + * @category Static + * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly + */ + static frustum( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far?: number, + ): Mat4Like; + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumZO( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far?: number, + ): Mat4Like; + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveNO(out: Mat4Like, fovy: number, aspect: number, near: number, far?: number): Mat4Like; + /** + * Alias for {@link Mat4.perspectiveNO} + * @category Static + * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly + */ + static perspective(out: Mat4Like, fovy: number, aspect: number, near: number, far?: number): Mat4Like; + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveZO(out: Mat4Like, fovy: number, aspect: number, near: number, far?: number): Mat4Like; + /** + * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating + * projection matrices to be used with the still experimental WebVR API. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + * @deprecated + */ + static perspectiveFromFieldOfView( + out: Mat4Like, + fov: { + upDegrees: number; + downDegrees: number; + leftDegrees: number; + rightDegrees: number; + }, + near: number, + far: number, + ): Mat4Like; + /** + * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoNO( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far: number, + ): Mat4Like; + /** + * Alias for {@link Mat4.orthoNO} + * @category Static + * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly + */ + static ortho( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far: number, + ): Mat4Like; + /** + * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoZO( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far: number, + ): Mat4Like; + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that + * actually makes an object look at another object, you should use targetTo instead. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param center - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static lookAt(out: Mat4Like, eye: Readonly, center: Readonly, up: Readonly): Mat4Like; + /** + * Generates a matrix that makes something look at something else. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param target - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static targetTo(out: Mat4Like, eye: Readonly, target: Readonly, up: Readonly): Mat4Like; + /** + * Returns Frobenius norm of a {@link Mat4} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a: Readonly): number; + /** + * Adds two {@link Mat4}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like; + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like; + /** + * Alias for {@link Mat4.subtract} + * @category Static + */ + static sub(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like; + /** + * Multiply each element of the matrix by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out: Mat4Like, a: Readonly, b: number): Mat4Like; + /** + * Adds two mat4's after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out: Mat4Like, a: Readonly, b: Readonly, scale: number): Mat4Like; + /** + * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether two {@link Mat4}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Returns a string representation of a {@link Mat4} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a: Readonly): string; +} + +/** + * Quaternion + */ +declare class Quat extends Float32Array { + #private; + /** + * Create a {@link Quat}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * The x component of the quaternion. Equivalent to `this[0];` + * @category Quaternion Components + */ + get x(): number; + set x(value: number); + /** + * The y component of the quaternion. Equivalent to `this[1];` + * @category Quaternion Components + */ + get y(): number; + set y(value: number); + /** + * The z component of the quaternion. Equivalent to `this[2];` + * @category Quaternion Components + */ + get z(): number; + set z(value: number); + /** + * The w component of the quaternion. Equivalent to `this[3];` + * @category Quaternion Components + */ + get w(): number; + set w(value: number); + /** + * The magnitude (length) of this. + * Equivalent to `Quat.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number; + /** + * Alias for {@link Quat.magnitude} + * + * @category Accessors + */ + get mag(): number; + /** + * A string representation of `this` + * Equivalent to `Quat.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Quat} into `this`. + * @category Methods + * + * @param a the source quaternion + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Set `this` to the identity quaternion + * Equivalent to Quat.identity(this) + * @category Methods + * + * @returns `this` + */ + identity(): this; + /** + * Multiplies `this` by a {@link Quat}. + * Equivalent to `Quat.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Quat.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Rotates `this` by the given angle about the X axis + * Equivalent to `Quat.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateX(rad: number): this; + /** + * Rotates `this` by the given angle about the Y axis + * Equivalent to `Quat.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateY(rad: number): this; + /** + * Rotates `this` by the given angle about the Z axis + * Equivalent to `Quat.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateZ(rad: number): this; + /** + * Inverts `this` + * Equivalent to `Quat.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Scales `this` by a scalar number + * Equivalent to `Quat.scale(this, this, scale);` + * @category Methods + * + * @param scale - amount to scale the vector by + * @returns `this` + */ + scale(scale: number): QuatLike; + /** + * Calculates the dot product of `this` and another {@link Quat} + * Equivalent to `Quat.dot(this, b);` + * @category Methods + * + * @param b - the second operand + * @returns dot product of `this` and b + */ + dot(b: Readonly): number; + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new identity quat + * @category Static + * + * @returns a new quaternion + */ + static create(): Quat; + /** + * Set a quat to the identity quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + static identity(out: QuatLike): QuatLike; + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * @category Static + * + * @param out - the receiving quaternion + * @param axis - the axis around which to rotate + * @param rad - the angle in radians + * @returns `out` + **/ + static setAxisAngle(out: QuatLike, axis: Readonly, rad: number): QuatLike; + /** + * Gets the rotation axis and angle for a given + * quaternion. If a quaternion is created with + * setAxisAngle, this method will return the same + * values as provided in the original parameter list + * OR functionally equivalent values. + * Example: The quaternion formed by axis [0, 0, 1] and + * angle -90 is the same as the quaternion formed by + * [0, 0, 1] and 270. This method favors the latter. + * @category Static + * + * @param out_axis - Vector receiving the axis of rotation + * @param q - Quaternion to be decomposed + * @return Angle, in radians, of the rotation + */ + static getAxisAngle(out_axis: Vec3Like, q: Readonly): number; + /** + * Gets the angular distance between two unit quaternions + * @category Static + * + * @param {ReadonlyQuat} a Origin unit quaternion + * @param {ReadonlyQuat} b Destination unit quaternion + * @return {Number} Angle, in radians, between the two quaternions + */ + static getAngle(a: Readonly, b: Readonly): number; + /** + * Multiplies two quaternions. + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out: QuatLike, a: Readonly, b: Readonly): QuatLike; + /** + * Rotates a quaternion by the given angle about the X axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out: QuatLike, a: Readonly, rad: number): QuatLike; + /** + * Rotates a quaternion by the given angle about the Y axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out: QuatLike, a: Readonly, rad: number): QuatLike; + /** + * Rotates a quaternion by the given angle about the Z axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out: QuatLike, a: Readonly, rad: number): QuatLike; + /** + * Calculates the W component of a quat from the X, Y, and Z components. + * Assumes that quaternion is 1 unit in length. + * Any existing W component will be ignored. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate W component of + * @returns `out` + */ + static calculateW(out: QuatLike, a: Readonly): QuatLike; + /** + * Calculate the exponential of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static exp(out: QuatLike, a: Readonly): QuatLike; + /** + * Calculate the natural logarithm of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static ln(out: QuatLike, a: Readonly): QuatLike; + /** + * Calculate the scalar power of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @param b - amount to scale the quaternion by + * @returns `out` + */ + static pow(out: QuatLike, a: Readonly, b: number): QuatLike; + /** + * Performs a spherical linear interpolation between two quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike; + /** + * Generates a random unit quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + /** + * Calculates the inverse of a quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate inverse of + * @returns `out` + */ + static invert(out: QuatLike, a: Readonly): QuatLike; + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate conjugate of + * @returns `out` + */ + static conjugate(out: QuatLike, a: Readonly): QuatLike; + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to re-normalize the quaternion yourself where necessary. + * @category Static + * + * @param out - the receiving quaternion + * @param m - rotation matrix + * @returns `out` + */ + static fromMat3(out: QuatLike, m: Readonly): QuatLike; + /** + * Creates a quaternion from the given euler angle x, y, z. + * @category Static + * + * @param out - the receiving quaternion + * @param x - Angle to rotate around X axis in degrees. + * @param y - Angle to rotate around Y axis in degrees. + * @param z - Angle to rotate around Z axis in degrees. + * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx. + * @returns `out` + */ + static fromEuler(out: QuatLike, x: number, y: number, z: number, order?: string): QuatLike; + /** + * Returns a string representation of a quatenion + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a: Readonly): string; + /** + * Creates a new quat initialized with values from an existing quaternion + * @category Static + * + * @param a - quaternion to clone + * @returns a new quaternion + */ + static clone(a: Readonly): Quat; + /** + * Creates a new quat initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new quaternion + */ + static fromValues(x: number, y: number, z: number, w: number): Quat; + /** + * Copy the values from one quat to another + * @category Static + * + * @param out - the receiving quaternion + * @param a - the source quaternion + * @returns `out` + */ + static copy(out: QuatLike, a: Readonly): QuatLike; + /** + * Set the components of a {@link Quat} to the given values + * @category Static + * + * @param out - the receiving quaternion + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + static set(out: QuatLike, x: number, y: number, z: number, w: number): QuatLike; + /** + * Adds two {@link Quat}'s + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: QuatLike, a: Readonly, b: Readonly): QuatLike; + /** + * Alias for {@link Quat.multiply} + * @category Static + */ + static mul(out: QuatLike, a: Readonly, b: Readonly): QuatLike; + /** + * Scales a quat by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param b - amount to scale the vector by + * @returns `out` + */ + static scale(out: QuatLike, a: Readonly, scale: number): QuatLike; + /** + * Calculates the dot product of two quat's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a: Readonly, b: Readonly): number; + /** + * Performs a linear interpolation between two quat's + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike; + /** + * Calculates the magnitude (length) of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate length of + * @returns length of `a` + */ + static magnitude(a: Readonly): number; + /** + * Alias for {@link Quat.magnitude} + * @category Static + */ + static mag(a: Readonly): number; + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + static length(a: Readonly): number; + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.mag} + */ + static len(a: Readonly): number; + /** + * Calculates the squared length of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a: Readonly): number; + /** + * Alias for {@link Quat.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly): number; + /** + * Normalize a {@link Quat} + * @category Static + * + * @param out - the receiving quaternion + * @param a - quaternion to normalize + * @returns `out` + */ + static normalize(out: QuatLike, a: Readonly): QuatLike; + /** + * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first quaternion. + * @param b - The second quaternion. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether the quaternions have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * @category Static + * + * @param out - the receiving quaternion. + * @param a - the initial vector + * @param b - the destination vector + * @returns `out` + */ + static rotationTo(out: QuatLike, a: Readonly, b: Readonly): QuatLike; + /** + * Performs a spherical linear interpolation with two control points + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static sqlerp( + out: QuatLike, + a: Readonly, + b: Readonly, + c: Readonly, + d: Readonly, + t: number, + ): QuatLike; + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * @category Static + * + * @param out - The receiving quaternion + * @param view - the vector representing the viewing direction + * @param right - the vector representing the local `right` direction + * @param up - the vector representing the local `up` direction + * @returns `out` + */ + static setAxes(out: QuatLike, view: Readonly, right: Readonly, up: Readonly): QuatLike; +} + +/** + * Dual Quaternion + */ +declare class Quat2 extends Float32Array { + #private; + /** + * Create a {@link Quat2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * A string representation of `this` + * Equivalent to `Quat2.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Quat2} into `this`. + * @category Methods + * + * @param a the source dual quaternion + * @returns `this` + */ + copy(a: Readonly): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat2}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new identity {@link Quat2} + * @category Static + * + * @returns a new dual quaternion [real -> rotation, dual -> translation] + */ + static create(): Quat2; + /** + * Creates a {@link Quat2} quat initialized with values from an existing quaternion + * @category Static + * + * @param a - dual quaternion to clone + * @returns a new dual quaternion + */ + static clone(a: Quat2Like): Quat2; + /** + * Creates a new {@link Quat2} initialized with the given values + * @category Static + * + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns a new dual quaternion + */ + static fromValues( + x1: number, + y1: number, + z1: number, + w1: number, + x2: number, + y2: number, + z2: number, + w2: number, + ): Quat2; + /** + * Creates a new {@link Quat2} from the given values (quat and translation) + * @category Static + * + * @param x1 - X component (rotation) + * @param y1 - Y component (rotation) + * @param z1 - Z component (rotation) + * @param w1 - W component (rotation) + * @param x2 - X component (translation) + * @param y2 - Y component (translation) + * @param z2 - Z component (translation) + * @returns a new dual quaternion + */ + static fromRotationTranslationValues( + x1: number, + y1: number, + z1: number, + w1: number, + x2: number, + y2: number, + z2: number, + ): Quat2; + /** + * Sets a {@link Quat2} from a quaternion and a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @param t - translation vector + * @returns `out` + */ + static fromRotationTranslation(out: Quat2Like, q: Readonly, t: Readonly): Quat2Like; + /** + * Sets a {@link Quat2} from a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param t - translation vector + * @returns `out` + */ + static fromTranslation(out: Quat2Like, t: Readonly): Quat2Like; + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @returns `out` + */ + static fromRotation(out: Quat2Like, q: Readonly): Quat2Like; + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param a - the matrix + * @returns `out` + */ + static fromMat4(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Copy the values from one {@link Quat2} to another + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the source dual quaternion + * @returns `out` + */ + static copy(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Set a {@link Quat2} to the identity dual quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @returns `out` + */ + static identity(out: QuatLike): QuatLike; + /** + * Set the components of a {@link Quat2} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns `out` + */ + static set( + out: Quat2Like, + x1: number, + y1: number, + z1: number, + w1: number, + x2: number, + y2: number, + z2: number, + w2: number, + ): Quat2Like; + /** + * Gets the real part of a dual quat + * @category Static + * + * @param out - real part + * @param a - Dual Quaternion + * @return `out` + */ + static getReal(out: QuatLike, a: Readonly): QuatLike; + /** + * Gets the dual part of a dual quat + * @category Static + * + * @param out - dual part + * @param a - Dual Quaternion + * @return `out` + */ + static getDual(out: QuatLike, a: Readonly): QuatLike; + /** + * Set the real component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the real part + * @return `out` + */ + static setReal(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Set the dual component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the dual part + * @return `out` + */ + static setDual(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Gets the translation of a normalized {@link Quat2} + * @category Static + * + * @param out - the receiving translation vector + * @param a - Dual Quaternion to be decomposed + * @return `out` + */ + static getTranslation(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Translates a {@link Quat2} by the given vector + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out: Quat2Like, a: Readonly, v: Readonly): Quat2Like; + /** + * Rotates a {@link Quat2} around the X axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out: Quat2Like, a: Readonly, rad: number): Quat2Like; + /** + * Rotates a {@link Quat2} around the Y axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out: Quat2Like, a: Readonly, rad: number): Quat2Like; + /** + * Rotates a {@link Quat2} around the Z axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out: Quat2Like, a: Readonly, rad: number): Quat2Like; + /** + * Rotates a {@link Quat2} by a given quaternion (a * q) + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param q - quaternion to rotate by + * @returns `out` + */ + static rotateByQuatAppend(out: Quat2Like, a: Readonly, q: Readonly): Quat2Like; + /** + * Rotates a {@link Quat2} by a given quaternion (q * a) + * @category Static + * + * @param out - the receiving dual quaternion + * @param q - quaternion to rotate by + * @param a - the dual quaternion to rotate + * @returns `out` + */ + static rotateByQuatPrepend(out: Quat2Like, q: Readonly, a: Readonly): Quat2Like; + /** + * Rotates a {@link Quat2} around a given axis. Does the normalization automatically + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param axis - the axis to rotate around + * @param rad - how far the rotation should be + * @returns `out` + */ + static rotateAroundAxis(out: Quat2Like, a: Readonly, axis: Readonly, rad: number): Quat2Like; + /** + * Adds two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like; + /** + * Multiplies two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns {quat2} out + */ + static multiply(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like; + /** + * Alias for {@link Quat2.multiply} + * @category Static + */ + static mul(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like; + /** + * Scales a {@link Quat2} by a scalar value + * @category Static + * + * @param out - the receiving dual quaterion + * @param a - the dual quaternion to scale + * @param b - scalar value to scale the dual quaterion by + * @returns `out` + */ + static scale(out: Quat2Like, a: Readonly, b: number): Quat2Like; + /** + * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts) + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a: Readonly, b: Readonly): number; + /** + * Performs a linear interpolation between two {@link Quat2}s + * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`) + * @category Static + * + * @param out - the receiving dual quat + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Quat2Like, a: Readonly, b: Readonly, t: number): Quat2Like; + /** + * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quat to calculate inverse of + * @returns `out` + */ + static invert(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than + * {@link Quat2.invert} and produces the same result. + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to calculate conjugate of + * @returns `out` + */ + static conjugate(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Calculates the magnitude (length) of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate length of + * @returns length of `a` + */ + static magnitude(a: Readonly): number; + /** + * Alias for {@link Quat2.magnitude} + * @category Static + */ + static mag(a: Readonly): number; + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + static length(a: Readonly): number; + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.mag} + */ + static len(a: Readonly): number; + /** + * Calculates the squared length of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a: Readonly): number; + /** + * Alias for {@link Quat2.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly): number; + /** + * Normalize a {@link Quat2} + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to normalize + * @returns `out` + */ + static normalize(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Returns a string representation of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to represent as a string + * @returns string representation of the vector + */ + static str(a: Readonly): string; + /** + * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether the {@link Quat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; +} + +/** + * 2 Dimensional Vector + */ +declare class Vec2 extends Float32Array { + /** + * Create a {@link Vec2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x(): number; + set x(value: number); + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y(): number; + set y(value: number); + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r(): number; + set r(value: number); + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g(): number; + set g(value: number); + /** + * The magnitude (length) of this. + * Equivalent to `Vec2.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number; + /** + * Alias for {@link Vec2.magnitude} + * + * @category Accessors + */ + get mag(): number; + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec2.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude(): number; + /** + * Alias for {@link Vec2.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag(): number; + /** + * A string representation of `this` + * Equivalent to `Vec2.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Vec2} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Adds a {@link Vec2} to `this`. + * Equivalent to `Vec2.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b: Readonly): this; + /** + * Subtracts a {@link Vec2} from `this`. + * Equivalent to `Vec2.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b: Readonly): this; + /** + * Alias for {@link Vec2.subtract} + * @category Methods + */ + sub(b: Readonly): this; + /** + * Multiplies `this` by a {@link Vec2}. + * Equivalent to `Vec2.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Vec2.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Divides `this` by a {@link Vec2}. + * Equivalent to `Vec2.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b: Readonly): this; + /** + * Alias for {@link Vec2.divide} + * @category Methods + */ + div(b: Readonly): this; + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec2.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b: number): this; + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b: Readonly, scale: number): this; + /** + * Calculates the Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b: Readonly): number; + /** + * Alias for {@link Vec2.distance} + * @category Methods + */ + dist(b: Readonly): number; + /** + * Calculates the squared Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b: Readonly): number; + /** + * Alias for {@link Vec2.squaredDistance} + * @category Methods + */ + sqrDist(b: Readonly): number; + /** + * Negates the components of `this`. + * Equivalent to `Vec2.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate(): this; + /** + * Inverts the components of `this`. + * Equivalent to `Vec2.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec2.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs(): this; + /** + * Calculates the dot product of this and another {@link Vec2}. + * Equivalent to `Vec2.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b: Readonly): number; + /** + * Normalize `this`. + * Equivalent to `Vec2.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize(): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec2}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, empty {@link Vec2} + * @category Static + * + * @returns A new 2D vector + */ + static create(): Vec2; + /** + * Creates a new {@link Vec2} initialized with values from an existing vector + * @category Static + * + * @param a - Vector to clone + * @returns A new 2D vector + */ + static clone(a: Readonly): Vec2; + /** + * Creates a new {@link Vec2} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @returns A new 2D vector + */ + static fromValues(x: number, y: number): Vec2; + /** + * Copy the values from one {@link Vec2} to another + * @category Static + * + * @param out - the receiving vector + * @param a - The source vector + * @returns `out` + */ + static copy(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Set the components of a {@link Vec2} to the given values + * @category Static + * + * @param out - The receiving vector + * @param x - X component + * @param y - Y component + * @returns `out` + */ + static set(out: Vec2Like, x: number, y: number): Vec2Like; + /** + * Adds two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static subtract(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Alias for {@link Vec2.subtract} + * @category Static + */ + static sub(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Multiplies two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Alias for {@link Vec2.multiply} + * @category Static + */ + static mul(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Divides two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static divide(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Alias for {@link Vec2.divide} + * @category Static + */ + static div(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Math.ceil the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to ceil + * @returns `out` + */ + static ceil(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Math.floor the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to floor + * @returns `out` + */ + static floor(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Returns the minimum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static min(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Returns the maximum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static max(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Math.round the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to round + * @returns `out` + */ + static round(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Scales a {@link Vec2} by a scalar number + * @category Static + * + * @param out - The receiving vector + * @param a - The vector to scale + * @param b - Amount to scale the vector by + * @returns `out` + */ + static scale(out: Vec2Like, a: Readonly, b: number): Vec2Like; + /** + * Adds two Vec2's after scaling the second operand by a scalar value + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param scale - The amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out: Vec2Like, a: Readonly, b: Readonly, scale: number): Vec2Like; + /** + * Calculates the Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns distance between `a` and `b` + */ + static distance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + static dist(a: Readonly, b: Readonly): number; + /** + * Calculates the squared Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Squared distance between `a` and `b` + */ + static squaredDistance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + static sqrDist(a: Readonly, b: Readonly): number; + /** + * Calculates the magnitude (length) of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a: Readonly): number; + /** + * Alias for {@link Vec2.magnitude} + * @category Static + */ + static mag(a: Readonly): number; + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + static length(a: Readonly): number; + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.mag} + */ + static len(a: Readonly): number; + /** + * Calculates the squared length of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate squared length of + * @returns Squared length of a + */ + static squaredLength(a: Readonly): number; + /** + * Alias for {@link Vec2.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly, b: Readonly): number; + /** + * Negates the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to negate + * @returns `out` + */ + static negate(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Returns the inverse of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to invert + * @returns `out` + */ + static inverse(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Returns the absolute value of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Normalize a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to normalize + * @returns `out` + */ + static normalize(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Calculates the dot product of two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Dot product of `a` and `b` + */ + static dot(a: Readonly, b: Readonly): number; + /** + * Computes the cross product of two {@link Vec2}s + * Note that the cross product must by definition produce a 3D vector. + * For this reason there is also not instance equivalent for this function. + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static cross(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Performs a linear interpolation between two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param t - Interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Vec2Like, a: Readonly, b: Readonly, t: number): Vec2Like; + /** + * Transforms the {@link Vec2} with a {@link Mat2} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like; + /** + * Transforms the {@link Vec2} with a {@link Mat2d} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2d(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like; + /** + * Transforms the {@link Vec2} with a {@link Mat3} + * 3rd vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat3(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like; + /** + * Transforms the {@link Vec2} with a {@link Mat4} + * 3rd vector component is implicitly '0' + * 4th vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat4(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like; + /** + * Rotate a 2D vector + * @category Static + * + * @param out - The receiving {@link Vec2} + * @param a - The {@link Vec2} point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotate(out: Vec2Like, a: Readonly, b: Readonly, rad: number): Vec2Like; + /** + * Get the angle between two 2D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static angle(a: Readonly, b: Readonly): number; + /** + * Set the components of a {@link Vec2} to zero + * @category Static + * + * @param out - The receiving vector + * @returns `out` + */ + static zero(out: Vec2Like): Vec2Like; + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors components are ===, `false` otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors are approximately equal, `false` otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - Vector to represent as a string + * @returns String representation of the vector + */ + static str(a: Readonly): string; +} + +/** + * 3 Dimensional Vector + */ +declare class Vec3 extends Float32Array { + /** + * Create a {@link Vec3}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x(): number; + set x(value: number); + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y(): number; + set y(value: number); + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z(): number; + set z(value: number); + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r(): number; + set r(value: number); + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g(): number; + set g(value: number); + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b(): number; + set b(value: number); + /** + * The magnitude (length) of this. + * Equivalent to `Vec3.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number; + /** + * Alias for {@link Vec3.magnitude} + * + * @category Accessors + */ + get mag(): number; + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec3.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude(): number; + /** + * Alias for {@link Vec3.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag(): number; + /** + * A string representation of `this` + * Equivalent to `Vec3.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Vec3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Adds a {@link Vec3} to `this`. + * Equivalent to `Vec3.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b: Readonly): this; + /** + * Subtracts a {@link Vec3} from `this`. + * Equivalent to `Vec3.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b: Readonly): this; + /** + * Alias for {@link Vec3.subtract} + * @category Methods + */ + sub(b: Readonly): this; + /** + * Multiplies `this` by a {@link Vec3}. + * Equivalent to `Vec3.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Vec3.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Divides `this` by a {@link Vec3}. + * Equivalent to `Vec3.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b: Readonly): this; + /** + * Alias for {@link Vec3.divide} + * @category Methods + */ + div(b: Readonly): this; + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec3.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b: number): this; + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b: Readonly, scale: number): this; + /** + * Calculates the Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b: Readonly): number; + /** + * Alias for {@link Vec3.distance} + * @category Methods + */ + dist(b: Readonly): number; + /** + * Calculates the squared Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b: Readonly): number; + /** + * Alias for {@link Vec3.squaredDistance} + * @category Methods + */ + sqrDist(b: Readonly): number; + /** + * Negates the components of `this`. + * Equivalent to `Vec3.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate(): this; + /** + * Inverts the components of `this`. + * Equivalent to `Vec3.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Sets each component of `this` to its absolute value. + * Equivalent to `Vec3.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs(): this; + /** + * Calculates the dot product of this and another {@link Vec3}. + * Equivalent to `Vec3.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b: Readonly): number; + /** + * Normalize `this`. + * Equivalent to `Vec3.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize(): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec3}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, empty vec3 + * @category Static + * + * @returns a new 3D vector + */ + static create(): Vec3; + /** + * Creates a new vec3 initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 3D vector + */ + static clone(a: Readonly): Vec3; + /** + * Calculates the magnitude (length) of a {@link Vec3} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a: Readonly): number; + /** + * Alias for {@link Vec3.magnitude} + * @category Static + */ + static mag(a: Readonly): number; + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + static length(a: Readonly): number; + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.mag} + */ + static len(a: Readonly): number; + /** + * Creates a new vec3 initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns a new 3D vector + */ + static fromValues(x: number, y: number, z: number): Vec3; + /** + * Copy the values from one vec3 to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Set the components of a vec3 to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns `out` + */ + static set(out: Vec3Like, x: number, y: number, z: number): Vec3Like; + /** + * Adds two {@link Vec3}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Alias for {@link Vec3.subtract} + * @category Static + */ + static sub(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Multiplies two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Alias for {@link Vec3.multiply} + * @category Static + */ + static mul(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Divides two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Alias for {@link Vec3.divide} + * @category Static + */ + static div(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Math.ceil the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Math.floor the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Returns the minimum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Returns the maximum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * symmetric round the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + /** + * Scales a vec3 by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out: Vec3Like, a: Readonly, scale: number): Vec3Like; + /** + * Adds two vec3's after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out: Vec3Like, a: Readonly, b: Readonly, scale: number): Vec3Like; + /** + * Calculates the Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec3.distance} + * @category Static + */ + static dist(a: Readonly, b: Readonly): number; + /** + * Calculates the squared Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec3.squaredDistance} + * @category Static + */ + static sqrDist(a: Readonly, b: Readonly): number; + /** + * Calculates the squared length of a vec3 + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a: Readonly): number; + /** + * Alias for {@link Vec3.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly, b: Readonly): number; + /** + * Negates the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Returns the inverse of the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Returns the absolute value of the components of a {@link Vec3} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Normalize a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Calculates the dot product of two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a: Readonly, b: Readonly): number; + /** + * Computes the cross product of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static cross(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Performs a linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like; + /** + * Performs a spherical linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like; + /** + * Performs a hermite interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static hermite( + out: Vec3Like, + a: Readonly, + b: Readonly, + c: Readonly, + d: Readonly, + t: number, + ): Vec3Like; + /** + * Performs a bezier interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static bezier( + out: Vec3Like, + a: Readonly, + b: Readonly, + c: Readonly, + d: Readonly, + t: number, + ): Vec3Like; + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned + * @returns `out` + */ + /** + * Transforms the vec3 with a mat4. + * 4th vector component is implicitly '1' + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out: Vec3Like, a: Readonly, m: Readonly): Vec3Like; + /** + * Transforms the vec3 with a mat3. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - the 3x3 matrix to transform with + * @returns `out` + */ + static transformMat3(out: Vec3Like, a: Vec3Like, m: Mat3Like): Vec3Like; + /** + * Transforms the vec3 with a quat + * Can also be used for dual quaternions. (Multiply it with the real part) + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out: Vec3Like, a: Readonly, q: Readonly): Vec3Like; + /** + * Rotate a 3D vector around the x-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateX(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like; + /** + * Rotate a 3D vector around the y-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateY(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like; + /** + * Rotate a 3D vector around the z-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateZ(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like; + /** + * Get the angle between two 3D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static angle(a: Readonly, b: Readonly): number; + /** + * Set the components of a vec3 to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out: Vec3Like): Vec3Like; + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a: Readonly): string; + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; +} + +/** + * 4 Dimensional Vector + */ +declare class Vec4 extends Float32Array { + /** + * Create a {@link Vec4}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x(): number; + set x(value: number); + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y(): number; + set y(value: number); + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z(): number; + set z(value: number); + /** + * The w component of the vector. Equivalent to `this[3];` + * @category Vector Components + */ + get w(): number; + set w(value: number); + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r(): number; + set r(value: number); + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g(): number; + set g(value: number); + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b(): number; + set b(value: number); + /** + * The a component of the vector. Equivalent to `this[3];` + * @category Color Components + */ + get a(): number; + set a(value: number); + /** + * The magnitude (length) of this. + * Equivalent to `Vec4.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number; + /** + * Alias for {@link Vec4.magnitude} + * + * @category Accessors + */ + get mag(): number; + /** + * A string representation of `this` + * Equivalent to `Vec4.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Vec4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Adds a {@link Vec4} to `this`. + * Equivalent to `Vec4.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b: Readonly): this; + /** + * Subtracts a {@link Vec4} from `this`. + * Equivalent to `Vec4.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b: Readonly): this; + /** + * Alias for {@link Vec4.subtract} + * @category Methods + */ + sub(b: Readonly): this; + /** + * Multiplies `this` by a {@link Vec4}. + * Equivalent to `Vec4.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Vec4.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Divides `this` by a {@link Vec4}. + * Equivalent to `Vec4.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b: Readonly): this; + /** + * Alias for {@link Vec4.divide} + * @category Methods + */ + div(b: Readonly): this; + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec4.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b: number): this; + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b: Readonly, scale: number): this; + /** + * Calculates the Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b: Readonly): number; + /** + * Alias for {@link Vec4.distance} + * @category Methods + */ + dist(b: Readonly): number; + /** + * Calculates the squared Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b: Readonly): number; + /** + * Alias for {@link Vec4.squaredDistance} + * @category Methods + */ + sqrDist(b: Readonly): number; + /** + * Negates the components of `this`. + * Equivalent to `Vec4.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate(): this; + /** + * Inverts the components of `this`. + * Equivalent to `Vec4.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec4.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs(): this; + /** + * Calculates the dot product of this and another {@link Vec4}. + * Equivalent to `Vec4.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b: Readonly): number; + /** + * Normalize `this`. + * Equivalent to `Vec4.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize(): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec4}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, empty {@link Vec4} + * @category Static + * + * @returns a new 4D vector + */ + static create(): Vec4; + /** + * Creates a new {@link Vec4} initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 4D vector + */ + static clone(a: Vec4Like): Vec4; + /** + * Creates a new {@link Vec4} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new 4D vector + */ + static fromValues(x: number, y: number, z: number, w: number): Vec4; + /** + * Copy the values from one {@link Vec4} to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Set the components of a {@link Vec4} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + static set(out: Vec4Like, x: number, y: number, z: number, w: number): Vec4Like; + /** + * Adds two {@link Vec4}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Alias for {@link Vec4.subtract} + * @category Static + */ + static sub(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Multiplies two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Alias for {@link Vec4.multiply} + * @category Static + */ + static mul(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Divides two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Alias for {@link Vec4.divide} + * @category Static + */ + static div(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Math.ceil the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Math.floor the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Returns the minimum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Returns the maximum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Math.round the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + static round(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Scales a {@link Vec4} by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out: Vec4Like, a: Readonly, scale: number): Vec4Like; + /** + * Adds two {@link Vec4}'s after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out: Vec4Like, a: Readonly, b: Readonly, scale: number): Vec4Like; + /** + * Calculates the Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec4.distance} + * @category Static + */ + static dist(a: Readonly, b: Readonly): number; + /** + * Calculates the squared Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec4.squaredDistance} + * @category Static + */ + static sqrDist(a: Readonly, b: Readonly): number; + /** + * Calculates the magnitude (length) of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate length of + * @returns length of `a` + */ + static magnitude(a: Readonly): number; + /** + * Alias for {@link Vec4.magnitude} + * @category Static + */ + static mag(a: Readonly): number; + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + static length(a: Readonly): number; + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.mag} + */ + static len(a: Readonly): number; + /** + * Calculates the squared length of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a: Readonly): number; + /** + * Alias for {@link Vec4.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly): number; + /** + * Negates the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Returns the inverse of the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Returns the absolute value of the components of a {@link Vec4} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Normalize a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Calculates the dot product of two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a: Readonly, b: Readonly): number; + /** + * Returns the cross-product of three vectors in a 4-dimensional space + * @category Static + * + * @param out the receiving vector + * @param u - the first vector + * @param v - the second vector + * @param w - the third vector + * @returns result + */ + static cross(out: Vec4Like, u: Readonly, v: Readonly, w: Readonly): Vec4Like; + /** + * Performs a linear interpolation between two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Vec4Like, a: Readonly, b: Readonly, t: number): Vec4Like; + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns `out` + */ + /** + * Transforms the {@link Vec4} with a {@link Mat4}. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out: Vec4Like, a: Readonly, m: Readonly): Vec4Like; + /** + * Transforms the {@link Vec4} with a {@link Quat} + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out: Vec4Like, a: Readonly, q: Readonly): Vec4Like; + /** + * Set the components of a {@link Vec4} to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out: Vec4Like): Vec4Like; + /** + * Returns a string representation of a {@link Vec4} + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a: Readonly): string; + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; +} + +/** + * To enable additional swizzle accessors for vector classes (32-bit) invoke the {@link EnableSwizzles} function from + * the `gl-matrix/swizzle` sub-path export. To enable ambient module declarations for IDE / Typescript support please + * see {@link gl-matrix/types/swizzle}. + * + * To enable swizzling for the 64-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle/f64}. + * + * @example + * ```ts + * import { Vec3 } from 'gl-matrix'; + * import { EnableSwizzles } from 'gl-matrix/swizzle'; + * + * EnableSwizzles(); + * + * const vec = new Vec3(0, 1, 2); + * const vecSwizzled = vec.zyx; // Returns a new Vec3(2, 1, 0). + * ``` + * + * @packageDocumentation + */ +/** + * Enables Swizzle operations on {@link gl-matrix.Vec2 | Vec2} / {@link gl-matrix.Vec3 | Vec3} / + * {@link gl-matrix.Vec4 | Vec4} types from {@link gl-matrix | gl-matrix} (32-bit). + * + * Swizzle operations are performed by using the `.` operator in conjunction with any combination + * of between two and four component names, either from the set `xyzw` or `rgbw` (though not intermixed). + * They return a new vector with the same number of components as specified in the swizzle attribute. + * + * @example + * ```js + * import { Vec3, EnableSwizzles } from 'gl-matrix'; + * + * EnableSwizzles(); + * + * let v = new Vec3(0, 1, 2); + * + * v.yx; // returns new Vec2(1, 0) + * v.xzy; // returns new Vec3(0, 2, 1) + * v.zyxz; // returns new Vec4(2, 1, 0, 2) + * + * v.rgb; // returns new Vec3(0, 1, 2) + * v.rbg; // returns new Vec3(0, 2, 1) + * v.gg; // returns new Vec2(1, 1) + * ``` + */ +declare function EnableSwizzles(): void; + +/** + * Ambient module declarations for `gl-matrix` (32-bit) swizzle extensions for vector classes. + * + * When swizzle accessors via {@link gl-matrix/swizzle.EnableSwizzles | EnableSwizzles} are enabled include this + * sub-path export as a `side effect` import to add ambient module declarations for the additional accessors to + * {@link gl-matrix.Vec2 | Vec2} / {@link gl-matrix.Vec3 | Vec3} / {@link gl-matrix.Vec4 | Vec4} + * + * To enable swizzling for the 32-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle}. + * + * ```js + * import { Vec2 } from 'gl-matrix'; + * import { EnableSwizzles } from 'gl-matrix/swizzle'; + * + * import 'gl-matrix/types/swizzle'; + * + * EnableSwizzles(); + * + * const vec = new Vec2(0, 1); + * + * // Swizzled instance - returns new Vec2(1, 0). + * const vecSwizzled = vec.yx; + * ``` + * + * @packageDocumentation + */ + +/** + * A type alias for Vec2 (32-bit). + * @hidden + */ +type Vec2Alias = Vec2; +/** + * A type alias for Vec3 (32-bit). + * @hidden + */ +type Vec3Alias = Vec3; +/** + * A type alias for Vec4 (32-bit). + * @hidden + */ +type Vec4Alias = Vec4; + +/** + * Vec2 swizzle extension accessors. + */ +interface Vec2 { + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggg(): Vec4Alias; +} +/** + * Vec3 swizzle extension accessors. + */ +interface Vec3 { + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get br(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbb(): Vec4Alias; +} +/** + * Vec4 swizzle extension accessors. + */ +interface Vec4 { + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get br(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xw(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yw(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zw(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get wx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get wy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get wz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ww(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xwx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xwy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xwz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xww(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ywx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ywy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ywz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yww(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zwx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zwy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zwz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zww(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wwx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wwy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wwz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get www(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ra(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ga(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ba(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ar(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ag(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ab(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get aa(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rra(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get raa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gra(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gaa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bra(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get baa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get arr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get arg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get arb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ara(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get agr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get agg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get agb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get abr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get abg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get abb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aaa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rraa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rarr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rarg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rarb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ragr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ragg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ragb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rabr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rabg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rabb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get graa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get garr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get garg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get garb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gagr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gagg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gagb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gabr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gabg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gabb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get braa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get barr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get barg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get barb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bagr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bagg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bagb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get babr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get babg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get babb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get argr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get argg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get argb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get araa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aarr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aarg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aarb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aagr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aagg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aagb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aabr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aabg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aabb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaaa(): Vec4Alias; +} + +/** + * Convert `radians` to `degrees`. + * + * @param value - Angle in `radians`. + * @returns Angle in `degrees`. + */ +declare function toDegree(value: number): number; +/** + * Convert `degrees` to `radians`. + * + * @param value - Angle in `degrees`. + * @returns Angle in `radians`. + */ +declare function toRadian(value: number): number; + +export { + EnableSwizzles, + type FloatArray, + Mat2, + type Mat2Like, + Mat2d, + type Mat2dLike, + Mat3, + type Mat3Like, + Mat4, + type Mat4Like, + Quat, + Quat2, + type Quat2Like, + type QuatLike, + Vec2, + type Vec2Like, + Vec3, + type Vec3Like, + Vec4, + type Vec4Like, + Mat2 as mat2, + Mat2d as mat2d, + Mat3 as mat3, + Mat4 as mat4, + Quat as quat, + Quat2 as quat2, + toDegree, + toRadian, + Vec2 as vec2, + Vec3 as vec3, + Vec4 as vec4, +}; diff --git a/dist-cdn/types/gl-matrix-f32.d.mts b/dist-cdn/types/gl-matrix-f32.d.mts new file mode 100644 index 00000000..0e3da008 --- /dev/null +++ b/dist-cdn/types/gl-matrix-f32.d.mts @@ -0,0 +1,9911 @@ +/** + * Provides an all-inclusive ESM distribution of `gl-matrix` (32-bit). All library classes extends `Float32Array`. + * + * @packageDocumentation + */ + +/** + * Provides all common type declarations shared across `gl-matrix`. + * + * ```ts + * import { Vec3 } from 'gl-matrix'; + * import type { Vec3Like } from 'gl-matrix/types'; + * + * const vec: Vec3Like = new Vec3(0, 1, 2); + * ``` + * + * For JSDoc using the new Typescript 5.5 `@import` tag: + * ```js + * /** + * * @import { Vec3Like } from 'gl-matrix/types' + * *\/ + * ``` + * + * For JSDoc using the older `import types` Typescript mechanism: + * ```js + * /** + * * @type {import('gl-matrix/types').Vec3Like} + * *\/ + * ``` + * + * @packageDocumentation + */ +/** + * The floating-point typed arrays that can be used in place of a vector, matrix, or quaternion. + */ +type FloatArray = Float32Array | Float64Array; +/** + * A 2x2 Matrix given as a {@link Mat2}, a 4-element floating-point TypedArray, or an array of 4 numbers. + */ +type Mat2Like = [number, number, number, number] | FloatArray; +/** + * A 2x3 Matrix given as a {@link Mat2d}, a 6-element floating-point TypedArray, or an array of 6 numbers. + */ +type Mat2dLike = [number, number, number, number, number, number] | FloatArray; +/** + * A 3x3 Matrix given as a {@link Mat3}, a 9-element floating-point TypedArray, or an array of 9 numbers. + */ +type Mat3Like = [number, number, number, number, number, number, number, number, number] | FloatArray; +/** + * A 4x4 Matrix given as a {@link Mat4}, a 16-element floating-point TypedArray, or an array of 16 numbers. + */ +type Mat4Like = + | [ + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + ] + | FloatArray; +/** + * A Quaternion given as a {@link Quat}, a 4-element floating-point TypedArray, or an array of 4 numbers. + */ +type QuatLike = Vec4Like; +/** + * A Dual Quaternion given as a {@link Quat2}, an 8-element floating-point TypedArray, or an array of 8 numbers. + */ +type Quat2Like = [number, number, number, number, number, number, number, number] | FloatArray; +/** + * A 2-dimensional vector given as a {@link Vec2}, a 2-element floating-point TypedArray, or an array of 2 numbers. + */ +type Vec2Like = [number, number] | FloatArray; +/** + * A 3-dimensional vector given as a {@link Vec3}, a 3-element floating-point TypedArray, or an array of 3 numbers. + */ +type Vec3Like = [number, number, number] | FloatArray; +/** + * A 4-dimensional vector given as a {@link Vec4}, a 4-element floating-point TypedArray, or an array of 4 numbers. + */ +type Vec4Like = [number, number, number, number] | FloatArray; + +/** + * A 2x2 Matrix + */ +declare class Mat2 extends Float32Array { + #private; + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * A string representation of `this` + * Equivalent to `Mat2.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Mat2} into `this`. + * + * @param a the source vector + * @returns `this` + * @category Methods + */ + copy(a: Readonly): this; + /** + * Set `this` to the identity matrix + * Equivalent to Mat2.identity(this) + * + * @returns `this` + * @category Methods + */ + identity(): this; + /** + * Multiplies this {@link Mat2} against another one + * Equivalent to `Mat2.multiply(this, this, b);` + * + * @param b - The second operand + * @returns `this` + * @category Methods + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Mat2.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Transpose this {@link Mat2} + * Equivalent to `Mat2.transpose(this, this);` + * + * @returns `this` + * @category Methods + */ + transpose(): this; + /** + * Inverts this {@link Mat2} + * Equivalent to `Mat4.invert(this, this);` + * + * @returns `this` + * @category Methods + */ + invert(): this; + /** + * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2.scale(this, this, v);` + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + * @category Methods + */ + scale(v: Readonly): this; + /** + * Rotates this {@link Mat2} by the given angle around the given axis + * Equivalent to `Mat2.rotate(this, this, rad);` + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + * @category Methods + */ + rotate(rad: number): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, identity {@link Mat2} + * @category Static + * + * @returns A new {@link Mat2} + */ + static create(): Mat2; + /** + * Creates a new {@link Mat2} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2} + */ + static clone(a: Readonly): Mat2; + /** + * Copy the values from one {@link Mat2} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out: Mat2Like, a: Readonly): Mat2Like; + /** + * Create a new {@link Mat2} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2} + */ + static fromValues(...values: number[]): Mat2; + /** + * Set the components of a {@link Mat2} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out: Mat2Like, ...values: number[]): Mat2Like; + /** + * Set a {@link Mat2} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out: Mat2Like): Mat2Like; + /** + * Transpose the values of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out: Mat2Like, a: Readonly): Mat2Like; + /** + * Inverts a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out: Mat2Like, a: Mat2Like): Mat2Like | null; + /** + * Calculates the adjugate of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out: Mat2Like, a: Mat2Like): Mat2Like; + /** + * Calculates the determinant of a {@link Mat2} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a: Readonly): number; + /** + * Adds two {@link Mat2}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like; + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like; + /** + * Alias for {@link Mat2.subtract} + * @category Static + */ + static sub(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like; + /** + * Multiplies two {@link Mat2}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like; + /** + * Alias for {@link Mat2.multiply} + * @category Static + */ + static mul(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like; + /** + * Rotates a {@link Mat2} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out: Mat2Like, a: Readonly, rad: number): Mat2Like; + /** + * Scales the {@link Mat2} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out: Mat2Like, a: Readonly, v: Readonly): Mat2Like; + /** + * Creates a {@link Mat2} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out: Mat2Like, rad: number): Mat2Like; + /** + * Creates a {@link Mat2} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out: Mat2Like, v: Readonly): Mat2Like; + /** + * Returns Frobenius norm of a {@link Mat2} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a: Readonly): number; + /** + * Multiply each element of a {@link Mat2} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out: Mat2Like, a: Readonly, b: number): Mat2Like; + /** + * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out: Mat2Like, a: Readonly, b: Readonly, scale: number): Mat2Like; + /** + * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix + * @category Static + * + * @param L - the lower triangular matrix + * @param D - the diagonal matrix + * @param U - the upper triangular matrix + * @param a - the input matrix to factorize + */ + static LDU( + L: Mat2Like, + D: Readonly, + U: Mat2Like, + a: Readonly, + ): [Mat2Like, Readonly, Mat2Like]; + /** + * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether two {@link Mat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Returns a string representation of a {@link Mat2} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a: Readonly): string; +} + +/** + * A 2x3 Matrix + */ +declare class Mat2d extends Float32Array { + #private; + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * A string representation of `this` + * Equivalent to `Mat2d.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Mat2d} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Set `this` to the identity matrix + * Equivalent to Mat2d.identity(this) + * @category Methods + * + * @returns `this` + */ + identity(): this; + /** + * Multiplies this {@link Mat2d} against another one + * Equivalent to `Mat2d.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Mat2d.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Translate this {@link Mat2d} by the given vector + * Equivalent to `Mat2d.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v: Readonly): this; + /** + * Rotates this {@link Mat2d} by the given angle around the given axis + * Equivalent to `Mat2d.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad: number): this; + /** + * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2d.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v: Readonly): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2d}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, identity {@link Mat2d} + * @category Static + * + * @returns A new {@link Mat2d} + */ + static create(): Mat2d; + /** + * Creates a new {@link Mat2d} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2d} + */ + static clone(a: Readonly): Mat2d; + /** + * Copy the values from one {@link Mat2d} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out: Mat2dLike, a: Readonly): Mat2dLike; + /** + * Create a new {@link Mat2d} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2d} + */ + static fromValues(...values: number[]): Mat2d; + /** + * Set the components of a {@link Mat2d} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out: Mat2dLike, ...values: number[]): Mat2dLike; + /** + * Set a {@link Mat2d} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out: Mat2dLike): Mat2dLike; + /** + * Inverts a {@link Mat2d} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out: Mat2dLike, a: Mat2dLike): Mat2dLike | null; + /** + * Calculates the determinant of a {@link Mat2d} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a: Readonly): number; + /** + * Adds two {@link Mat2d}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike; + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike; + /** + * Alias for {@link Mat2d.subtract} + * @category Static + */ + static sub(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike; + /** + * Multiplies two {@link Mat2d}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike; + /** + * Alias for {@link Mat2d.multiply} + * @category Static + */ + static mul(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike; + /** + * Translate a {@link Mat2d} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike; + /** + * Rotates a {@link Mat2d} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out: Mat2dLike, a: Readonly, rad: number): Mat2dLike; + /** + * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike; + /** + * Creates a {@link Mat2d} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out: Mat2dLike, v: Readonly): Mat2dLike; + /** + * Creates a {@link Mat2d} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out: Mat2dLike, rad: number): Mat2dLike; + /** + * Creates a {@link Mat2d} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out: Mat2dLike, v: Readonly): Mat2dLike; + /** + * Returns Frobenius norm of a {@link Mat2d} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a: Readonly): number; + /** + * Multiply each element of a {@link Mat2d} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out: Mat2dLike, a: Readonly, b: number): Mat2dLike; + /** + * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out: Mat2dLike, a: Readonly, b: Readonly, scale: number): Mat2dLike; + /** + * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether two {@link Mat2d}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Returns a string representation of a {@link Mat2d} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a: Readonly): string; +} + +/** + * A 3x3 Matrix + */ +declare class Mat3 extends Float32Array { + #private; + /** + * Create a {@link Mat3}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * A string representation of `this` + * Equivalent to `Mat3.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Mat3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Set `this` to the identity matrix + * Equivalent to Mat3.identity(this) + * @category Methods + * + * @returns `this` + */ + identity(): this; + /** + * Multiplies this {@link Mat3} against another one + * Equivalent to `Mat3.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Mat3.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Transpose this {@link Mat3} + * Equivalent to `Mat3.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose(): this; + /** + * Inverts this {@link Mat3} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Translate this {@link Mat3} by the given vector + * Equivalent to `Mat3.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v: Readonly): this; + /** + * Rotates this {@link Mat3} by the given angle around the given axis + * Equivalent to `Mat3.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad: number): this; + /** + * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat3.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v: Readonly): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat3}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, identity {@link Mat3} + * @category Static + * + * @returns A new {@link Mat3} + */ + static create(): Mat3; + /** + * Creates a new {@link Mat3} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat3} + */ + static clone(a: Readonly): Mat3; + /** + * Copy the values from one {@link Mat3} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out: Mat3Like, a: Readonly): Mat3Like; + /** + * Create a new {@link Mat3} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat3} + */ + static fromValues(...values: number[]): Mat3; + /** + * Set the components of a {@link Mat3} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out: Mat3Like, ...values: number[]): Mat3Like; + /** + * Set a {@link Mat3} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out: Mat3Like): Mat3Like; + /** + * Transpose the values of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out: Mat3Like, a: Readonly): Mat3Like; + /** + * Inverts a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out: Mat3Like, a: Mat3Like): Mat3Like | null; + /** + * Calculates the adjugate of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out: Mat3Like, a: Mat3Like): Mat3Like; + /** + * Calculates the determinant of a {@link Mat3} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a: Readonly): number; + /** + * Adds two {@link Mat3}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like; + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like; + /** + * Alias for {@link Mat3.subtract} + * @category Static + */ + static sub(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like; + /** + * Multiplies two {@link Mat3}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like; + /** + * Alias for {@link Mat3.multiply} + * @category Static + */ + static mul(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like; + /** + * Translate a {@link Mat3} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like; + /** + * Rotates a {@link Mat3} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out: Mat3Like, a: Readonly, rad: number): Mat3Like; + /** + * Scales the {@link Mat3} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like; + /** + * Creates a {@link Mat3} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out: Mat3Like, v: Readonly): Mat3Like; + /** + * Creates a {@link Mat3} from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat3.identity(dest); + * mat3.rotate(dest, dest, rad); + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out: Mat3Like, rad: number): Mat3Like; + /** + * Creates a {@link Mat3} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out: Mat3Like, v: Readonly): Mat3Like; + /** + * Copies the upper-left 3x3 values of a {@link Mat2d} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 2x3 matrix + * @returns `out` + */ + static fromMat2d(out: Mat3Like, a: Readonly): Mat3Like; + /** + * Calculates a {@link Mat3} from the given quaternion + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param q - {@link Quat} to create matrix from + * @returns `out` + */ + static fromQuat(out: Mat3Like, q: Readonly): Mat3Like; + /** + * Copies the upper-left 3x3 values of a {@link Mat4} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 4x4 matrix + * @returns `out` + */ + static fromMat4(out: Mat3Like, a: Readonly): Mat3Like; + /** + * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix + * @category Static + * + * @param {mat3} out mat3 receiving operation result + * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out: Mat3Like, a: Readonly): Mat3Like | null; + /** + * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out: Mat3Like, a: Readonly): Mat3Like; + /** + * Generates a 2D projection matrix with the given bounds + * @category Static + * + * @param out mat3 frustum matrix will be written into + * @param width Width of your gl context + * @param height Height of gl context + * @returns `out` + */ + static projection(out: Mat3Like, width: number, height: number): Mat3Like; + /** + * Returns Frobenius norm of a {@link Mat3} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a: Readonly): number; + /** + * Multiply each element of a {@link Mat3} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out: Mat3Like, a: Readonly, b: number): Mat3Like; + /** + * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out: Mat3Like, a: Readonly, b: Readonly, scale: number): Mat3Like; + /** + * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether two {@link Mat3}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Returns a string representation of a {@link Mat3} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a: Readonly): string; +} + +/** + * A 4x4 Matrix + */ +declare class Mat4 extends Float32Array { + #private; + /** + * Create a {@link Mat4}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * A string representation of `this` + * Equivalent to `Mat4.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Mat4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Set `this` to the identity matrix + * Equivalent to Mat4.identity(this) + * @category Methods + * + * @returns `this` + */ + identity(): this; + /** + * Multiplies this {@link Mat4} against another one + * Equivalent to `Mat4.multiply(this, this, b);` + * @category Methods + * + * @param b - The second operand + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Mat4.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Transpose this {@link Mat4} + * Equivalent to `Mat4.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose(): this; + /** + * Inverts this {@link Mat4} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Translate this {@link Mat4} by the given vector + * Equivalent to `Mat4.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to translate by + * @returns `this` + */ + translate(v: Readonly): this; + /** + * Rotates this {@link Mat4} by the given angle around the given axis + * Equivalent to `Mat4.rotate(this, this, rad, axis);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `this` + */ + rotate(rad: number, axis: Readonly): this; + /** + * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat4.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to scale the matrix by + * @returns `this` + */ + scale(v: Readonly): this; + /** + * Rotates this {@link Mat4} by the given angle around the X axis + * Equivalent to `Mat4.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateX(rad: number): this; + /** + * Rotates this {@link Mat4} by the given angle around the Y axis + * Equivalent to `Mat4.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateY(rad: number): this; + /** + * Rotates this {@link Mat4} by the given angle around the Z axis + * Equivalent to `Mat4.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateZ(rad: number): this; + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveNO(fovy: number, aspect: number, near: number, far: number): this; + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveZO(fovy: number, aspect: number, near: number, far: number): this; + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoNO(left: number, right: number, bottom: number, top: number, near: number, far: number): this; + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoZO(left: number, right: number, bottom: number, top: number, near: number, far: number): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat4}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, identity {@link Mat4} + * @category Static + * + * @returns A new {@link Mat4} + */ + static create(): Mat4; + /** + * Creates a new {@link Mat4} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat4} + */ + static clone(a: Readonly): Mat4; + /** + * Copy the values from one {@link Mat4} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out: Mat4Like, a: Readonly): Mat4Like; + /** + * Create a new mat4 with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat4} + */ + static fromValues(...values: number[]): Mat4; + /** + * Set the components of a mat4 to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out: Mat4Like, ...values: number[]): Mat4Like; + /** + * Set a {@link Mat4} to the identity matrix + * @category Static + * + * @param out - The receiving Matrix + * @returns `out` + */ + static identity(out: Mat4Like): Mat4Like; + /** + * Transpose the values of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out: Mat4Like, a: Readonly): Mat4Like; + /** + * Inverts a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out: Mat4Like, a: Mat4Like): Mat4Like | null; + /** + * Calculates the adjugate of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out: Mat4Like, a: Mat4Like): Mat4Like; + /** + * Calculates the determinant of a {@link Mat4} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a: Readonly): number; + /** + * Multiplies two {@link Mat4}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like; + /** + * Alias for {@link Mat4.multiply} + * @category Static + */ + static mul(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like; + /** + * Translate a {@link Mat4} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like; + /** + * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec3} to scale the matrix by + * @returns `out` + **/ + static scale(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like; + /** + * Rotates a {@link Mat4} by the given angle around the given axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if axis has a length of 0 + */ + static rotate(out: Mat4Like, a: Readonly, rad: number, axis: Readonly): Mat4Like | null; + /** + * Rotates a matrix by the given angle around the X axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateX(out: Mat4Like, a: Readonly, rad: number): Mat4Like; + /** + * Rotates a matrix by the given angle around the Y axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateY(out: Mat4Like, a: Readonly, rad: number): Mat4Like; + /** + * Rotates a matrix by the given angle around the Z axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateZ(out: Mat4Like, a: Readonly, rad: number): Mat4Like; + /** + * Creates a {@link Mat4} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out: Mat4Like, v: Readonly): Mat4Like; + /** + * Creates a {@link Mat4} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out: Mat4Like, v: Readonly): Mat4Like; + /** + * Creates a {@link Mat4} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotate(dest, dest, rad, axis); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if `axis` has a length of 0 + */ + static fromRotation(out: Mat4Like, rad: number, axis: Readonly): Mat4Like | null; + /** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateX(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromXRotation(out: Mat4Like, rad: number): Mat4Like; + /** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateY(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromYRotation(out: Mat4Like, rad: number): Mat4Like; + /** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateZ(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromZRotation(out: Mat4Like, rad: number): Mat4Like; + /** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @returns `out` + */ + static fromRotationTranslation(out: Mat4Like, q: Readonly, v: Readonly): Mat4Like; + /** + * Sets a {@link Mat4} from a {@link Quat2}. + * @category Static + * + * @param out - Matrix + * @param a - Dual Quaternion + * @returns `out` + */ + static fromQuat2(out: Mat4Like, a: Quat2Like): Mat4Like; + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out: Mat4Like, a: Readonly): Mat4Like | null; + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out: Mat4Like, a: Readonly): Mat4Like; + /** + * Returns the translation vector component of a transformation + * matrix. If a matrix is built with fromRotationTranslation, + * the returned vector will be the same as the translation vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive translation component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getTranslation(out: Vec3Like, mat: Readonly): Vec3Like; + /** + * Returns the scaling factor component of a transformation + * matrix. If a matrix is built with fromRotationTranslationScale + * with a normalized Quaternion parameter, the returned vector will be + * the same as the scaling vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive scaling factor component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getScaling(out: Vec3Like, mat: Readonly): Vec3Like; + /** + * Returns a quaternion representing the rotational component + * of a transformation matrix. If a matrix is built with + * fromRotationTranslation, the returned quaternion will be the + * same as the quaternion originally supplied. + * @category Static + * + * @param out - Quaternion to receive the rotation component + * @param mat - Matrix to be decomposed (input) + * @return `out` + */ + static getRotation(out: QuatLike, mat: Readonly): QuatLike; + /** + * Decomposes a transformation matrix into its rotation, translation + * and scale components. Returns only the rotation component + * @category Static + * + * @param out_r - Quaternion to receive the rotation component + * @param out_t - Vector to receive the translation vector + * @param out_s - Vector to receive the scaling factor + * @param mat - Matrix to be decomposed (input) + * @returns `out_r` + */ + static decompose(out_r: QuatLike, out_t: Vec3Like, out_s: Vec3Like, mat: Readonly): QuatLike; + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @returns `out` + */ + static fromRotationTranslationScale( + out: Mat4Like, + q: Readonly, + v: Readonly, + s: Readonly, + ): Mat4Like; + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the + * given origin. This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * mat4.translate(dest, origin); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * mat4.translate(dest, negativeOrigin); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @param o - The origin vector around which to scale and rotate + * @returns `out` + */ + static fromRotationTranslationScaleOrigin( + out: Mat4Like, + q: Readonly, + v: Readonly, + s: Readonly, + o: Readonly, + ): Mat4Like; + /** + * Calculates a 4x4 matrix from the given quaternion + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Quaternion to create matrix from + * @returns `out` + */ + static fromQuat(out: Mat4Like, q: Readonly): Mat4Like; + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumNO( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far?: number, + ): Mat4Like; + /** + * Alias for {@link Mat4.frustumNO} + * @category Static + * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly + */ + static frustum( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far?: number, + ): Mat4Like; + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumZO( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far?: number, + ): Mat4Like; + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveNO(out: Mat4Like, fovy: number, aspect: number, near: number, far?: number): Mat4Like; + /** + * Alias for {@link Mat4.perspectiveNO} + * @category Static + * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly + */ + static perspective(out: Mat4Like, fovy: number, aspect: number, near: number, far?: number): Mat4Like; + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveZO(out: Mat4Like, fovy: number, aspect: number, near: number, far?: number): Mat4Like; + /** + * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating + * projection matrices to be used with the still experimental WebVR API. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + * @deprecated + */ + static perspectiveFromFieldOfView( + out: Mat4Like, + fov: { + upDegrees: number; + downDegrees: number; + leftDegrees: number; + rightDegrees: number; + }, + near: number, + far: number, + ): Mat4Like; + /** + * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoNO( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far: number, + ): Mat4Like; + /** + * Alias for {@link Mat4.orthoNO} + * @category Static + * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly + */ + static ortho( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far: number, + ): Mat4Like; + /** + * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoZO( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far: number, + ): Mat4Like; + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that + * actually makes an object look at another object, you should use targetTo instead. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param center - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static lookAt(out: Mat4Like, eye: Readonly, center: Readonly, up: Readonly): Mat4Like; + /** + * Generates a matrix that makes something look at something else. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param target - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static targetTo(out: Mat4Like, eye: Readonly, target: Readonly, up: Readonly): Mat4Like; + /** + * Returns Frobenius norm of a {@link Mat4} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a: Readonly): number; + /** + * Adds two {@link Mat4}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like; + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like; + /** + * Alias for {@link Mat4.subtract} + * @category Static + */ + static sub(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like; + /** + * Multiply each element of the matrix by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out: Mat4Like, a: Readonly, b: number): Mat4Like; + /** + * Adds two mat4's after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out: Mat4Like, a: Readonly, b: Readonly, scale: number): Mat4Like; + /** + * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether two {@link Mat4}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Returns a string representation of a {@link Mat4} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a: Readonly): string; +} + +/** + * Quaternion + */ +declare class Quat extends Float32Array { + #private; + /** + * Create a {@link Quat}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * The x component of the quaternion. Equivalent to `this[0];` + * @category Quaternion Components + */ + get x(): number; + set x(value: number); + /** + * The y component of the quaternion. Equivalent to `this[1];` + * @category Quaternion Components + */ + get y(): number; + set y(value: number); + /** + * The z component of the quaternion. Equivalent to `this[2];` + * @category Quaternion Components + */ + get z(): number; + set z(value: number); + /** + * The w component of the quaternion. Equivalent to `this[3];` + * @category Quaternion Components + */ + get w(): number; + set w(value: number); + /** + * The magnitude (length) of this. + * Equivalent to `Quat.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number; + /** + * Alias for {@link Quat.magnitude} + * + * @category Accessors + */ + get mag(): number; + /** + * A string representation of `this` + * Equivalent to `Quat.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Quat} into `this`. + * @category Methods + * + * @param a the source quaternion + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Set `this` to the identity quaternion + * Equivalent to Quat.identity(this) + * @category Methods + * + * @returns `this` + */ + identity(): this; + /** + * Multiplies `this` by a {@link Quat}. + * Equivalent to `Quat.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Quat.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Rotates `this` by the given angle about the X axis + * Equivalent to `Quat.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateX(rad: number): this; + /** + * Rotates `this` by the given angle about the Y axis + * Equivalent to `Quat.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateY(rad: number): this; + /** + * Rotates `this` by the given angle about the Z axis + * Equivalent to `Quat.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateZ(rad: number): this; + /** + * Inverts `this` + * Equivalent to `Quat.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Scales `this` by a scalar number + * Equivalent to `Quat.scale(this, this, scale);` + * @category Methods + * + * @param scale - amount to scale the vector by + * @returns `this` + */ + scale(scale: number): QuatLike; + /** + * Calculates the dot product of `this` and another {@link Quat} + * Equivalent to `Quat.dot(this, b);` + * @category Methods + * + * @param b - the second operand + * @returns dot product of `this` and b + */ + dot(b: Readonly): number; + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new identity quat + * @category Static + * + * @returns a new quaternion + */ + static create(): Quat; + /** + * Set a quat to the identity quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + static identity(out: QuatLike): QuatLike; + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * @category Static + * + * @param out - the receiving quaternion + * @param axis - the axis around which to rotate + * @param rad - the angle in radians + * @returns `out` + **/ + static setAxisAngle(out: QuatLike, axis: Readonly, rad: number): QuatLike; + /** + * Gets the rotation axis and angle for a given + * quaternion. If a quaternion is created with + * setAxisAngle, this method will return the same + * values as provided in the original parameter list + * OR functionally equivalent values. + * Example: The quaternion formed by axis [0, 0, 1] and + * angle -90 is the same as the quaternion formed by + * [0, 0, 1] and 270. This method favors the latter. + * @category Static + * + * @param out_axis - Vector receiving the axis of rotation + * @param q - Quaternion to be decomposed + * @return Angle, in radians, of the rotation + */ + static getAxisAngle(out_axis: Vec3Like, q: Readonly): number; + /** + * Gets the angular distance between two unit quaternions + * @category Static + * + * @param {ReadonlyQuat} a Origin unit quaternion + * @param {ReadonlyQuat} b Destination unit quaternion + * @return {Number} Angle, in radians, between the two quaternions + */ + static getAngle(a: Readonly, b: Readonly): number; + /** + * Multiplies two quaternions. + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out: QuatLike, a: Readonly, b: Readonly): QuatLike; + /** + * Rotates a quaternion by the given angle about the X axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out: QuatLike, a: Readonly, rad: number): QuatLike; + /** + * Rotates a quaternion by the given angle about the Y axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out: QuatLike, a: Readonly, rad: number): QuatLike; + /** + * Rotates a quaternion by the given angle about the Z axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out: QuatLike, a: Readonly, rad: number): QuatLike; + /** + * Calculates the W component of a quat from the X, Y, and Z components. + * Assumes that quaternion is 1 unit in length. + * Any existing W component will be ignored. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate W component of + * @returns `out` + */ + static calculateW(out: QuatLike, a: Readonly): QuatLike; + /** + * Calculate the exponential of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static exp(out: QuatLike, a: Readonly): QuatLike; + /** + * Calculate the natural logarithm of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static ln(out: QuatLike, a: Readonly): QuatLike; + /** + * Calculate the scalar power of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @param b - amount to scale the quaternion by + * @returns `out` + */ + static pow(out: QuatLike, a: Readonly, b: number): QuatLike; + /** + * Performs a spherical linear interpolation between two quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike; + /** + * Generates a random unit quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + /** + * Calculates the inverse of a quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate inverse of + * @returns `out` + */ + static invert(out: QuatLike, a: Readonly): QuatLike; + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate conjugate of + * @returns `out` + */ + static conjugate(out: QuatLike, a: Readonly): QuatLike; + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to re-normalize the quaternion yourself where necessary. + * @category Static + * + * @param out - the receiving quaternion + * @param m - rotation matrix + * @returns `out` + */ + static fromMat3(out: QuatLike, m: Readonly): QuatLike; + /** + * Creates a quaternion from the given euler angle x, y, z. + * @category Static + * + * @param out - the receiving quaternion + * @param x - Angle to rotate around X axis in degrees. + * @param y - Angle to rotate around Y axis in degrees. + * @param z - Angle to rotate around Z axis in degrees. + * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx. + * @returns `out` + */ + static fromEuler(out: QuatLike, x: number, y: number, z: number, order?: string): QuatLike; + /** + * Returns a string representation of a quatenion + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a: Readonly): string; + /** + * Creates a new quat initialized with values from an existing quaternion + * @category Static + * + * @param a - quaternion to clone + * @returns a new quaternion + */ + static clone(a: Readonly): Quat; + /** + * Creates a new quat initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new quaternion + */ + static fromValues(x: number, y: number, z: number, w: number): Quat; + /** + * Copy the values from one quat to another + * @category Static + * + * @param out - the receiving quaternion + * @param a - the source quaternion + * @returns `out` + */ + static copy(out: QuatLike, a: Readonly): QuatLike; + /** + * Set the components of a {@link Quat} to the given values + * @category Static + * + * @param out - the receiving quaternion + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + static set(out: QuatLike, x: number, y: number, z: number, w: number): QuatLike; + /** + * Adds two {@link Quat}'s + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: QuatLike, a: Readonly, b: Readonly): QuatLike; + /** + * Alias for {@link Quat.multiply} + * @category Static + */ + static mul(out: QuatLike, a: Readonly, b: Readonly): QuatLike; + /** + * Scales a quat by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param b - amount to scale the vector by + * @returns `out` + */ + static scale(out: QuatLike, a: Readonly, scale: number): QuatLike; + /** + * Calculates the dot product of two quat's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a: Readonly, b: Readonly): number; + /** + * Performs a linear interpolation between two quat's + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike; + /** + * Calculates the magnitude (length) of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate length of + * @returns length of `a` + */ + static magnitude(a: Readonly): number; + /** + * Alias for {@link Quat.magnitude} + * @category Static + */ + static mag(a: Readonly): number; + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + static length(a: Readonly): number; + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.mag} + */ + static len(a: Readonly): number; + /** + * Calculates the squared length of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a: Readonly): number; + /** + * Alias for {@link Quat.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly): number; + /** + * Normalize a {@link Quat} + * @category Static + * + * @param out - the receiving quaternion + * @param a - quaternion to normalize + * @returns `out` + */ + static normalize(out: QuatLike, a: Readonly): QuatLike; + /** + * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first quaternion. + * @param b - The second quaternion. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether the quaternions have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * @category Static + * + * @param out - the receiving quaternion. + * @param a - the initial vector + * @param b - the destination vector + * @returns `out` + */ + static rotationTo(out: QuatLike, a: Readonly, b: Readonly): QuatLike; + /** + * Performs a spherical linear interpolation with two control points + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static sqlerp( + out: QuatLike, + a: Readonly, + b: Readonly, + c: Readonly, + d: Readonly, + t: number, + ): QuatLike; + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * @category Static + * + * @param out - The receiving quaternion + * @param view - the vector representing the viewing direction + * @param right - the vector representing the local `right` direction + * @param up - the vector representing the local `up` direction + * @returns `out` + */ + static setAxes(out: QuatLike, view: Readonly, right: Readonly, up: Readonly): QuatLike; +} + +/** + * Dual Quaternion + */ +declare class Quat2 extends Float32Array { + #private; + /** + * Create a {@link Quat2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * A string representation of `this` + * Equivalent to `Quat2.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Quat2} into `this`. + * @category Methods + * + * @param a the source dual quaternion + * @returns `this` + */ + copy(a: Readonly): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat2}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new identity {@link Quat2} + * @category Static + * + * @returns a new dual quaternion [real -> rotation, dual -> translation] + */ + static create(): Quat2; + /** + * Creates a {@link Quat2} quat initialized with values from an existing quaternion + * @category Static + * + * @param a - dual quaternion to clone + * @returns a new dual quaternion + */ + static clone(a: Quat2Like): Quat2; + /** + * Creates a new {@link Quat2} initialized with the given values + * @category Static + * + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns a new dual quaternion + */ + static fromValues( + x1: number, + y1: number, + z1: number, + w1: number, + x2: number, + y2: number, + z2: number, + w2: number, + ): Quat2; + /** + * Creates a new {@link Quat2} from the given values (quat and translation) + * @category Static + * + * @param x1 - X component (rotation) + * @param y1 - Y component (rotation) + * @param z1 - Z component (rotation) + * @param w1 - W component (rotation) + * @param x2 - X component (translation) + * @param y2 - Y component (translation) + * @param z2 - Z component (translation) + * @returns a new dual quaternion + */ + static fromRotationTranslationValues( + x1: number, + y1: number, + z1: number, + w1: number, + x2: number, + y2: number, + z2: number, + ): Quat2; + /** + * Sets a {@link Quat2} from a quaternion and a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @param t - translation vector + * @returns `out` + */ + static fromRotationTranslation(out: Quat2Like, q: Readonly, t: Readonly): Quat2Like; + /** + * Sets a {@link Quat2} from a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param t - translation vector + * @returns `out` + */ + static fromTranslation(out: Quat2Like, t: Readonly): Quat2Like; + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @returns `out` + */ + static fromRotation(out: Quat2Like, q: Readonly): Quat2Like; + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param a - the matrix + * @returns `out` + */ + static fromMat4(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Copy the values from one {@link Quat2} to another + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the source dual quaternion + * @returns `out` + */ + static copy(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Set a {@link Quat2} to the identity dual quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @returns `out` + */ + static identity(out: QuatLike): QuatLike; + /** + * Set the components of a {@link Quat2} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns `out` + */ + static set( + out: Quat2Like, + x1: number, + y1: number, + z1: number, + w1: number, + x2: number, + y2: number, + z2: number, + w2: number, + ): Quat2Like; + /** + * Gets the real part of a dual quat + * @category Static + * + * @param out - real part + * @param a - Dual Quaternion + * @return `out` + */ + static getReal(out: QuatLike, a: Readonly): QuatLike; + /** + * Gets the dual part of a dual quat + * @category Static + * + * @param out - dual part + * @param a - Dual Quaternion + * @return `out` + */ + static getDual(out: QuatLike, a: Readonly): QuatLike; + /** + * Set the real component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the real part + * @return `out` + */ + static setReal(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Set the dual component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the dual part + * @return `out` + */ + static setDual(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Gets the translation of a normalized {@link Quat2} + * @category Static + * + * @param out - the receiving translation vector + * @param a - Dual Quaternion to be decomposed + * @return `out` + */ + static getTranslation(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Translates a {@link Quat2} by the given vector + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out: Quat2Like, a: Readonly, v: Readonly): Quat2Like; + /** + * Rotates a {@link Quat2} around the X axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out: Quat2Like, a: Readonly, rad: number): Quat2Like; + /** + * Rotates a {@link Quat2} around the Y axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out: Quat2Like, a: Readonly, rad: number): Quat2Like; + /** + * Rotates a {@link Quat2} around the Z axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out: Quat2Like, a: Readonly, rad: number): Quat2Like; + /** + * Rotates a {@link Quat2} by a given quaternion (a * q) + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param q - quaternion to rotate by + * @returns `out` + */ + static rotateByQuatAppend(out: Quat2Like, a: Readonly, q: Readonly): Quat2Like; + /** + * Rotates a {@link Quat2} by a given quaternion (q * a) + * @category Static + * + * @param out - the receiving dual quaternion + * @param q - quaternion to rotate by + * @param a - the dual quaternion to rotate + * @returns `out` + */ + static rotateByQuatPrepend(out: Quat2Like, q: Readonly, a: Readonly): Quat2Like; + /** + * Rotates a {@link Quat2} around a given axis. Does the normalization automatically + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param axis - the axis to rotate around + * @param rad - how far the rotation should be + * @returns `out` + */ + static rotateAroundAxis(out: Quat2Like, a: Readonly, axis: Readonly, rad: number): Quat2Like; + /** + * Adds two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like; + /** + * Multiplies two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns {quat2} out + */ + static multiply(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like; + /** + * Alias for {@link Quat2.multiply} + * @category Static + */ + static mul(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like; + /** + * Scales a {@link Quat2} by a scalar value + * @category Static + * + * @param out - the receiving dual quaterion + * @param a - the dual quaternion to scale + * @param b - scalar value to scale the dual quaterion by + * @returns `out` + */ + static scale(out: Quat2Like, a: Readonly, b: number): Quat2Like; + /** + * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts) + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a: Readonly, b: Readonly): number; + /** + * Performs a linear interpolation between two {@link Quat2}s + * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`) + * @category Static + * + * @param out - the receiving dual quat + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Quat2Like, a: Readonly, b: Readonly, t: number): Quat2Like; + /** + * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quat to calculate inverse of + * @returns `out` + */ + static invert(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than + * {@link Quat2.invert} and produces the same result. + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to calculate conjugate of + * @returns `out` + */ + static conjugate(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Calculates the magnitude (length) of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate length of + * @returns length of `a` + */ + static magnitude(a: Readonly): number; + /** + * Alias for {@link Quat2.magnitude} + * @category Static + */ + static mag(a: Readonly): number; + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + static length(a: Readonly): number; + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.mag} + */ + static len(a: Readonly): number; + /** + * Calculates the squared length of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a: Readonly): number; + /** + * Alias for {@link Quat2.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly): number; + /** + * Normalize a {@link Quat2} + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to normalize + * @returns `out` + */ + static normalize(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Returns a string representation of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to represent as a string + * @returns string representation of the vector + */ + static str(a: Readonly): string; + /** + * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether the {@link Quat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; +} + +/** + * 2 Dimensional Vector + */ +declare class Vec2 extends Float32Array { + /** + * Create a {@link Vec2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x(): number; + set x(value: number); + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y(): number; + set y(value: number); + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r(): number; + set r(value: number); + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g(): number; + set g(value: number); + /** + * The magnitude (length) of this. + * Equivalent to `Vec2.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number; + /** + * Alias for {@link Vec2.magnitude} + * + * @category Accessors + */ + get mag(): number; + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec2.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude(): number; + /** + * Alias for {@link Vec2.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag(): number; + /** + * A string representation of `this` + * Equivalent to `Vec2.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Vec2} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Adds a {@link Vec2} to `this`. + * Equivalent to `Vec2.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b: Readonly): this; + /** + * Subtracts a {@link Vec2} from `this`. + * Equivalent to `Vec2.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b: Readonly): this; + /** + * Alias for {@link Vec2.subtract} + * @category Methods + */ + sub(b: Readonly): this; + /** + * Multiplies `this` by a {@link Vec2}. + * Equivalent to `Vec2.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Vec2.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Divides `this` by a {@link Vec2}. + * Equivalent to `Vec2.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b: Readonly): this; + /** + * Alias for {@link Vec2.divide} + * @category Methods + */ + div(b: Readonly): this; + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec2.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b: number): this; + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b: Readonly, scale: number): this; + /** + * Calculates the Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b: Readonly): number; + /** + * Alias for {@link Vec2.distance} + * @category Methods + */ + dist(b: Readonly): number; + /** + * Calculates the squared Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b: Readonly): number; + /** + * Alias for {@link Vec2.squaredDistance} + * @category Methods + */ + sqrDist(b: Readonly): number; + /** + * Negates the components of `this`. + * Equivalent to `Vec2.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate(): this; + /** + * Inverts the components of `this`. + * Equivalent to `Vec2.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec2.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs(): this; + /** + * Calculates the dot product of this and another {@link Vec2}. + * Equivalent to `Vec2.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b: Readonly): number; + /** + * Normalize `this`. + * Equivalent to `Vec2.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize(): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec2}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, empty {@link Vec2} + * @category Static + * + * @returns A new 2D vector + */ + static create(): Vec2; + /** + * Creates a new {@link Vec2} initialized with values from an existing vector + * @category Static + * + * @param a - Vector to clone + * @returns A new 2D vector + */ + static clone(a: Readonly): Vec2; + /** + * Creates a new {@link Vec2} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @returns A new 2D vector + */ + static fromValues(x: number, y: number): Vec2; + /** + * Copy the values from one {@link Vec2} to another + * @category Static + * + * @param out - the receiving vector + * @param a - The source vector + * @returns `out` + */ + static copy(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Set the components of a {@link Vec2} to the given values + * @category Static + * + * @param out - The receiving vector + * @param x - X component + * @param y - Y component + * @returns `out` + */ + static set(out: Vec2Like, x: number, y: number): Vec2Like; + /** + * Adds two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static subtract(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Alias for {@link Vec2.subtract} + * @category Static + */ + static sub(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Multiplies two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Alias for {@link Vec2.multiply} + * @category Static + */ + static mul(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Divides two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static divide(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Alias for {@link Vec2.divide} + * @category Static + */ + static div(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Math.ceil the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to ceil + * @returns `out` + */ + static ceil(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Math.floor the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to floor + * @returns `out` + */ + static floor(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Returns the minimum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static min(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Returns the maximum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static max(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Math.round the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to round + * @returns `out` + */ + static round(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Scales a {@link Vec2} by a scalar number + * @category Static + * + * @param out - The receiving vector + * @param a - The vector to scale + * @param b - Amount to scale the vector by + * @returns `out` + */ + static scale(out: Vec2Like, a: Readonly, b: number): Vec2Like; + /** + * Adds two Vec2's after scaling the second operand by a scalar value + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param scale - The amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out: Vec2Like, a: Readonly, b: Readonly, scale: number): Vec2Like; + /** + * Calculates the Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns distance between `a` and `b` + */ + static distance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + static dist(a: Readonly, b: Readonly): number; + /** + * Calculates the squared Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Squared distance between `a` and `b` + */ + static squaredDistance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + static sqrDist(a: Readonly, b: Readonly): number; + /** + * Calculates the magnitude (length) of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a: Readonly): number; + /** + * Alias for {@link Vec2.magnitude} + * @category Static + */ + static mag(a: Readonly): number; + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + static length(a: Readonly): number; + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.mag} + */ + static len(a: Readonly): number; + /** + * Calculates the squared length of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate squared length of + * @returns Squared length of a + */ + static squaredLength(a: Readonly): number; + /** + * Alias for {@link Vec2.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly, b: Readonly): number; + /** + * Negates the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to negate + * @returns `out` + */ + static negate(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Returns the inverse of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to invert + * @returns `out` + */ + static inverse(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Returns the absolute value of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Normalize a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to normalize + * @returns `out` + */ + static normalize(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Calculates the dot product of two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Dot product of `a` and `b` + */ + static dot(a: Readonly, b: Readonly): number; + /** + * Computes the cross product of two {@link Vec2}s + * Note that the cross product must by definition produce a 3D vector. + * For this reason there is also not instance equivalent for this function. + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static cross(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Performs a linear interpolation between two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param t - Interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Vec2Like, a: Readonly, b: Readonly, t: number): Vec2Like; + /** + * Transforms the {@link Vec2} with a {@link Mat2} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like; + /** + * Transforms the {@link Vec2} with a {@link Mat2d} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2d(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like; + /** + * Transforms the {@link Vec2} with a {@link Mat3} + * 3rd vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat3(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like; + /** + * Transforms the {@link Vec2} with a {@link Mat4} + * 3rd vector component is implicitly '0' + * 4th vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat4(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like; + /** + * Rotate a 2D vector + * @category Static + * + * @param out - The receiving {@link Vec2} + * @param a - The {@link Vec2} point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotate(out: Vec2Like, a: Readonly, b: Readonly, rad: number): Vec2Like; + /** + * Get the angle between two 2D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static angle(a: Readonly, b: Readonly): number; + /** + * Set the components of a {@link Vec2} to zero + * @category Static + * + * @param out - The receiving vector + * @returns `out` + */ + static zero(out: Vec2Like): Vec2Like; + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors components are ===, `false` otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors are approximately equal, `false` otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - Vector to represent as a string + * @returns String representation of the vector + */ + static str(a: Readonly): string; +} + +/** + * 3 Dimensional Vector + */ +declare class Vec3 extends Float32Array { + /** + * Create a {@link Vec3}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x(): number; + set x(value: number); + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y(): number; + set y(value: number); + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z(): number; + set z(value: number); + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r(): number; + set r(value: number); + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g(): number; + set g(value: number); + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b(): number; + set b(value: number); + /** + * The magnitude (length) of this. + * Equivalent to `Vec3.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number; + /** + * Alias for {@link Vec3.magnitude} + * + * @category Accessors + */ + get mag(): number; + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec3.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude(): number; + /** + * Alias for {@link Vec3.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag(): number; + /** + * A string representation of `this` + * Equivalent to `Vec3.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Vec3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Adds a {@link Vec3} to `this`. + * Equivalent to `Vec3.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b: Readonly): this; + /** + * Subtracts a {@link Vec3} from `this`. + * Equivalent to `Vec3.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b: Readonly): this; + /** + * Alias for {@link Vec3.subtract} + * @category Methods + */ + sub(b: Readonly): this; + /** + * Multiplies `this` by a {@link Vec3}. + * Equivalent to `Vec3.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Vec3.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Divides `this` by a {@link Vec3}. + * Equivalent to `Vec3.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b: Readonly): this; + /** + * Alias for {@link Vec3.divide} + * @category Methods + */ + div(b: Readonly): this; + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec3.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b: number): this; + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b: Readonly, scale: number): this; + /** + * Calculates the Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b: Readonly): number; + /** + * Alias for {@link Vec3.distance} + * @category Methods + */ + dist(b: Readonly): number; + /** + * Calculates the squared Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b: Readonly): number; + /** + * Alias for {@link Vec3.squaredDistance} + * @category Methods + */ + sqrDist(b: Readonly): number; + /** + * Negates the components of `this`. + * Equivalent to `Vec3.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate(): this; + /** + * Inverts the components of `this`. + * Equivalent to `Vec3.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Sets each component of `this` to its absolute value. + * Equivalent to `Vec3.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs(): this; + /** + * Calculates the dot product of this and another {@link Vec3}. + * Equivalent to `Vec3.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b: Readonly): number; + /** + * Normalize `this`. + * Equivalent to `Vec3.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize(): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec3}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, empty vec3 + * @category Static + * + * @returns a new 3D vector + */ + static create(): Vec3; + /** + * Creates a new vec3 initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 3D vector + */ + static clone(a: Readonly): Vec3; + /** + * Calculates the magnitude (length) of a {@link Vec3} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a: Readonly): number; + /** + * Alias for {@link Vec3.magnitude} + * @category Static + */ + static mag(a: Readonly): number; + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + static length(a: Readonly): number; + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.mag} + */ + static len(a: Readonly): number; + /** + * Creates a new vec3 initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns a new 3D vector + */ + static fromValues(x: number, y: number, z: number): Vec3; + /** + * Copy the values from one vec3 to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Set the components of a vec3 to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns `out` + */ + static set(out: Vec3Like, x: number, y: number, z: number): Vec3Like; + /** + * Adds two {@link Vec3}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Alias for {@link Vec3.subtract} + * @category Static + */ + static sub(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Multiplies two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Alias for {@link Vec3.multiply} + * @category Static + */ + static mul(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Divides two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Alias for {@link Vec3.divide} + * @category Static + */ + static div(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Math.ceil the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Math.floor the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Returns the minimum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Returns the maximum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * symmetric round the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + /** + * Scales a vec3 by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out: Vec3Like, a: Readonly, scale: number): Vec3Like; + /** + * Adds two vec3's after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out: Vec3Like, a: Readonly, b: Readonly, scale: number): Vec3Like; + /** + * Calculates the Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec3.distance} + * @category Static + */ + static dist(a: Readonly, b: Readonly): number; + /** + * Calculates the squared Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec3.squaredDistance} + * @category Static + */ + static sqrDist(a: Readonly, b: Readonly): number; + /** + * Calculates the squared length of a vec3 + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a: Readonly): number; + /** + * Alias for {@link Vec3.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly, b: Readonly): number; + /** + * Negates the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Returns the inverse of the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Returns the absolute value of the components of a {@link Vec3} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Normalize a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Calculates the dot product of two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a: Readonly, b: Readonly): number; + /** + * Computes the cross product of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static cross(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Performs a linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like; + /** + * Performs a spherical linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like; + /** + * Performs a hermite interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static hermite( + out: Vec3Like, + a: Readonly, + b: Readonly, + c: Readonly, + d: Readonly, + t: number, + ): Vec3Like; + /** + * Performs a bezier interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static bezier( + out: Vec3Like, + a: Readonly, + b: Readonly, + c: Readonly, + d: Readonly, + t: number, + ): Vec3Like; + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned + * @returns `out` + */ + /** + * Transforms the vec3 with a mat4. + * 4th vector component is implicitly '1' + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out: Vec3Like, a: Readonly, m: Readonly): Vec3Like; + /** + * Transforms the vec3 with a mat3. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - the 3x3 matrix to transform with + * @returns `out` + */ + static transformMat3(out: Vec3Like, a: Vec3Like, m: Mat3Like): Vec3Like; + /** + * Transforms the vec3 with a quat + * Can also be used for dual quaternions. (Multiply it with the real part) + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out: Vec3Like, a: Readonly, q: Readonly): Vec3Like; + /** + * Rotate a 3D vector around the x-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateX(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like; + /** + * Rotate a 3D vector around the y-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateY(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like; + /** + * Rotate a 3D vector around the z-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateZ(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like; + /** + * Get the angle between two 3D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static angle(a: Readonly, b: Readonly): number; + /** + * Set the components of a vec3 to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out: Vec3Like): Vec3Like; + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a: Readonly): string; + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; +} + +/** + * 4 Dimensional Vector + */ +declare class Vec4 extends Float32Array { + /** + * Create a {@link Vec4}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x(): number; + set x(value: number); + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y(): number; + set y(value: number); + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z(): number; + set z(value: number); + /** + * The w component of the vector. Equivalent to `this[3];` + * @category Vector Components + */ + get w(): number; + set w(value: number); + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r(): number; + set r(value: number); + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g(): number; + set g(value: number); + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b(): number; + set b(value: number); + /** + * The a component of the vector. Equivalent to `this[3];` + * @category Color Components + */ + get a(): number; + set a(value: number); + /** + * The magnitude (length) of this. + * Equivalent to `Vec4.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number; + /** + * Alias for {@link Vec4.magnitude} + * + * @category Accessors + */ + get mag(): number; + /** + * A string representation of `this` + * Equivalent to `Vec4.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Vec4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Adds a {@link Vec4} to `this`. + * Equivalent to `Vec4.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b: Readonly): this; + /** + * Subtracts a {@link Vec4} from `this`. + * Equivalent to `Vec4.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b: Readonly): this; + /** + * Alias for {@link Vec4.subtract} + * @category Methods + */ + sub(b: Readonly): this; + /** + * Multiplies `this` by a {@link Vec4}. + * Equivalent to `Vec4.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Vec4.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Divides `this` by a {@link Vec4}. + * Equivalent to `Vec4.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b: Readonly): this; + /** + * Alias for {@link Vec4.divide} + * @category Methods + */ + div(b: Readonly): this; + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec4.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b: number): this; + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b: Readonly, scale: number): this; + /** + * Calculates the Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b: Readonly): number; + /** + * Alias for {@link Vec4.distance} + * @category Methods + */ + dist(b: Readonly): number; + /** + * Calculates the squared Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b: Readonly): number; + /** + * Alias for {@link Vec4.squaredDistance} + * @category Methods + */ + sqrDist(b: Readonly): number; + /** + * Negates the components of `this`. + * Equivalent to `Vec4.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate(): this; + /** + * Inverts the components of `this`. + * Equivalent to `Vec4.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec4.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs(): this; + /** + * Calculates the dot product of this and another {@link Vec4}. + * Equivalent to `Vec4.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b: Readonly): number; + /** + * Normalize `this`. + * Equivalent to `Vec4.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize(): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec4}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, empty {@link Vec4} + * @category Static + * + * @returns a new 4D vector + */ + static create(): Vec4; + /** + * Creates a new {@link Vec4} initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 4D vector + */ + static clone(a: Vec4Like): Vec4; + /** + * Creates a new {@link Vec4} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new 4D vector + */ + static fromValues(x: number, y: number, z: number, w: number): Vec4; + /** + * Copy the values from one {@link Vec4} to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Set the components of a {@link Vec4} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + static set(out: Vec4Like, x: number, y: number, z: number, w: number): Vec4Like; + /** + * Adds two {@link Vec4}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Alias for {@link Vec4.subtract} + * @category Static + */ + static sub(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Multiplies two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Alias for {@link Vec4.multiply} + * @category Static + */ + static mul(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Divides two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Alias for {@link Vec4.divide} + * @category Static + */ + static div(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Math.ceil the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Math.floor the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Returns the minimum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Returns the maximum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Math.round the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + static round(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Scales a {@link Vec4} by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out: Vec4Like, a: Readonly, scale: number): Vec4Like; + /** + * Adds two {@link Vec4}'s after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out: Vec4Like, a: Readonly, b: Readonly, scale: number): Vec4Like; + /** + * Calculates the Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec4.distance} + * @category Static + */ + static dist(a: Readonly, b: Readonly): number; + /** + * Calculates the squared Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec4.squaredDistance} + * @category Static + */ + static sqrDist(a: Readonly, b: Readonly): number; + /** + * Calculates the magnitude (length) of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate length of + * @returns length of `a` + */ + static magnitude(a: Readonly): number; + /** + * Alias for {@link Vec4.magnitude} + * @category Static + */ + static mag(a: Readonly): number; + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + static length(a: Readonly): number; + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.mag} + */ + static len(a: Readonly): number; + /** + * Calculates the squared length of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a: Readonly): number; + /** + * Alias for {@link Vec4.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly): number; + /** + * Negates the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Returns the inverse of the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Returns the absolute value of the components of a {@link Vec4} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Normalize a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Calculates the dot product of two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a: Readonly, b: Readonly): number; + /** + * Returns the cross-product of three vectors in a 4-dimensional space + * @category Static + * + * @param out the receiving vector + * @param u - the first vector + * @param v - the second vector + * @param w - the third vector + * @returns result + */ + static cross(out: Vec4Like, u: Readonly, v: Readonly, w: Readonly): Vec4Like; + /** + * Performs a linear interpolation between two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Vec4Like, a: Readonly, b: Readonly, t: number): Vec4Like; + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns `out` + */ + /** + * Transforms the {@link Vec4} with a {@link Mat4}. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out: Vec4Like, a: Readonly, m: Readonly): Vec4Like; + /** + * Transforms the {@link Vec4} with a {@link Quat} + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out: Vec4Like, a: Readonly, q: Readonly): Vec4Like; + /** + * Set the components of a {@link Vec4} to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out: Vec4Like): Vec4Like; + /** + * Returns a string representation of a {@link Vec4} + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a: Readonly): string; + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; +} + +/** + * To enable additional swizzle accessors for vector classes (32-bit) invoke the {@link EnableSwizzles} function from + * the `gl-matrix/swizzle` sub-path export. To enable ambient module declarations for IDE / Typescript support please + * see {@link gl-matrix/types/swizzle}. + * + * To enable swizzling for the 64-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle/f64}. + * + * @example + * ```ts + * import { Vec3 } from 'gl-matrix'; + * import { EnableSwizzles } from 'gl-matrix/swizzle'; + * + * EnableSwizzles(); + * + * const vec = new Vec3(0, 1, 2); + * const vecSwizzled = vec.zyx; // Returns a new Vec3(2, 1, 0). + * ``` + * + * @packageDocumentation + */ +/** + * Enables Swizzle operations on {@link gl-matrix.Vec2 | Vec2} / {@link gl-matrix.Vec3 | Vec3} / + * {@link gl-matrix.Vec4 | Vec4} types from {@link gl-matrix | gl-matrix} (32-bit). + * + * Swizzle operations are performed by using the `.` operator in conjunction with any combination + * of between two and four component names, either from the set `xyzw` or `rgbw` (though not intermixed). + * They return a new vector with the same number of components as specified in the swizzle attribute. + * + * @example + * ```js + * import { Vec3, EnableSwizzles } from 'gl-matrix'; + * + * EnableSwizzles(); + * + * let v = new Vec3(0, 1, 2); + * + * v.yx; // returns new Vec2(1, 0) + * v.xzy; // returns new Vec3(0, 2, 1) + * v.zyxz; // returns new Vec4(2, 1, 0, 2) + * + * v.rgb; // returns new Vec3(0, 1, 2) + * v.rbg; // returns new Vec3(0, 2, 1) + * v.gg; // returns new Vec2(1, 1) + * ``` + */ +declare function EnableSwizzles(): void; + +/** + * Ambient module declarations for `gl-matrix` (32-bit) swizzle extensions for vector classes. + * + * When swizzle accessors via {@link gl-matrix/swizzle.EnableSwizzles | EnableSwizzles} are enabled include this + * sub-path export as a `side effect` import to add ambient module declarations for the additional accessors to + * {@link gl-matrix.Vec2 | Vec2} / {@link gl-matrix.Vec3 | Vec3} / {@link gl-matrix.Vec4 | Vec4} + * + * To enable swizzling for the 32-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle}. + * + * ```js + * import { Vec2 } from 'gl-matrix'; + * import { EnableSwizzles } from 'gl-matrix/swizzle'; + * + * import 'gl-matrix/types/swizzle'; + * + * EnableSwizzles(); + * + * const vec = new Vec2(0, 1); + * + * // Swizzled instance - returns new Vec2(1, 0). + * const vecSwizzled = vec.yx; + * ``` + * + * @packageDocumentation + */ + +/** + * A type alias for Vec2 (32-bit). + * @hidden + */ +type Vec2Alias = Vec2; +/** + * A type alias for Vec3 (32-bit). + * @hidden + */ +type Vec3Alias = Vec3; +/** + * A type alias for Vec4 (32-bit). + * @hidden + */ +type Vec4Alias = Vec4; + +/** + * Vec2 swizzle extension accessors. + */ +interface Vec2 { + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggg(): Vec4Alias; +} +/** + * Vec3 swizzle extension accessors. + */ +interface Vec3 { + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get br(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbb(): Vec4Alias; +} +/** + * Vec4 swizzle extension accessors. + */ +interface Vec4 { + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get br(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xw(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yw(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zw(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get wx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get wy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get wz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ww(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xwx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xwy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xwz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xww(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ywx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ywy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ywz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yww(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zwx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zwy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zwz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zww(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wwx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wwy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wwz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get www(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ra(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ga(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ba(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ar(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ag(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ab(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get aa(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rra(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get raa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gra(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gaa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bra(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get baa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get arr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get arg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get arb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ara(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get agr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get agg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get agb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get abr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get abg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get abb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aaa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rraa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rarr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rarg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rarb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ragr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ragg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ragb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rabr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rabg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rabb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get graa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get garr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get garg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get garb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gagr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gagg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gagb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gabr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gabg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gabb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get braa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get barr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get barg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get barb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bagr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bagg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bagb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get babr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get babg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get babb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get argr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get argg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get argb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get araa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aarr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aarg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aarb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aagr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aagg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aagb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aabr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aabg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aabb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaaa(): Vec4Alias; +} + +/** + * Convert `radians` to `degrees`. + * + * @param value - Angle in `radians`. + * @returns Angle in `degrees`. + */ +declare function toDegree(value: number): number; +/** + * Convert `degrees` to `radians`. + * + * @param value - Angle in `degrees`. + * @returns Angle in `radians`. + */ +declare function toRadian(value: number): number; + +export { + EnableSwizzles, + type FloatArray, + Mat2, + type Mat2Like, + Mat2d, + type Mat2dLike, + Mat3, + type Mat3Like, + Mat4, + type Mat4Like, + Quat, + Quat2, + type Quat2Like, + type QuatLike, + Vec2, + type Vec2Like, + Vec3, + type Vec3Like, + Vec4, + type Vec4Like, + Mat2 as mat2, + Mat2d as mat2d, + Mat3 as mat3, + Mat4 as mat4, + Quat as quat, + Quat2 as quat2, + toDegree, + toRadian, + Vec2 as vec2, + Vec3 as vec3, + Vec4 as vec4, +}; diff --git a/dist-cdn/types/gl-matrix-f64.d.cts b/dist-cdn/types/gl-matrix-f64.d.cts new file mode 100644 index 00000000..e1de483f --- /dev/null +++ b/dist-cdn/types/gl-matrix-f64.d.cts @@ -0,0 +1,9903 @@ +/** + * Provides an all-inclusive ESM distribution of `gl-matrix` (64-bit). All library classes extends `Float64Array`. + * + * @packageDocumentation + */ + +/** + * Provides all common type declarations shared across `gl-matrix`. + * + * ```ts + * import { Vec3 } from 'gl-matrix'; + * import type { Vec3Like } from 'gl-matrix/types'; + * + * const vec: Vec3Like = new Vec3(0, 1, 2); + * ``` + * + * For JSDoc using the new Typescript 5.5 `@import` tag: + * ```js + * /** + * * @import { Vec3Like } from 'gl-matrix/types' + * *\/ + * ``` + * + * For JSDoc using the older `import types` Typescript mechanism: + * ```js + * /** + * * @type {import('gl-matrix/types').Vec3Like} + * *\/ + * ``` + * + * @packageDocumentation + */ +/** + * The floating-point typed arrays that can be used in place of a vector, matrix, or quaternion. + */ +type FloatArray = Float32Array | Float64Array; +/** + * A 2x2 Matrix given as a {@link Mat2}, a 4-element floating-point TypedArray, or an array of 4 numbers. + */ +type Mat2Like = [number, number, number, number] | FloatArray; +/** + * A 2x3 Matrix given as a {@link Mat2d}, a 6-element floating-point TypedArray, or an array of 6 numbers. + */ +type Mat2dLike = [number, number, number, number, number, number] | FloatArray; +/** + * A 3x3 Matrix given as a {@link Mat3}, a 9-element floating-point TypedArray, or an array of 9 numbers. + */ +type Mat3Like = [number, number, number, number, number, number, number, number, number] | FloatArray; +/** + * A 4x4 Matrix given as a {@link Mat4}, a 16-element floating-point TypedArray, or an array of 16 numbers. + */ +type Mat4Like = + | [ + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + ] + | FloatArray; +/** + * A Quaternion given as a {@link Quat}, a 4-element floating-point TypedArray, or an array of 4 numbers. + */ +type QuatLike = Vec4Like; +/** + * A Dual Quaternion given as a {@link Quat2}, an 8-element floating-point TypedArray, or an array of 8 numbers. + */ +type Quat2Like = [number, number, number, number, number, number, number, number] | FloatArray; +/** + * A 2-dimensional vector given as a {@link Vec2}, a 2-element floating-point TypedArray, or an array of 2 numbers. + */ +type Vec2Like = [number, number] | FloatArray; +/** + * A 3-dimensional vector given as a {@link Vec3}, a 3-element floating-point TypedArray, or an array of 3 numbers. + */ +type Vec3Like = [number, number, number] | FloatArray; +/** + * A 4-dimensional vector given as a {@link Vec4}, a 4-element floating-point TypedArray, or an array of 4 numbers. + */ +type Vec4Like = [number, number, number, number] | FloatArray; + +/** + * A 2x2 Matrix + */ +declare class Mat2 extends Float64Array { + #private; + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * A string representation of `this` + * Equivalent to `Mat2.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Mat2} into `this`. + * + * @param a the source vector + * @returns `this` + * @category Methods + */ + copy(a: Readonly): this; + /** + * Set `this` to the identity matrix + * Equivalent to Mat2.identity(this) + * + * @returns `this` + * @category Methods + */ + identity(): this; + /** + * Multiplies this {@link Mat2} against another one + * Equivalent to `Mat2.multiply(this, this, b);` + * + * @param b - The second operand + * @returns `this` + * @category Methods + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Mat2.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Transpose this {@link Mat2} + * Equivalent to `Mat2.transpose(this, this);` + * + * @returns `this` + * @category Methods + */ + transpose(): this; + /** + * Inverts this {@link Mat2} + * Equivalent to `Mat4.invert(this, this);` + * + * @returns `this` + * @category Methods + */ + invert(): this; + /** + * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2.scale(this, this, v);` + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + * @category Methods + */ + scale(v: Readonly): this; + /** + * Rotates this {@link Mat2} by the given angle around the given axis + * Equivalent to `Mat2.rotate(this, this, rad);` + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + * @category Methods + */ + rotate(rad: number): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, identity {@link Mat2} + * @category Static + * + * @returns A new {@link Mat2} + */ + static create(): Mat2; + /** + * Creates a new {@link Mat2} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2} + */ + static clone(a: Readonly): Mat2; + /** + * Copy the values from one {@link Mat2} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out: Mat2Like, a: Readonly): Mat2Like; + /** + * Create a new {@link Mat2} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2} + */ + static fromValues(...values: number[]): Mat2; + /** + * Set the components of a {@link Mat2} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out: Mat2Like, ...values: number[]): Mat2Like; + /** + * Set a {@link Mat2} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out: Mat2Like): Mat2Like; + /** + * Transpose the values of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out: Mat2Like, a: Readonly): Mat2Like; + /** + * Inverts a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out: Mat2Like, a: Mat2Like): Mat2Like | null; + /** + * Calculates the adjugate of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out: Mat2Like, a: Mat2Like): Mat2Like; + /** + * Calculates the determinant of a {@link Mat2} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a: Readonly): number; + /** + * Adds two {@link Mat2}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like; + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like; + /** + * Alias for {@link Mat2.subtract} + * @category Static + */ + static sub(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like; + /** + * Multiplies two {@link Mat2}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like; + /** + * Alias for {@link Mat2.multiply} + * @category Static + */ + static mul(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like; + /** + * Rotates a {@link Mat2} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out: Mat2Like, a: Readonly, rad: number): Mat2Like; + /** + * Scales the {@link Mat2} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out: Mat2Like, a: Readonly, v: Readonly): Mat2Like; + /** + * Creates a {@link Mat2} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out: Mat2Like, rad: number): Mat2Like; + /** + * Creates a {@link Mat2} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out: Mat2Like, v: Readonly): Mat2Like; + /** + * Returns Frobenius norm of a {@link Mat2} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a: Readonly): number; + /** + * Multiply each element of a {@link Mat2} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out: Mat2Like, a: Readonly, b: number): Mat2Like; + /** + * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out: Mat2Like, a: Readonly, b: Readonly, scale: number): Mat2Like; + /** + * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix + * @category Static + * + * @param L - the lower triangular matrix + * @param D - the diagonal matrix + * @param U - the upper triangular matrix + * @param a - the input matrix to factorize + */ + static LDU( + L: Mat2Like, + D: Readonly, + U: Mat2Like, + a: Readonly, + ): [Mat2Like, Readonly, Mat2Like]; + /** + * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether two {@link Mat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Returns a string representation of a {@link Mat2} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a: Readonly): string; +} + +/** + * A 2x3 Matrix + */ +declare class Mat2d extends Float64Array { + #private; + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * A string representation of `this` + * Equivalent to `Mat2d.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Mat2d} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Set `this` to the identity matrix + * Equivalent to Mat2d.identity(this) + * @category Methods + * + * @returns `this` + */ + identity(): this; + /** + * Multiplies this {@link Mat2d} against another one + * Equivalent to `Mat2d.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Mat2d.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Translate this {@link Mat2d} by the given vector + * Equivalent to `Mat2d.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v: Readonly): this; + /** + * Rotates this {@link Mat2d} by the given angle around the given axis + * Equivalent to `Mat2d.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad: number): this; + /** + * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2d.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v: Readonly): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2d}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, identity {@link Mat2d} + * @category Static + * + * @returns A new {@link Mat2d} + */ + static create(): Mat2d; + /** + * Creates a new {@link Mat2d} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2d} + */ + static clone(a: Readonly): Mat2d; + /** + * Copy the values from one {@link Mat2d} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out: Mat2dLike, a: Readonly): Mat2dLike; + /** + * Create a new {@link Mat2d} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2d} + */ + static fromValues(...values: number[]): Mat2d; + /** + * Set the components of a {@link Mat2d} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out: Mat2dLike, ...values: number[]): Mat2dLike; + /** + * Set a {@link Mat2d} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out: Mat2dLike): Mat2dLike; + /** + * Inverts a {@link Mat2d} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out: Mat2dLike, a: Mat2dLike): Mat2dLike | null; + /** + * Calculates the determinant of a {@link Mat2d} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a: Readonly): number; + /** + * Adds two {@link Mat2d}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike; + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike; + /** + * Alias for {@link Mat2d.subtract} + * @category Static + */ + static sub(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike; + /** + * Multiplies two {@link Mat2d}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike; + /** + * Alias for {@link Mat2d.multiply} + * @category Static + */ + static mul(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike; + /** + * Translate a {@link Mat2d} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike; + /** + * Rotates a {@link Mat2d} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out: Mat2dLike, a: Readonly, rad: number): Mat2dLike; + /** + * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike; + /** + * Creates a {@link Mat2d} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out: Mat2dLike, v: Readonly): Mat2dLike; + /** + * Creates a {@link Mat2d} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out: Mat2dLike, rad: number): Mat2dLike; + /** + * Creates a {@link Mat2d} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out: Mat2dLike, v: Readonly): Mat2dLike; + /** + * Returns Frobenius norm of a {@link Mat2d} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a: Readonly): number; + /** + * Multiply each element of a {@link Mat2d} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out: Mat2dLike, a: Readonly, b: number): Mat2dLike; + /** + * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out: Mat2dLike, a: Readonly, b: Readonly, scale: number): Mat2dLike; + /** + * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether two {@link Mat2d}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Returns a string representation of a {@link Mat2d} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a: Readonly): string; +} + +/** + * A 3x3 Matrix + */ +declare class Mat3 extends Float64Array { + #private; + /** + * Create a {@link Mat3}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * A string representation of `this` + * Equivalent to `Mat3.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Mat3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Set `this` to the identity matrix + * Equivalent to Mat3.identity(this) + * @category Methods + * + * @returns `this` + */ + identity(): this; + /** + * Multiplies this {@link Mat3} against another one + * Equivalent to `Mat3.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Mat3.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Transpose this {@link Mat3} + * Equivalent to `Mat3.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose(): this; + /** + * Inverts this {@link Mat3} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Translate this {@link Mat3} by the given vector + * Equivalent to `Mat3.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v: Readonly): this; + /** + * Rotates this {@link Mat3} by the given angle around the given axis + * Equivalent to `Mat3.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad: number): this; + /** + * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat3.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v: Readonly): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat3}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, identity {@link Mat3} + * @category Static + * + * @returns A new {@link Mat3} + */ + static create(): Mat3; + /** + * Creates a new {@link Mat3} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat3} + */ + static clone(a: Readonly): Mat3; + /** + * Copy the values from one {@link Mat3} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out: Mat3Like, a: Readonly): Mat3Like; + /** + * Create a new {@link Mat3} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat3} + */ + static fromValues(...values: number[]): Mat3; + /** + * Set the components of a {@link Mat3} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out: Mat3Like, ...values: number[]): Mat3Like; + /** + * Set a {@link Mat3} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out: Mat3Like): Mat3Like; + /** + * Transpose the values of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out: Mat3Like, a: Readonly): Mat3Like; + /** + * Inverts a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out: Mat3Like, a: Mat3Like): Mat3Like | null; + /** + * Calculates the adjugate of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out: Mat3Like, a: Mat3Like): Mat3Like; + /** + * Calculates the determinant of a {@link Mat3} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a: Readonly): number; + /** + * Adds two {@link Mat3}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like; + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like; + /** + * Alias for {@link Mat3.subtract} + * @category Static + */ + static sub(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like; + /** + * Multiplies two {@link Mat3}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like; + /** + * Alias for {@link Mat3.multiply} + * @category Static + */ + static mul(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like; + /** + * Translate a {@link Mat3} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like; + /** + * Rotates a {@link Mat3} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out: Mat3Like, a: Readonly, rad: number): Mat3Like; + /** + * Scales the {@link Mat3} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like; + /** + * Creates a {@link Mat3} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out: Mat3Like, v: Readonly): Mat3Like; + /** + * Creates a {@link Mat3} from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat3.identity(dest); + * mat3.rotate(dest, dest, rad); + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out: Mat3Like, rad: number): Mat3Like; + /** + * Creates a {@link Mat3} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out: Mat3Like, v: Readonly): Mat3Like; + /** + * Copies the upper-left 3x3 values of a {@link Mat2d} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 2x3 matrix + * @returns `out` + */ + static fromMat2d(out: Mat3Like, a: Readonly): Mat3Like; + /** + * Calculates a {@link Mat3} from the given quaternion + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param q - {@link Quat} to create matrix from + * @returns `out` + */ + static fromQuat(out: Mat3Like, q: Readonly): Mat3Like; + /** + * Copies the upper-left 3x3 values of a {@link Mat4} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 4x4 matrix + * @returns `out` + */ + static fromMat4(out: Mat3Like, a: Readonly): Mat3Like; + /** + * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix + * @category Static + * + * @param {mat3} out mat3 receiving operation result + * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out: Mat3Like, a: Readonly): Mat3Like | null; + /** + * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out: Mat3Like, a: Readonly): Mat3Like; + /** + * Generates a 2D projection matrix with the given bounds + * @category Static + * + * @param out mat3 frustum matrix will be written into + * @param width Width of your gl context + * @param height Height of gl context + * @returns `out` + */ + static projection(out: Mat3Like, width: number, height: number): Mat3Like; + /** + * Returns Frobenius norm of a {@link Mat3} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a: Readonly): number; + /** + * Multiply each element of a {@link Mat3} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out: Mat3Like, a: Readonly, b: number): Mat3Like; + /** + * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out: Mat3Like, a: Readonly, b: Readonly, scale: number): Mat3Like; + /** + * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether two {@link Mat3}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Returns a string representation of a {@link Mat3} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a: Readonly): string; +} + +/** + * A 4x4 Matrix + */ +declare class Mat4 extends Float64Array { + #private; + /** + * Create a {@link Mat4}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * A string representation of `this` + * Equivalent to `Mat4.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Mat4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Set `this` to the identity matrix + * Equivalent to Mat4.identity(this) + * @category Methods + * + * @returns `this` + */ + identity(): this; + /** + * Multiplies this {@link Mat4} against another one + * Equivalent to `Mat4.multiply(this, this, b);` + * @category Methods + * + * @param b - The second operand + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Mat4.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Transpose this {@link Mat4} + * Equivalent to `Mat4.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose(): this; + /** + * Inverts this {@link Mat4} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Translate this {@link Mat4} by the given vector + * Equivalent to `Mat4.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to translate by + * @returns `this` + */ + translate(v: Readonly): this; + /** + * Rotates this {@link Mat4} by the given angle around the given axis + * Equivalent to `Mat4.rotate(this, this, rad, axis);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `this` + */ + rotate(rad: number, axis: Readonly): this; + /** + * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat4.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to scale the matrix by + * @returns `this` + */ + scale(v: Readonly): this; + /** + * Rotates this {@link Mat4} by the given angle around the X axis + * Equivalent to `Mat4.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateX(rad: number): this; + /** + * Rotates this {@link Mat4} by the given angle around the Y axis + * Equivalent to `Mat4.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateY(rad: number): this; + /** + * Rotates this {@link Mat4} by the given angle around the Z axis + * Equivalent to `Mat4.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateZ(rad: number): this; + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveNO(fovy: number, aspect: number, near: number, far: number): this; + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveZO(fovy: number, aspect: number, near: number, far: number): this; + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoNO(left: number, right: number, bottom: number, top: number, near: number, far: number): this; + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoZO(left: number, right: number, bottom: number, top: number, near: number, far: number): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat4}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, identity {@link Mat4} + * @category Static + * + * @returns A new {@link Mat4} + */ + static create(): Mat4; + /** + * Creates a new {@link Mat4} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat4} + */ + static clone(a: Readonly): Mat4; + /** + * Copy the values from one {@link Mat4} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out: Mat4Like, a: Readonly): Mat4Like; + /** + * Create a new mat4 with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat4} + */ + static fromValues(...values: number[]): Mat4; + /** + * Set the components of a mat4 to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out: Mat4Like, ...values: number[]): Mat4Like; + /** + * Set a {@link Mat4} to the identity matrix + * @category Static + * + * @param out - The receiving Matrix + * @returns `out` + */ + static identity(out: Mat4Like): Mat4Like; + /** + * Transpose the values of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out: Mat4Like, a: Readonly): Mat4Like; + /** + * Inverts a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out: Mat4Like, a: Mat4Like): Mat4Like | null; + /** + * Calculates the adjugate of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out: Mat4Like, a: Mat4Like): Mat4Like; + /** + * Calculates the determinant of a {@link Mat4} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a: Readonly): number; + /** + * Multiplies two {@link Mat4}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like; + /** + * Alias for {@link Mat4.multiply} + * @category Static + */ + static mul(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like; + /** + * Translate a {@link Mat4} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like; + /** + * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec3} to scale the matrix by + * @returns `out` + **/ + static scale(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like; + /** + * Rotates a {@link Mat4} by the given angle around the given axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if axis has a length of 0 + */ + static rotate(out: Mat4Like, a: Readonly, rad: number, axis: Readonly): Mat4Like | null; + /** + * Rotates a matrix by the given angle around the X axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateX(out: Mat4Like, a: Readonly, rad: number): Mat4Like; + /** + * Rotates a matrix by the given angle around the Y axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateY(out: Mat4Like, a: Readonly, rad: number): Mat4Like; + /** + * Rotates a matrix by the given angle around the Z axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateZ(out: Mat4Like, a: Readonly, rad: number): Mat4Like; + /** + * Creates a {@link Mat4} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out: Mat4Like, v: Readonly): Mat4Like; + /** + * Creates a {@link Mat4} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out: Mat4Like, v: Readonly): Mat4Like; + /** + * Creates a {@link Mat4} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotate(dest, dest, rad, axis); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if `axis` has a length of 0 + */ + static fromRotation(out: Mat4Like, rad: number, axis: Readonly): Mat4Like | null; + /** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateX(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromXRotation(out: Mat4Like, rad: number): Mat4Like; + /** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateY(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromYRotation(out: Mat4Like, rad: number): Mat4Like; + /** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateZ(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromZRotation(out: Mat4Like, rad: number): Mat4Like; + /** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @returns `out` + */ + static fromRotationTranslation(out: Mat4Like, q: Readonly, v: Readonly): Mat4Like; + /** + * Sets a {@link Mat4} from a {@link Quat2}. + * @category Static + * + * @param out - Matrix + * @param a - Dual Quaternion + * @returns `out` + */ + static fromQuat2(out: Mat4Like, a: Quat2Like): Mat4Like; + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out: Mat4Like, a: Readonly): Mat4Like | null; + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out: Mat4Like, a: Readonly): Mat4Like; + /** + * Returns the translation vector component of a transformation + * matrix. If a matrix is built with fromRotationTranslation, + * the returned vector will be the same as the translation vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive translation component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getTranslation(out: Vec3Like, mat: Readonly): Vec3Like; + /** + * Returns the scaling factor component of a transformation + * matrix. If a matrix is built with fromRotationTranslationScale + * with a normalized Quaternion parameter, the returned vector will be + * the same as the scaling vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive scaling factor component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getScaling(out: Vec3Like, mat: Readonly): Vec3Like; + /** + * Returns a quaternion representing the rotational component + * of a transformation matrix. If a matrix is built with + * fromRotationTranslation, the returned quaternion will be the + * same as the quaternion originally supplied. + * @category Static + * + * @param out - Quaternion to receive the rotation component + * @param mat - Matrix to be decomposed (input) + * @return `out` + */ + static getRotation(out: QuatLike, mat: Readonly): QuatLike; + /** + * Decomposes a transformation matrix into its rotation, translation + * and scale components. Returns only the rotation component + * @category Static + * + * @param out_r - Quaternion to receive the rotation component + * @param out_t - Vector to receive the translation vector + * @param out_s - Vector to receive the scaling factor + * @param mat - Matrix to be decomposed (input) + * @returns `out_r` + */ + static decompose(out_r: QuatLike, out_t: Vec3Like, out_s: Vec3Like, mat: Readonly): QuatLike; + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @returns `out` + */ + static fromRotationTranslationScale( + out: Mat4Like, + q: Readonly, + v: Readonly, + s: Readonly, + ): Mat4Like; + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the + * given origin. This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * mat4.translate(dest, origin); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * mat4.translate(dest, negativeOrigin); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @param o - The origin vector around which to scale and rotate + * @returns `out` + */ + static fromRotationTranslationScaleOrigin( + out: Mat4Like, + q: Readonly, + v: Readonly, + s: Readonly, + o: Readonly, + ): Mat4Like; + /** + * Calculates a 4x4 matrix from the given quaternion + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Quaternion to create matrix from + * @returns `out` + */ + static fromQuat(out: Mat4Like, q: Readonly): Mat4Like; + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumNO( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far?: number, + ): Mat4Like; + /** + * Alias for {@link Mat4.frustumNO} + * @category Static + * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly + */ + static frustum( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far?: number, + ): Mat4Like; + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumZO( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far?: number, + ): Mat4Like; + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveNO(out: Mat4Like, fovy: number, aspect: number, near: number, far?: number): Mat4Like; + /** + * Alias for {@link Mat4.perspectiveNO} + * @category Static + * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly + */ + static perspective(out: Mat4Like, fovy: number, aspect: number, near: number, far?: number): Mat4Like; + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveZO(out: Mat4Like, fovy: number, aspect: number, near: number, far?: number): Mat4Like; + /** + * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating + * projection matrices to be used with the still experimental WebVR API. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + * @deprecated + */ + static perspectiveFromFieldOfView( + out: Mat4Like, + fov: { + upDegrees: number; + downDegrees: number; + leftDegrees: number; + rightDegrees: number; + }, + near: number, + far: number, + ): Mat4Like; + /** + * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoNO( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far: number, + ): Mat4Like; + /** + * Alias for {@link Mat4.orthoNO} + * @category Static + * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly + */ + static ortho( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far: number, + ): Mat4Like; + /** + * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoZO( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far: number, + ): Mat4Like; + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that + * actually makes an object look at another object, you should use targetTo instead. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param center - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static lookAt(out: Mat4Like, eye: Readonly, center: Readonly, up: Readonly): Mat4Like; + /** + * Generates a matrix that makes something look at something else. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param target - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static targetTo(out: Mat4Like, eye: Readonly, target: Readonly, up: Readonly): Mat4Like; + /** + * Returns Frobenius norm of a {@link Mat4} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a: Readonly): number; + /** + * Adds two {@link Mat4}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like; + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like; + /** + * Alias for {@link Mat4.subtract} + * @category Static + */ + static sub(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like; + /** + * Multiply each element of the matrix by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out: Mat4Like, a: Readonly, b: number): Mat4Like; + /** + * Adds two mat4's after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out: Mat4Like, a: Readonly, b: Readonly, scale: number): Mat4Like; + /** + * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether two {@link Mat4}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Returns a string representation of a {@link Mat4} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a: Readonly): string; +} + +/** + * Quaternion + */ +declare class Quat extends Float64Array { + #private; + /** + * Create a {@link Quat}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * The x component of the quaternion. Equivalent to `this[0];` + * @category Quaternion Components + */ + get x(): number; + set x(value: number); + /** + * The y component of the quaternion. Equivalent to `this[1];` + * @category Quaternion Components + */ + get y(): number; + set y(value: number); + /** + * The z component of the quaternion. Equivalent to `this[2];` + * @category Quaternion Components + */ + get z(): number; + set z(value: number); + /** + * The w component of the quaternion. Equivalent to `this[3];` + * @category Quaternion Components + */ + get w(): number; + set w(value: number); + /** + * The magnitude (length) of this. + * Equivalent to `Quat.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number; + /** + * Alias for {@link Quat.magnitude} + * + * @category Accessors + */ + get mag(): number; + /** + * A string representation of `this` + * Equivalent to `Quat.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Quat} into `this`. + * @category Methods + * + * @param a the source quaternion + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Set `this` to the identity quaternion + * Equivalent to Quat.identity(this) + * @category Methods + * + * @returns `this` + */ + identity(): this; + /** + * Multiplies `this` by a {@link Quat}. + * Equivalent to `Quat.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Quat.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Rotates `this` by the given angle about the X axis + * Equivalent to `Quat.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateX(rad: number): this; + /** + * Rotates `this` by the given angle about the Y axis + * Equivalent to `Quat.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateY(rad: number): this; + /** + * Rotates `this` by the given angle about the Z axis + * Equivalent to `Quat.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateZ(rad: number): this; + /** + * Inverts `this` + * Equivalent to `Quat.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Scales `this` by a scalar number + * Equivalent to `Quat.scale(this, this, scale);` + * @category Methods + * + * @param scale - amount to scale the vector by + * @returns `this` + */ + scale(scale: number): QuatLike; + /** + * Calculates the dot product of `this` and another {@link Quat} + * Equivalent to `Quat.dot(this, b);` + * @category Methods + * + * @param b - the second operand + * @returns dot product of `this` and b + */ + dot(b: Readonly): number; + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new identity quat + * @category Static + * + * @returns a new quaternion + */ + static create(): Quat; + /** + * Set a quat to the identity quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + static identity(out: QuatLike): QuatLike; + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * @category Static + * + * @param out - the receiving quaternion + * @param axis - the axis around which to rotate + * @param rad - the angle in radians + * @returns `out` + **/ + static setAxisAngle(out: QuatLike, axis: Readonly, rad: number): QuatLike; + /** + * Gets the rotation axis and angle for a given + * quaternion. If a quaternion is created with + * setAxisAngle, this method will return the same + * values as provided in the original parameter list + * OR functionally equivalent values. + * Example: The quaternion formed by axis [0, 0, 1] and + * angle -90 is the same as the quaternion formed by + * [0, 0, 1] and 270. This method favors the latter. + * @category Static + * + * @param out_axis - Vector receiving the axis of rotation + * @param q - Quaternion to be decomposed + * @return Angle, in radians, of the rotation + */ + static getAxisAngle(out_axis: Vec3Like, q: Readonly): number; + /** + * Gets the angular distance between two unit quaternions + * @category Static + * + * @param {ReadonlyQuat} a Origin unit quaternion + * @param {ReadonlyQuat} b Destination unit quaternion + * @return {Number} Angle, in radians, between the two quaternions + */ + static getAngle(a: Readonly, b: Readonly): number; + /** + * Multiplies two quaternions. + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out: QuatLike, a: Readonly, b: Readonly): QuatLike; + /** + * Rotates a quaternion by the given angle about the X axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out: QuatLike, a: Readonly, rad: number): QuatLike; + /** + * Rotates a quaternion by the given angle about the Y axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out: QuatLike, a: Readonly, rad: number): QuatLike; + /** + * Rotates a quaternion by the given angle about the Z axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out: QuatLike, a: Readonly, rad: number): QuatLike; + /** + * Calculates the W component of a quat from the X, Y, and Z components. + * Assumes that quaternion is 1 unit in length. + * Any existing W component will be ignored. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate W component of + * @returns `out` + */ + static calculateW(out: QuatLike, a: Readonly): QuatLike; + /** + * Calculate the exponential of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static exp(out: QuatLike, a: Readonly): QuatLike; + /** + * Calculate the natural logarithm of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static ln(out: QuatLike, a: Readonly): QuatLike; + /** + * Calculate the scalar power of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @param b - amount to scale the quaternion by + * @returns `out` + */ + static pow(out: QuatLike, a: Readonly, b: number): QuatLike; + /** + * Performs a spherical linear interpolation between two quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike; + /** + * Generates a random unit quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + /** + * Calculates the inverse of a quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate inverse of + * @returns `out` + */ + static invert(out: QuatLike, a: Readonly): QuatLike; + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate conjugate of + * @returns `out` + */ + static conjugate(out: QuatLike, a: Readonly): QuatLike; + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to re-normalize the quaternion yourself where necessary. + * @category Static + * + * @param out - the receiving quaternion + * @param m - rotation matrix + * @returns `out` + */ + static fromMat3(out: QuatLike, m: Readonly): QuatLike; + /** + * Creates a quaternion from the given euler angle x, y, z. + * @category Static + * + * @param out - the receiving quaternion + * @param x - Angle to rotate around X axis in degrees. + * @param y - Angle to rotate around Y axis in degrees. + * @param z - Angle to rotate around Z axis in degrees. + * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx. + * @returns `out` + */ + static fromEuler(out: QuatLike, x: number, y: number, z: number, order?: string): QuatLike; + /** + * Returns a string representation of a quatenion + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a: Readonly): string; + /** + * Creates a new quat initialized with values from an existing quaternion + * @category Static + * + * @param a - quaternion to clone + * @returns a new quaternion + */ + static clone(a: Readonly): Quat; + /** + * Creates a new quat initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new quaternion + */ + static fromValues(x: number, y: number, z: number, w: number): Quat; + /** + * Copy the values from one quat to another + * @category Static + * + * @param out - the receiving quaternion + * @param a - the source quaternion + * @returns `out` + */ + static copy(out: QuatLike, a: Readonly): QuatLike; + /** + * Set the components of a {@link Quat} to the given values + * @category Static + * + * @param out - the receiving quaternion + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + static set(out: QuatLike, x: number, y: number, z: number, w: number): QuatLike; + /** + * Adds two {@link Quat}'s + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: QuatLike, a: Readonly, b: Readonly): QuatLike; + /** + * Alias for {@link Quat.multiply} + * @category Static + */ + static mul(out: QuatLike, a: Readonly, b: Readonly): QuatLike; + /** + * Scales a quat by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param b - amount to scale the vector by + * @returns `out` + */ + static scale(out: QuatLike, a: Readonly, scale: number): QuatLike; + /** + * Calculates the dot product of two quat's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a: Readonly, b: Readonly): number; + /** + * Performs a linear interpolation between two quat's + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike; + /** + * Calculates the magnitude (length) of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate length of + * @returns length of `a` + */ + static magnitude(a: Readonly): number; + /** + * Alias for {@link Quat.magnitude} + * @category Static + */ + static mag(a: Readonly): number; + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + static length(a: Readonly): number; + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.mag} + */ + static len(a: Readonly): number; + /** + * Calculates the squared length of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a: Readonly): number; + /** + * Alias for {@link Quat.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly): number; + /** + * Normalize a {@link Quat} + * @category Static + * + * @param out - the receiving quaternion + * @param a - quaternion to normalize + * @returns `out` + */ + static normalize(out: QuatLike, a: Readonly): QuatLike; + /** + * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first quaternion. + * @param b - The second quaternion. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether the quaternions have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * @category Static + * + * @param out - the receiving quaternion. + * @param a - the initial vector + * @param b - the destination vector + * @returns `out` + */ + static rotationTo(out: QuatLike, a: Readonly, b: Readonly): QuatLike; + /** + * Performs a spherical linear interpolation with two control points + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static sqlerp( + out: QuatLike, + a: Readonly, + b: Readonly, + c: Readonly, + d: Readonly, + t: number, + ): QuatLike; + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * @category Static + * + * @param out - The receiving quaternion + * @param view - the vector representing the viewing direction + * @param right - the vector representing the local `right` direction + * @param up - the vector representing the local `up` direction + * @returns `out` + */ + static setAxes(out: QuatLike, view: Readonly, right: Readonly, up: Readonly): QuatLike; +} + +/** + * Dual Quaternion + */ +declare class Quat2 extends Float64Array { + #private; + /** + * Create a {@link Quat2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * A string representation of `this` + * Equivalent to `Quat2.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Quat2} into `this`. + * @category Methods + * + * @param a the source dual quaternion + * @returns `this` + */ + copy(a: Readonly): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat2}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new identity {@link Quat2} + * @category Static + * + * @returns a new dual quaternion [real -> rotation, dual -> translation] + */ + static create(): Quat2; + /** + * Creates a {@link Quat2} quat initialized with values from an existing quaternion + * @category Static + * + * @param a - dual quaternion to clone + * @returns a new dual quaternion + */ + static clone(a: Quat2Like): Quat2; + /** + * Creates a new {@link Quat2} initialized with the given values + * @category Static + * + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns a new dual quaternion + */ + static fromValues( + x1: number, + y1: number, + z1: number, + w1: number, + x2: number, + y2: number, + z2: number, + w2: number, + ): Quat2; + /** + * Creates a new {@link Quat2} from the given values (quat and translation) + * @category Static + * + * @param x1 - X component (rotation) + * @param y1 - Y component (rotation) + * @param z1 - Z component (rotation) + * @param w1 - W component (rotation) + * @param x2 - X component (translation) + * @param y2 - Y component (translation) + * @param z2 - Z component (translation) + * @returns a new dual quaternion + */ + static fromRotationTranslationValues( + x1: number, + y1: number, + z1: number, + w1: number, + x2: number, + y2: number, + z2: number, + ): Quat2; + /** + * Sets a {@link Quat2} from a quaternion and a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @param t - translation vector + * @returns `out` + */ + static fromRotationTranslation(out: Quat2Like, q: Readonly, t: Readonly): Quat2Like; + /** + * Sets a {@link Quat2} from a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param t - translation vector + * @returns `out` + */ + static fromTranslation(out: Quat2Like, t: Readonly): Quat2Like; + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @returns `out` + */ + static fromRotation(out: Quat2Like, q: Readonly): Quat2Like; + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param a - the matrix + * @returns `out` + */ + static fromMat4(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Copy the values from one {@link Quat2} to another + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the source dual quaternion + * @returns `out` + */ + static copy(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Set a {@link Quat2} to the identity dual quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @returns `out` + */ + static identity(out: QuatLike): QuatLike; + /** + * Set the components of a {@link Quat2} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns `out` + */ + static set( + out: Quat2Like, + x1: number, + y1: number, + z1: number, + w1: number, + x2: number, + y2: number, + z2: number, + w2: number, + ): Quat2Like; + /** + * Gets the real part of a dual quat + * @category Static + * + * @param out - real part + * @param a - Dual Quaternion + * @return `out` + */ + static getReal(out: QuatLike, a: Readonly): QuatLike; + /** + * Gets the dual part of a dual quat + * @category Static + * + * @param out - dual part + * @param a - Dual Quaternion + * @return `out` + */ + static getDual(out: QuatLike, a: Readonly): QuatLike; + /** + * Set the real component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the real part + * @return `out` + */ + static setReal(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Set the dual component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the dual part + * @return `out` + */ + static setDual(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Gets the translation of a normalized {@link Quat2} + * @category Static + * + * @param out - the receiving translation vector + * @param a - Dual Quaternion to be decomposed + * @return `out` + */ + static getTranslation(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Translates a {@link Quat2} by the given vector + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out: Quat2Like, a: Readonly, v: Readonly): Quat2Like; + /** + * Rotates a {@link Quat2} around the X axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out: Quat2Like, a: Readonly, rad: number): Quat2Like; + /** + * Rotates a {@link Quat2} around the Y axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out: Quat2Like, a: Readonly, rad: number): Quat2Like; + /** + * Rotates a {@link Quat2} around the Z axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out: Quat2Like, a: Readonly, rad: number): Quat2Like; + /** + * Rotates a {@link Quat2} by a given quaternion (a * q) + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param q - quaternion to rotate by + * @returns `out` + */ + static rotateByQuatAppend(out: Quat2Like, a: Readonly, q: Readonly): Quat2Like; + /** + * Rotates a {@link Quat2} by a given quaternion (q * a) + * @category Static + * + * @param out - the receiving dual quaternion + * @param q - quaternion to rotate by + * @param a - the dual quaternion to rotate + * @returns `out` + */ + static rotateByQuatPrepend(out: Quat2Like, q: Readonly, a: Readonly): Quat2Like; + /** + * Rotates a {@link Quat2} around a given axis. Does the normalization automatically + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param axis - the axis to rotate around + * @param rad - how far the rotation should be + * @returns `out` + */ + static rotateAroundAxis(out: Quat2Like, a: Readonly, axis: Readonly, rad: number): Quat2Like; + /** + * Adds two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like; + /** + * Multiplies two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns {quat2} out + */ + static multiply(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like; + /** + * Alias for {@link Quat2.multiply} + * @category Static + */ + static mul(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like; + /** + * Scales a {@link Quat2} by a scalar value + * @category Static + * + * @param out - the receiving dual quaterion + * @param a - the dual quaternion to scale + * @param b - scalar value to scale the dual quaterion by + * @returns `out` + */ + static scale(out: Quat2Like, a: Readonly, b: number): Quat2Like; + /** + * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts) + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a: Readonly, b: Readonly): number; + /** + * Performs a linear interpolation between two {@link Quat2}s + * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`) + * @category Static + * + * @param out - the receiving dual quat + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Quat2Like, a: Readonly, b: Readonly, t: number): Quat2Like; + /** + * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quat to calculate inverse of + * @returns `out` + */ + static invert(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than + * {@link Quat2.invert} and produces the same result. + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to calculate conjugate of + * @returns `out` + */ + static conjugate(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Calculates the magnitude (length) of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate length of + * @returns length of `a` + */ + static magnitude(a: Readonly): number; + /** + * Alias for {@link Quat2.magnitude} + * @category Static + */ + static mag(a: Readonly): number; + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + static length(a: Readonly): number; + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.mag} + */ + static len(a: Readonly): number; + /** + * Calculates the squared length of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a: Readonly): number; + /** + * Alias for {@link Quat2.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly): number; + /** + * Normalize a {@link Quat2} + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to normalize + * @returns `out` + */ + static normalize(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Returns a string representation of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to represent as a string + * @returns string representation of the vector + */ + static str(a: Readonly): string; + /** + * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether the {@link Quat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; +} + +/** + * 2 Dimensional Vector + */ +declare class Vec2 extends Float64Array { + /** + * Create a {@link Vec2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x(): number; + set x(value: number); + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y(): number; + set y(value: number); + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r(): number; + set r(value: number); + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g(): number; + set g(value: number); + /** + * The magnitude (length) of this. + * Equivalent to `Vec2.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number; + /** + * Alias for {@link Vec2.magnitude} + * + * @category Accessors + */ + get mag(): number; + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec2.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude(): number; + /** + * Alias for {@link Vec2.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag(): number; + /** + * A string representation of `this` + * Equivalent to `Vec2.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Vec2} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Adds a {@link Vec2} to `this`. + * Equivalent to `Vec2.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b: Readonly): this; + /** + * Subtracts a {@link Vec2} from `this`. + * Equivalent to `Vec2.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b: Readonly): this; + /** + * Alias for {@link Vec2.subtract} + * @category Methods + */ + sub(b: Readonly): this; + /** + * Multiplies `this` by a {@link Vec2}. + * Equivalent to `Vec2.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Vec2.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Divides `this` by a {@link Vec2}. + * Equivalent to `Vec2.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b: Readonly): this; + /** + * Alias for {@link Vec2.divide} + * @category Methods + */ + div(b: Readonly): this; + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec2.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b: number): this; + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b: Readonly, scale: number): this; + /** + * Calculates the Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b: Readonly): number; + /** + * Alias for {@link Vec2.distance} + * @category Methods + */ + dist(b: Readonly): number; + /** + * Calculates the squared Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b: Readonly): number; + /** + * Alias for {@link Vec2.squaredDistance} + * @category Methods + */ + sqrDist(b: Readonly): number; + /** + * Negates the components of `this`. + * Equivalent to `Vec2.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate(): this; + /** + * Inverts the components of `this`. + * Equivalent to `Vec2.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec2.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs(): this; + /** + * Calculates the dot product of this and another {@link Vec2}. + * Equivalent to `Vec2.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b: Readonly): number; + /** + * Normalize `this`. + * Equivalent to `Vec2.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize(): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec2}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, empty {@link Vec2} + * @category Static + * + * @returns A new 2D vector + */ + static create(): Vec2; + /** + * Creates a new {@link Vec2} initialized with values from an existing vector + * @category Static + * + * @param a - Vector to clone + * @returns A new 2D vector + */ + static clone(a: Readonly): Vec2; + /** + * Creates a new {@link Vec2} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @returns A new 2D vector + */ + static fromValues(x: number, y: number): Vec2; + /** + * Copy the values from one {@link Vec2} to another + * @category Static + * + * @param out - the receiving vector + * @param a - The source vector + * @returns `out` + */ + static copy(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Set the components of a {@link Vec2} to the given values + * @category Static + * + * @param out - The receiving vector + * @param x - X component + * @param y - Y component + * @returns `out` + */ + static set(out: Vec2Like, x: number, y: number): Vec2Like; + /** + * Adds two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static subtract(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Alias for {@link Vec2.subtract} + * @category Static + */ + static sub(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Multiplies two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Alias for {@link Vec2.multiply} + * @category Static + */ + static mul(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Divides two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static divide(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Alias for {@link Vec2.divide} + * @category Static + */ + static div(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Math.ceil the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to ceil + * @returns `out` + */ + static ceil(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Math.floor the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to floor + * @returns `out` + */ + static floor(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Returns the minimum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static min(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Returns the maximum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static max(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Math.round the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to round + * @returns `out` + */ + static round(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Scales a {@link Vec2} by a scalar number + * @category Static + * + * @param out - The receiving vector + * @param a - The vector to scale + * @param b - Amount to scale the vector by + * @returns `out` + */ + static scale(out: Vec2Like, a: Readonly, b: number): Vec2Like; + /** + * Adds two Vec2's after scaling the second operand by a scalar value + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param scale - The amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out: Vec2Like, a: Readonly, b: Readonly, scale: number): Vec2Like; + /** + * Calculates the Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns distance between `a` and `b` + */ + static distance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + static dist(a: Readonly, b: Readonly): number; + /** + * Calculates the squared Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Squared distance between `a` and `b` + */ + static squaredDistance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + static sqrDist(a: Readonly, b: Readonly): number; + /** + * Calculates the magnitude (length) of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a: Readonly): number; + /** + * Alias for {@link Vec2.magnitude} + * @category Static + */ + static mag(a: Readonly): number; + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + static length(a: Readonly): number; + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.mag} + */ + static len(a: Readonly): number; + /** + * Calculates the squared length of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate squared length of + * @returns Squared length of a + */ + static squaredLength(a: Readonly): number; + /** + * Alias for {@link Vec2.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly, b: Readonly): number; + /** + * Negates the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to negate + * @returns `out` + */ + static negate(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Returns the inverse of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to invert + * @returns `out` + */ + static inverse(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Returns the absolute value of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Normalize a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to normalize + * @returns `out` + */ + static normalize(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Calculates the dot product of two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Dot product of `a` and `b` + */ + static dot(a: Readonly, b: Readonly): number; + /** + * Computes the cross product of two {@link Vec2}s + * Note that the cross product must by definition produce a 3D vector. + * For this reason there is also not instance equivalent for this function. + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static cross(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Performs a linear interpolation between two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param t - Interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Vec2Like, a: Readonly, b: Readonly, t: number): Vec2Like; + /** + * Transforms the {@link Vec2} with a {@link Mat2} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like; + /** + * Transforms the {@link Vec2} with a {@link Mat2d} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2d(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like; + /** + * Transforms the {@link Vec2} with a {@link Mat3} + * 3rd vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat3(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like; + /** + * Transforms the {@link Vec2} with a {@link Mat4} + * 3rd vector component is implicitly '0' + * 4th vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat4(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like; + /** + * Rotate a 2D vector + * @category Static + * + * @param out - The receiving {@link Vec2} + * @param a - The {@link Vec2} point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotate(out: Vec2Like, a: Readonly, b: Readonly, rad: number): Vec2Like; + /** + * Get the angle between two 2D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static angle(a: Readonly, b: Readonly): number; + /** + * Set the components of a {@link Vec2} to zero + * @category Static + * + * @param out - The receiving vector + * @returns `out` + */ + static zero(out: Vec2Like): Vec2Like; + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors components are ===, `false` otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors are approximately equal, `false` otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - Vector to represent as a string + * @returns String representation of the vector + */ + static str(a: Readonly): string; +} + +/** + * 3 Dimensional Vector + */ +declare class Vec3 extends Float64Array { + /** + * Create a {@link Vec3}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x(): number; + set x(value: number); + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y(): number; + set y(value: number); + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z(): number; + set z(value: number); + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r(): number; + set r(value: number); + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g(): number; + set g(value: number); + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b(): number; + set b(value: number); + /** + * The magnitude (length) of this. + * Equivalent to `Vec3.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number; + /** + * Alias for {@link Vec3.magnitude} + * + * @category Accessors + */ + get mag(): number; + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec3.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude(): number; + /** + * Alias for {@link Vec3.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag(): number; + /** + * A string representation of `this` + * Equivalent to `Vec3.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Vec3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Adds a {@link Vec3} to `this`. + * Equivalent to `Vec3.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b: Readonly): this; + /** + * Subtracts a {@link Vec3} from `this`. + * Equivalent to `Vec3.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b: Readonly): this; + /** + * Alias for {@link Vec3.subtract} + * @category Methods + */ + sub(b: Readonly): this; + /** + * Multiplies `this` by a {@link Vec3}. + * Equivalent to `Vec3.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Vec3.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Divides `this` by a {@link Vec3}. + * Equivalent to `Vec3.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b: Readonly): this; + /** + * Alias for {@link Vec3.divide} + * @category Methods + */ + div(b: Readonly): this; + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec3.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b: number): this; + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b: Readonly, scale: number): this; + /** + * Calculates the Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b: Readonly): number; + /** + * Alias for {@link Vec3.distance} + * @category Methods + */ + dist(b: Readonly): number; + /** + * Calculates the squared Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b: Readonly): number; + /** + * Alias for {@link Vec3.squaredDistance} + * @category Methods + */ + sqrDist(b: Readonly): number; + /** + * Negates the components of `this`. + * Equivalent to `Vec3.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate(): this; + /** + * Inverts the components of `this`. + * Equivalent to `Vec3.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Sets each component of `this` to its absolute value. + * Equivalent to `Vec3.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs(): this; + /** + * Calculates the dot product of this and another {@link Vec3}. + * Equivalent to `Vec3.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b: Readonly): number; + /** + * Normalize `this`. + * Equivalent to `Vec3.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize(): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec3}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, empty vec3 + * @category Static + * + * @returns a new 3D vector + */ + static create(): Vec3; + /** + * Creates a new vec3 initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 3D vector + */ + static clone(a: Readonly): Vec3; + /** + * Calculates the magnitude (length) of a {@link Vec3} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a: Readonly): number; + /** + * Alias for {@link Vec3.magnitude} + * @category Static + */ + static mag(a: Readonly): number; + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + static length(a: Readonly): number; + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.mag} + */ + static len(a: Readonly): number; + /** + * Creates a new vec3 initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns a new 3D vector + */ + static fromValues(x: number, y: number, z: number): Vec3; + /** + * Copy the values from one vec3 to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Set the components of a vec3 to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns `out` + */ + static set(out: Vec3Like, x: number, y: number, z: number): Vec3Like; + /** + * Adds two {@link Vec3}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Alias for {@link Vec3.subtract} + * @category Static + */ + static sub(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Multiplies two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Alias for {@link Vec3.multiply} + * @category Static + */ + static mul(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Divides two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Alias for {@link Vec3.divide} + * @category Static + */ + static div(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Math.ceil the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Math.floor the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Returns the minimum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Returns the maximum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * symmetric round the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + /** + * Scales a vec3 by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out: Vec3Like, a: Readonly, scale: number): Vec3Like; + /** + * Adds two vec3's after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out: Vec3Like, a: Readonly, b: Readonly, scale: number): Vec3Like; + /** + * Calculates the Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec3.distance} + * @category Static + */ + static dist(a: Readonly, b: Readonly): number; + /** + * Calculates the squared Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec3.squaredDistance} + * @category Static + */ + static sqrDist(a: Readonly, b: Readonly): number; + /** + * Calculates the squared length of a vec3 + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a: Readonly): number; + /** + * Alias for {@link Vec3.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly, b: Readonly): number; + /** + * Negates the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Returns the inverse of the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Returns the absolute value of the components of a {@link Vec3} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Normalize a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Calculates the dot product of two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a: Readonly, b: Readonly): number; + /** + * Computes the cross product of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static cross(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Performs a linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like; + /** + * Performs a spherical linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like; + /** + * Performs a hermite interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static hermite( + out: Vec3Like, + a: Readonly, + b: Readonly, + c: Readonly, + d: Readonly, + t: number, + ): Vec3Like; + /** + * Performs a bezier interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static bezier( + out: Vec3Like, + a: Readonly, + b: Readonly, + c: Readonly, + d: Readonly, + t: number, + ): Vec3Like; + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned + * @returns `out` + */ + /** + * Transforms the vec3 with a mat4. + * 4th vector component is implicitly '1' + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out: Vec3Like, a: Readonly, m: Readonly): Vec3Like; + /** + * Transforms the vec3 with a mat3. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - the 3x3 matrix to transform with + * @returns `out` + */ + static transformMat3(out: Vec3Like, a: Vec3Like, m: Mat3Like): Vec3Like; + /** + * Transforms the vec3 with a quat + * Can also be used for dual quaternions. (Multiply it with the real part) + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out: Vec3Like, a: Readonly, q: Readonly): Vec3Like; + /** + * Rotate a 3D vector around the x-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateX(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like; + /** + * Rotate a 3D vector around the y-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateY(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like; + /** + * Rotate a 3D vector around the z-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateZ(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like; + /** + * Get the angle between two 3D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static angle(a: Readonly, b: Readonly): number; + /** + * Set the components of a vec3 to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out: Vec3Like): Vec3Like; + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a: Readonly): string; + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; +} + +/** + * 4 Dimensional Vector + */ +declare class Vec4 extends Float64Array { + /** + * Create a {@link Vec4}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x(): number; + set x(value: number); + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y(): number; + set y(value: number); + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z(): number; + set z(value: number); + /** + * The w component of the vector. Equivalent to `this[3];` + * @category Vector Components + */ + get w(): number; + set w(value: number); + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r(): number; + set r(value: number); + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g(): number; + set g(value: number); + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b(): number; + set b(value: number); + /** + * The a component of the vector. Equivalent to `this[3];` + * @category Color Components + */ + get a(): number; + set a(value: number); + /** + * The magnitude (length) of this. + * Equivalent to `Vec4.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number; + /** + * Alias for {@link Vec4.magnitude} + * + * @category Accessors + */ + get mag(): number; + /** + * A string representation of `this` + * Equivalent to `Vec4.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Vec4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Adds a {@link Vec4} to `this`. + * Equivalent to `Vec4.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b: Readonly): this; + /** + * Subtracts a {@link Vec4} from `this`. + * Equivalent to `Vec4.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b: Readonly): this; + /** + * Alias for {@link Vec4.subtract} + * @category Methods + */ + sub(b: Readonly): this; + /** + * Multiplies `this` by a {@link Vec4}. + * Equivalent to `Vec4.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Vec4.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Divides `this` by a {@link Vec4}. + * Equivalent to `Vec4.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b: Readonly): this; + /** + * Alias for {@link Vec4.divide} + * @category Methods + */ + div(b: Readonly): this; + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec4.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b: number): this; + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b: Readonly, scale: number): this; + /** + * Calculates the Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b: Readonly): number; + /** + * Alias for {@link Vec4.distance} + * @category Methods + */ + dist(b: Readonly): number; + /** + * Calculates the squared Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b: Readonly): number; + /** + * Alias for {@link Vec4.squaredDistance} + * @category Methods + */ + sqrDist(b: Readonly): number; + /** + * Negates the components of `this`. + * Equivalent to `Vec4.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate(): this; + /** + * Inverts the components of `this`. + * Equivalent to `Vec4.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec4.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs(): this; + /** + * Calculates the dot product of this and another {@link Vec4}. + * Equivalent to `Vec4.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b: Readonly): number; + /** + * Normalize `this`. + * Equivalent to `Vec4.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize(): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec4}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, empty {@link Vec4} + * @category Static + * + * @returns a new 4D vector + */ + static create(): Vec4; + /** + * Creates a new {@link Vec4} initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 4D vector + */ + static clone(a: Vec4Like): Vec4; + /** + * Creates a new {@link Vec4} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new 4D vector + */ + static fromValues(x: number, y: number, z: number, w: number): Vec4; + /** + * Copy the values from one {@link Vec4} to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Set the components of a {@link Vec4} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + static set(out: Vec4Like, x: number, y: number, z: number, w: number): Vec4Like; + /** + * Adds two {@link Vec4}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Alias for {@link Vec4.subtract} + * @category Static + */ + static sub(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Multiplies two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Alias for {@link Vec4.multiply} + * @category Static + */ + static mul(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Divides two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Alias for {@link Vec4.divide} + * @category Static + */ + static div(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Math.ceil the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Math.floor the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Returns the minimum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Returns the maximum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Math.round the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + static round(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Scales a {@link Vec4} by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out: Vec4Like, a: Readonly, scale: number): Vec4Like; + /** + * Adds two {@link Vec4}'s after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out: Vec4Like, a: Readonly, b: Readonly, scale: number): Vec4Like; + /** + * Calculates the Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec4.distance} + * @category Static + */ + static dist(a: Readonly, b: Readonly): number; + /** + * Calculates the squared Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec4.squaredDistance} + * @category Static + */ + static sqrDist(a: Readonly, b: Readonly): number; + /** + * Calculates the magnitude (length) of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate length of + * @returns length of `a` + */ + static magnitude(a: Readonly): number; + /** + * Alias for {@link Vec4.magnitude} + * @category Static + */ + static mag(a: Readonly): number; + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + static length(a: Readonly): number; + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.mag} + */ + static len(a: Readonly): number; + /** + * Calculates the squared length of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a: Readonly): number; + /** + * Alias for {@link Vec4.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly): number; + /** + * Negates the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Returns the inverse of the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Returns the absolute value of the components of a {@link Vec4} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Normalize a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Calculates the dot product of two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a: Readonly, b: Readonly): number; + /** + * Returns the cross-product of three vectors in a 4-dimensional space + * @category Static + * + * @param out the receiving vector + * @param u - the first vector + * @param v - the second vector + * @param w - the third vector + * @returns result + */ + static cross(out: Vec4Like, u: Readonly, v: Readonly, w: Readonly): Vec4Like; + /** + * Performs a linear interpolation between two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Vec4Like, a: Readonly, b: Readonly, t: number): Vec4Like; + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns `out` + */ + /** + * Transforms the {@link Vec4} with a {@link Mat4}. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out: Vec4Like, a: Readonly, m: Readonly): Vec4Like; + /** + * Transforms the {@link Vec4} with a {@link Quat} + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out: Vec4Like, a: Readonly, q: Readonly): Vec4Like; + /** + * Set the components of a {@link Vec4} to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out: Vec4Like): Vec4Like; + /** + * Returns a string representation of a {@link Vec4} + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a: Readonly): string; + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; +} + +/** + * To enable additional swizzle accessors for vector classes (64-bit) invoke the {@link EnableSwizzlesF64} function from + * the `gl-matrix/swizzle/f64` sub-path export. To enable ambient module declarations for IDE / Typescript support + * please see {@link gl-matrix/types/swizzle/f64}. + * + * To enable swizzling for the 32-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle}. + * + * @example + * ```ts + * import { Vec3 } from 'gl-matrix/f64'; + * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64'; + * + * EnableSwizzlesF64(); + * + * const vec = new Vec3(0, 1, 2); + * const vecSwizzled = vec.zyx; // Returns a new Vec3(2, 1, 0). + * ``` + * + * @packageDocumentation + */ +/** + * Enables Swizzle operations on {@link gl-matrix/f64.Vec2 | Vec2} / {@link gl-matrix/f64.Vec3 | Vec3} / + * {@link gl-matrix/f64.Vec4 | Vec4} types from {@link gl-matrix/f64} (64-bit). + * + * Swizzle operations are performed by using the `.` operator in conjunction with any combination + * of between two and four component names, either from the set `xyzw` or `rgbw` (though not intermixed). + * They return a new vector with the same number of components as specified in the swizzle attribute. + * + * @example + * ```js + * import { Vec3 } from 'gl-matrix/f64'; + * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64'; + * + * EnableSwizzlesF64(); + * + * let v = new Vec3(0, 1, 2); + * + * v.yx; // returns new Vec2(1, 0) + * v.xzy; // returns new Vec3(0, 2, 1) + * v.zyxz; // returns new Vec4(2, 1, 0, 2) + * + * v.rgb; // returns new Vec3(0, 1, 2) + * v.rbg; // returns new Vec3(0, 2, 1) + * v.gg; // returns new Vec2(1, 1) + * ``` + */ +declare function EnableSwizzlesF64(): void; + +/** + * Ambient module declarations for `gl-matrix/f64` (64-bit) swizzle extensions for vector classes. + * + * When swizzle accessors via {@link gl-matrix/swizzle/f64.EnableSwizzlesF64 | EnableSwizzlesF64} are enabled include + * this sub-path export as a `side effect` import to add ambient module declarations for the additional accessors to + * {@link gl-matrix/f64.Vec2 | Vec2} / {@link gl-matrix/f64.Vec3 | Vec3} / {@link gl-matrix/f64.Vec4 | Vec4}. + * + * To enable swizzling for the 64-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle/f64}. + * + * ```js + * import { Vec2 } from 'gl-matrix/f64'; + * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64'; + * + * import 'gl-matrix/types/swizzle/f64'; + * + * EnableSwizzlesF64(); + * + * const vec = new Vec2(0, 1); + * + * // Swizzled instance - returns new Vec2(1, 0). + * const vecSwizzled = vec.yx; + * ``` + * + * @packageDocumentation + */ + +/** + * A type alias for Vec2 (64-bit). + * @hidden + */ +type Vec2Alias = Vec2; +/** + * A type alias for Vec3 (64-bit). + * @hidden + */ +type Vec3Alias = Vec3; +/** + * A type alias for Vec4 (64-bit). + * @hidden + */ +type Vec4Alias = Vec4; + +/** + * Vec2 swizzle extension accessors. + */ +interface Vec2 { + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggg(): Vec4Alias; +} +/** + * Vec3 swizzle extension accessors. + */ +interface Vec3 { + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get br(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbb(): Vec4Alias; +} +/** + * Vec4 swizzle extension accessors. + */ +interface Vec4 { + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get br(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xw(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yw(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zw(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get wx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get wy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get wz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ww(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xwx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xwy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xwz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xww(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ywx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ywy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ywz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yww(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zwx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zwy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zwz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zww(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wwx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wwy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wwz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get www(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ra(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ga(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ba(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ar(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ag(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ab(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get aa(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rra(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get raa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gra(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gaa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bra(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get baa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get arr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get arg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get arb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ara(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get agr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get agg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get agb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get abr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get abg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get abb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aaa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rraa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rarr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rarg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rarb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ragr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ragg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ragb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rabr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rabg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rabb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get graa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get garr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get garg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get garb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gagr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gagg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gagb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gabr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gabg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gabb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get braa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get barr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get barg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get barb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bagr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bagg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bagb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get babr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get babg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get babb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get argr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get argg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get argb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get araa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aarr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aarg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aarb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aagr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aagg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aagb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aabr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aabg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aabb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaaa(): Vec4Alias; +} + +/** + * Convert `radians` to `degrees`. + * + * @param value - Angle in `radians`. + * @returns Angle in `degrees`. + */ +declare function toDegree(value: number): number; +/** + * Convert `degrees` to `radians`. + * + * @param value - Angle in `degrees`. + * @returns Angle in `radians`. + */ +declare function toRadian(value: number): number; + +export { + EnableSwizzlesF64, + type FloatArray, + Mat2, + type Mat2Like, + Mat2d, + type Mat2dLike, + Mat3, + type Mat3Like, + Mat4, + type Mat4Like, + Quat, + Quat2, + type Quat2Like, + type QuatLike, + Vec2, + type Vec2Like, + Vec3, + type Vec3Like, + Vec4, + type Vec4Like, + toDegree, + toRadian, +}; diff --git a/dist-cdn/types/gl-matrix-f64.d.mts b/dist-cdn/types/gl-matrix-f64.d.mts new file mode 100644 index 00000000..e1de483f --- /dev/null +++ b/dist-cdn/types/gl-matrix-f64.d.mts @@ -0,0 +1,9903 @@ +/** + * Provides an all-inclusive ESM distribution of `gl-matrix` (64-bit). All library classes extends `Float64Array`. + * + * @packageDocumentation + */ + +/** + * Provides all common type declarations shared across `gl-matrix`. + * + * ```ts + * import { Vec3 } from 'gl-matrix'; + * import type { Vec3Like } from 'gl-matrix/types'; + * + * const vec: Vec3Like = new Vec3(0, 1, 2); + * ``` + * + * For JSDoc using the new Typescript 5.5 `@import` tag: + * ```js + * /** + * * @import { Vec3Like } from 'gl-matrix/types' + * *\/ + * ``` + * + * For JSDoc using the older `import types` Typescript mechanism: + * ```js + * /** + * * @type {import('gl-matrix/types').Vec3Like} + * *\/ + * ``` + * + * @packageDocumentation + */ +/** + * The floating-point typed arrays that can be used in place of a vector, matrix, or quaternion. + */ +type FloatArray = Float32Array | Float64Array; +/** + * A 2x2 Matrix given as a {@link Mat2}, a 4-element floating-point TypedArray, or an array of 4 numbers. + */ +type Mat2Like = [number, number, number, number] | FloatArray; +/** + * A 2x3 Matrix given as a {@link Mat2d}, a 6-element floating-point TypedArray, or an array of 6 numbers. + */ +type Mat2dLike = [number, number, number, number, number, number] | FloatArray; +/** + * A 3x3 Matrix given as a {@link Mat3}, a 9-element floating-point TypedArray, or an array of 9 numbers. + */ +type Mat3Like = [number, number, number, number, number, number, number, number, number] | FloatArray; +/** + * A 4x4 Matrix given as a {@link Mat4}, a 16-element floating-point TypedArray, or an array of 16 numbers. + */ +type Mat4Like = + | [ + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + ] + | FloatArray; +/** + * A Quaternion given as a {@link Quat}, a 4-element floating-point TypedArray, or an array of 4 numbers. + */ +type QuatLike = Vec4Like; +/** + * A Dual Quaternion given as a {@link Quat2}, an 8-element floating-point TypedArray, or an array of 8 numbers. + */ +type Quat2Like = [number, number, number, number, number, number, number, number] | FloatArray; +/** + * A 2-dimensional vector given as a {@link Vec2}, a 2-element floating-point TypedArray, or an array of 2 numbers. + */ +type Vec2Like = [number, number] | FloatArray; +/** + * A 3-dimensional vector given as a {@link Vec3}, a 3-element floating-point TypedArray, or an array of 3 numbers. + */ +type Vec3Like = [number, number, number] | FloatArray; +/** + * A 4-dimensional vector given as a {@link Vec4}, a 4-element floating-point TypedArray, or an array of 4 numbers. + */ +type Vec4Like = [number, number, number, number] | FloatArray; + +/** + * A 2x2 Matrix + */ +declare class Mat2 extends Float64Array { + #private; + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * A string representation of `this` + * Equivalent to `Mat2.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Mat2} into `this`. + * + * @param a the source vector + * @returns `this` + * @category Methods + */ + copy(a: Readonly): this; + /** + * Set `this` to the identity matrix + * Equivalent to Mat2.identity(this) + * + * @returns `this` + * @category Methods + */ + identity(): this; + /** + * Multiplies this {@link Mat2} against another one + * Equivalent to `Mat2.multiply(this, this, b);` + * + * @param b - The second operand + * @returns `this` + * @category Methods + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Mat2.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Transpose this {@link Mat2} + * Equivalent to `Mat2.transpose(this, this);` + * + * @returns `this` + * @category Methods + */ + transpose(): this; + /** + * Inverts this {@link Mat2} + * Equivalent to `Mat4.invert(this, this);` + * + * @returns `this` + * @category Methods + */ + invert(): this; + /** + * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2.scale(this, this, v);` + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + * @category Methods + */ + scale(v: Readonly): this; + /** + * Rotates this {@link Mat2} by the given angle around the given axis + * Equivalent to `Mat2.rotate(this, this, rad);` + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + * @category Methods + */ + rotate(rad: number): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, identity {@link Mat2} + * @category Static + * + * @returns A new {@link Mat2} + */ + static create(): Mat2; + /** + * Creates a new {@link Mat2} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2} + */ + static clone(a: Readonly): Mat2; + /** + * Copy the values from one {@link Mat2} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out: Mat2Like, a: Readonly): Mat2Like; + /** + * Create a new {@link Mat2} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2} + */ + static fromValues(...values: number[]): Mat2; + /** + * Set the components of a {@link Mat2} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out: Mat2Like, ...values: number[]): Mat2Like; + /** + * Set a {@link Mat2} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out: Mat2Like): Mat2Like; + /** + * Transpose the values of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out: Mat2Like, a: Readonly): Mat2Like; + /** + * Inverts a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out: Mat2Like, a: Mat2Like): Mat2Like | null; + /** + * Calculates the adjugate of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out: Mat2Like, a: Mat2Like): Mat2Like; + /** + * Calculates the determinant of a {@link Mat2} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a: Readonly): number; + /** + * Adds two {@link Mat2}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like; + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like; + /** + * Alias for {@link Mat2.subtract} + * @category Static + */ + static sub(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like; + /** + * Multiplies two {@link Mat2}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like; + /** + * Alias for {@link Mat2.multiply} + * @category Static + */ + static mul(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like; + /** + * Rotates a {@link Mat2} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out: Mat2Like, a: Readonly, rad: number): Mat2Like; + /** + * Scales the {@link Mat2} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out: Mat2Like, a: Readonly, v: Readonly): Mat2Like; + /** + * Creates a {@link Mat2} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out: Mat2Like, rad: number): Mat2Like; + /** + * Creates a {@link Mat2} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out: Mat2Like, v: Readonly): Mat2Like; + /** + * Returns Frobenius norm of a {@link Mat2} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a: Readonly): number; + /** + * Multiply each element of a {@link Mat2} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out: Mat2Like, a: Readonly, b: number): Mat2Like; + /** + * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out: Mat2Like, a: Readonly, b: Readonly, scale: number): Mat2Like; + /** + * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix + * @category Static + * + * @param L - the lower triangular matrix + * @param D - the diagonal matrix + * @param U - the upper triangular matrix + * @param a - the input matrix to factorize + */ + static LDU( + L: Mat2Like, + D: Readonly, + U: Mat2Like, + a: Readonly, + ): [Mat2Like, Readonly, Mat2Like]; + /** + * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether two {@link Mat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Returns a string representation of a {@link Mat2} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a: Readonly): string; +} + +/** + * A 2x3 Matrix + */ +declare class Mat2d extends Float64Array { + #private; + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * A string representation of `this` + * Equivalent to `Mat2d.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Mat2d} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Set `this` to the identity matrix + * Equivalent to Mat2d.identity(this) + * @category Methods + * + * @returns `this` + */ + identity(): this; + /** + * Multiplies this {@link Mat2d} against another one + * Equivalent to `Mat2d.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Mat2d.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Translate this {@link Mat2d} by the given vector + * Equivalent to `Mat2d.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v: Readonly): this; + /** + * Rotates this {@link Mat2d} by the given angle around the given axis + * Equivalent to `Mat2d.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad: number): this; + /** + * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2d.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v: Readonly): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2d}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, identity {@link Mat2d} + * @category Static + * + * @returns A new {@link Mat2d} + */ + static create(): Mat2d; + /** + * Creates a new {@link Mat2d} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2d} + */ + static clone(a: Readonly): Mat2d; + /** + * Copy the values from one {@link Mat2d} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out: Mat2dLike, a: Readonly): Mat2dLike; + /** + * Create a new {@link Mat2d} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2d} + */ + static fromValues(...values: number[]): Mat2d; + /** + * Set the components of a {@link Mat2d} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out: Mat2dLike, ...values: number[]): Mat2dLike; + /** + * Set a {@link Mat2d} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out: Mat2dLike): Mat2dLike; + /** + * Inverts a {@link Mat2d} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out: Mat2dLike, a: Mat2dLike): Mat2dLike | null; + /** + * Calculates the determinant of a {@link Mat2d} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a: Readonly): number; + /** + * Adds two {@link Mat2d}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike; + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike; + /** + * Alias for {@link Mat2d.subtract} + * @category Static + */ + static sub(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike; + /** + * Multiplies two {@link Mat2d}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike; + /** + * Alias for {@link Mat2d.multiply} + * @category Static + */ + static mul(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike; + /** + * Translate a {@link Mat2d} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike; + /** + * Rotates a {@link Mat2d} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out: Mat2dLike, a: Readonly, rad: number): Mat2dLike; + /** + * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike; + /** + * Creates a {@link Mat2d} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out: Mat2dLike, v: Readonly): Mat2dLike; + /** + * Creates a {@link Mat2d} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out: Mat2dLike, rad: number): Mat2dLike; + /** + * Creates a {@link Mat2d} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out: Mat2dLike, v: Readonly): Mat2dLike; + /** + * Returns Frobenius norm of a {@link Mat2d} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a: Readonly): number; + /** + * Multiply each element of a {@link Mat2d} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out: Mat2dLike, a: Readonly, b: number): Mat2dLike; + /** + * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out: Mat2dLike, a: Readonly, b: Readonly, scale: number): Mat2dLike; + /** + * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether two {@link Mat2d}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Returns a string representation of a {@link Mat2d} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a: Readonly): string; +} + +/** + * A 3x3 Matrix + */ +declare class Mat3 extends Float64Array { + #private; + /** + * Create a {@link Mat3}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * A string representation of `this` + * Equivalent to `Mat3.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Mat3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Set `this` to the identity matrix + * Equivalent to Mat3.identity(this) + * @category Methods + * + * @returns `this` + */ + identity(): this; + /** + * Multiplies this {@link Mat3} against another one + * Equivalent to `Mat3.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Mat3.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Transpose this {@link Mat3} + * Equivalent to `Mat3.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose(): this; + /** + * Inverts this {@link Mat3} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Translate this {@link Mat3} by the given vector + * Equivalent to `Mat3.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v: Readonly): this; + /** + * Rotates this {@link Mat3} by the given angle around the given axis + * Equivalent to `Mat3.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad: number): this; + /** + * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat3.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v: Readonly): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat3}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, identity {@link Mat3} + * @category Static + * + * @returns A new {@link Mat3} + */ + static create(): Mat3; + /** + * Creates a new {@link Mat3} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat3} + */ + static clone(a: Readonly): Mat3; + /** + * Copy the values from one {@link Mat3} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out: Mat3Like, a: Readonly): Mat3Like; + /** + * Create a new {@link Mat3} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat3} + */ + static fromValues(...values: number[]): Mat3; + /** + * Set the components of a {@link Mat3} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out: Mat3Like, ...values: number[]): Mat3Like; + /** + * Set a {@link Mat3} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out: Mat3Like): Mat3Like; + /** + * Transpose the values of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out: Mat3Like, a: Readonly): Mat3Like; + /** + * Inverts a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out: Mat3Like, a: Mat3Like): Mat3Like | null; + /** + * Calculates the adjugate of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out: Mat3Like, a: Mat3Like): Mat3Like; + /** + * Calculates the determinant of a {@link Mat3} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a: Readonly): number; + /** + * Adds two {@link Mat3}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like; + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like; + /** + * Alias for {@link Mat3.subtract} + * @category Static + */ + static sub(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like; + /** + * Multiplies two {@link Mat3}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like; + /** + * Alias for {@link Mat3.multiply} + * @category Static + */ + static mul(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like; + /** + * Translate a {@link Mat3} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like; + /** + * Rotates a {@link Mat3} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out: Mat3Like, a: Readonly, rad: number): Mat3Like; + /** + * Scales the {@link Mat3} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like; + /** + * Creates a {@link Mat3} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out: Mat3Like, v: Readonly): Mat3Like; + /** + * Creates a {@link Mat3} from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat3.identity(dest); + * mat3.rotate(dest, dest, rad); + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out: Mat3Like, rad: number): Mat3Like; + /** + * Creates a {@link Mat3} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out: Mat3Like, v: Readonly): Mat3Like; + /** + * Copies the upper-left 3x3 values of a {@link Mat2d} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 2x3 matrix + * @returns `out` + */ + static fromMat2d(out: Mat3Like, a: Readonly): Mat3Like; + /** + * Calculates a {@link Mat3} from the given quaternion + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param q - {@link Quat} to create matrix from + * @returns `out` + */ + static fromQuat(out: Mat3Like, q: Readonly): Mat3Like; + /** + * Copies the upper-left 3x3 values of a {@link Mat4} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 4x4 matrix + * @returns `out` + */ + static fromMat4(out: Mat3Like, a: Readonly): Mat3Like; + /** + * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix + * @category Static + * + * @param {mat3} out mat3 receiving operation result + * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out: Mat3Like, a: Readonly): Mat3Like | null; + /** + * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out: Mat3Like, a: Readonly): Mat3Like; + /** + * Generates a 2D projection matrix with the given bounds + * @category Static + * + * @param out mat3 frustum matrix will be written into + * @param width Width of your gl context + * @param height Height of gl context + * @returns `out` + */ + static projection(out: Mat3Like, width: number, height: number): Mat3Like; + /** + * Returns Frobenius norm of a {@link Mat3} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a: Readonly): number; + /** + * Multiply each element of a {@link Mat3} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out: Mat3Like, a: Readonly, b: number): Mat3Like; + /** + * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out: Mat3Like, a: Readonly, b: Readonly, scale: number): Mat3Like; + /** + * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether two {@link Mat3}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Returns a string representation of a {@link Mat3} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a: Readonly): string; +} + +/** + * A 4x4 Matrix + */ +declare class Mat4 extends Float64Array { + #private; + /** + * Create a {@link Mat4}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * A string representation of `this` + * Equivalent to `Mat4.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Mat4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Set `this` to the identity matrix + * Equivalent to Mat4.identity(this) + * @category Methods + * + * @returns `this` + */ + identity(): this; + /** + * Multiplies this {@link Mat4} against another one + * Equivalent to `Mat4.multiply(this, this, b);` + * @category Methods + * + * @param b - The second operand + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Mat4.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Transpose this {@link Mat4} + * Equivalent to `Mat4.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose(): this; + /** + * Inverts this {@link Mat4} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Translate this {@link Mat4} by the given vector + * Equivalent to `Mat4.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to translate by + * @returns `this` + */ + translate(v: Readonly): this; + /** + * Rotates this {@link Mat4} by the given angle around the given axis + * Equivalent to `Mat4.rotate(this, this, rad, axis);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `this` + */ + rotate(rad: number, axis: Readonly): this; + /** + * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat4.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to scale the matrix by + * @returns `this` + */ + scale(v: Readonly): this; + /** + * Rotates this {@link Mat4} by the given angle around the X axis + * Equivalent to `Mat4.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateX(rad: number): this; + /** + * Rotates this {@link Mat4} by the given angle around the Y axis + * Equivalent to `Mat4.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateY(rad: number): this; + /** + * Rotates this {@link Mat4} by the given angle around the Z axis + * Equivalent to `Mat4.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateZ(rad: number): this; + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveNO(fovy: number, aspect: number, near: number, far: number): this; + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveZO(fovy: number, aspect: number, near: number, far: number): this; + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoNO(left: number, right: number, bottom: number, top: number, near: number, far: number): this; + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoZO(left: number, right: number, bottom: number, top: number, near: number, far: number): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat4}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, identity {@link Mat4} + * @category Static + * + * @returns A new {@link Mat4} + */ + static create(): Mat4; + /** + * Creates a new {@link Mat4} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat4} + */ + static clone(a: Readonly): Mat4; + /** + * Copy the values from one {@link Mat4} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out: Mat4Like, a: Readonly): Mat4Like; + /** + * Create a new mat4 with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat4} + */ + static fromValues(...values: number[]): Mat4; + /** + * Set the components of a mat4 to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out: Mat4Like, ...values: number[]): Mat4Like; + /** + * Set a {@link Mat4} to the identity matrix + * @category Static + * + * @param out - The receiving Matrix + * @returns `out` + */ + static identity(out: Mat4Like): Mat4Like; + /** + * Transpose the values of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out: Mat4Like, a: Readonly): Mat4Like; + /** + * Inverts a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out: Mat4Like, a: Mat4Like): Mat4Like | null; + /** + * Calculates the adjugate of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out: Mat4Like, a: Mat4Like): Mat4Like; + /** + * Calculates the determinant of a {@link Mat4} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a: Readonly): number; + /** + * Multiplies two {@link Mat4}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like; + /** + * Alias for {@link Mat4.multiply} + * @category Static + */ + static mul(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like; + /** + * Translate a {@link Mat4} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like; + /** + * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec3} to scale the matrix by + * @returns `out` + **/ + static scale(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like; + /** + * Rotates a {@link Mat4} by the given angle around the given axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if axis has a length of 0 + */ + static rotate(out: Mat4Like, a: Readonly, rad: number, axis: Readonly): Mat4Like | null; + /** + * Rotates a matrix by the given angle around the X axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateX(out: Mat4Like, a: Readonly, rad: number): Mat4Like; + /** + * Rotates a matrix by the given angle around the Y axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateY(out: Mat4Like, a: Readonly, rad: number): Mat4Like; + /** + * Rotates a matrix by the given angle around the Z axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateZ(out: Mat4Like, a: Readonly, rad: number): Mat4Like; + /** + * Creates a {@link Mat4} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out: Mat4Like, v: Readonly): Mat4Like; + /** + * Creates a {@link Mat4} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out: Mat4Like, v: Readonly): Mat4Like; + /** + * Creates a {@link Mat4} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotate(dest, dest, rad, axis); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if `axis` has a length of 0 + */ + static fromRotation(out: Mat4Like, rad: number, axis: Readonly): Mat4Like | null; + /** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateX(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromXRotation(out: Mat4Like, rad: number): Mat4Like; + /** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateY(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromYRotation(out: Mat4Like, rad: number): Mat4Like; + /** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateZ(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromZRotation(out: Mat4Like, rad: number): Mat4Like; + /** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @returns `out` + */ + static fromRotationTranslation(out: Mat4Like, q: Readonly, v: Readonly): Mat4Like; + /** + * Sets a {@link Mat4} from a {@link Quat2}. + * @category Static + * + * @param out - Matrix + * @param a - Dual Quaternion + * @returns `out` + */ + static fromQuat2(out: Mat4Like, a: Quat2Like): Mat4Like; + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out: Mat4Like, a: Readonly): Mat4Like | null; + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out: Mat4Like, a: Readonly): Mat4Like; + /** + * Returns the translation vector component of a transformation + * matrix. If a matrix is built with fromRotationTranslation, + * the returned vector will be the same as the translation vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive translation component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getTranslation(out: Vec3Like, mat: Readonly): Vec3Like; + /** + * Returns the scaling factor component of a transformation + * matrix. If a matrix is built with fromRotationTranslationScale + * with a normalized Quaternion parameter, the returned vector will be + * the same as the scaling vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive scaling factor component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getScaling(out: Vec3Like, mat: Readonly): Vec3Like; + /** + * Returns a quaternion representing the rotational component + * of a transformation matrix. If a matrix is built with + * fromRotationTranslation, the returned quaternion will be the + * same as the quaternion originally supplied. + * @category Static + * + * @param out - Quaternion to receive the rotation component + * @param mat - Matrix to be decomposed (input) + * @return `out` + */ + static getRotation(out: QuatLike, mat: Readonly): QuatLike; + /** + * Decomposes a transformation matrix into its rotation, translation + * and scale components. Returns only the rotation component + * @category Static + * + * @param out_r - Quaternion to receive the rotation component + * @param out_t - Vector to receive the translation vector + * @param out_s - Vector to receive the scaling factor + * @param mat - Matrix to be decomposed (input) + * @returns `out_r` + */ + static decompose(out_r: QuatLike, out_t: Vec3Like, out_s: Vec3Like, mat: Readonly): QuatLike; + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @returns `out` + */ + static fromRotationTranslationScale( + out: Mat4Like, + q: Readonly, + v: Readonly, + s: Readonly, + ): Mat4Like; + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the + * given origin. This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * mat4.translate(dest, origin); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * mat4.translate(dest, negativeOrigin); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @param o - The origin vector around which to scale and rotate + * @returns `out` + */ + static fromRotationTranslationScaleOrigin( + out: Mat4Like, + q: Readonly, + v: Readonly, + s: Readonly, + o: Readonly, + ): Mat4Like; + /** + * Calculates a 4x4 matrix from the given quaternion + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Quaternion to create matrix from + * @returns `out` + */ + static fromQuat(out: Mat4Like, q: Readonly): Mat4Like; + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumNO( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far?: number, + ): Mat4Like; + /** + * Alias for {@link Mat4.frustumNO} + * @category Static + * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly + */ + static frustum( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far?: number, + ): Mat4Like; + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumZO( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far?: number, + ): Mat4Like; + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveNO(out: Mat4Like, fovy: number, aspect: number, near: number, far?: number): Mat4Like; + /** + * Alias for {@link Mat4.perspectiveNO} + * @category Static + * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly + */ + static perspective(out: Mat4Like, fovy: number, aspect: number, near: number, far?: number): Mat4Like; + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveZO(out: Mat4Like, fovy: number, aspect: number, near: number, far?: number): Mat4Like; + /** + * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating + * projection matrices to be used with the still experimental WebVR API. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + * @deprecated + */ + static perspectiveFromFieldOfView( + out: Mat4Like, + fov: { + upDegrees: number; + downDegrees: number; + leftDegrees: number; + rightDegrees: number; + }, + near: number, + far: number, + ): Mat4Like; + /** + * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoNO( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far: number, + ): Mat4Like; + /** + * Alias for {@link Mat4.orthoNO} + * @category Static + * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly + */ + static ortho( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far: number, + ): Mat4Like; + /** + * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoZO( + out: Mat4Like, + left: number, + right: number, + bottom: number, + top: number, + near: number, + far: number, + ): Mat4Like; + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that + * actually makes an object look at another object, you should use targetTo instead. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param center - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static lookAt(out: Mat4Like, eye: Readonly, center: Readonly, up: Readonly): Mat4Like; + /** + * Generates a matrix that makes something look at something else. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param target - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static targetTo(out: Mat4Like, eye: Readonly, target: Readonly, up: Readonly): Mat4Like; + /** + * Returns Frobenius norm of a {@link Mat4} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a: Readonly): number; + /** + * Adds two {@link Mat4}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like; + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like; + /** + * Alias for {@link Mat4.subtract} + * @category Static + */ + static sub(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like; + /** + * Multiply each element of the matrix by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out: Mat4Like, a: Readonly, b: number): Mat4Like; + /** + * Adds two mat4's after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out: Mat4Like, a: Readonly, b: Readonly, scale: number): Mat4Like; + /** + * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether two {@link Mat4}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Returns a string representation of a {@link Mat4} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a: Readonly): string; +} + +/** + * Quaternion + */ +declare class Quat extends Float64Array { + #private; + /** + * Create a {@link Quat}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * The x component of the quaternion. Equivalent to `this[0];` + * @category Quaternion Components + */ + get x(): number; + set x(value: number); + /** + * The y component of the quaternion. Equivalent to `this[1];` + * @category Quaternion Components + */ + get y(): number; + set y(value: number); + /** + * The z component of the quaternion. Equivalent to `this[2];` + * @category Quaternion Components + */ + get z(): number; + set z(value: number); + /** + * The w component of the quaternion. Equivalent to `this[3];` + * @category Quaternion Components + */ + get w(): number; + set w(value: number); + /** + * The magnitude (length) of this. + * Equivalent to `Quat.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number; + /** + * Alias for {@link Quat.magnitude} + * + * @category Accessors + */ + get mag(): number; + /** + * A string representation of `this` + * Equivalent to `Quat.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Quat} into `this`. + * @category Methods + * + * @param a the source quaternion + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Set `this` to the identity quaternion + * Equivalent to Quat.identity(this) + * @category Methods + * + * @returns `this` + */ + identity(): this; + /** + * Multiplies `this` by a {@link Quat}. + * Equivalent to `Quat.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Quat.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Rotates `this` by the given angle about the X axis + * Equivalent to `Quat.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateX(rad: number): this; + /** + * Rotates `this` by the given angle about the Y axis + * Equivalent to `Quat.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateY(rad: number): this; + /** + * Rotates `this` by the given angle about the Z axis + * Equivalent to `Quat.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateZ(rad: number): this; + /** + * Inverts `this` + * Equivalent to `Quat.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Scales `this` by a scalar number + * Equivalent to `Quat.scale(this, this, scale);` + * @category Methods + * + * @param scale - amount to scale the vector by + * @returns `this` + */ + scale(scale: number): QuatLike; + /** + * Calculates the dot product of `this` and another {@link Quat} + * Equivalent to `Quat.dot(this, b);` + * @category Methods + * + * @param b - the second operand + * @returns dot product of `this` and b + */ + dot(b: Readonly): number; + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new identity quat + * @category Static + * + * @returns a new quaternion + */ + static create(): Quat; + /** + * Set a quat to the identity quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + static identity(out: QuatLike): QuatLike; + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * @category Static + * + * @param out - the receiving quaternion + * @param axis - the axis around which to rotate + * @param rad - the angle in radians + * @returns `out` + **/ + static setAxisAngle(out: QuatLike, axis: Readonly, rad: number): QuatLike; + /** + * Gets the rotation axis and angle for a given + * quaternion. If a quaternion is created with + * setAxisAngle, this method will return the same + * values as provided in the original parameter list + * OR functionally equivalent values. + * Example: The quaternion formed by axis [0, 0, 1] and + * angle -90 is the same as the quaternion formed by + * [0, 0, 1] and 270. This method favors the latter. + * @category Static + * + * @param out_axis - Vector receiving the axis of rotation + * @param q - Quaternion to be decomposed + * @return Angle, in radians, of the rotation + */ + static getAxisAngle(out_axis: Vec3Like, q: Readonly): number; + /** + * Gets the angular distance between two unit quaternions + * @category Static + * + * @param {ReadonlyQuat} a Origin unit quaternion + * @param {ReadonlyQuat} b Destination unit quaternion + * @return {Number} Angle, in radians, between the two quaternions + */ + static getAngle(a: Readonly, b: Readonly): number; + /** + * Multiplies two quaternions. + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out: QuatLike, a: Readonly, b: Readonly): QuatLike; + /** + * Rotates a quaternion by the given angle about the X axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out: QuatLike, a: Readonly, rad: number): QuatLike; + /** + * Rotates a quaternion by the given angle about the Y axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out: QuatLike, a: Readonly, rad: number): QuatLike; + /** + * Rotates a quaternion by the given angle about the Z axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out: QuatLike, a: Readonly, rad: number): QuatLike; + /** + * Calculates the W component of a quat from the X, Y, and Z components. + * Assumes that quaternion is 1 unit in length. + * Any existing W component will be ignored. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate W component of + * @returns `out` + */ + static calculateW(out: QuatLike, a: Readonly): QuatLike; + /** + * Calculate the exponential of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static exp(out: QuatLike, a: Readonly): QuatLike; + /** + * Calculate the natural logarithm of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static ln(out: QuatLike, a: Readonly): QuatLike; + /** + * Calculate the scalar power of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @param b - amount to scale the quaternion by + * @returns `out` + */ + static pow(out: QuatLike, a: Readonly, b: number): QuatLike; + /** + * Performs a spherical linear interpolation between two quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike; + /** + * Generates a random unit quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + /** + * Calculates the inverse of a quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate inverse of + * @returns `out` + */ + static invert(out: QuatLike, a: Readonly): QuatLike; + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate conjugate of + * @returns `out` + */ + static conjugate(out: QuatLike, a: Readonly): QuatLike; + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to re-normalize the quaternion yourself where necessary. + * @category Static + * + * @param out - the receiving quaternion + * @param m - rotation matrix + * @returns `out` + */ + static fromMat3(out: QuatLike, m: Readonly): QuatLike; + /** + * Creates a quaternion from the given euler angle x, y, z. + * @category Static + * + * @param out - the receiving quaternion + * @param x - Angle to rotate around X axis in degrees. + * @param y - Angle to rotate around Y axis in degrees. + * @param z - Angle to rotate around Z axis in degrees. + * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx. + * @returns `out` + */ + static fromEuler(out: QuatLike, x: number, y: number, z: number, order?: string): QuatLike; + /** + * Returns a string representation of a quatenion + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a: Readonly): string; + /** + * Creates a new quat initialized with values from an existing quaternion + * @category Static + * + * @param a - quaternion to clone + * @returns a new quaternion + */ + static clone(a: Readonly): Quat; + /** + * Creates a new quat initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new quaternion + */ + static fromValues(x: number, y: number, z: number, w: number): Quat; + /** + * Copy the values from one quat to another + * @category Static + * + * @param out - the receiving quaternion + * @param a - the source quaternion + * @returns `out` + */ + static copy(out: QuatLike, a: Readonly): QuatLike; + /** + * Set the components of a {@link Quat} to the given values + * @category Static + * + * @param out - the receiving quaternion + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + static set(out: QuatLike, x: number, y: number, z: number, w: number): QuatLike; + /** + * Adds two {@link Quat}'s + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: QuatLike, a: Readonly, b: Readonly): QuatLike; + /** + * Alias for {@link Quat.multiply} + * @category Static + */ + static mul(out: QuatLike, a: Readonly, b: Readonly): QuatLike; + /** + * Scales a quat by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param b - amount to scale the vector by + * @returns `out` + */ + static scale(out: QuatLike, a: Readonly, scale: number): QuatLike; + /** + * Calculates the dot product of two quat's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a: Readonly, b: Readonly): number; + /** + * Performs a linear interpolation between two quat's + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike; + /** + * Calculates the magnitude (length) of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate length of + * @returns length of `a` + */ + static magnitude(a: Readonly): number; + /** + * Alias for {@link Quat.magnitude} + * @category Static + */ + static mag(a: Readonly): number; + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + static length(a: Readonly): number; + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.mag} + */ + static len(a: Readonly): number; + /** + * Calculates the squared length of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a: Readonly): number; + /** + * Alias for {@link Quat.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly): number; + /** + * Normalize a {@link Quat} + * @category Static + * + * @param out - the receiving quaternion + * @param a - quaternion to normalize + * @returns `out` + */ + static normalize(out: QuatLike, a: Readonly): QuatLike; + /** + * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first quaternion. + * @param b - The second quaternion. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether the quaternions have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * @category Static + * + * @param out - the receiving quaternion. + * @param a - the initial vector + * @param b - the destination vector + * @returns `out` + */ + static rotationTo(out: QuatLike, a: Readonly, b: Readonly): QuatLike; + /** + * Performs a spherical linear interpolation with two control points + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static sqlerp( + out: QuatLike, + a: Readonly, + b: Readonly, + c: Readonly, + d: Readonly, + t: number, + ): QuatLike; + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * @category Static + * + * @param out - The receiving quaternion + * @param view - the vector representing the viewing direction + * @param right - the vector representing the local `right` direction + * @param up - the vector representing the local `up` direction + * @returns `out` + */ + static setAxes(out: QuatLike, view: Readonly, right: Readonly, up: Readonly): QuatLike; +} + +/** + * Dual Quaternion + */ +declare class Quat2 extends Float64Array { + #private; + /** + * Create a {@link Quat2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * A string representation of `this` + * Equivalent to `Quat2.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Quat2} into `this`. + * @category Methods + * + * @param a the source dual quaternion + * @returns `this` + */ + copy(a: Readonly): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat2}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new identity {@link Quat2} + * @category Static + * + * @returns a new dual quaternion [real -> rotation, dual -> translation] + */ + static create(): Quat2; + /** + * Creates a {@link Quat2} quat initialized with values from an existing quaternion + * @category Static + * + * @param a - dual quaternion to clone + * @returns a new dual quaternion + */ + static clone(a: Quat2Like): Quat2; + /** + * Creates a new {@link Quat2} initialized with the given values + * @category Static + * + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns a new dual quaternion + */ + static fromValues( + x1: number, + y1: number, + z1: number, + w1: number, + x2: number, + y2: number, + z2: number, + w2: number, + ): Quat2; + /** + * Creates a new {@link Quat2} from the given values (quat and translation) + * @category Static + * + * @param x1 - X component (rotation) + * @param y1 - Y component (rotation) + * @param z1 - Z component (rotation) + * @param w1 - W component (rotation) + * @param x2 - X component (translation) + * @param y2 - Y component (translation) + * @param z2 - Z component (translation) + * @returns a new dual quaternion + */ + static fromRotationTranslationValues( + x1: number, + y1: number, + z1: number, + w1: number, + x2: number, + y2: number, + z2: number, + ): Quat2; + /** + * Sets a {@link Quat2} from a quaternion and a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @param t - translation vector + * @returns `out` + */ + static fromRotationTranslation(out: Quat2Like, q: Readonly, t: Readonly): Quat2Like; + /** + * Sets a {@link Quat2} from a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param t - translation vector + * @returns `out` + */ + static fromTranslation(out: Quat2Like, t: Readonly): Quat2Like; + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @returns `out` + */ + static fromRotation(out: Quat2Like, q: Readonly): Quat2Like; + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param a - the matrix + * @returns `out` + */ + static fromMat4(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Copy the values from one {@link Quat2} to another + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the source dual quaternion + * @returns `out` + */ + static copy(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Set a {@link Quat2} to the identity dual quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @returns `out` + */ + static identity(out: QuatLike): QuatLike; + /** + * Set the components of a {@link Quat2} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns `out` + */ + static set( + out: Quat2Like, + x1: number, + y1: number, + z1: number, + w1: number, + x2: number, + y2: number, + z2: number, + w2: number, + ): Quat2Like; + /** + * Gets the real part of a dual quat + * @category Static + * + * @param out - real part + * @param a - Dual Quaternion + * @return `out` + */ + static getReal(out: QuatLike, a: Readonly): QuatLike; + /** + * Gets the dual part of a dual quat + * @category Static + * + * @param out - dual part + * @param a - Dual Quaternion + * @return `out` + */ + static getDual(out: QuatLike, a: Readonly): QuatLike; + /** + * Set the real component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the real part + * @return `out` + */ + static setReal(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Set the dual component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the dual part + * @return `out` + */ + static setDual(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Gets the translation of a normalized {@link Quat2} + * @category Static + * + * @param out - the receiving translation vector + * @param a - Dual Quaternion to be decomposed + * @return `out` + */ + static getTranslation(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Translates a {@link Quat2} by the given vector + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out: Quat2Like, a: Readonly, v: Readonly): Quat2Like; + /** + * Rotates a {@link Quat2} around the X axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out: Quat2Like, a: Readonly, rad: number): Quat2Like; + /** + * Rotates a {@link Quat2} around the Y axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out: Quat2Like, a: Readonly, rad: number): Quat2Like; + /** + * Rotates a {@link Quat2} around the Z axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out: Quat2Like, a: Readonly, rad: number): Quat2Like; + /** + * Rotates a {@link Quat2} by a given quaternion (a * q) + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param q - quaternion to rotate by + * @returns `out` + */ + static rotateByQuatAppend(out: Quat2Like, a: Readonly, q: Readonly): Quat2Like; + /** + * Rotates a {@link Quat2} by a given quaternion (q * a) + * @category Static + * + * @param out - the receiving dual quaternion + * @param q - quaternion to rotate by + * @param a - the dual quaternion to rotate + * @returns `out` + */ + static rotateByQuatPrepend(out: Quat2Like, q: Readonly, a: Readonly): Quat2Like; + /** + * Rotates a {@link Quat2} around a given axis. Does the normalization automatically + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param axis - the axis to rotate around + * @param rad - how far the rotation should be + * @returns `out` + */ + static rotateAroundAxis(out: Quat2Like, a: Readonly, axis: Readonly, rad: number): Quat2Like; + /** + * Adds two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like; + /** + * Multiplies two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns {quat2} out + */ + static multiply(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like; + /** + * Alias for {@link Quat2.multiply} + * @category Static + */ + static mul(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like; + /** + * Scales a {@link Quat2} by a scalar value + * @category Static + * + * @param out - the receiving dual quaterion + * @param a - the dual quaternion to scale + * @param b - scalar value to scale the dual quaterion by + * @returns `out` + */ + static scale(out: Quat2Like, a: Readonly, b: number): Quat2Like; + /** + * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts) + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a: Readonly, b: Readonly): number; + /** + * Performs a linear interpolation between two {@link Quat2}s + * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`) + * @category Static + * + * @param out - the receiving dual quat + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Quat2Like, a: Readonly, b: Readonly, t: number): Quat2Like; + /** + * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quat to calculate inverse of + * @returns `out` + */ + static invert(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than + * {@link Quat2.invert} and produces the same result. + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to calculate conjugate of + * @returns `out` + */ + static conjugate(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Calculates the magnitude (length) of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate length of + * @returns length of `a` + */ + static magnitude(a: Readonly): number; + /** + * Alias for {@link Quat2.magnitude} + * @category Static + */ + static mag(a: Readonly): number; + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + static length(a: Readonly): number; + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.mag} + */ + static len(a: Readonly): number; + /** + * Calculates the squared length of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a: Readonly): number; + /** + * Alias for {@link Quat2.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly): number; + /** + * Normalize a {@link Quat2} + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to normalize + * @returns `out` + */ + static normalize(out: Quat2Like, a: Readonly): Quat2Like; + /** + * Returns a string representation of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to represent as a string + * @returns string representation of the vector + */ + static str(a: Readonly): string; + /** + * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether the {@link Quat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; +} + +/** + * 2 Dimensional Vector + */ +declare class Vec2 extends Float64Array { + /** + * Create a {@link Vec2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x(): number; + set x(value: number); + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y(): number; + set y(value: number); + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r(): number; + set r(value: number); + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g(): number; + set g(value: number); + /** + * The magnitude (length) of this. + * Equivalent to `Vec2.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number; + /** + * Alias for {@link Vec2.magnitude} + * + * @category Accessors + */ + get mag(): number; + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec2.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude(): number; + /** + * Alias for {@link Vec2.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag(): number; + /** + * A string representation of `this` + * Equivalent to `Vec2.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Vec2} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Adds a {@link Vec2} to `this`. + * Equivalent to `Vec2.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b: Readonly): this; + /** + * Subtracts a {@link Vec2} from `this`. + * Equivalent to `Vec2.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b: Readonly): this; + /** + * Alias for {@link Vec2.subtract} + * @category Methods + */ + sub(b: Readonly): this; + /** + * Multiplies `this` by a {@link Vec2}. + * Equivalent to `Vec2.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Vec2.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Divides `this` by a {@link Vec2}. + * Equivalent to `Vec2.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b: Readonly): this; + /** + * Alias for {@link Vec2.divide} + * @category Methods + */ + div(b: Readonly): this; + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec2.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b: number): this; + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b: Readonly, scale: number): this; + /** + * Calculates the Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b: Readonly): number; + /** + * Alias for {@link Vec2.distance} + * @category Methods + */ + dist(b: Readonly): number; + /** + * Calculates the squared Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b: Readonly): number; + /** + * Alias for {@link Vec2.squaredDistance} + * @category Methods + */ + sqrDist(b: Readonly): number; + /** + * Negates the components of `this`. + * Equivalent to `Vec2.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate(): this; + /** + * Inverts the components of `this`. + * Equivalent to `Vec2.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec2.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs(): this; + /** + * Calculates the dot product of this and another {@link Vec2}. + * Equivalent to `Vec2.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b: Readonly): number; + /** + * Normalize `this`. + * Equivalent to `Vec2.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize(): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec2}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, empty {@link Vec2} + * @category Static + * + * @returns A new 2D vector + */ + static create(): Vec2; + /** + * Creates a new {@link Vec2} initialized with values from an existing vector + * @category Static + * + * @param a - Vector to clone + * @returns A new 2D vector + */ + static clone(a: Readonly): Vec2; + /** + * Creates a new {@link Vec2} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @returns A new 2D vector + */ + static fromValues(x: number, y: number): Vec2; + /** + * Copy the values from one {@link Vec2} to another + * @category Static + * + * @param out - the receiving vector + * @param a - The source vector + * @returns `out` + */ + static copy(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Set the components of a {@link Vec2} to the given values + * @category Static + * + * @param out - The receiving vector + * @param x - X component + * @param y - Y component + * @returns `out` + */ + static set(out: Vec2Like, x: number, y: number): Vec2Like; + /** + * Adds two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static subtract(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Alias for {@link Vec2.subtract} + * @category Static + */ + static sub(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Multiplies two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Alias for {@link Vec2.multiply} + * @category Static + */ + static mul(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Divides two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static divide(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Alias for {@link Vec2.divide} + * @category Static + */ + static div(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Math.ceil the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to ceil + * @returns `out` + */ + static ceil(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Math.floor the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to floor + * @returns `out` + */ + static floor(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Returns the minimum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static min(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Returns the maximum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static max(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Math.round the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to round + * @returns `out` + */ + static round(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Scales a {@link Vec2} by a scalar number + * @category Static + * + * @param out - The receiving vector + * @param a - The vector to scale + * @param b - Amount to scale the vector by + * @returns `out` + */ + static scale(out: Vec2Like, a: Readonly, b: number): Vec2Like; + /** + * Adds two Vec2's after scaling the second operand by a scalar value + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param scale - The amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out: Vec2Like, a: Readonly, b: Readonly, scale: number): Vec2Like; + /** + * Calculates the Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns distance between `a` and `b` + */ + static distance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + static dist(a: Readonly, b: Readonly): number; + /** + * Calculates the squared Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Squared distance between `a` and `b` + */ + static squaredDistance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + static sqrDist(a: Readonly, b: Readonly): number; + /** + * Calculates the magnitude (length) of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a: Readonly): number; + /** + * Alias for {@link Vec2.magnitude} + * @category Static + */ + static mag(a: Readonly): number; + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + static length(a: Readonly): number; + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.mag} + */ + static len(a: Readonly): number; + /** + * Calculates the squared length of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate squared length of + * @returns Squared length of a + */ + static squaredLength(a: Readonly): number; + /** + * Alias for {@link Vec2.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly, b: Readonly): number; + /** + * Negates the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to negate + * @returns `out` + */ + static negate(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Returns the inverse of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to invert + * @returns `out` + */ + static inverse(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Returns the absolute value of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Normalize a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to normalize + * @returns `out` + */ + static normalize(out: Vec2Like, a: Readonly): Vec2Like; + /** + * Calculates the dot product of two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Dot product of `a` and `b` + */ + static dot(a: Readonly, b: Readonly): number; + /** + * Computes the cross product of two {@link Vec2}s + * Note that the cross product must by definition produce a 3D vector. + * For this reason there is also not instance equivalent for this function. + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static cross(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like; + /** + * Performs a linear interpolation between two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param t - Interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Vec2Like, a: Readonly, b: Readonly, t: number): Vec2Like; + /** + * Transforms the {@link Vec2} with a {@link Mat2} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like; + /** + * Transforms the {@link Vec2} with a {@link Mat2d} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2d(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like; + /** + * Transforms the {@link Vec2} with a {@link Mat3} + * 3rd vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat3(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like; + /** + * Transforms the {@link Vec2} with a {@link Mat4} + * 3rd vector component is implicitly '0' + * 4th vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat4(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like; + /** + * Rotate a 2D vector + * @category Static + * + * @param out - The receiving {@link Vec2} + * @param a - The {@link Vec2} point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotate(out: Vec2Like, a: Readonly, b: Readonly, rad: number): Vec2Like; + /** + * Get the angle between two 2D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static angle(a: Readonly, b: Readonly): number; + /** + * Set the components of a {@link Vec2} to zero + * @category Static + * + * @param out - The receiving vector + * @returns `out` + */ + static zero(out: Vec2Like): Vec2Like; + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors components are ===, `false` otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors are approximately equal, `false` otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - Vector to represent as a string + * @returns String representation of the vector + */ + static str(a: Readonly): string; +} + +/** + * 3 Dimensional Vector + */ +declare class Vec3 extends Float64Array { + /** + * Create a {@link Vec3}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x(): number; + set x(value: number); + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y(): number; + set y(value: number); + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z(): number; + set z(value: number); + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r(): number; + set r(value: number); + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g(): number; + set g(value: number); + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b(): number; + set b(value: number); + /** + * The magnitude (length) of this. + * Equivalent to `Vec3.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number; + /** + * Alias for {@link Vec3.magnitude} + * + * @category Accessors + */ + get mag(): number; + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec3.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude(): number; + /** + * Alias for {@link Vec3.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag(): number; + /** + * A string representation of `this` + * Equivalent to `Vec3.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Vec3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Adds a {@link Vec3} to `this`. + * Equivalent to `Vec3.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b: Readonly): this; + /** + * Subtracts a {@link Vec3} from `this`. + * Equivalent to `Vec3.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b: Readonly): this; + /** + * Alias for {@link Vec3.subtract} + * @category Methods + */ + sub(b: Readonly): this; + /** + * Multiplies `this` by a {@link Vec3}. + * Equivalent to `Vec3.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Vec3.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Divides `this` by a {@link Vec3}. + * Equivalent to `Vec3.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b: Readonly): this; + /** + * Alias for {@link Vec3.divide} + * @category Methods + */ + div(b: Readonly): this; + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec3.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b: number): this; + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b: Readonly, scale: number): this; + /** + * Calculates the Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b: Readonly): number; + /** + * Alias for {@link Vec3.distance} + * @category Methods + */ + dist(b: Readonly): number; + /** + * Calculates the squared Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b: Readonly): number; + /** + * Alias for {@link Vec3.squaredDistance} + * @category Methods + */ + sqrDist(b: Readonly): number; + /** + * Negates the components of `this`. + * Equivalent to `Vec3.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate(): this; + /** + * Inverts the components of `this`. + * Equivalent to `Vec3.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Sets each component of `this` to its absolute value. + * Equivalent to `Vec3.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs(): this; + /** + * Calculates the dot product of this and another {@link Vec3}. + * Equivalent to `Vec3.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b: Readonly): number; + /** + * Normalize `this`. + * Equivalent to `Vec3.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize(): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec3}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, empty vec3 + * @category Static + * + * @returns a new 3D vector + */ + static create(): Vec3; + /** + * Creates a new vec3 initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 3D vector + */ + static clone(a: Readonly): Vec3; + /** + * Calculates the magnitude (length) of a {@link Vec3} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a: Readonly): number; + /** + * Alias for {@link Vec3.magnitude} + * @category Static + */ + static mag(a: Readonly): number; + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + static length(a: Readonly): number; + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.mag} + */ + static len(a: Readonly): number; + /** + * Creates a new vec3 initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns a new 3D vector + */ + static fromValues(x: number, y: number, z: number): Vec3; + /** + * Copy the values from one vec3 to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Set the components of a vec3 to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns `out` + */ + static set(out: Vec3Like, x: number, y: number, z: number): Vec3Like; + /** + * Adds two {@link Vec3}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Alias for {@link Vec3.subtract} + * @category Static + */ + static sub(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Multiplies two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Alias for {@link Vec3.multiply} + * @category Static + */ + static mul(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Divides two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Alias for {@link Vec3.divide} + * @category Static + */ + static div(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Math.ceil the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Math.floor the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Returns the minimum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Returns the maximum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * symmetric round the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + /** + * Scales a vec3 by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out: Vec3Like, a: Readonly, scale: number): Vec3Like; + /** + * Adds two vec3's after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out: Vec3Like, a: Readonly, b: Readonly, scale: number): Vec3Like; + /** + * Calculates the Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec3.distance} + * @category Static + */ + static dist(a: Readonly, b: Readonly): number; + /** + * Calculates the squared Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec3.squaredDistance} + * @category Static + */ + static sqrDist(a: Readonly, b: Readonly): number; + /** + * Calculates the squared length of a vec3 + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a: Readonly): number; + /** + * Alias for {@link Vec3.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly, b: Readonly): number; + /** + * Negates the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Returns the inverse of the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Returns the absolute value of the components of a {@link Vec3} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Normalize a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out: Vec3Like, a: Readonly): Vec3Like; + /** + * Calculates the dot product of two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a: Readonly, b: Readonly): number; + /** + * Computes the cross product of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static cross(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like; + /** + * Performs a linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like; + /** + * Performs a spherical linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like; + /** + * Performs a hermite interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static hermite( + out: Vec3Like, + a: Readonly, + b: Readonly, + c: Readonly, + d: Readonly, + t: number, + ): Vec3Like; + /** + * Performs a bezier interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static bezier( + out: Vec3Like, + a: Readonly, + b: Readonly, + c: Readonly, + d: Readonly, + t: number, + ): Vec3Like; + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned + * @returns `out` + */ + /** + * Transforms the vec3 with a mat4. + * 4th vector component is implicitly '1' + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out: Vec3Like, a: Readonly, m: Readonly): Vec3Like; + /** + * Transforms the vec3 with a mat3. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - the 3x3 matrix to transform with + * @returns `out` + */ + static transformMat3(out: Vec3Like, a: Vec3Like, m: Mat3Like): Vec3Like; + /** + * Transforms the vec3 with a quat + * Can also be used for dual quaternions. (Multiply it with the real part) + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out: Vec3Like, a: Readonly, q: Readonly): Vec3Like; + /** + * Rotate a 3D vector around the x-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateX(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like; + /** + * Rotate a 3D vector around the y-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateY(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like; + /** + * Rotate a 3D vector around the z-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateZ(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like; + /** + * Get the angle between two 3D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static angle(a: Readonly, b: Readonly): number; + /** + * Set the components of a vec3 to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out: Vec3Like): Vec3Like; + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a: Readonly): string; + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; +} + +/** + * 4 Dimensional Vector + */ +declare class Vec4 extends Float64Array { + /** + * Create a {@link Vec4}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]); + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x(): number; + set x(value: number); + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y(): number; + set y(value: number); + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z(): number; + set z(value: number); + /** + * The w component of the vector. Equivalent to `this[3];` + * @category Vector Components + */ + get w(): number; + set w(value: number); + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r(): number; + set r(value: number); + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g(): number; + set g(value: number); + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b(): number; + set b(value: number); + /** + * The a component of the vector. Equivalent to `this[3];` + * @category Color Components + */ + get a(): number; + set a(value: number); + /** + * The magnitude (length) of this. + * Equivalent to `Vec4.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number; + /** + * Alias for {@link Vec4.magnitude} + * + * @category Accessors + */ + get mag(): number; + /** + * A string representation of `this` + * Equivalent to `Vec4.str(this);` + * + * @category Accessors + */ + get str(): string; + /** + * Copy the values from another {@link Vec4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this; + /** + * Adds a {@link Vec4} to `this`. + * Equivalent to `Vec4.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b: Readonly): this; + /** + * Subtracts a {@link Vec4} from `this`. + * Equivalent to `Vec4.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b: Readonly): this; + /** + * Alias for {@link Vec4.subtract} + * @category Methods + */ + sub(b: Readonly): this; + /** + * Multiplies `this` by a {@link Vec4}. + * Equivalent to `Vec4.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this; + /** + * Alias for {@link Vec4.multiply} + * @category Methods + */ + mul(b: Readonly): this; + /** + * Divides `this` by a {@link Vec4}. + * Equivalent to `Vec4.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b: Readonly): this; + /** + * Alias for {@link Vec4.divide} + * @category Methods + */ + div(b: Readonly): this; + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec4.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b: number): this; + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b: Readonly, scale: number): this; + /** + * Calculates the Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b: Readonly): number; + /** + * Alias for {@link Vec4.distance} + * @category Methods + */ + dist(b: Readonly): number; + /** + * Calculates the squared Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b: Readonly): number; + /** + * Alias for {@link Vec4.squaredDistance} + * @category Methods + */ + sqrDist(b: Readonly): number; + /** + * Negates the components of `this`. + * Equivalent to `Vec4.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate(): this; + /** + * Inverts the components of `this`. + * Equivalent to `Vec4.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this; + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec4.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs(): this; + /** + * Calculates the dot product of this and another {@link Vec4}. + * Equivalent to `Vec4.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b: Readonly): number; + /** + * Normalize `this`. + * Equivalent to `Vec4.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize(): this; + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec4}. + */ + static get BYTE_LENGTH(): number; + /** + * Creates a new, empty {@link Vec4} + * @category Static + * + * @returns a new 4D vector + */ + static create(): Vec4; + /** + * Creates a new {@link Vec4} initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 4D vector + */ + static clone(a: Vec4Like): Vec4; + /** + * Creates a new {@link Vec4} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new 4D vector + */ + static fromValues(x: number, y: number, z: number, w: number): Vec4; + /** + * Copy the values from one {@link Vec4} to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Set the components of a {@link Vec4} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + static set(out: Vec4Like, x: number, y: number, z: number, w: number): Vec4Like; + /** + * Adds two {@link Vec4}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Alias for {@link Vec4.subtract} + * @category Static + */ + static sub(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Multiplies two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Alias for {@link Vec4.multiply} + * @category Static + */ + static mul(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Divides two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Alias for {@link Vec4.divide} + * @category Static + */ + static div(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Math.ceil the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Math.floor the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Returns the minimum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Returns the maximum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like; + /** + * Math.round the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + static round(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Scales a {@link Vec4} by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out: Vec4Like, a: Readonly, scale: number): Vec4Like; + /** + * Adds two {@link Vec4}'s after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out: Vec4Like, a: Readonly, b: Readonly, scale: number): Vec4Like; + /** + * Calculates the Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec4.distance} + * @category Static + */ + static dist(a: Readonly, b: Readonly): number; + /** + * Calculates the squared Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a: Readonly, b: Readonly): number; + /** + * Alias for {@link Vec4.squaredDistance} + * @category Static + */ + static sqrDist(a: Readonly, b: Readonly): number; + /** + * Calculates the magnitude (length) of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate length of + * @returns length of `a` + */ + static magnitude(a: Readonly): number; + /** + * Alias for {@link Vec4.magnitude} + * @category Static + */ + static mag(a: Readonly): number; + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + static length(a: Readonly): number; + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.mag} + */ + static len(a: Readonly): number; + /** + * Calculates the squared length of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a: Readonly): number; + /** + * Alias for {@link Vec4.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly): number; + /** + * Negates the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Returns the inverse of the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Returns the absolute value of the components of a {@link Vec4} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Normalize a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out: Vec4Like, a: Readonly): Vec4Like; + /** + * Calculates the dot product of two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a: Readonly, b: Readonly): number; + /** + * Returns the cross-product of three vectors in a 4-dimensional space + * @category Static + * + * @param out the receiving vector + * @param u - the first vector + * @param v - the second vector + * @param w - the third vector + * @returns result + */ + static cross(out: Vec4Like, u: Readonly, v: Readonly, w: Readonly): Vec4Like; + /** + * Performs a linear interpolation between two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Vec4Like, a: Readonly, b: Readonly, t: number): Vec4Like; + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns `out` + */ + /** + * Transforms the {@link Vec4} with a {@link Mat4}. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out: Vec4Like, a: Readonly, m: Readonly): Vec4Like; + /** + * Transforms the {@link Vec4} with a {@link Quat} + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out: Vec4Like, a: Readonly, q: Readonly): Vec4Like; + /** + * Set the components of a {@link Vec4} to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out: Vec4Like): Vec4Like; + /** + * Returns a string representation of a {@link Vec4} + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a: Readonly): string; + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean; + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean; +} + +/** + * To enable additional swizzle accessors for vector classes (64-bit) invoke the {@link EnableSwizzlesF64} function from + * the `gl-matrix/swizzle/f64` sub-path export. To enable ambient module declarations for IDE / Typescript support + * please see {@link gl-matrix/types/swizzle/f64}. + * + * To enable swizzling for the 32-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle}. + * + * @example + * ```ts + * import { Vec3 } from 'gl-matrix/f64'; + * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64'; + * + * EnableSwizzlesF64(); + * + * const vec = new Vec3(0, 1, 2); + * const vecSwizzled = vec.zyx; // Returns a new Vec3(2, 1, 0). + * ``` + * + * @packageDocumentation + */ +/** + * Enables Swizzle operations on {@link gl-matrix/f64.Vec2 | Vec2} / {@link gl-matrix/f64.Vec3 | Vec3} / + * {@link gl-matrix/f64.Vec4 | Vec4} types from {@link gl-matrix/f64} (64-bit). + * + * Swizzle operations are performed by using the `.` operator in conjunction with any combination + * of between two and four component names, either from the set `xyzw` or `rgbw` (though not intermixed). + * They return a new vector with the same number of components as specified in the swizzle attribute. + * + * @example + * ```js + * import { Vec3 } from 'gl-matrix/f64'; + * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64'; + * + * EnableSwizzlesF64(); + * + * let v = new Vec3(0, 1, 2); + * + * v.yx; // returns new Vec2(1, 0) + * v.xzy; // returns new Vec3(0, 2, 1) + * v.zyxz; // returns new Vec4(2, 1, 0, 2) + * + * v.rgb; // returns new Vec3(0, 1, 2) + * v.rbg; // returns new Vec3(0, 2, 1) + * v.gg; // returns new Vec2(1, 1) + * ``` + */ +declare function EnableSwizzlesF64(): void; + +/** + * Ambient module declarations for `gl-matrix/f64` (64-bit) swizzle extensions for vector classes. + * + * When swizzle accessors via {@link gl-matrix/swizzle/f64.EnableSwizzlesF64 | EnableSwizzlesF64} are enabled include + * this sub-path export as a `side effect` import to add ambient module declarations for the additional accessors to + * {@link gl-matrix/f64.Vec2 | Vec2} / {@link gl-matrix/f64.Vec3 | Vec3} / {@link gl-matrix/f64.Vec4 | Vec4}. + * + * To enable swizzling for the 64-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle/f64}. + * + * ```js + * import { Vec2 } from 'gl-matrix/f64'; + * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64'; + * + * import 'gl-matrix/types/swizzle/f64'; + * + * EnableSwizzlesF64(); + * + * const vec = new Vec2(0, 1); + * + * // Swizzled instance - returns new Vec2(1, 0). + * const vecSwizzled = vec.yx; + * ``` + * + * @packageDocumentation + */ + +/** + * A type alias for Vec2 (64-bit). + * @hidden + */ +type Vec2Alias = Vec2; +/** + * A type alias for Vec3 (64-bit). + * @hidden + */ +type Vec3Alias = Vec3; +/** + * A type alias for Vec4 (64-bit). + * @hidden + */ +type Vec4Alias = Vec4; + +/** + * Vec2 swizzle extension accessors. + */ +interface Vec2 { + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggg(): Vec4Alias; +} +/** + * Vec3 swizzle extension accessors. + */ +interface Vec3 { + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get br(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbb(): Vec4Alias; +} +/** + * Vec4 swizzle extension accessors. + */ +interface Vec4 { + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get br(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xw(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yw(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zw(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get wx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get wy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get wz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ww(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xwx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xwy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xwz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xww(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ywx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ywy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ywz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yww(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zwx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zwy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zwz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zww(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wwx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wwy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wwz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get www(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ra(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ga(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ba(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ar(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ag(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ab(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get aa(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rra(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get raa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gra(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gaa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bra(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get baa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get arr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get arg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get arb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ara(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get agr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get agg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get agb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get abr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get abg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get abb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aaa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rraa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rarr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rarg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rarb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ragr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ragg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ragb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rabr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rabg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rabb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get graa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get garr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get garg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get garb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gagr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gagg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gagb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gabr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gabg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gabb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get braa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get barr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get barg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get barb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bagr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bagg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bagb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get babr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get babg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get babb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get argr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get argg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get argb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get araa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aarr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aarg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aarb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aagr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aagg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aagb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aabr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aabg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aabb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaaa(): Vec4Alias; +} + +/** + * Convert `radians` to `degrees`. + * + * @param value - Angle in `radians`. + * @returns Angle in `degrees`. + */ +declare function toDegree(value: number): number; +/** + * Convert `degrees` to `radians`. + * + * @param value - Angle in `degrees`. + * @returns Angle in `radians`. + */ +declare function toRadian(value: number): number; + +export { + EnableSwizzlesF64, + type FloatArray, + Mat2, + type Mat2Like, + Mat2d, + type Mat2dLike, + Mat3, + type Mat3Like, + Mat4, + type Mat4Like, + Quat, + Quat2, + type Quat2Like, + type QuatLike, + Vec2, + type Vec2Like, + Vec3, + type Vec3Like, + Vec4, + type Vec4Like, + toDegree, + toRadian, +}; diff --git a/dist-cdn/types/globals-f32.d.cts b/dist-cdn/types/globals-f32.d.cts new file mode 100644 index 00000000..adc8b408 --- /dev/null +++ b/dist-cdn/types/globals-f32.d.cts @@ -0,0 +1,7 @@ +import type * as libF32 from './gl-matrix-f32.d.cts'; + +declare global { + const glMatrix: typeof libF32; +} + +export {}; diff --git a/dist-cdn/types/globals-f32.d.mts b/dist-cdn/types/globals-f32.d.mts new file mode 100644 index 00000000..b2600fd6 --- /dev/null +++ b/dist-cdn/types/globals-f32.d.mts @@ -0,0 +1,7 @@ +import type * as libF32 from './gl-matrix-f32.d.mts'; + +declare global { + const glMatrix: typeof libF32; +} + +export {}; diff --git a/dist-cdn/types/globals-f64.d.cts b/dist-cdn/types/globals-f64.d.cts new file mode 100644 index 00000000..62ee1f7d --- /dev/null +++ b/dist-cdn/types/globals-f64.d.cts @@ -0,0 +1,7 @@ +import type * as libF64 from './gl-matrix-f64.d.cts'; + +declare global { + const glMatrixF64: typeof libF64; +} + +export {}; diff --git a/dist-cdn/types/globals-f64.d.mts b/dist-cdn/types/globals-f64.d.mts new file mode 100644 index 00000000..9d950c58 --- /dev/null +++ b/dist-cdn/types/globals-f64.d.mts @@ -0,0 +1,7 @@ +import type * as libF64 from './gl-matrix-f64.d.mts'; + +declare global { + const glMatrixF64: typeof libF64; +} + +export {}; diff --git a/dist-cdn/types/index.cjs b/dist-cdn/types/index.cjs new file mode 100644 index 00000000..43a1d7b2 --- /dev/null +++ b/dist-cdn/types/index.cjs @@ -0,0 +1,18 @@ +// glMatrix - v4.0.0-beta.3 +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// dist-cdn/types/index.js +var types_exports = {}; +module.exports = __toCommonJS(types_exports); diff --git a/dist-cdn/types/index.js b/dist-cdn/types/index.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/dist-cdn/types/index.js @@ -0,0 +1 @@ +export {}; diff --git a/dist-cdn/umd/gl-matrix-f32.js b/dist-cdn/umd/gl-matrix-f32.js new file mode 100644 index 00000000..227cd9e9 --- /dev/null +++ b/dist-cdn/umd/gl-matrix-f32.js @@ -0,0 +1,10793 @@ +// gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library. +// @author Brandon Jones +// @author Colin MacKenzie IV +// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md) +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.glMatrix = {})); +})(this, (function (exports) { 'use strict'; + + function _assertThisInitialized(e) { + if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return e; + } + function _callSuper(t, o, e) { + return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); + } + function _classCallCheck(a, n) { + if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); + } + function _construct(t, e, r) { + if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); + var o = [null]; + o.push.apply(o, e); + var p = new (t.bind.apply(t, o))(); + return r && _setPrototypeOf(p, r.prototype), p; + } + function _defineProperties(e, r) { + for (var t = 0; t < r.length; t++) { + var o = r[t]; + o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); + } + } + function _createClass(e, r, t) { + return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { + writable: !1 + }), e; + } + function _get() { + return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { + var p = _superPropBase(e, t); + if (p) { + var n = Object.getOwnPropertyDescriptor(p, t); + return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; + } + }, _get.apply(null, arguments); + } + function _getPrototypeOf(t) { + return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { + return t.__proto__ || Object.getPrototypeOf(t); + }, _getPrototypeOf(t); + } + function _inherits(t, e) { + if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); + t.prototype = Object.create(e && e.prototype, { + constructor: { + value: t, + writable: !0, + configurable: !0 + } + }), Object.defineProperty(t, "prototype", { + writable: !1 + }), e && _setPrototypeOf(t, e); + } + function _isNativeFunction(t) { + try { + return -1 !== Function.toString.call(t).indexOf("[native code]"); + } catch (n) { + return "function" == typeof t; + } + } + function _isNativeReflectConstruct() { + try { + var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (t) {} + return (_isNativeReflectConstruct = function () { + return !!t; + })(); + } + function _possibleConstructorReturn(t, e) { + if (e && ("object" == typeof e || "function" == typeof e)) return e; + if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); + return _assertThisInitialized(t); + } + function _setPrototypeOf(t, e) { + return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { + return t.__proto__ = e, t; + }, _setPrototypeOf(t, e); + } + function _superPropBase(t, o) { + for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); + return t; + } + function _superPropGet(t, o, e, r) { + var p = _get(_getPrototypeOf(t.prototype ), o, e); + return "function" == typeof p ? function (t) { + return p.apply(e, t); + } : p; + } + function _toPrimitive(t, r) { + if ("object" != typeof t || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r); + if ("object" != typeof i) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return (String )(t); + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == typeof i ? i : i + ""; + } + function _wrapNativeSuper(t) { + var r = "function" == typeof Map ? new Map() : void 0; + return _wrapNativeSuper = function (t) { + if (null === t || !_isNativeFunction(t)) return t; + if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); + if (void 0 !== r) { + if (r.has(t)) return r.get(t); + r.set(t, Wrapper); + } + function Wrapper() { + return _construct(t, arguments, _getPrototypeOf(this).constructor); + } + return Wrapper.prototype = Object.create(t.prototype, { + constructor: { + value: Wrapper, + enumerable: !1, + writable: !0, + configurable: !0 + } + }), _setPrototypeOf(Wrapper, t); + }, _wrapNativeSuper(t); + } + + // gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library. + // @author Brandon Jones + // @author Colin MacKenzie IV + // @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md) + var __typeError = function __typeError(msg) { + throw TypeError(msg); + }; + var __accessCheck = function __accessCheck(obj, member, msg) { + return member.has(obj) || __typeError("Cannot " + msg); + }; + var __privateGet = function __privateGet(obj, member, getter) { + return __accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj); + }; + var __privateAdd = function __privateAdd(obj, member, value) { + return member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); + }; + + // src/common/index.ts + var GLM_EPSILON = 1e-6; + + // src/_lib/f32/Mat2.ts + var _IDENTITY_2X2; + var _Mat2 = /*#__PURE__*/function (_Float32Array) { + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + function _Mat2() { + var _this; + _classCallCheck(this, _Mat2); + for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) { + values[_key] = arguments[_key]; + } + switch (values.length) { + case 4: + _this = _callSuper(this, _Mat2, [values]); + break; + case 2: + _this = _callSuper(this, _Mat2, [values[0], values[1], 4]); + break; + case 1: + var v = values[0]; + if (typeof v === "number") { + _this = _callSuper(this, _Mat2, [[v, v, v, v]]); + } else { + _this = _callSuper(this, _Mat2, [v, 0, 4]); + } + break; + default: + _this = _callSuper(this, _Mat2, [__privateGet(_Mat2, _IDENTITY_2X2)]); + break; + } + return _assertThisInitialized(_this); + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat2.str(this);` + * + * @category Accessors + */ + _inherits(_Mat2, _Float32Array); + return _createClass(_Mat2, [{ + key: "str", + get: function get() { + return _Mat2.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat2} into `this`. + * + * @param a the source vector + * @returns `this` + * @category Methods + */ + }, { + key: "copy", + value: function copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat2.identity(this) + * + * @returns `this` + * @category Methods + */ + }, { + key: "identity", + value: function identity() { + this.set(__privateGet(_Mat2, _IDENTITY_2X2)); + return this; + } + /** + * Multiplies this {@link Mat2} against another one + * Equivalent to `Mat2.multiply(this, this, b);` + * + * @param b - The second operand + * @returns `this` + * @category Methods + */ + }, { + key: "multiply", + value: function multiply(b) { + return _Mat2.multiply(this, this, b); + } + /** + * Alias for {@link Mat2.multiply} + * @category Methods + */ + }, { + key: "mul", + value: function mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat2} + * Equivalent to `Mat2.transpose(this, this);` + * + * @returns `this` + * @category Methods + */ + }, { + key: "transpose", + value: function transpose() { + return _Mat2.transpose(this, this); + } + /** + * Inverts this {@link Mat2} + * Equivalent to `Mat4.invert(this, this);` + * + * @returns `this` + * @category Methods + */ + }, { + key: "invert", + value: function invert() { + return _Mat2.invert(this, this); + } + /** + * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2.scale(this, this, v);` + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + * @category Methods + */ + }, { + key: "scale", + value: function scale(v) { + return _Mat2.scale(this, this, v); + } + /** + * Rotates this {@link Mat2} by the given angle around the given axis + * Equivalent to `Mat2.rotate(this, this, rad);` + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + * @category Methods + */ + }, { + key: "rotate", + value: function rotate(rad) { + return _Mat2.rotate(this, this, rad); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2}. + */ + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 4 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat2} + * @category Static + * + * @returns A new {@link Mat2} + */ + }, { + key: "create", + value: function create() { + return new _Mat2(); + } + /** + * Creates a new {@link Mat2} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2} + */ + }, { + key: "clone", + value: function clone(a) { + return new _Mat2(a); + } + /** + * Copy the values from one {@link Mat2} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + }, { + key: "copy", + value: function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Create a new {@link Mat2} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2} + */ + }, { + key: "fromValues", + value: function fromValues() { + for (var _len2 = arguments.length, values = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + values[_key2] = arguments[_key2]; + } + return _construct(_Mat2, values); + } + /** + * Set the components of a {@link Mat2} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + }, { + key: "set", + value: function set(out) { + out[0] = arguments.length <= 1 ? undefined : arguments[1]; + out[1] = arguments.length <= 2 ? undefined : arguments[2]; + out[2] = arguments.length <= 3 ? undefined : arguments[3]; + out[3] = arguments.length <= 4 ? undefined : arguments[4]; + return out; + } + /** + * Set a {@link Mat2} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + }, { + key: "identity", + value: function identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + }, { + key: "transpose", + value: function transpose(out, a) { + if (out === a) { + var a1 = a[1]; + out[1] = a[2]; + out[2] = a1; + } else { + out[0] = a[0]; + out[1] = a[2]; + out[2] = a[1]; + out[3] = a[3]; + } + return out; + } + /** + * Inverts a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + }, { + key: "invert", + value: function invert(out, a) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var det = a0 * a3 - a2 * a1; + if (!det) { + return null; + } + det = 1 / det; + out[0] = a3 * det; + out[1] = -a1 * det; + out[2] = -a2 * det; + out[3] = a0 * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + }, { + key: "adjoint", + value: function adjoint(out, a) { + var a0 = a[0]; + out[0] = a[3]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a0; + return out; + } + /** + * Calculates the determinant of a {@link Mat2} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + }, { + key: "determinant", + value: function determinant(a) { + return a[0] * a[3] - a[2] * a[1]; + } + /** + * Adds two {@link Mat2}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "add", + value: function add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "subtract", + value: function subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + return out; + } + /** + * Alias for {@link Mat2.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sub", + value: function sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat2}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "multiply", + value: function multiply(out, a, b) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; + out[0] = a0 * b0 + a2 * b1; + out[1] = a1 * b0 + a3 * b1; + out[2] = a0 * b2 + a2 * b3; + out[3] = a1 * b2 + a3 * b3; + return out; + } + /** + * Alias for {@link Mat2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "mul", + value: function mul(out, a, b) { + return out; + } + /** + * Rotates a {@link Mat2} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "rotate", + value: function rotate(out, a, rad) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var s = Math.sin(rad); + var c = Math.cos(rad); + out[0] = a0 * c + a2 * s; + out[1] = a1 * c + a3 * s; + out[2] = a0 * -s + a2 * c; + out[3] = a1 * -s + a3 * c; + return out; + } + /** + * Scales the {@link Mat2} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + }, { + key: "scale", + value: function scale(out, a, v) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var v0 = v[0]; + var v1 = v[1]; + out[0] = a0 * v0; + out[1] = a1 * v0; + out[2] = a2 * v1; + out[3] = a3 * v1; + return out; + } + /** + * Creates a {@link Mat2} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "fromRotation", + value: function fromRotation(out, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = -s; + out[3] = c; + return out; + } + /** + * Creates a {@link Mat2} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + }, { + key: "fromScaling", + value: function fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = v[1]; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat2} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + }, { + key: "frob", + value: function frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]); + } + /** + * Multiply each element of a {@link Mat2} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + }, { + key: "multiplyScalar", + value: function multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + return out; + } + /** + * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + }, { + key: "multiplyScalarAndAdd", + value: function multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + return out; + } + /** + * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix + * @category Static + * + * @param L - the lower triangular matrix + * @param D - the diagonal matrix + * @param U - the upper triangular matrix + * @param a - the input matrix to factorize + */ + }, { + key: "LDU", + value: function LDU(L, D, U, a) { + L[2] = a[2] / a[0]; + U[0] = a[0]; + U[1] = a[1]; + U[3] = a[3] - L[2] * U[1]; + return [L, D, U]; + } + /** + * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + }, { + key: "exactEquals", + value: function exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + /** + * Returns whether two {@link Mat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + }, { + key: "equals", + value: function equals(a, b) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)); + } + /** + * Returns a string representation of a {@link Mat2} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + }, { + key: "str", + value: function str(a) { + return "Mat2(".concat(a.join(", "), ")"); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float32Array)); + _IDENTITY_2X2 = new WeakMap(); + __privateAdd(_Mat2, _IDENTITY_2X2, new Float32Array([1, 0, 0, 1])); + var Mat2 = _Mat2; + Mat2.prototype.mul = Mat2.prototype.multiply; + Mat2.mul = Mat2.multiply; + Mat2.sub = Mat2.subtract; + + // src/_lib/f32/Mat2d.ts + var _IDENTITY_2X3; + var _Mat2d = /*#__PURE__*/function (_Float32Array2) { + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + function _Mat2d() { + var _this2; + _classCallCheck(this, _Mat2d); + for (var _len3 = arguments.length, values = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + values[_key3] = arguments[_key3]; + } + switch (values.length) { + case 6: + _this2 = _callSuper(this, _Mat2d, [values]); + break; + case 2: + _this2 = _callSuper(this, _Mat2d, [values[0], values[1], 6]); + break; + case 1: + var v = values[0]; + if (typeof v === "number") { + _this2 = _callSuper(this, _Mat2d, [[v, v, v, v, v, v]]); + } else { + _this2 = _callSuper(this, _Mat2d, [v, 0, 6]); + } + break; + default: + _this2 = _callSuper(this, _Mat2d, [__privateGet(_Mat2d, _IDENTITY_2X3)]); + break; + } + return _assertThisInitialized(_this2); + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat2d.str(this);` + * + * @category Accessors + */ + _inherits(_Mat2d, _Float32Array2); + return _createClass(_Mat2d, [{ + key: "str", + get: function get() { + return _Mat2d.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Mat2d} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + }, { + key: "copy", + value: function copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat2d.identity(this) + * @category Methods + * + * @returns `this` + */ + }, { + key: "identity", + value: function identity() { + this.set(__privateGet(_Mat2d, _IDENTITY_2X3)); + return this; + } + /** + * Multiplies this {@link Mat2d} against another one + * Equivalent to `Mat2d.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + }, { + key: "multiply", + value: function multiply(b) { + return _Mat2d.multiply(this, this, b); + } + /** + * Alias for {@link Mat2d.multiply} + * @category Methods + */ + }, { + key: "mul", + value: function mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Translate this {@link Mat2d} by the given vector + * Equivalent to `Mat2d.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + }, { + key: "translate", + value: function translate(v) { + return _Mat2d.translate(this, this, v); + } + /** + * Rotates this {@link Mat2d} by the given angle around the given axis + * Equivalent to `Mat2d.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + }, { + key: "rotate", + value: function rotate(rad) { + return _Mat2d.rotate(this, this, rad); + } + /** + * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2d.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + }, { + key: "scale", + value: function scale(v) { + return _Mat2d.scale(this, this, v); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2d}. + */ + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 6 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat2d} + * @category Static + * + * @returns A new {@link Mat2d} + */ + }, { + key: "create", + value: function create() { + return new _Mat2d(); + } + /** + * Creates a new {@link Mat2d} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2d} + */ + }, { + key: "clone", + value: function clone(a) { + return new _Mat2d(a); + } + /** + * Copy the values from one {@link Mat2d} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + }, { + key: "copy", + value: function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + return out; + } + /** + * Create a new {@link Mat2d} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2d} + */ + }, { + key: "fromValues", + value: function fromValues() { + for (var _len4 = arguments.length, values = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + values[_key4] = arguments[_key4]; + } + return _construct(_Mat2d, values); + } + /** + * Set the components of a {@link Mat2d} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + }, { + key: "set", + value: function set(out) { + out[0] = arguments.length <= 1 ? undefined : arguments[1]; + out[1] = arguments.length <= 2 ? undefined : arguments[2]; + out[2] = arguments.length <= 3 ? undefined : arguments[3]; + out[3] = arguments.length <= 4 ? undefined : arguments[4]; + out[4] = arguments.length <= 5 ? undefined : arguments[5]; + out[5] = arguments.length <= 6 ? undefined : arguments[6]; + return out; + } + /** + * Set a {@link Mat2d} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + }, { + key: "identity", + value: function identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Inverts a {@link Mat2d} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + }, { + key: "invert", + value: function invert(out, a) { + var aa = a[0]; + var ab = a[1]; + var ac = a[2]; + var ad = a[3]; + var atx = a[4]; + var aty = a[5]; + var det = aa * ad - ab * ac; + if (!det) { + return null; + } + det = 1 / det; + out[0] = ad * det; + out[1] = -ab * det; + out[2] = -ac * det; + out[3] = aa * det; + out[4] = (ac * aty - ad * atx) * det; + out[5] = (ab * atx - aa * aty) * det; + return out; + } + /** + * Calculates the determinant of a {@link Mat2d} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + }, { + key: "determinant", + value: function determinant(a) { + return a[0] * a[3] - a[1] * a[2]; + } + /** + * Adds two {@link Mat2d}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "add", + value: function add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "subtract", + value: function subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + return out; + } + /** + * Alias for {@link Mat2d.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sub", + value: function sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat2d}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "multiply", + value: function multiply(out, a, b) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var a4 = a[4]; + var a5 = a[5]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; + var b4 = b[4]; + var b5 = b[5]; + out[0] = a0 * b0 + a2 * b1; + out[1] = a1 * b0 + a3 * b1; + out[2] = a0 * b2 + a2 * b3; + out[3] = a1 * b2 + a3 * b3; + out[4] = a0 * b4 + a2 * b5 + a4; + out[5] = a1 * b4 + a3 * b5 + a5; + return out; + } + /** + * Alias for {@link Mat2d.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "mul", + value: function mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat2d} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + }, { + key: "translate", + value: function translate(out, a, v) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var a4 = a[4]; + var a5 = a[5]; + var v0 = v[0]; + var v1 = v[1]; + out[0] = a0; + out[1] = a1; + out[2] = a2; + out[3] = a3; + out[4] = a0 * v0 + a2 * v1 + a4; + out[5] = a1 * v0 + a3 * v1 + a5; + return out; + } + /** + * Rotates a {@link Mat2d} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "rotate", + value: function rotate(out, a, rad) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var a4 = a[4]; + var a5 = a[5]; + var s = Math.sin(rad); + var c = Math.cos(rad); + out[0] = a0 * c + a2 * s; + out[1] = a1 * c + a3 * s; + out[2] = a0 * -s + a2 * c; + out[3] = a1 * -s + a3 * c; + out[4] = a4; + out[5] = a5; + return out; + } + /** + * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + }, { + key: "scale", + value: function scale(out, a, v) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var a4 = a[4]; + var a5 = a[5]; + var v0 = v[0]; + var v1 = v[1]; + out[0] = a0 * v0; + out[1] = a1 * v0; + out[2] = a2 * v1; + out[3] = a3 * v1; + out[4] = a4; + out[5] = a5; + return out; + } + // TODO: Got to fromRotation + /** + * Creates a {@link Mat2d} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + }, { + key: "fromTranslation", + value: function fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = v[0]; + out[5] = v[1]; + return out; + } + /** + * Creates a {@link Mat2d} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "fromRotation", + value: function fromRotation(out, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = -s; + out[3] = c; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Creates a {@link Mat2d} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + }, { + key: "fromScaling", + value: function fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = v[1]; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat2d} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + }, { + key: "frob", + value: function frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1); + } + /** + * Multiply each element of a {@link Mat2d} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + }, { + key: "multiplyScalar", + value: function multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + return out; + } + /** + * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + }, { + key: "multiplyScalarAndAdd", + value: function multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + return out; + } + /** + * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + }, { + key: "exactEquals", + value: function exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5]; + } + /** + * Returns whether two {@link Mat2d}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + }, { + key: "equals", + value: function equals(a, b) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var a4 = a[4]; + var a5 = a[5]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; + var b4 = b[4]; + var b5 = b[5]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)); + } + /** + * Returns a string representation of a {@link Mat2d} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + }, { + key: "str", + value: function str(a) { + return "Mat2d(".concat(a.join(", "), ")"); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float32Array)); + _IDENTITY_2X3 = new WeakMap(); + __privateAdd(_Mat2d, _IDENTITY_2X3, new Float32Array([1, 0, 0, 1, 0, 0])); + var Mat2d = _Mat2d; + Mat2d.mul = Mat2d.multiply; + Mat2d.sub = Mat2d.subtract; + + // src/_lib/f32/Mat3.ts + var _IDENTITY_3X3; + var _Mat3 = /*#__PURE__*/function (_Float32Array3) { + /** + * Create a {@link Mat3}. + * + * @category Constructor + */ + function _Mat3() { + var _this3; + _classCallCheck(this, _Mat3); + for (var _len5 = arguments.length, values = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { + values[_key5] = arguments[_key5]; + } + switch (values.length) { + case 9: + _this3 = _callSuper(this, _Mat3, [values]); + break; + case 2: + _this3 = _callSuper(this, _Mat3, [values[0], values[1], 9]); + break; + case 1: + var v = values[0]; + if (typeof v === "number") { + _this3 = _callSuper(this, _Mat3, [[v, v, v, v, v, v, v, v, v]]); + } else { + _this3 = _callSuper(this, _Mat3, [v, 0, 9]); + } + break; + default: + _this3 = _callSuper(this, _Mat3, [__privateGet(_Mat3, _IDENTITY_3X3)]); + break; + } + return _assertThisInitialized(_this3); + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat3.str(this);` + * + * @category Accessors + */ + _inherits(_Mat3, _Float32Array3); + return _createClass(_Mat3, [{ + key: "str", + get: function get() { + return _Mat3.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + }, { + key: "copy", + value: function copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat3.identity(this) + * @category Methods + * + * @returns `this` + */ + }, { + key: "identity", + value: function identity() { + this.set(__privateGet(_Mat3, _IDENTITY_3X3)); + return this; + } + /** + * Multiplies this {@link Mat3} against another one + * Equivalent to `Mat3.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + }, { + key: "multiply", + value: function multiply(b) { + return _Mat3.multiply(this, this, b); + } + /** + * Alias for {@link Mat3.multiply} + * @category Methods + */ + }, { + key: "mul", + value: function mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat3} + * Equivalent to `Mat3.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "transpose", + value: function transpose() { + return _Mat3.transpose(this, this); + } + /** + * Inverts this {@link Mat3} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "invert", + value: function invert() { + return _Mat3.invert(this, this); + } + /** + * Translate this {@link Mat3} by the given vector + * Equivalent to `Mat3.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + }, { + key: "translate", + value: function translate(v) { + return _Mat3.translate(this, this, v); + } + /** + * Rotates this {@link Mat3} by the given angle around the given axis + * Equivalent to `Mat3.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + }, { + key: "rotate", + value: function rotate(rad) { + return _Mat3.rotate(this, this, rad); + } + /** + * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat3.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + }, { + key: "scale", + value: function scale(v) { + return _Mat3.scale(this, this, v); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat3}. + */ + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 9 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat3} + * @category Static + * + * @returns A new {@link Mat3} + */ + }, { + key: "create", + value: function create() { + return new _Mat3(); + } + /** + * Creates a new {@link Mat3} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat3} + */ + }, { + key: "clone", + value: function clone(a) { + return new _Mat3(a); + } + /** + * Copy the values from one {@link Mat3} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + }, { + key: "copy", + value: function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + return out; + } + /** + * Create a new {@link Mat3} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat3} + */ + }, { + key: "fromValues", + value: function fromValues() { + for (var _len6 = arguments.length, values = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { + values[_key6] = arguments[_key6]; + } + return _construct(_Mat3, values); + } + /** + * Set the components of a {@link Mat3} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + }, { + key: "set", + value: function set(out) { + out[0] = arguments.length <= 1 ? undefined : arguments[1]; + out[1] = arguments.length <= 2 ? undefined : arguments[2]; + out[2] = arguments.length <= 3 ? undefined : arguments[3]; + out[3] = arguments.length <= 4 ? undefined : arguments[4]; + out[4] = arguments.length <= 5 ? undefined : arguments[5]; + out[5] = arguments.length <= 6 ? undefined : arguments[6]; + out[6] = arguments.length <= 7 ? undefined : arguments[7]; + out[7] = arguments.length <= 8 ? undefined : arguments[8]; + out[8] = arguments.length <= 9 ? undefined : arguments[9]; + return out; + } + /** + * Set a {@link Mat3} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + }, { + key: "identity", + value: function identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + }, { + key: "transpose", + value: function transpose(out, a) { + if (out === a) { + var a01 = a[1], + a02 = a[2], + a12 = a[5]; + out[1] = a[3]; + out[2] = a[6]; + out[3] = a01; + out[5] = a[7]; + out[6] = a02; + out[7] = a12; + } else { + out[0] = a[0]; + out[1] = a[3]; + out[2] = a[6]; + out[3] = a[1]; + out[4] = a[4]; + out[5] = a[7]; + out[6] = a[2]; + out[7] = a[5]; + out[8] = a[8]; + } + return out; + } + /** + * Inverts a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + }, { + key: "invert", + value: function invert(out, a) { + var a00 = a[0], + a01 = a[1], + a02 = a[2]; + var a10 = a[3], + a11 = a[4], + a12 = a[5]; + var a20 = a[6], + a21 = a[7], + a22 = a[8]; + var b01 = a22 * a11 - a12 * a21; + var b11 = -a22 * a10 + a12 * a20; + var b21 = a21 * a10 - a11 * a20; + var det = a00 * b01 + a01 * b11 + a02 * b21; + if (!det) { + return null; + } + det = 1 / det; + out[0] = b01 * det; + out[1] = (-a22 * a01 + a02 * a21) * det; + out[2] = (a12 * a01 - a02 * a11) * det; + out[3] = b11 * det; + out[4] = (a22 * a00 - a02 * a20) * det; + out[5] = (-a12 * a00 + a02 * a10) * det; + out[6] = b21 * det; + out[7] = (-a21 * a00 + a01 * a20) * det; + out[8] = (a11 * a00 - a01 * a10) * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + }, { + key: "adjoint", + value: function adjoint(out, a) { + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; + out[0] = a11 * a22 - a12 * a21; + out[1] = a02 * a21 - a01 * a22; + out[2] = a01 * a12 - a02 * a11; + out[3] = a12 * a20 - a10 * a22; + out[4] = a00 * a22 - a02 * a20; + out[5] = a02 * a10 - a00 * a12; + out[6] = a10 * a21 - a11 * a20; + out[7] = a01 * a20 - a00 * a21; + out[8] = a00 * a11 - a01 * a10; + return out; + } + /** + * Calculates the determinant of a {@link Mat3} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + }, { + key: "determinant", + value: function determinant(a) { + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; + return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20); + } + /** + * Adds two {@link Mat3}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "add", + value: function add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + out[8] = a[8] + b[8]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "subtract", + value: function subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + out[6] = a[6] - b[6]; + out[7] = a[7] - b[7]; + out[8] = a[8] - b[8]; + return out; + } + /** + * Alias for {@link Mat3.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sub", + value: function sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat3}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "multiply", + value: function multiply(out, a, b) { + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20; + out[1] = b0 * a01 + b1 * a11 + b2 * a21; + out[2] = b0 * a02 + b1 * a12 + b2 * a22; + b0 = b[3]; + b1 = b[4]; + b2 = b[5]; + out[3] = b0 * a00 + b1 * a10 + b2 * a20; + out[4] = b0 * a01 + b1 * a11 + b2 * a21; + out[5] = b0 * a02 + b1 * a12 + b2 * a22; + b0 = b[6]; + b1 = b[7]; + b2 = b[8]; + out[6] = b0 * a00 + b1 * a10 + b2 * a20; + out[7] = b0 * a01 + b1 * a11 + b2 * a21; + out[8] = b0 * a02 + b1 * a12 + b2 * a22; + return out; + } + /** + * Alias for {@link Mat3.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "mul", + value: function mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat3} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + }, { + key: "translate", + value: function translate(out, a, v) { + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; + var x = v[0]; + var y = v[1]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a10; + out[4] = a11; + out[5] = a12; + out[6] = x * a00 + y * a10 + a20; + out[7] = x * a01 + y * a11 + a21; + out[8] = x * a02 + y * a12 + a22; + return out; + } + /** + * Rotates a {@link Mat3} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "rotate", + value: function rotate(out, a, rad) { + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; + var s = Math.sin(rad); + var c = Math.cos(rad); + out[0] = c * a00 + s * a10; + out[1] = c * a01 + s * a11; + out[2] = c * a02 + s * a12; + out[3] = c * a10 - s * a00; + out[4] = c * a11 - s * a01; + out[5] = c * a12 - s * a02; + out[6] = a20; + out[7] = a21; + out[8] = a22; + return out; + } + /** + * Scales the {@link Mat3} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + }, { + key: "scale", + value: function scale(out, a, v) { + var x = v[0]; + var y = v[1]; + out[0] = x * a[0]; + out[1] = x * a[1]; + out[2] = x * a[2]; + out[3] = y * a[3]; + out[4] = y * a[4]; + out[5] = y * a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + return out; + } + /** + * Creates a {@link Mat3} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + }, { + key: "fromTranslation", + value: function fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = v[0]; + out[7] = v[1]; + out[8] = 1; + return out; + } + /** + * Creates a {@link Mat3} from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat3.identity(dest); + * mat3.rotate(dest, dest, rad); + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "fromRotation", + value: function fromRotation(out, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = 0; + out[3] = -s; + out[4] = c; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Creates a {@link Mat3} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + }, { + key: "fromScaling", + value: function fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = v[1]; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Copies the upper-left 3x3 values of a {@link Mat2d} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 2x3 matrix + * @returns `out` + */ + }, { + key: "fromMat2d", + value: function fromMat2d(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = 0; + out[3] = a[2]; + out[4] = a[3]; + out[5] = 0; + out[6] = a[4]; + out[7] = a[5]; + out[8] = 1; + return out; + } + /** + * Calculates a {@link Mat3} from the given quaternion + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param q - {@link Quat} to create matrix from + * @returns `out` + */ + }, { + key: "fromQuat", + value: function fromQuat(out, q) { + var x = q[0]; + var y = q[1]; + var z = q[2]; + var w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var yx = y * x2; + var yy = y * y2; + var zx = z * x2; + var zy = z * y2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + out[0] = 1 - yy - zz; + out[3] = yx - wz; + out[6] = zx + wy; + out[1] = yx + wz; + out[4] = 1 - xx - zz; + out[7] = zy - wx; + out[2] = zx - wy; + out[5] = zy + wx; + out[8] = 1 - xx - yy; + return out; + } + /** + * Copies the upper-left 3x3 values of a {@link Mat4} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 4x4 matrix + * @returns `out` + */ + }, { + key: "fromMat4", + value: function fromMat4(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[4]; + out[4] = a[5]; + out[5] = a[6]; + out[6] = a[8]; + out[7] = a[9]; + out[8] = a[10]; + return out; + } + /** + * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix + * @category Static + * + * @param {mat3} out mat3 receiving operation result + * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + }, { + key: "normalFromMat4", + value: function normalFromMat4(out, a) { + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; + var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + return out; + } + /** + * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + }, { + key: "normalFromMat4Fast", + value: function normalFromMat4Fast(out, a) { + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + var bx = a[4]; + var by = a[5]; + var bz = a[6]; + var cx = a[8]; + var cy = a[9]; + var cz = a[10]; + out[0] = by * cz - cz * cy; + out[1] = bz * cx - cx * cz; + out[2] = bx * cy - cy * cx; + out[3] = cy * az - cz * ay; + out[4] = cz * ax - cx * az; + out[5] = cx * ay - cy * ax; + out[6] = ay * bz - az * by; + out[7] = az * bx - ax * bz; + out[8] = ax * by - ay * bx; + return out; + } + /** + * Generates a 2D projection matrix with the given bounds + * @category Static + * + * @param out mat3 frustum matrix will be written into + * @param width Width of your gl context + * @param height Height of gl context + * @returns `out` + */ + }, { + key: "projection", + value: function projection(out, width, height) { + out[0] = 2 / width; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = -2 / height; + out[5] = 0; + out[6] = -1; + out[7] = 1; + out[8] = 1; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat3} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + }, { + key: "frob", + value: function frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8]); + } + /** + * Multiply each element of a {@link Mat3} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + }, { + key: "multiplyScalar", + value: function multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + out[8] = a[8] * b; + return out; + } + /** + * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + }, { + key: "multiplyScalarAndAdd", + value: function multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + out[6] = a[6] + b[6] * scale; + out[7] = a[7] + b[7] * scale; + out[8] = a[8] + b[8] * scale; + return out; + } + /** + * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + }, { + key: "exactEquals", + value: function exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8]; + } + /** + * Returns whether two {@link Mat3}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + }, { + key: "equals", + value: function equals(a, b) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var a4 = a[4]; + var a5 = a[5]; + var a6 = a[6]; + var a7 = a[7]; + var a8 = a[8]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; + var b4 = b[4]; + var b5 = b[5]; + var b6 = b[6]; + var b7 = b[7]; + var b8 = b[8]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)); + } + /** + * Returns a string representation of a {@link Mat3} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + }, { + key: "str", + value: function str(a) { + return "Mat3(".concat(a.join(", "), ")"); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float32Array)); + _IDENTITY_3X3 = new WeakMap(); + __privateAdd(_Mat3, _IDENTITY_3X3, new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1])); + var Mat3 = _Mat3; + Mat3.prototype.mul = Mat3.prototype.multiply; + Mat3.mul = Mat3.multiply; + Mat3.sub = Mat3.subtract; + + // src/_lib/f32/Mat4.ts + var _IDENTITY_4X4, _TMP_VEC3; + var _Mat4 = /*#__PURE__*/function (_Float32Array4) { + /** + * Create a {@link Mat4}. + * + * @category Constructor + */ + function _Mat4() { + var _this4; + _classCallCheck(this, _Mat4); + for (var _len7 = arguments.length, values = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { + values[_key7] = arguments[_key7]; + } + switch (values.length) { + case 16: + _this4 = _callSuper(this, _Mat4, [values]); + break; + case 2: + _this4 = _callSuper(this, _Mat4, [values[0], values[1], 16]); + break; + case 1: + var v = values[0]; + if (typeof v === "number") { + _this4 = _callSuper(this, _Mat4, [[v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v]]); + } else { + _this4 = _callSuper(this, _Mat4, [v, 0, 16]); + } + break; + default: + _this4 = _callSuper(this, _Mat4, [__privateGet(_Mat4, _IDENTITY_4X4)]); + break; + } + return _assertThisInitialized(_this4); + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat4.str(this);` + * + * @category Accessors + */ + _inherits(_Mat4, _Float32Array4); + return _createClass(_Mat4, [{ + key: "str", + get: function get() { + return _Mat4.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + }, { + key: "copy", + value: function copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat4.identity(this) + * @category Methods + * + * @returns `this` + */ + }, { + key: "identity", + value: function identity() { + this.set(__privateGet(_Mat4, _IDENTITY_4X4)); + return this; + } + /** + * Multiplies this {@link Mat4} against another one + * Equivalent to `Mat4.multiply(this, this, b);` + * @category Methods + * + * @param b - The second operand + * @returns `this` + */ + }, { + key: "multiply", + value: function multiply(b) { + return _Mat4.multiply(this, this, b); + } + /** + * Alias for {@link Mat4.multiply} + * @category Methods + */ + }, { + key: "mul", + value: function mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat4} + * Equivalent to `Mat4.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "transpose", + value: function transpose() { + return _Mat4.transpose(this, this); + } + /** + * Inverts this {@link Mat4} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "invert", + value: function invert() { + return _Mat4.invert(this, this); + } + /** + * Translate this {@link Mat4} by the given vector + * Equivalent to `Mat4.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to translate by + * @returns `this` + */ + }, { + key: "translate", + value: function translate(v) { + return _Mat4.translate(this, this, v); + } + /** + * Rotates this {@link Mat4} by the given angle around the given axis + * Equivalent to `Mat4.rotate(this, this, rad, axis);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `this` + */ + }, { + key: "rotate", + value: function rotate(rad, axis) { + return _Mat4.rotate(this, this, rad, axis); + } + /** + * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat4.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to scale the matrix by + * @returns `this` + */ + }, { + key: "scale", + value: function scale(v) { + return _Mat4.scale(this, this, v); + } + /** + * Rotates this {@link Mat4} by the given angle around the X axis + * Equivalent to `Mat4.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + }, { + key: "rotateX", + value: function rotateX(rad) { + return _Mat4.rotateX(this, this, rad); + } + /** + * Rotates this {@link Mat4} by the given angle around the Y axis + * Equivalent to `Mat4.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + }, { + key: "rotateY", + value: function rotateY(rad) { + return _Mat4.rotateY(this, this, rad); + } + /** + * Rotates this {@link Mat4} by the given angle around the Z axis + * Equivalent to `Mat4.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + }, { + key: "rotateZ", + value: function rotateZ(rad) { + return _Mat4.rotateZ(this, this, rad); + } + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + }, { + key: "perspectiveNO", + value: function perspectiveNO(fovy, aspect, near, far) { + return _Mat4.perspectiveNO(this, fovy, aspect, near, far); + } + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + }, { + key: "perspectiveZO", + value: function perspectiveZO(fovy, aspect, near, far) { + return _Mat4.perspectiveZO(this, fovy, aspect, near, far); + } + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + }, { + key: "orthoNO", + value: function orthoNO(left, right, bottom, top, near, far) { + return _Mat4.orthoNO(this, left, right, bottom, top, near, far); + } + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + }, { + key: "orthoZO", + value: function orthoZO(left, right, bottom, top, near, far) { + return _Mat4.orthoZO(this, left, right, bottom, top, near, far); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat4}. + */ + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 16 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat4} + * @category Static + * + * @returns A new {@link Mat4} + */ + }, { + key: "create", + value: function create() { + return new _Mat4(); + } + /** + * Creates a new {@link Mat4} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat4} + */ + }, { + key: "clone", + value: function clone(a) { + return new _Mat4(a); + } + /** + * Copy the values from one {@link Mat4} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + }, { + key: "copy", + value: function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + /** + * Create a new mat4 with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat4} + */ + }, { + key: "fromValues", + value: function fromValues() { + for (var _len8 = arguments.length, values = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) { + values[_key8] = arguments[_key8]; + } + return _construct(_Mat4, values); + } + /** + * Set the components of a mat4 to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + }, { + key: "set", + value: function set(out) { + out[0] = arguments.length <= 1 ? undefined : arguments[1]; + out[1] = arguments.length <= 2 ? undefined : arguments[2]; + out[2] = arguments.length <= 3 ? undefined : arguments[3]; + out[3] = arguments.length <= 4 ? undefined : arguments[4]; + out[4] = arguments.length <= 5 ? undefined : arguments[5]; + out[5] = arguments.length <= 6 ? undefined : arguments[6]; + out[6] = arguments.length <= 7 ? undefined : arguments[7]; + out[7] = arguments.length <= 8 ? undefined : arguments[8]; + out[8] = arguments.length <= 9 ? undefined : arguments[9]; + out[9] = arguments.length <= 10 ? undefined : arguments[10]; + out[10] = arguments.length <= 11 ? undefined : arguments[11]; + out[11] = arguments.length <= 12 ? undefined : arguments[12]; + out[12] = arguments.length <= 13 ? undefined : arguments[13]; + out[13] = arguments.length <= 14 ? undefined : arguments[14]; + out[14] = arguments.length <= 15 ? undefined : arguments[15]; + out[15] = arguments.length <= 16 ? undefined : arguments[16]; + return out; + } + /** + * Set a {@link Mat4} to the identity matrix + * @category Static + * + * @param out - The receiving Matrix + * @returns `out` + */ + }, { + key: "identity", + value: function identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + }, { + key: "transpose", + value: function transpose(out, a) { + if (out === a) { + var a01 = a[1], + a02 = a[2], + a03 = a[3]; + var a12 = a[6], + a13 = a[7]; + var a23 = a[11]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a01; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a02; + out[9] = a12; + out[11] = a[14]; + out[12] = a03; + out[13] = a13; + out[14] = a23; + } else { + out[0] = a[0]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a[1]; + out[5] = a[5]; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a[2]; + out[9] = a[6]; + out[10] = a[10]; + out[11] = a[14]; + out[12] = a[3]; + out[13] = a[7]; + out[14] = a[11]; + out[15] = a[15]; + } + return out; + } + /** + * Inverts a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + }, { + key: "invert", + value: function invert(out, a) { + var a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3]; + var a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7]; + var a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + var a30 = a[12], + a31 = a[13], + a32 = a[14], + a33 = a[15]; + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; + var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + }, { + key: "adjoint", + value: function adjoint(out, a) { + var a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3]; + var a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7]; + var a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + var a30 = a[12], + a31 = a[13], + a32 = a[14], + a33 = a[15]; + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; + out[0] = a11 * b11 - a12 * b10 + a13 * b09; + out[1] = a02 * b10 - a01 * b11 - a03 * b09; + out[2] = a31 * b05 - a32 * b04 + a33 * b03; + out[3] = a22 * b04 - a21 * b05 - a23 * b03; + out[4] = a12 * b08 - a10 * b11 - a13 * b07; + out[5] = a00 * b11 - a02 * b08 + a03 * b07; + out[6] = a32 * b02 - a30 * b05 - a33 * b01; + out[7] = a20 * b05 - a22 * b02 + a23 * b01; + out[8] = a10 * b10 - a11 * b08 + a13 * b06; + out[9] = a01 * b08 - a00 * b10 - a03 * b06; + out[10] = a30 * b04 - a31 * b02 + a33 * b00; + out[11] = a21 * b02 - a20 * b04 - a23 * b00; + out[12] = a11 * b07 - a10 * b09 - a12 * b06; + out[13] = a00 * b09 - a01 * b07 + a02 * b06; + out[14] = a31 * b01 - a30 * b03 - a32 * b00; + out[15] = a20 * b03 - a21 * b01 + a22 * b00; + return out; + } + /** + * Calculates the determinant of a {@link Mat4} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + }, { + key: "determinant", + value: function determinant(a) { + var a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3]; + var a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7]; + var a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + var a30 = a[12], + a31 = a[13], + a32 = a[14], + a33 = a[15]; + var b0 = a00 * a11 - a01 * a10; + var b1 = a00 * a12 - a02 * a10; + var b2 = a01 * a12 - a02 * a11; + var b3 = a20 * a31 - a21 * a30; + var b4 = a20 * a32 - a22 * a30; + var b5 = a21 * a32 - a22 * a31; + var b6 = a00 * b5 - a01 * b4 + a02 * b3; + var b7 = a10 * b5 - a11 * b4 + a12 * b3; + var b8 = a20 * b2 - a21 * b1 + a22 * b0; + var b9 = a30 * b2 - a31 * b1 + a32 * b0; + return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9; + } + /** + * Multiplies two {@link Mat4}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "multiply", + value: function multiply(out, a, b) { + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[4]; + b1 = b[5]; + b2 = b[6]; + b3 = b[7]; + out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[8]; + b1 = b[9]; + b2 = b[10]; + b3 = b[11]; + out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[12]; + b1 = b[13]; + b2 = b[14]; + b3 = b[15]; + out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + return out; + } + /** + * Alias for {@link Mat4.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "mul", + value: function mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat4} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + }, { + key: "translate", + value: function translate(out, a, v) { + var x = v[0]; + var y = v[1]; + var z = v[2]; + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a03; + out[4] = a10; + out[5] = a11; + out[6] = a12; + out[7] = a13; + out[8] = a20; + out[9] = a21; + out[10] = a22; + out[11] = a23; + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + return out; + } + /** + * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec3} to scale the matrix by + * @returns `out` + **/ + }, { + key: "scale", + value: function scale(out, a, v) { + var x = v[0]; + var y = v[1]; + var z = v[2]; + out[0] = a[0] * x; + out[1] = a[1] * x; + out[2] = a[2] * x; + out[3] = a[3] * x; + out[4] = a[4] * y; + out[5] = a[5] * y; + out[6] = a[6] * y; + out[7] = a[7] * y; + out[8] = a[8] * z; + out[9] = a[9] * z; + out[10] = a[10] * z; + out[11] = a[11] * z; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + /** + * Rotates a {@link Mat4} by the given angle around the given axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if axis has a length of 0 + */ + }, { + key: "rotate", + value: function rotate(out, a, rad, axis) { + var x = axis[0]; + var y = axis[1]; + var z = axis[2]; + var len = Math.sqrt(x * x + y * y + z * z); + if (len < GLM_EPSILON) { + return null; + } + len = 1 / len; + x *= len; + y *= len; + z *= len; + var s = Math.sin(rad); + var c = Math.cos(rad); + var t = 1 - c; + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + var b00 = x * x * t + c; + var b01 = y * x * t + z * s; + var b02 = z * x * t - y * s; + var b10 = x * y * t - z * s; + var b11 = y * y * t + c; + var b12 = z * y * t + x * s; + var b20 = x * z * t + y * s; + var b21 = y * z * t - x * s; + var b22 = z * z * t + c; + out[0] = a00 * b00 + a10 * b01 + a20 * b02; + out[1] = a01 * b00 + a11 * b01 + a21 * b02; + out[2] = a02 * b00 + a12 * b01 + a22 * b02; + out[3] = a03 * b00 + a13 * b01 + a23 * b02; + out[4] = a00 * b10 + a10 * b11 + a20 * b12; + out[5] = a01 * b10 + a11 * b11 + a21 * b12; + out[6] = a02 * b10 + a12 * b11 + a22 * b12; + out[7] = a03 * b10 + a13 * b11 + a23 * b12; + out[8] = a00 * b20 + a10 * b21 + a20 * b22; + out[9] = a01 * b20 + a11 * b21 + a21 * b22; + out[10] = a02 * b20 + a12 * b21 + a22 * b22; + out[11] = a03 * b20 + a13 * b21 + a23 * b22; + if (a !== out) { + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + return out; + } + /** + * Rotates a matrix by the given angle around the X axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "rotateX", + value: function rotateX(out, a, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + if (a !== out) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[4] = a10 * c + a20 * s; + out[5] = a11 * c + a21 * s; + out[6] = a12 * c + a22 * s; + out[7] = a13 * c + a23 * s; + out[8] = a20 * c - a10 * s; + out[9] = a21 * c - a11 * s; + out[10] = a22 * c - a12 * s; + out[11] = a23 * c - a13 * s; + return out; + } + /** + * Rotates a matrix by the given angle around the Y axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "rotateY", + value: function rotateY(out, a, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + if (a !== out) { + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[0] = a00 * c - a20 * s; + out[1] = a01 * c - a21 * s; + out[2] = a02 * c - a22 * s; + out[3] = a03 * c - a23 * s; + out[8] = a00 * s + a20 * c; + out[9] = a01 * s + a21 * c; + out[10] = a02 * s + a22 * c; + out[11] = a03 * s + a23 * c; + return out; + } + /** + * Rotates a matrix by the given angle around the Z axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "rotateZ", + value: function rotateZ(out, a, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + if (a !== out) { + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[0] = a00 * c + a10 * s; + out[1] = a01 * c + a11 * s; + out[2] = a02 * c + a12 * s; + out[3] = a03 * c + a13 * s; + out[4] = a10 * c - a00 * s; + out[5] = a11 * c - a01 * s; + out[6] = a12 * c - a02 * s; + out[7] = a13 * c - a03 * s; + return out; + } + /** + * Creates a {@link Mat4} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + }, { + key: "fromTranslation", + value: function fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Creates a {@link Mat4} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + }, { + key: "fromScaling", + value: function fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = v[1]; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = v[2]; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a {@link Mat4} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotate(dest, dest, rad, axis); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if `axis` has a length of 0 + */ + }, { + key: "fromRotation", + value: function fromRotation(out, rad, axis) { + var x = axis[0]; + var y = axis[1]; + var z = axis[2]; + var len = Math.sqrt(x * x + y * y + z * z); + if (len < GLM_EPSILON) { + return null; + } + len = 1 / len; + x *= len; + y *= len; + z *= len; + var s = Math.sin(rad); + var c = Math.cos(rad); + var t = 1 - c; + out[0] = x * x * t + c; + out[1] = y * x * t + z * s; + out[2] = z * x * t - y * s; + out[3] = 0; + out[4] = x * y * t - z * s; + out[5] = y * y * t + c; + out[6] = z * y * t + x * s; + out[7] = 0; + out[8] = x * z * t + y * s; + out[9] = y * z * t - x * s; + out[10] = z * z * t + c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateX(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "fromXRotation", + value: function fromXRotation(out, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = c; + out[6] = s; + out[7] = 0; + out[8] = 0; + out[9] = -s; + out[10] = c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateY(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "fromYRotation", + value: function fromYRotation(out, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + out[0] = c; + out[1] = 0; + out[2] = -s; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = s; + out[9] = 0; + out[10] = c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateZ(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "fromZRotation", + value: function fromZRotation(out, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = 0; + out[3] = 0; + out[4] = -s; + out[5] = c; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @returns `out` + */ + }, { + key: "fromRotationTranslation", + value: function fromRotationTranslation(out, q, v) { + var x = q[0]; + var y = q[1]; + var z = q[2]; + var w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Sets a {@link Mat4} from a {@link Quat2}. + * @category Static + * + * @param out - Matrix + * @param a - Dual Quaternion + * @returns `out` + */ + }, { + key: "fromQuat2", + value: function fromQuat2(out, a) { + var bx = -a[0]; + var by = -a[1]; + var bz = -a[2]; + var bw = a[3]; + var ax = a[4]; + var ay = a[5]; + var az = a[6]; + var aw = a[7]; + var magnitude = bx * bx + by * by + bz * bz + bw * bw; + if (magnitude > 0) { + __privateGet(_Mat4, _TMP_VEC3)[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude; + __privateGet(_Mat4, _TMP_VEC3)[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude; + __privateGet(_Mat4, _TMP_VEC3)[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude; + } else { + __privateGet(_Mat4, _TMP_VEC3)[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; + __privateGet(_Mat4, _TMP_VEC3)[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; + __privateGet(_Mat4, _TMP_VEC3)[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + } + _Mat4.fromRotationTranslation(out, a, __privateGet(_Mat4, _TMP_VEC3)); + return out; + } + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + }, { + key: "normalFromMat4", + value: function normalFromMat4(out, a) { + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; + var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[3] = 0; + out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[7] = 0; + out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + }, { + key: "normalFromMat4Fast", + value: function normalFromMat4Fast(out, a) { + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + var bx = a[4]; + var by = a[5]; + var bz = a[6]; + var cx = a[8]; + var cy = a[9]; + var cz = a[10]; + out[0] = by * cz - cz * cy; + out[1] = bz * cx - cx * cz; + out[2] = bx * cy - cy * cx; + out[3] = 0; + out[4] = cy * az - cz * ay; + out[5] = cz * ax - cx * az; + out[6] = cx * ay - cy * ax; + out[7] = 0; + out[8] = ay * bz - az * by; + out[9] = az * bx - ax * bz; + out[10] = ax * by - ay * bx; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Returns the translation vector component of a transformation + * matrix. If a matrix is built with fromRotationTranslation, + * the returned vector will be the same as the translation vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive translation component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + }, { + key: "getTranslation", + value: function getTranslation(out, mat) { + out[0] = mat[12]; + out[1] = mat[13]; + out[2] = mat[14]; + return out; + } + /** + * Returns the scaling factor component of a transformation + * matrix. If a matrix is built with fromRotationTranslationScale + * with a normalized Quaternion parameter, the returned vector will be + * the same as the scaling vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive scaling factor component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + }, { + key: "getScaling", + value: function getScaling(out, mat) { + var m11 = mat[0]; + var m12 = mat[1]; + var m13 = mat[2]; + var m21 = mat[4]; + var m22 = mat[5]; + var m23 = mat[6]; + var m31 = mat[8]; + var m32 = mat[9]; + var m33 = mat[10]; + out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + return out; + } + /** + * Returns a quaternion representing the rotational component + * of a transformation matrix. If a matrix is built with + * fromRotationTranslation, the returned quaternion will be the + * same as the quaternion originally supplied. + * @category Static + * + * @param out - Quaternion to receive the rotation component + * @param mat - Matrix to be decomposed (input) + * @return `out` + */ + }, { + key: "getRotation", + value: function getRotation(out, mat) { + _Mat4.getScaling(__privateGet(_Mat4, _TMP_VEC3), mat); + var is1 = 1 / __privateGet(_Mat4, _TMP_VEC3)[0]; + var is2 = 1 / __privateGet(_Mat4, _TMP_VEC3)[1]; + var is3 = 1 / __privateGet(_Mat4, _TMP_VEC3)[2]; + var sm11 = mat[0] * is1; + var sm12 = mat[1] * is2; + var sm13 = mat[2] * is3; + var sm21 = mat[4] * is1; + var sm22 = mat[5] * is2; + var sm23 = mat[6] * is3; + var sm31 = mat[8] * is1; + var sm32 = mat[9] * is2; + var sm33 = mat[10] * is3; + var trace = sm11 + sm22 + sm33; + var S = 0; + if (trace > 0) { + S = Math.sqrt(trace + 1) * 2; + out[3] = 0.25 * S; + out[0] = (sm23 - sm32) / S; + out[1] = (sm31 - sm13) / S; + out[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2; + out[3] = (sm23 - sm32) / S; + out[0] = 0.25 * S; + out[1] = (sm12 + sm21) / S; + out[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2; + out[3] = (sm31 - sm13) / S; + out[0] = (sm12 + sm21) / S; + out[1] = 0.25 * S; + out[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2; + out[3] = (sm12 - sm21) / S; + out[0] = (sm31 + sm13) / S; + out[1] = (sm23 + sm32) / S; + out[2] = 0.25 * S; + } + return out; + } + /** + * Decomposes a transformation matrix into its rotation, translation + * and scale components. Returns only the rotation component + * @category Static + * + * @param out_r - Quaternion to receive the rotation component + * @param out_t - Vector to receive the translation vector + * @param out_s - Vector to receive the scaling factor + * @param mat - Matrix to be decomposed (input) + * @returns `out_r` + */ + }, { + key: "decompose", + value: function decompose(out_r, out_t, out_s, mat) { + out_t[0] = mat[12]; + out_t[1] = mat[13]; + out_t[2] = mat[14]; + var m11 = mat[0]; + var m12 = mat[1]; + var m13 = mat[2]; + var m21 = mat[4]; + var m22 = mat[5]; + var m23 = mat[6]; + var m31 = mat[8]; + var m32 = mat[9]; + var m33 = mat[10]; + out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + var is1 = 1 / out_s[0]; + var is2 = 1 / out_s[1]; + var is3 = 1 / out_s[2]; + var sm11 = m11 * is1; + var sm12 = m12 * is2; + var sm13 = m13 * is3; + var sm21 = m21 * is1; + var sm22 = m22 * is2; + var sm23 = m23 * is3; + var sm31 = m31 * is1; + var sm32 = m32 * is2; + var sm33 = m33 * is3; + var trace = sm11 + sm22 + sm33; + var S = 0; + if (trace > 0) { + S = Math.sqrt(trace + 1) * 2; + out_r[3] = 0.25 * S; + out_r[0] = (sm23 - sm32) / S; + out_r[1] = (sm31 - sm13) / S; + out_r[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2; + out_r[3] = (sm23 - sm32) / S; + out_r[0] = 0.25 * S; + out_r[1] = (sm12 + sm21) / S; + out_r[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2; + out_r[3] = (sm31 - sm13) / S; + out_r[0] = (sm12 + sm21) / S; + out_r[1] = 0.25 * S; + out_r[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2; + out_r[3] = (sm12 - sm21) / S; + out_r[0] = (sm31 + sm13) / S; + out_r[1] = (sm23 + sm32) / S; + out_r[2] = 0.25 * S; + } + return out_r; + } + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @returns `out` + */ + }, { + key: "fromRotationTranslationScale", + value: function fromRotationTranslationScale(out, q, v, s) { + var x = q[0]; + var y = q[1]; + var z = q[2]; + var w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + var sx = s[0]; + var sy = s[1]; + var sz = s[2]; + out[0] = (1 - (yy + zz)) * sx; + out[1] = (xy + wz) * sx; + out[2] = (xz - wy) * sx; + out[3] = 0; + out[4] = (xy - wz) * sy; + out[5] = (1 - (xx + zz)) * sy; + out[6] = (yz + wx) * sy; + out[7] = 0; + out[8] = (xz + wy) * sz; + out[9] = (yz - wx) * sz; + out[10] = (1 - (xx + yy)) * sz; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the + * given origin. This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * mat4.translate(dest, origin); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * mat4.translate(dest, negativeOrigin); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @param o - The origin vector around which to scale and rotate + * @returns `out` + */ + }, { + key: "fromRotationTranslationScaleOrigin", + value: function fromRotationTranslationScaleOrigin(out, q, v, s, o) { + var x = q[0]; + var y = q[1]; + var z = q[2]; + var w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + var sx = s[0]; + var sy = s[1]; + var sz = s[2]; + var ox = o[0]; + var oy = o[1]; + var oz = o[2]; + var out0 = (1 - (yy + zz)) * sx; + var out1 = (xy + wz) * sx; + var out2 = (xz - wy) * sx; + var out4 = (xy - wz) * sy; + var out5 = (1 - (xx + zz)) * sy; + var out6 = (yz + wx) * sy; + var out8 = (xz + wy) * sz; + var out9 = (yz - wx) * sz; + var out10 = (1 - (xx + yy)) * sz; + out[0] = out0; + out[1] = out1; + out[2] = out2; + out[3] = 0; + out[4] = out4; + out[5] = out5; + out[6] = out6; + out[7] = 0; + out[8] = out8; + out[9] = out9; + out[10] = out10; + out[11] = 0; + out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz); + out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz); + out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); + out[15] = 1; + return out; + } + /** + * Calculates a 4x4 matrix from the given quaternion + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Quaternion to create matrix from + * @returns `out` + */ + }, { + key: "fromQuat", + value: function fromQuat(out, q) { + var x = q[0]; + var y = q[1]; + var z = q[2]; + var w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var yx = y * x2; + var yy = y * y2; + var zx = z * x2; + var zy = z * y2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + out[0] = 1 - yy - zz; + out[1] = yx + wz; + out[2] = zx - wy; + out[3] = 0; + out[4] = yx - wz; + out[5] = 1 - xx - zz; + out[6] = zy + wx; + out[7] = 0; + out[8] = zx + wy; + out[9] = zy - wx; + out[10] = 1 - xx - yy; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + }, { + key: "frustumNO", + value: function frustumNO(out, left, right, bottom, top, near) { + var far = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : Infinity; + var rl = 1 / (right - left); + var tb = 1 / (top - bottom); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + var nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + /** + * Alias for {@link Mat4.frustumNO} + * @category Static + * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly + */ + }, { + key: "frustum", + value: function frustum(out, left, right, bottom, top, near) { + return out; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + }, { + key: "frustumZO", + value: function frustumZO(out, left, right, bottom, top, near) { + var far = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : Infinity; + var rl = 1 / (right - left); + var tb = 1 / (top - bottom); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + var nf = 1 / (near - far); + out[10] = far * nf; + out[14] = far * near * nf; + } else { + out[10] = -1; + out[14] = -near; + } + return out; + } + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + }, { + key: "perspectiveNO", + value: function perspectiveNO(out, fovy, aspect, near) { + var far = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : Infinity; + var f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + var nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + /** + * Alias for {@link Mat4.perspectiveNO} + * @category Static + * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "perspective", + value: function perspective(out, fovy, aspect, near) { + return out; + } + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + }, { + key: "perspectiveZO", + value: function perspectiveZO(out, fovy, aspect, near) { + var far = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : Infinity; + var f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + var nf = 1 / (near - far); + out[10] = far * nf; + out[14] = far * near * nf; + } else { + out[10] = -1; + out[14] = -near; + } + return out; + } + /** + * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating + * projection matrices to be used with the still experimental WebVR API. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + * @deprecated + */ + }, { + key: "perspectiveFromFieldOfView", + value: function perspectiveFromFieldOfView(out, fov, near, far) { + var upTan = Math.tan(fov.upDegrees * Math.PI / 180); + var downTan = Math.tan(fov.downDegrees * Math.PI / 180); + var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180); + var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180); + var xScale = 2 / (leftTan + rightTan); + var yScale = 2 / (upTan + downTan); + out[0] = xScale; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = yScale; + out[6] = 0; + out[7] = 0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = (upTan - downTan) * yScale * 0.5; + out[10] = far / (near - far); + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = far * near / (near - far); + out[15] = 0; + return out; + } + /** + * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + }, { + key: "orthoNO", + value: function orthoNO(out, left, right, bottom, top, near, far) { + var lr = 1 / (left - right); + var bt = 1 / (bottom - top); + var nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; + } + /** + * Alias for {@link Mat4.orthoNO} + * @category Static + * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "ortho", + value: function ortho(out, left, right, bottom, top, near, far) { + return out; + } + /** + * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + }, { + key: "orthoZO", + value: function orthoZO(out, left, right, bottom, top, near, far) { + var lr = 1 / (left - right); + var bt = 1 / (bottom - top); + var nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = near * nf; + out[15] = 1; + return out; + } + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that + * actually makes an object look at another object, you should use targetTo instead. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param center - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + }, { + key: "lookAt", + value: function lookAt(out, eye, center, up) { + var eyex = eye[0]; + var eyey = eye[1]; + var eyez = eye[2]; + var upx = up[0]; + var upy = up[1]; + var upz = up[2]; + var centerx = center[0]; + var centery = center[1]; + var centerz = center[2]; + if (Math.abs(eyex - centerx) < GLM_EPSILON && Math.abs(eyey - centery) < GLM_EPSILON && Math.abs(eyez - centerz) < GLM_EPSILON) { + return _Mat4.identity(out); + } + var z0 = eyex - centerx; + var z1 = eyey - centery; + var z2 = eyez - centerz; + var len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + z0 *= len; + z1 *= len; + z2 *= len; + var x0 = upy * z2 - upz * z1; + var x1 = upz * z0 - upx * z2; + var x2 = upx * z1 - upy * z0; + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + if (!len) { + x0 = 0; + x1 = 0; + x2 = 0; + } else { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + var y0 = z1 * x2 - z2 * x1; + var y1 = z2 * x0 - z0 * x2; + var y2 = z0 * x1 - z1 * x0; + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + if (!len) { + y0 = 0; + y1 = 0; + y2 = 0; + } else { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + out[0] = x0; + out[1] = y0; + out[2] = z0; + out[3] = 0; + out[4] = x1; + out[5] = y1; + out[6] = z1; + out[7] = 0; + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); + out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); + out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + return out; + } + /** + * Generates a matrix that makes something look at something else. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param target - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + }, { + key: "targetTo", + value: function targetTo(out, eye, target, up) { + var eyex = eye[0]; + var eyey = eye[1]; + var eyez = eye[2]; + var upx = up[0]; + var upy = up[1]; + var upz = up[2]; + var z0 = eyex - target[0]; + var z1 = eyey - target[1]; + var z2 = eyez - target[2]; + var len = z0 * z0 + z1 * z1 + z2 * z2; + if (len > 0) { + len = 1 / Math.sqrt(len); + z0 *= len; + z1 *= len; + z2 *= len; + } + var x0 = upy * z2 - upz * z1; + var x1 = upz * z0 - upx * z2; + var x2 = upx * z1 - upy * z0; + len = x0 * x0 + x1 * x1 + x2 * x2; + if (len > 0) { + len = 1 / Math.sqrt(len); + x0 *= len; + x1 *= len; + x2 *= len; + } + out[0] = x0; + out[1] = x1; + out[2] = x2; + out[3] = 0; + out[4] = z1 * x2 - z2 * x1; + out[5] = z2 * x0 - z0 * x2; + out[6] = z0 * x1 - z1 * x0; + out[7] = 0; + out[8] = z0; + out[9] = z1; + out[10] = z2; + out[11] = 0; + out[12] = eyex; + out[13] = eyey; + out[14] = eyez; + out[15] = 1; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat4} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + }, { + key: "frob", + value: function frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + a[9] * a[9] + a[10] * a[10] + a[11] * a[11] + a[12] * a[12] + a[13] * a[13] + a[14] * a[14] + a[15] * a[15]); + } + /** + * Adds two {@link Mat4}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "add", + value: function add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + out[8] = a[8] + b[8]; + out[9] = a[9] + b[9]; + out[10] = a[10] + b[10]; + out[11] = a[11] + b[11]; + out[12] = a[12] + b[12]; + out[13] = a[13] + b[13]; + out[14] = a[14] + b[14]; + out[15] = a[15] + b[15]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "subtract", + value: function subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + out[6] = a[6] - b[6]; + out[7] = a[7] - b[7]; + out[8] = a[8] - b[8]; + out[9] = a[9] - b[9]; + out[10] = a[10] - b[10]; + out[11] = a[11] - b[11]; + out[12] = a[12] - b[12]; + out[13] = a[13] - b[13]; + out[14] = a[14] - b[14]; + out[15] = a[15] - b[15]; + return out; + } + /** + * Alias for {@link Mat4.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sub", + value: function sub(out, a, b) { + return out; + } + /** + * Multiply each element of the matrix by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + }, { + key: "multiplyScalar", + value: function multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + out[8] = a[8] * b; + out[9] = a[9] * b; + out[10] = a[10] * b; + out[11] = a[11] * b; + out[12] = a[12] * b; + out[13] = a[13] * b; + out[14] = a[14] * b; + out[15] = a[15] * b; + return out; + } + /** + * Adds two mat4's after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + }, { + key: "multiplyScalarAndAdd", + value: function multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + out[6] = a[6] + b[6] * scale; + out[7] = a[7] + b[7] * scale; + out[8] = a[8] + b[8] * scale; + out[9] = a[9] + b[9] * scale; + out[10] = a[10] + b[10] * scale; + out[11] = a[11] + b[11] * scale; + out[12] = a[12] + b[12] * scale; + out[13] = a[13] + b[13] * scale; + out[14] = a[14] + b[14] * scale; + out[15] = a[15] + b[15] * scale; + return out; + } + /** + * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + }, { + key: "exactEquals", + value: function exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15]; + } + /** + * Returns whether two {@link Mat4}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + }, { + key: "equals", + value: function equals(a, b) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var a4 = a[4]; + var a5 = a[5]; + var a6 = a[6]; + var a7 = a[7]; + var a8 = a[8]; + var a9 = a[9]; + var a10 = a[10]; + var a11 = a[11]; + var a12 = a[12]; + var a13 = a[13]; + var a14 = a[14]; + var a15 = a[15]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; + var b4 = b[4]; + var b5 = b[5]; + var b6 = b[6]; + var b7 = b[7]; + var b8 = b[8]; + var b9 = b[9]; + var b10 = b[10]; + var b11 = b[11]; + var b12 = b[12]; + var b13 = b[13]; + var b14 = b[14]; + var b15 = b[15]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15)); + } + /** + * Returns a string representation of a {@link Mat4} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + }, { + key: "str", + value: function str(a) { + return "Mat4(".concat(a.join(", "), ")"); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float32Array)); + _IDENTITY_4X4 = new WeakMap(); + _TMP_VEC3 = new WeakMap(); + __privateAdd(_Mat4, _IDENTITY_4X4, new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])); + /** + * Temporary variable to prevent repeated allocations in the algorithms within Mat4. + * These are declared as TypedArrays to aid in tree-shaking. + */ + __privateAdd(_Mat4, _TMP_VEC3, new Float32Array(3)); + var Mat4 = _Mat4; + Mat4.prototype.mul = Mat4.prototype.multiply; + Mat4.sub = Mat4.subtract; + Mat4.mul = Mat4.multiply; + Mat4.frustum = Mat4.frustumNO; + Mat4.perspective = Mat4.perspectiveNO; + Mat4.ortho = Mat4.orthoNO; + + // src/_lib/f32/Vec3.ts + var Vec3 = /*#__PURE__*/function (_Float32Array5) { + /** + * Create a {@link Vec3}. + * + * @category Constructor + */ + function _Vec3() { + var _this5; + _classCallCheck(this, _Vec3); + for (var _len9 = arguments.length, values = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) { + values[_key9] = arguments[_key9]; + } + switch (values.length) { + case 3: + _this5 = _callSuper(this, _Vec3, [values]); + break; + case 2: + _this5 = _callSuper(this, _Vec3, [values[0], values[1], 3]); + break; + case 1: + { + var v = values[0]; + if (typeof v === "number") { + _this5 = _callSuper(this, _Vec3, [[v, v, v]]); + } else { + _this5 = _callSuper(this, _Vec3, [v, 0, 3]); + } + break; + } + default: + _this5 = _callSuper(this, _Vec3, [3]); + break; + } + return _assertThisInitialized(_this5); + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + _inherits(_Vec3, _Float32Array5); + return _createClass(_Vec3, [{ + key: "x", + get: function get() { + return this[0]; + }, + set: function set(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + }, { + key: "y", + get: function get() { + return this[1]; + }, + set: function set(value) { + this[1] = value; + } + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + }, { + key: "z", + get: function get() { + return this[2]; + }, + set: function set(value) { + this[2] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + }, { + key: "r", + get: function get() { + return this[0]; + }, + set: function set(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + }, { + key: "g", + get: function get() { + return this[1]; + }, + set: function set(value) { + this[1] = value; + } + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + }, { + key: "b", + get: function get() { + return this[2]; + }, + set: function set(value) { + this[2] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec3.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + }, { + key: "magnitude", + get: function get() { + var x = this[0]; + var y = this[1]; + var z = this[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.magnitude} + * + * @category Accessors + */ + }, { + key: "mag", + get: function get() { + return this.magnitude; + } + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec3.squaredMagnitude(this);` + * + * @category Accessors + */ + }, { + key: "squaredMagnitude", + get: function get() { + var x = this[0]; + var y = this[1]; + var z = this[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredMagnitude} + * + * @category Accessors + */ + }, { + key: "sqrMag", + get: function get() { + return this.squaredMagnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec3.str(this);` + * + * @category Accessors + */ + }, { + key: "str", + get: function get() { + return _Vec3.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + }, { + key: "copy", + value: function copy(a) { + this.set(a); + return this; + } + /** + * Adds a {@link Vec3} to `this`. + * Equivalent to `Vec3.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + }, { + key: "add", + value: function add(b) { + this[0] += b[0]; + this[1] += b[1]; + this[2] += b[2]; + return this; + } + /** + * Subtracts a {@link Vec3} from `this`. + * Equivalent to `Vec3.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + }, { + key: "subtract", + value: function subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + this[2] -= b[2]; + return this; + } + /** + * Alias for {@link Vec3.subtract} + * @category Methods + */ + }, { + key: "sub", + value: function sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec3}. + * Equivalent to `Vec3.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + }, { + key: "multiply", + value: function multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + this[2] *= b[2]; + return this; + } + /** + * Alias for {@link Vec3.multiply} + * @category Methods + */ + }, { + key: "mul", + value: function mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec3}. + * Equivalent to `Vec3.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + }, { + key: "divide", + value: function divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + this[2] /= b[2]; + return this; + } + /** + * Alias for {@link Vec3.divide} + * @category Methods + */ + }, { + key: "div", + value: function div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec3.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + }, { + key: "scale", + value: function scale(b) { + this[0] *= b; + this[1] *= b; + this[2] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + this[2] += b[2] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + }, { + key: "distance", + value: function distance(b) { + return _Vec3.distance(this, b); + } + /** + * Alias for {@link Vec3.distance} + * @category Methods + */ + }, { + key: "dist", + value: function dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + }, { + key: "squaredDistance", + value: function squaredDistance(b) { + return _Vec3.squaredDistance(this, b); + } + /** + * Alias for {@link Vec3.squaredDistance} + * @category Methods + */ + }, { + key: "sqrDist", + value: function sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec3.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "negate", + value: function negate() { + this[0] *= -1; + this[1] *= -1; + this[2] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec3.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "invert", + value: function invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + this[2] = 1 / this[2]; + return this; + } + /** + * Sets each component of `this` to its absolute value. + * Equivalent to `Vec3.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "abs", + value: function abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + this[2] = Math.abs(this[2]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec3}. + * Equivalent to `Vec3.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + }, { + key: "dot", + value: function dot(b) { + return this[0] * b[0] + this[1] * b[1] + this[2] * b[2]; + } + /** + * Normalize `this`. + * Equivalent to `Vec3.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "normalize", + value: function normalize() { + return _Vec3.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec3}. + */ + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 3 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty vec3 + * @category Static + * + * @returns a new 3D vector + */ + }, { + key: "create", + value: function create() { + return new _Vec3(); + } + /** + * Creates a new vec3 initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 3D vector + */ + }, { + key: "clone", + value: function clone(a) { + return new _Vec3(a); + } + /** + * Calculates the magnitude (length) of a {@link Vec3} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + }, { + key: "magnitude", + value: function magnitude(a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.magnitude} + * @category Static + */ + }, { + key: "mag", + value: function mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + // Length conflicts with Function.length + }, { + key: "length", + value: function length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.mag} + */ + }, { + key: "len", + value: function len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Creates a new vec3 initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns a new 3D vector + */ + }, { + key: "fromValues", + value: function fromValues(x, y, z) { + return new _Vec3(x, y, z); + } + /** + * Copy the values from one vec3 to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + }, { + key: "copy", + value: function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + return out; + } + /** + * Set the components of a vec3 to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns `out` + */ + }, { + key: "set", + value: function set(out, x, y, z) { + out[0] = x; + out[1] = y; + out[2] = z; + return out; + } + /** + * Adds two {@link Vec3}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "add", + value: function add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "subtract", + value: function subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + return out; + } + /** + * Alias for {@link Vec3.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sub", + value: function sub(out, a, b) { + return [0, 0, 0]; + } + /** + * Multiplies two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "multiply", + value: function multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + return out; + } + /** + * Alias for {@link Vec3.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "mul", + value: function mul(out, a, b) { + return [0, 0, 0]; + } + /** + * Divides two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "divide", + value: function divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + out[2] = a[2] / b[2]; + return out; + } + /** + * Alias for {@link Vec3.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "div", + value: function div(out, a, b) { + return [0, 0, 0]; + } + /** + * Math.ceil the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + }, { + key: "ceil", + value: function ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + out[2] = Math.ceil(a[2]); + return out; + } + /** + * Math.floor the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + }, { + key: "floor", + value: function floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + out[2] = Math.floor(a[2]); + return out; + } + /** + * Returns the minimum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "min", + value: function min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + return out; + } + /** + * Returns the maximum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "max", + value: function max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + return out; + } + /** + * symmetric round the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + /* + static round(out: Vec3Like, a: Readonly): Vec3Like { + out[0] = glMatrix.round(a[0]); + out[1] = glMatrix.round(a[1]); + out[2] = glMatrix.round(a[2]); + return out; + }*/ + /** + * Scales a vec3 by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + }, { + key: "scale", + value: function scale(out, a, _scale) { + out[0] = a[0] * _scale; + out[1] = a[1] * _scale; + out[2] = a[2] * _scale; + return out; + } + /** + * Adds two vec3's after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + }, { + key: "distance", + value: function distance(a, b) { + var x = b[0] - a[0]; + var y = b[1] - a[1]; + var z = b[2] - a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "dist", + value: function dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + }, { + key: "squaredDistance", + value: function squaredDistance(a, b) { + var x = b[0] - a[0]; + var y = b[1] - a[1]; + var z = b[2] - a[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredDistance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sqrDist", + value: function sqrDist(a, b) { + return 0; + } + /** + * Calculates the squared length of a vec3 + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + }, { + key: "squaredLength", + value: function squaredLength(a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredLength} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sqrLen", + value: function sqrLen(a, b) { + return 0; + } + /** + * Negates the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + }, { + key: "negate", + value: function negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + return out; + } + /** + * Returns the inverse of the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + }, { + key: "inverse", + value: function inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + out[2] = 1 / a[2]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec3} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + }, { + key: "abs", + value: function abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + out[2] = Math.abs(a[2]); + return out; + } + /** + * Normalize a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + }, { + key: "normalize", + value: function normalize(out, a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + var len = x * x + y * y + z * z; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + out[2] = a[2] * len; + return out; + } + /** + * Calculates the dot product of two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + }, { + key: "dot", + value: function dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; + } + /** + * Computes the cross product of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "cross", + value: function cross(out, a, b) { + var ax = a[0], + ay = a[1], + az = a[2]; + var bx = b[0], + by = b[1], + bz = b[2]; + out[0] = ay * bz - az * by; + out[1] = az * bx - ax * bz; + out[2] = ax * by - ay * bx; + return out; + } + /** + * Performs a linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + }, { + key: "lerp", + value: function lerp(out, a, b, t) { + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + return out; + } + /** + * Performs a spherical linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + }, { + key: "slerp", + value: function slerp(out, a, b, t) { + var angle = Math.acos(Math.min(Math.max(_Vec3.dot(a, b), -1), 1)); + var sinTotal = Math.sin(angle); + var ratioA = Math.sin((1 - t) * angle) / sinTotal; + var ratioB = Math.sin(t * angle) / sinTotal; + out[0] = ratioA * a[0] + ratioB * b[0]; + out[1] = ratioA * a[1] + ratioB * b[1]; + out[2] = ratioA * a[2] + ratioB * b[2]; + return out; + } + /** + * Performs a hermite interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + }, { + key: "hermite", + value: function hermite(out, a, b, c, d, t) { + var factorTimes2 = t * t; + var factor1 = factorTimes2 * (2 * t - 3) + 1; + var factor2 = factorTimes2 * (t - 2) + t; + var factor3 = factorTimes2 * (t - 1); + var factor4 = factorTimes2 * (3 - 2 * t); + out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; + out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; + out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; + return out; + } + /** + * Performs a bezier interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + }, { + key: "bezier", + value: function bezier(out, a, b, c, d, t) { + var inverseFactor = 1 - t; + var inverseFactorTimesTwo = inverseFactor * inverseFactor; + var factorTimes2 = t * t; + var factor1 = inverseFactorTimesTwo * inverseFactor; + var factor2 = 3 * t * inverseFactorTimesTwo; + var factor3 = 3 * factorTimes2 * inverseFactor; + var factor4 = factorTimes2 * t; + out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; + out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; + out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; + return out; + } + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned + * @returns `out` + */ + /* + static random(out: Vec3Like, scale) { + scale = scale === undefined ? 1.0 : scale; + + let r = glMatrix.RANDOM() * 2.0 * Math.PI; + let z = glMatrix.RANDOM() * 2.0 - 1.0; + let zScale = Math.sqrt(1.0 - z * z) * scale; + + out[0] = Math.cos(r) * zScale; + out[1] = Math.sin(r) * zScale; + out[2] = z * scale; + return out; + }*/ + /** + * Transforms the vec3 with a mat4. + * 4th vector component is implicitly '1' + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + }, { + key: "transformMat4", + value: function transformMat4(out, a, m) { + var x = a[0], + y = a[1], + z = a[2]; + var w = m[3] * x + m[7] * y + m[11] * z + m[15] || 1; + out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; + out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; + out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; + return out; + } + /** + * Transforms the vec3 with a mat3. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - the 3x3 matrix to transform with + * @returns `out` + */ + }, { + key: "transformMat3", + value: function transformMat3(out, a, m) { + var x = a[0], + y = a[1], + z = a[2]; + out[0] = x * m[0] + y * m[3] + z * m[6]; + out[1] = x * m[1] + y * m[4] + z * m[7]; + out[2] = x * m[2] + y * m[5] + z * m[8]; + return out; + } + /** + * Transforms the vec3 with a quat + * Can also be used for dual quaternions. (Multiply it with the real part) + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + }, { + key: "transformQuat", + value: function transformQuat(out, a, q) { + var qx = q[0]; + var qy = q[1]; + var qz = q[2]; + var w2 = q[3] * 2; + var x = a[0]; + var y = a[1]; + var z = a[2]; + var uvx = qy * z - qz * y; + var uvy = qz * x - qx * z; + var uvz = qx * y - qy * x; + var uuvx = (qy * uvz - qz * uvy) * 2; + var uuvy = (qz * uvx - qx * uvz) * 2; + var uuvz = (qx * uvy - qy * uvx) * 2; + out[0] = x + uvx * w2 + uuvx; + out[1] = y + uvy * w2 + uuvy; + out[2] = z + uvz * w2 + uuvz; + return out; + } + /** + * Rotate a 3D vector around the x-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + }, { + key: "rotateX", + value: function rotateX(out, a, b, rad) { + var by = b[1]; + var bz = b[2]; + var py = a[1] - by; + var pz = a[2] - bz; + out[0] = a[0]; + out[1] = py * Math.cos(rad) - pz * Math.sin(rad) + by; + out[2] = py * Math.sin(rad) + pz * Math.cos(rad) + bz; + return out; + } + /** + * Rotate a 3D vector around the y-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + }, { + key: "rotateY", + value: function rotateY(out, a, b, rad) { + var bx = b[0]; + var bz = b[2]; + var px = a[0] - bx; + var pz = a[2] - bz; + out[0] = pz * Math.sin(rad) + px * Math.cos(rad) + bx; + out[1] = a[1]; + out[2] = pz * Math.cos(rad) - px * Math.sin(rad) + bz; + return out; + } + /** + * Rotate a 3D vector around the z-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + }, { + key: "rotateZ", + value: function rotateZ(out, a, b, rad) { + var bx = b[0]; + var by = b[1]; + var px = a[0] - bx; + var py = a[1] - by; + out[0] = px * Math.cos(rad) - py * Math.sin(rad) + bx; + out[1] = px * Math.sin(rad) + py * Math.cos(rad) + by; + out[2] = b[2]; + return out; + } + /** + * Get the angle between two 3D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + }, { + key: "angle", + value: function angle(a, b) { + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + var bx = b[0]; + var by = b[1]; + var bz = b[2]; + var mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz)); + var cosine = mag && _Vec3.dot(a, b) / mag; + return Math.acos(Math.min(Math.max(cosine, -1), 1)); + } + /** + * Set the components of a vec3 to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + }, { + key: "zero", + value: function zero(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + return out; + } + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + }, { + key: "str", + value: function str(a) { + return "Vec3(".concat(a.join(", "), ")"); + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + }, { + key: "exactEquals", + value: function exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + }, { + key: "equals", + value: function equals(a, b) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float32Array)); + Vec3.prototype.sub = Vec3.prototype.subtract; + Vec3.prototype.mul = Vec3.prototype.multiply; + Vec3.prototype.div = Vec3.prototype.divide; + Vec3.prototype.dist = Vec3.prototype.distance; + Vec3.prototype.sqrDist = Vec3.prototype.squaredDistance; + Vec3.sub = Vec3.subtract; + Vec3.mul = Vec3.multiply; + Vec3.div = Vec3.divide; + Vec3.dist = Vec3.distance; + Vec3.sqrDist = Vec3.squaredDistance; + Vec3.sqrLen = Vec3.squaredLength; + Vec3.mag = Vec3.magnitude; + Vec3.length = Vec3.magnitude; + Vec3.len = Vec3.magnitude; + + // src/_lib/f32/Vec4.ts + var Vec4 = /*#__PURE__*/function (_Float32Array6) { + /** + * Create a {@link Vec4}. + * + * @category Constructor + */ + function _Vec4() { + var _this6; + _classCallCheck(this, _Vec4); + for (var _len10 = arguments.length, values = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) { + values[_key10] = arguments[_key10]; + } + switch (values.length) { + case 4: + _this6 = _callSuper(this, _Vec4, [values]); + break; + case 2: + _this6 = _callSuper(this, _Vec4, [values[0], values[1], 4]); + break; + case 1: + { + var v = values[0]; + if (typeof v === "number") { + _this6 = _callSuper(this, _Vec4, [[v, v, v, v]]); + } else { + _this6 = _callSuper(this, _Vec4, [v, 0, 4]); + } + break; + } + default: + _this6 = _callSuper(this, _Vec4, [4]); + break; + } + return _assertThisInitialized(_this6); + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + _inherits(_Vec4, _Float32Array6); + return _createClass(_Vec4, [{ + key: "x", + get: function get() { + return this[0]; + }, + set: function set(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + }, { + key: "y", + get: function get() { + return this[1]; + }, + set: function set(value) { + this[1] = value; + } + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + }, { + key: "z", + get: function get() { + return this[2]; + }, + set: function set(value) { + this[2] = value; + } + /** + * The w component of the vector. Equivalent to `this[3];` + * @category Vector Components + */ + }, { + key: "w", + get: function get() { + return this[3]; + }, + set: function set(value) { + this[3] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + }, { + key: "r", + get: function get() { + return this[0]; + }, + set: function set(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + }, { + key: "g", + get: function get() { + return this[1]; + }, + set: function set(value) { + this[1] = value; + } + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + }, { + key: "b", + get: function get() { + return this[2]; + }, + set: function set(value) { + this[2] = value; + } + /** + * The a component of the vector. Equivalent to `this[3];` + * @category Color Components + */ + }, { + key: "a", + get: function get() { + return this[3]; + }, + set: function set(value) { + this[3] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec4.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + }, { + key: "magnitude", + get: function get() { + var x = this[0]; + var y = this[1]; + var z = this[2]; + var w = this[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Vec4.magnitude} + * + * @category Accessors + */ + }, { + key: "mag", + get: function get() { + return this.magnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec4.str(this);` + * + * @category Accessors + */ + }, { + key: "str", + get: function get() { + return _Vec4.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + }, { + key: "copy", + value: function copy(a) { + _superPropGet(_Vec4, "set", this)([a]); + return this; + } + /** + * Adds a {@link Vec4} to `this`. + * Equivalent to `Vec4.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + }, { + key: "add", + value: function add(b) { + this[0] += b[0]; + this[1] += b[1]; + this[2] += b[2]; + this[3] += b[3]; + return this; + } + /** + * Subtracts a {@link Vec4} from `this`. + * Equivalent to `Vec4.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + }, { + key: "subtract", + value: function subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + this[2] -= b[2]; + this[3] -= b[3]; + return this; + } + /** + * Alias for {@link Vec4.subtract} + * @category Methods + */ + }, { + key: "sub", + value: function sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec4}. + * Equivalent to `Vec4.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + }, { + key: "multiply", + value: function multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + this[2] *= b[2]; + this[3] *= b[3]; + return this; + } + /** + * Alias for {@link Vec4.multiply} + * @category Methods + */ + }, { + key: "mul", + value: function mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec4}. + * Equivalent to `Vec4.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + }, { + key: "divide", + value: function divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + this[2] /= b[2]; + this[3] /= b[3]; + return this; + } + /** + * Alias for {@link Vec4.divide} + * @category Methods + */ + }, { + key: "div", + value: function div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec4.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + }, { + key: "scale", + value: function scale(b) { + this[0] *= b; + this[1] *= b; + this[2] *= b; + this[3] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + this[2] += b[2] * scale; + this[3] += b[3] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + }, { + key: "distance", + value: function distance(b) { + return _Vec4.distance(this, b); + } + /** + * Alias for {@link Vec4.distance} + * @category Methods + */ + }, { + key: "dist", + value: function dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + }, { + key: "squaredDistance", + value: function squaredDistance(b) { + return _Vec4.squaredDistance(this, b); + } + /** + * Alias for {@link Vec4.squaredDistance} + * @category Methods + */ + }, { + key: "sqrDist", + value: function sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec4.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "negate", + value: function negate() { + this[0] *= -1; + this[1] *= -1; + this[2] *= -1; + this[3] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec4.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "invert", + value: function invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + this[2] = 1 / this[2]; + this[3] = 1 / this[3]; + return this; + } + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec4.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "abs", + value: function abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + this[2] = Math.abs(this[2]); + this[3] = Math.abs(this[3]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec4}. + * Equivalent to `Vec4.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + }, { + key: "dot", + value: function dot(b) { + return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3]; + } + /** + * Normalize `this`. + * Equivalent to `Vec4.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "normalize", + value: function normalize() { + return _Vec4.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec4}. + */ + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 4 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty {@link Vec4} + * @category Static + * + * @returns a new 4D vector + */ + }, { + key: "create", + value: function create() { + return new _Vec4(); + } + /** + * Creates a new {@link Vec4} initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 4D vector + */ + }, { + key: "clone", + value: function clone(a) { + return new _Vec4(a); + } + /** + * Creates a new {@link Vec4} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new 4D vector + */ + }, { + key: "fromValues", + value: function fromValues(x, y, z, w) { + return new _Vec4(x, y, z, w); + } + /** + * Copy the values from one {@link Vec4} to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + }, { + key: "copy", + value: function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Vec4} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + }, { + key: "set", + value: function set(out, x, y, z, w) { + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = w; + return out; + } + /** + * Adds two {@link Vec4}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "add", + value: function add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "subtract", + value: function subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + return out; + } + /** + * Alias for {@link Vec4.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sub", + value: function sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "multiply", + value: function multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + out[3] = a[3] * b[3]; + return out; + } + /** + * Alias for {@link Vec4.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "mul", + value: function mul(out, a, b) { + return out; + } + /** + * Divides two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "divide", + value: function divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + out[2] = a[2] / b[2]; + out[3] = a[3] / b[3]; + return out; + } + /** + * Alias for {@link Vec4.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "div", + value: function div(out, a, b) { + return out; + } + /** + * Math.ceil the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + }, { + key: "ceil", + value: function ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + out[2] = Math.ceil(a[2]); + out[3] = Math.ceil(a[3]); + return out; + } + /** + * Math.floor the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + }, { + key: "floor", + value: function floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + out[2] = Math.floor(a[2]); + out[3] = Math.floor(a[3]); + return out; + } + /** + * Returns the minimum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "min", + value: function min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + out[3] = Math.min(a[3], b[3]); + return out; + } + /** + * Returns the maximum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "max", + value: function max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + out[3] = Math.max(a[3], b[3]); + return out; + } + /** + * Math.round the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + }, { + key: "round", + value: function round(out, a) { + out[0] = Math.round(a[0]); + out[1] = Math.round(a[1]); + out[2] = Math.round(a[2]); + out[3] = Math.round(a[3]); + return out; + } + /** + * Scales a {@link Vec4} by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + }, { + key: "scale", + value: function scale(out, a, _scale2) { + out[0] = a[0] * _scale2; + out[1] = a[1] * _scale2; + out[2] = a[2] * _scale2; + out[3] = a[3] * _scale2; + return out; + } + /** + * Adds two {@link Vec4}'s after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + }, { + key: "distance", + value: function distance(a, b) { + var x = b[0] - a[0]; + var y = b[1] - a[1]; + var z = b[2] - a[2]; + var w = b[3] - a[3]; + return Math.hypot(x, y, z, w); + } + /** + * Alias for {@link Vec4.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "dist", + value: function dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + }, { + key: "squaredDistance", + value: function squaredDistance(a, b) { + var x = b[0] - a[0]; + var y = b[1] - a[1]; + var z = b[2] - a[2]; + var w = b[3] - a[3]; + return x * x + y * y + z * z + w * w; + } + /** + * Alias for {@link Vec4.squaredDistance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sqrDist", + value: function sqrDist(a, b) { + return 0; + } + /** + * Calculates the magnitude (length) of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate length of + * @returns length of `a` + */ + }, { + key: "magnitude", + value: function magnitude(a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + var w = a[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Vec4.magnitude} + * @category Static + */ + }, { + key: "mag", + value: function mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + }, { + key: "length", + value: function length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.mag} + */ + }, { + key: "len", + value: function len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + }, { + key: "squaredLength", + value: function squaredLength(a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + var w = a[3]; + return x * x + y * y + z * z + w * w; + } + /** + * Alias for {@link Vec4.squaredLength} + * @category Static + */ + }, { + key: "sqrLen", + value: function sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + }, { + key: "negate", + value: function negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = -a[3]; + return out; + } + /** + * Returns the inverse of the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + }, { + key: "inverse", + value: function inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + out[2] = 1 / a[2]; + out[3] = 1 / a[3]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec4} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + }, { + key: "abs", + value: function abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + out[2] = Math.abs(a[2]); + out[3] = Math.abs(a[3]); + return out; + } + /** + * Normalize a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + }, { + key: "normalize", + value: function normalize(out, a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + var w = a[3]; + var len = x * x + y * y + z * z + w * w; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = x * len; + out[1] = y * len; + out[2] = z * len; + out[3] = w * len; + return out; + } + /** + * Calculates the dot product of two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + }, { + key: "dot", + value: function dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + /** + * Returns the cross-product of three vectors in a 4-dimensional space + * @category Static + * + * @param out the receiving vector + * @param u - the first vector + * @param v - the second vector + * @param w - the third vector + * @returns result + */ + }, { + key: "cross", + value: function cross(out, u, v, w) { + var a = v[0] * w[1] - v[1] * w[0]; + var b = v[0] * w[2] - v[2] * w[0]; + var c = v[0] * w[3] - v[3] * w[0]; + var d = v[1] * w[2] - v[2] * w[1]; + var e = v[1] * w[3] - v[3] * w[1]; + var f = v[2] * w[3] - v[3] * w[2]; + var g = u[0]; + var h = u[1]; + var i = u[2]; + var j = u[3]; + out[0] = h * f - i * e + j * d; + out[1] = -(g * f) + i * c - j * b; + out[2] = g * e - h * c + j * a; + out[3] = -(g * d) + h * b - i * a; + return out; + } + /** + * Performs a linear interpolation between two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + }, { + key: "lerp", + value: function lerp(out, a, b, t) { + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + var aw = a[3]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + out[3] = aw + t * (b[3] - aw); + return out; + } + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns `out` + */ + /* + static random(out: Vec4Like, scale): Vec4Like { + scale = scale || 1.0; + + // Marsaglia, George. Choosing a Point from the Surface of a + // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646. + // http://projecteuclid.org/euclid.aoms/1177692644; + var v1, v2, v3, v4; + var s1, s2; + do { + v1 = glMatrix.RANDOM() * 2 - 1; + v2 = glMatrix.RANDOM() * 2 - 1; + s1 = v1 * v1 + v2 * v2; + } while (s1 >= 1); + do { + v3 = glMatrix.RANDOM() * 2 - 1; + v4 = glMatrix.RANDOM() * 2 - 1; + s2 = v3 * v3 + v4 * v4; + } while (s2 >= 1); + + var d = Math.sqrt((1 - s1) / s2); + out[0] = scale * v1; + out[1] = scale * v2; + out[2] = scale * v3 * d; + out[3] = scale * v4 * d; + return out; + }*/ + /** + * Transforms the {@link Vec4} with a {@link Mat4}. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + }, { + key: "transformMat4", + value: function transformMat4(out, a, m) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + var w = a[3]; + out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; + out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; + out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; + out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; + return out; + } + /** + * Transforms the {@link Vec4} with a {@link Quat} + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + }, { + key: "transformQuat", + value: function transformQuat(out, a, q) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + var qx = q[0]; + var qy = q[1]; + var qz = q[2]; + var qw = q[3]; + var ix = qw * x + qy * z - qz * y; + var iy = qw * y + qz * x - qx * z; + var iz = qw * z + qx * y - qy * x; + var iw = -qx * x - qy * y - qz * z; + out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy; + out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz; + out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Vec4} to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + }, { + key: "zero", + value: function zero(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 0; + return out; + } + /** + * Returns a string representation of a {@link Vec4} + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + }, { + key: "str", + value: function str(a) { + return "Vec4(".concat(a.join(", "), ")"); + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + }, { + key: "exactEquals", + value: function exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + }, { + key: "equals", + value: function equals(a, b) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float32Array)); + Vec4.prototype.sub = Vec4.prototype.subtract; + Vec4.prototype.mul = Vec4.prototype.multiply; + Vec4.prototype.div = Vec4.prototype.divide; + Vec4.prototype.dist = Vec4.prototype.distance; + Vec4.prototype.sqrDist = Vec4.prototype.squaredDistance; + Vec4.sub = Vec4.subtract; + Vec4.mul = Vec4.multiply; + Vec4.div = Vec4.divide; + Vec4.dist = Vec4.distance; + Vec4.sqrDist = Vec4.squaredDistance; + Vec4.sqrLen = Vec4.squaredLength; + Vec4.mag = Vec4.magnitude; + Vec4.length = Vec4.magnitude; + Vec4.len = Vec4.magnitude; + + // src/_lib/f32/Quat.ts + var _DEFAULT_ANGLE_ORDER, _TMP_QUAT1, _TMP_QUAT2, _TMP_MAT3, _TMP_VEC32, _X_UNIT_VEC3, _Y_UNIT_VEC3; + var _Quat = /*#__PURE__*/function (_Float32Array7) { + /** + * Create a {@link Quat}. + * + * @category Constructor + */ + function _Quat() { + var _this7; + _classCallCheck(this, _Quat); + for (var _len11 = arguments.length, values = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) { + values[_key11] = arguments[_key11]; + } + switch (values.length) { + case 4: + _this7 = _callSuper(this, _Quat, [values]); + break; + case 2: + _this7 = _callSuper(this, _Quat, [values[0], values[1], 4]); + break; + case 1: + { + var v = values[0]; + if (typeof v === "number") { + _this7 = _callSuper(this, _Quat, [[v, v, v, v]]); + } else { + _this7 = _callSuper(this, _Quat, [v, 0, 4]); + } + break; + } + default: + _this7 = _callSuper(this, _Quat, [4]); + _this7[3] = 1; + break; + } + return _assertThisInitialized(_this7); + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the quaternion. Equivalent to `this[0];` + * @category Quaternion Components + */ + _inherits(_Quat, _Float32Array7); + return _createClass(_Quat, [{ + key: "x", + get: function get() { + return this[0]; + }, + set: function set(value) { + this[0] = value; + } + /** + * The y component of the quaternion. Equivalent to `this[1];` + * @category Quaternion Components + */ + }, { + key: "y", + get: function get() { + return this[1]; + }, + set: function set(value) { + this[1] = value; + } + /** + * The z component of the quaternion. Equivalent to `this[2];` + * @category Quaternion Components + */ + }, { + key: "z", + get: function get() { + return this[2]; + }, + set: function set(value) { + this[2] = value; + } + /** + * The w component of the quaternion. Equivalent to `this[3];` + * @category Quaternion Components + */ + }, { + key: "w", + get: function get() { + return this[3]; + }, + set: function set(value) { + this[3] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Quat.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + }, { + key: "magnitude", + get: function get() { + var x = this[0]; + var y = this[1]; + var z = this[2]; + var w = this[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Quat.magnitude} + * + * @category Accessors + */ + }, { + key: "mag", + get: function get() { + return this.magnitude; + } + /** + * A string representation of `this` + * Equivalent to `Quat.str(this);` + * + * @category Accessors + */ + }, { + key: "str", + get: function get() { + return _Quat.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Quat} into `this`. + * @category Methods + * + * @param a the source quaternion + * @returns `this` + */ + }, { + key: "copy", + value: function copy(a) { + _superPropGet(_Quat, "set", this)([a]); + return this; + } + /** + * Set `this` to the identity quaternion + * Equivalent to Quat.identity(this) + * @category Methods + * + * @returns `this` + */ + }, { + key: "identity", + value: function identity() { + this[0] = 0; + this[1] = 0; + this[2] = 0; + this[3] = 1; + return this; + } + /** + * Multiplies `this` by a {@link Quat}. + * Equivalent to `Quat.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + }, { + key: "multiply", + value: function multiply(b) { + return _Quat.multiply(this, this, b); + } + /** + * Alias for {@link Quat.multiply} + * @category Methods + */ + }, { + key: "mul", + value: function mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Rotates `this` by the given angle about the X axis + * Equivalent to `Quat.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + }, { + key: "rotateX", + value: function rotateX(rad) { + return _Quat.rotateX(this, this, rad); + } + /** + * Rotates `this` by the given angle about the Y axis + * Equivalent to `Quat.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + }, { + key: "rotateY", + value: function rotateY(rad) { + return _Quat.rotateY(this, this, rad); + } + /** + * Rotates `this` by the given angle about the Z axis + * Equivalent to `Quat.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + }, { + key: "rotateZ", + value: function rotateZ(rad) { + return _Quat.rotateZ(this, this, rad); + } + /** + * Inverts `this` + * Equivalent to `Quat.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "invert", + value: function invert() { + return _Quat.invert(this, this); + } + /** + * Scales `this` by a scalar number + * Equivalent to `Quat.scale(this, this, scale);` + * @category Methods + * + * @param scale - amount to scale the vector by + * @returns `this` + */ + }, { + key: "scale", + value: function scale(_scale3) { + this[0] *= _scale3; + this[1] *= _scale3; + this[2] *= _scale3; + this[3] *= _scale3; + return this; + } + /** + * Calculates the dot product of `this` and another {@link Quat} + * Equivalent to `Quat.dot(this, b);` + * @category Methods + * + * @param b - the second operand + * @returns dot product of `this` and b + */ + }, { + key: "dot", + value: function dot(b) { + return _Quat.dot(this, b); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat}. + */ + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 4 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new identity quat + * @category Static + * + * @returns a new quaternion + */ + }, { + key: "create", + value: function create() { + return new _Quat(); + } + /** + * Set a quat to the identity quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + }, { + key: "identity", + value: function identity(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * @category Static + * + * @param out - the receiving quaternion + * @param axis - the axis around which to rotate + * @param rad - the angle in radians + * @returns `out` + **/ + }, { + key: "setAxisAngle", + value: function setAxisAngle(out, axis, rad) { + rad *= 0.5; + var s = Math.sin(rad); + out[0] = s * axis[0]; + out[1] = s * axis[1]; + out[2] = s * axis[2]; + out[3] = Math.cos(rad); + return out; + } + /** + * Gets the rotation axis and angle for a given + * quaternion. If a quaternion is created with + * setAxisAngle, this method will return the same + * values as provided in the original parameter list + * OR functionally equivalent values. + * Example: The quaternion formed by axis [0, 0, 1] and + * angle -90 is the same as the quaternion formed by + * [0, 0, 1] and 270. This method favors the latter. + * @category Static + * + * @param out_axis - Vector receiving the axis of rotation + * @param q - Quaternion to be decomposed + * @return Angle, in radians, of the rotation + */ + }, { + key: "getAxisAngle", + value: function getAxisAngle(out_axis, q) { + var rad = Math.acos(q[3]) * 2; + var s = Math.sin(rad / 2); + if (s > GLM_EPSILON) { + out_axis[0] = q[0] / s; + out_axis[1] = q[1] / s; + out_axis[2] = q[2] / s; + } else { + out_axis[0] = 1; + out_axis[1] = 0; + out_axis[2] = 0; + } + return rad; + } + /** + * Gets the angular distance between two unit quaternions + * @category Static + * + * @param {ReadonlyQuat} a Origin unit quaternion + * @param {ReadonlyQuat} b Destination unit quaternion + * @return {Number} Angle, in radians, between the two quaternions + */ + }, { + key: "getAngle", + value: function getAngle(a, b) { + var dotproduct = _Quat.dot(a, b); + return Math.acos(2 * dotproduct * dotproduct - 1); + } + /** + * Multiplies two quaternions. + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "multiply", + value: function multiply(out, a, b) { + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + var aw = a[3]; + var bx = b[0]; + var by = b[1]; + var bz = b[2]; + var bw = b[3]; + out[0] = ax * bw + aw * bx + ay * bz - az * by; + out[1] = ay * bw + aw * by + az * bx - ax * bz; + out[2] = az * bw + aw * bz + ax * by - ay * bx; + out[3] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + /** + * Rotates a quaternion by the given angle about the X axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + }, { + key: "rotateX", + value: function rotateX(out, a, rad) { + rad *= 0.5; + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + var aw = a[3]; + var bx = Math.sin(rad); + var bw = Math.cos(rad); + out[0] = ax * bw + aw * bx; + out[1] = ay * bw + az * bx; + out[2] = az * bw - ay * bx; + out[3] = aw * bw - ax * bx; + return out; + } + /** + * Rotates a quaternion by the given angle about the Y axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + }, { + key: "rotateY", + value: function rotateY(out, a, rad) { + rad *= 0.5; + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + var aw = a[3]; + var by = Math.sin(rad); + var bw = Math.cos(rad); + out[0] = ax * bw - az * by; + out[1] = ay * bw + aw * by; + out[2] = az * bw + ax * by; + out[3] = aw * bw - ay * by; + return out; + } + /** + * Rotates a quaternion by the given angle about the Z axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + }, { + key: "rotateZ", + value: function rotateZ(out, a, rad) { + rad *= 0.5; + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + var aw = a[3]; + var bz = Math.sin(rad); + var bw = Math.cos(rad); + out[0] = ax * bw + ay * bz; + out[1] = ay * bw - ax * bz; + out[2] = az * bw + aw * bz; + out[3] = aw * bw - az * bz; + return out; + } + /** + * Calculates the W component of a quat from the X, Y, and Z components. + * Assumes that quaternion is 1 unit in length. + * Any existing W component will be ignored. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate W component of + * @returns `out` + */ + }, { + key: "calculateW", + value: function calculateW(out, a) { + var x = a[0], + y = a[1], + z = a[2]; + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = Math.sqrt(Math.abs(1 - x * x - y * y - z * z)); + return out; + } + /** + * Calculate the exponential of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + }, { + key: "exp", + value: function exp(out, a) { + var x = a[0], + y = a[1], + z = a[2], + w = a[3]; + var r = Math.sqrt(x * x + y * y + z * z); + var et = Math.exp(w); + var s = r > 0 ? et * Math.sin(r) / r : 0; + out[0] = x * s; + out[1] = y * s; + out[2] = z * s; + out[3] = et * Math.cos(r); + return out; + } + /** + * Calculate the natural logarithm of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + }, { + key: "ln", + value: function ln(out, a) { + var x = a[0], + y = a[1], + z = a[2], + w = a[3]; + var r = Math.sqrt(x * x + y * y + z * z); + var t = r > 0 ? Math.atan2(r, w) / r : 0; + out[0] = x * t; + out[1] = y * t; + out[2] = z * t; + out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w); + return out; + } + /** + * Calculate the scalar power of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @param b - amount to scale the quaternion by + * @returns `out` + */ + }, { + key: "pow", + value: function pow(out, a, b) { + _Quat.ln(out, a); + _Quat.scale(out, out, b); + _Quat.exp(out, out); + return out; + } + /** + * Performs a spherical linear interpolation between two quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + }, { + key: "slerp", + value: function slerp(out, a, b, t) { + var ax = a[0], + ay = a[1], + az = a[2], + aw = a[3]; + var bx = b[0], + by = b[1], + bz = b[2], + bw = b[3]; + var scale0; + var scale1; + var cosom = ax * bx + ay * by + az * bz + aw * bw; + if (cosom < 0) { + cosom = -cosom; + bx = -bx; + by = -by; + bz = -bz; + bw = -bw; + } + if (1 - cosom > GLM_EPSILON) { + var omega = Math.acos(cosom); + var sinom = Math.sin(omega); + scale0 = Math.sin((1 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; + } else { + scale0 = 1 - t; + scale1 = t; + } + out[0] = scale0 * ax + scale1 * bx; + out[1] = scale0 * ay + scale1 * by; + out[2] = scale0 * az + scale1 * bz; + out[3] = scale0 * aw + scale1 * bw; + return out; + } + /** + * Generates a random unit quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + /* static random(out: QuatLike): QuatLike { + // Implementation of http://planning.cs.uiuc.edu/node198.html + // TODO: Calling random 3 times is probably not the fastest solution + let u1 = glMatrix.RANDOM(); + let u2 = glMatrix.RANDOM(); + let u3 = glMatrix.RANDOM(); + + let sqrt1MinusU1 = Math.sqrt(1 - u1); + let sqrtU1 = Math.sqrt(u1); + + out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2); + out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2); + out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3); + out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3); + return out; + }*/ + /** + * Calculates the inverse of a quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate inverse of + * @returns `out` + */ + }, { + key: "invert", + value: function invert(out, a) { + var a0 = a[0], + a1 = a[1], + a2 = a[2], + a3 = a[3]; + var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; + var invDot = dot ? 1 / dot : 0; + out[0] = -a0 * invDot; + out[1] = -a1 * invDot; + out[2] = -a2 * invDot; + out[3] = a3 * invDot; + return out; + } + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate conjugate of + * @returns `out` + */ + }, { + key: "conjugate", + value: function conjugate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + return out; + } + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to re-normalize the quaternion yourself where necessary. + * @category Static + * + * @param out - the receiving quaternion + * @param m - rotation matrix + * @returns `out` + */ + }, { + key: "fromMat3", + value: function fromMat3(out, m) { + var fTrace = m[0] + m[4] + m[8]; + var fRoot; + if (fTrace > 0) { + fRoot = Math.sqrt(fTrace + 1); + out[3] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[0] = (m[5] - m[7]) * fRoot; + out[1] = (m[6] - m[2]) * fRoot; + out[2] = (m[1] - m[3]) * fRoot; + } else { + var i = 0; + if (m[4] > m[0]) { + i = 1; + } + if (m[8] > m[i * 3 + i]) { + i = 2; + } + var j = (i + 1) % 3; + var k = (i + 2) % 3; + fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1); + out[i] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot; + out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; + out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + } + return out; + } + /** + * Creates a quaternion from the given euler angle x, y, z. + * @category Static + * + * @param out - the receiving quaternion + * @param x - Angle to rotate around X axis in degrees. + * @param y - Angle to rotate around Y axis in degrees. + * @param z - Angle to rotate around Z axis in degrees. + * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx. + * @returns `out` + */ + }, { + key: "fromEuler", + value: function fromEuler(out, x, y, z) { + var order = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : __privateGet(_Quat, _DEFAULT_ANGLE_ORDER); + var halfToRad = 0.5 * Math.PI / 180; + x *= halfToRad; + y *= halfToRad; + z *= halfToRad; + var sx = Math.sin(x); + var cx = Math.cos(x); + var sy = Math.sin(y); + var cy = Math.cos(y); + var sz = Math.sin(z); + var cz = Math.cos(z); + switch (order) { + case "xyz": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "xzy": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + case "yxz": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + case "yzx": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "zxy": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "zyx": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + default: + throw new Error("Unknown angle order ".concat(order)); + } + return out; + } + /** + * Returns a string representation of a quatenion + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + }, { + key: "str", + value: function str(a) { + return "Quat(".concat(a.join(", "), ")"); + } + /** + * Creates a new quat initialized with values from an existing quaternion + * @category Static + * + * @param a - quaternion to clone + * @returns a new quaternion + */ + }, { + key: "clone", + value: function clone(a) { + return new _Quat(a); + } + /** + * Creates a new quat initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new quaternion + */ + }, { + key: "fromValues", + value: function fromValues(x, y, z, w) { + return new _Quat(x, y, z, w); + } + /** + * Copy the values from one quat to another + * @category Static + * + * @param out - the receiving quaternion + * @param a - the source quaternion + * @returns `out` + */ + }, { + key: "copy", + value: function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Quat} to the given values + * @category Static + * + * @param out - the receiving quaternion + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "set", + value: function set(out, x, y, z, w) { + return out; + } + /** + * Adds two {@link Quat}'s + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "add", + value: function add(out, a, b) { + return out; + } + /** + * Alias for {@link Quat.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "mul", + value: function mul(out, a, b) { + return out; + } + /** + * Scales a quat by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param b - amount to scale the vector by + * @returns `out` + */ + }, { + key: "scale", + value: function scale(out, a, _scale4) { + out[0] = a[0] * _scale4; + out[1] = a[1] * _scale4; + out[2] = a[2] * _scale4; + out[3] = a[3] * _scale4; + return out; + } + /** + * Calculates the dot product of two quat's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + }, { + key: "dot", + value: function dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + /** + * Performs a linear interpolation between two quat's + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "lerp", + value: function lerp(out, a, b, t) { + return out; + } + /** + * Calculates the magnitude (length) of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate length of + * @returns length of `a` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "magnitude", + value: function magnitude(a) { + return 0; + } + /** + * Alias for {@link Quat.magnitude} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "mag", + value: function mag(a) { + return 0; + } + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + }, { + key: "length", + value: function length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.mag} + */ + }, { + key: "len", + value: function len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate squared length of + * @returns squared length of a + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "squaredLength", + value: function squaredLength(a) { + return 0; + } + /** + * Alias for {@link Quat.squaredLength} + * @category Static + */ + }, { + key: "sqrLen", + value: function sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Normalize a {@link Quat} + * @category Static + * + * @param out - the receiving quaternion + * @param a - quaternion to normalize + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "normalize", + value: function normalize(out, a) { + return out; + } + /** + * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first quaternion. + * @param b - The second quaternion. + * @returns True if the vectors are equal, false otherwise. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "exactEquals", + value: function exactEquals(a, b) { + return false; + } + /** + * Returns whether the quaternions have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "equals", + value: function equals(a, b) { + return false; + } + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * @category Static + * + * @param out - the receiving quaternion. + * @param a - the initial vector + * @param b - the destination vector + * @returns `out` + */ + }, { + key: "rotationTo", + value: function rotationTo(out, a, b) { + var dot = Vec3.dot(a, b); + if (dot < -0.999999) { + Vec3.cross(__privateGet(_Quat, _TMP_VEC32), __privateGet(_Quat, _X_UNIT_VEC3), a); + if (Vec3.mag(__privateGet(_Quat, _TMP_VEC32)) < 1e-6) { + Vec3.cross(__privateGet(_Quat, _TMP_VEC32), __privateGet(_Quat, _Y_UNIT_VEC3), a); + } + Vec3.normalize(__privateGet(_Quat, _TMP_VEC32), __privateGet(_Quat, _TMP_VEC32)); + _Quat.setAxisAngle(out, __privateGet(_Quat, _TMP_VEC32), Math.PI); + return out; + } else if (dot > 0.999999) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } else { + Vec3.cross(__privateGet(_Quat, _TMP_VEC32), a, b); + out[0] = __privateGet(_Quat, _TMP_VEC32)[0]; + out[1] = __privateGet(_Quat, _TMP_VEC32)[1]; + out[2] = __privateGet(_Quat, _TMP_VEC32)[2]; + out[3] = 1 + dot; + return _Quat.normalize(out, out); + } + } + /** + * Performs a spherical linear interpolation with two control points + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + }, { + key: "sqlerp", + value: function sqlerp(out, a, b, c, d, t) { + _Quat.slerp(__privateGet(_Quat, _TMP_QUAT1), a, d, t); + _Quat.slerp(__privateGet(_Quat, _TMP_QUAT2), b, c, t); + _Quat.slerp(out, __privateGet(_Quat, _TMP_QUAT1), __privateGet(_Quat, _TMP_QUAT2), 2 * t * (1 - t)); + return out; + } + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * @category Static + * + * @param out - The receiving quaternion + * @param view - the vector representing the viewing direction + * @param right - the vector representing the local `right` direction + * @param up - the vector representing the local `up` direction + * @returns `out` + */ + }, { + key: "setAxes", + value: function setAxes(out, view, right, up) { + __privateGet(_Quat, _TMP_MAT3)[0] = right[0]; + __privateGet(_Quat, _TMP_MAT3)[3] = right[1]; + __privateGet(_Quat, _TMP_MAT3)[6] = right[2]; + __privateGet(_Quat, _TMP_MAT3)[1] = up[0]; + __privateGet(_Quat, _TMP_MAT3)[4] = up[1]; + __privateGet(_Quat, _TMP_MAT3)[7] = up[2]; + __privateGet(_Quat, _TMP_MAT3)[2] = -view[0]; + __privateGet(_Quat, _TMP_MAT3)[5] = -view[1]; + __privateGet(_Quat, _TMP_MAT3)[8] = -view[2]; + return _Quat.normalize(out, _Quat.fromMat3(out, __privateGet(_Quat, _TMP_MAT3))); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float32Array)); + _DEFAULT_ANGLE_ORDER = new WeakMap(); + _TMP_QUAT1 = new WeakMap(); + _TMP_QUAT2 = new WeakMap(); + _TMP_MAT3 = new WeakMap(); + _TMP_VEC32 = new WeakMap(); + _X_UNIT_VEC3 = new WeakMap(); + _Y_UNIT_VEC3 = new WeakMap(); + __privateAdd(_Quat, _DEFAULT_ANGLE_ORDER, "zyx"); + // Temporary variables to prevent repeated allocations in the algorithms within Quat. + // These are declared as TypedArrays to aid in tree-shaking. + __privateAdd(_Quat, _TMP_QUAT1, new Float32Array(4)); + __privateAdd(_Quat, _TMP_QUAT2, new Float32Array(4)); + __privateAdd(_Quat, _TMP_MAT3, new Float32Array(9)); + __privateAdd(_Quat, _TMP_VEC32, new Float32Array(3)); + __privateAdd(_Quat, _X_UNIT_VEC3, new Float32Array([1, 0, 0])); + __privateAdd(_Quat, _Y_UNIT_VEC3, new Float32Array([0, 1, 0])); + var Quat = _Quat; + Quat.set = Vec4.set; + Quat.add = Vec4.add; + Quat.lerp = Vec4.lerp; + Quat.normalize = Vec4.normalize; + Quat.squaredLength = Vec4.squaredLength; + Quat.sqrLen = Vec4.squaredLength; + Quat.exactEquals = Vec4.exactEquals; + Quat.equals = Vec4.equals; + Quat.magnitude = Vec4.magnitude; + Quat.prototype.mul = Quat.prototype.multiply; + Quat.mul = Quat.multiply; + Quat.mag = Quat.magnitude; + Quat.length = Quat.magnitude; + Quat.len = Quat.magnitude; + + // src/_lib/f32/Quat2.ts + var _TMP_QUAT, _TMP_VEC33; + var _Quat2 = /*#__PURE__*/function (_Float32Array8) { + /** + * Create a {@link Quat2}. + * + * @category Constructor + */ + function _Quat2() { + var _this8; + _classCallCheck(this, _Quat2); + for (var _len12 = arguments.length, values = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) { + values[_key12] = arguments[_key12]; + } + switch (values.length) { + case 8: + _this8 = _callSuper(this, _Quat2, [values]); + break; + case 2: + _this8 = _callSuper(this, _Quat2, [values[0], values[1], 8]); + break; + case 1: + { + var v = values[0]; + if (typeof v === "number") { + _this8 = _callSuper(this, _Quat2, [[v, v, v, v, v, v, v, v]]); + } else { + _this8 = _callSuper(this, _Quat2, [v, 0, 8]); + } + break; + } + default: + _this8 = _callSuper(this, _Quat2, [8]); + _this8[3] = 1; + break; + } + return _assertThisInitialized(_this8); + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Quat2.str(this);` + * + * @category Accessors + */ + _inherits(_Quat2, _Float32Array8); + return _createClass(_Quat2, [{ + key: "str", + get: function get() { + return _Quat2.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Quat2} into `this`. + * @category Methods + * + * @param a the source dual quaternion + * @returns `this` + */ + }, { + key: "copy", + value: function copy(a) { + _superPropGet(_Quat2, "set", this)([a]); + return this; + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat2}. + */ + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 8 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new identity {@link Quat2} + * @category Static + * + * @returns a new dual quaternion [real -> rotation, dual -> translation] + */ + }, { + key: "create", + value: function create() { + return new _Quat2(); + } + /** + * Creates a {@link Quat2} quat initialized with values from an existing quaternion + * @category Static + * + * @param a - dual quaternion to clone + * @returns a new dual quaternion + */ + }, { + key: "clone", + value: function clone(a) { + return new _Quat2(a); + } + /** + * Creates a new {@link Quat2} initialized with the given values + * @category Static + * + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns a new dual quaternion + */ + }, { + key: "fromValues", + value: function fromValues(x1, y1, z1, w1, x2, y2, z2, w2) { + return new _Quat2(x1, y1, z1, w1, x2, y2, z2, w2); + } + /** + * Creates a new {@link Quat2} from the given values (quat and translation) + * @category Static + * + * @param x1 - X component (rotation) + * @param y1 - Y component (rotation) + * @param z1 - Z component (rotation) + * @param w1 - W component (rotation) + * @param x2 - X component (translation) + * @param y2 - Y component (translation) + * @param z2 - Z component (translation) + * @returns a new dual quaternion + */ + }, { + key: "fromRotationTranslationValues", + value: function fromRotationTranslationValues(x1, y1, z1, w1, x2, y2, z2) { + var ax = x2 * 0.5; + var ay = y2 * 0.5; + var az = z2 * 0.5; + return new _Quat2(x1, y1, z1, w1, ax * w1 + ay * z1 - az * y1, ay * w1 + az * x1 - ax * z1, az * w1 + ax * y1 - ay * x1, -ax * x1 - ay * y1 - az * z1); + } + /** + * Sets a {@link Quat2} from a quaternion and a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @param t - translation vector + * @returns `out` + */ + }, { + key: "fromRotationTranslation", + value: function fromRotationTranslation(out, q, t) { + var ax = t[0] * 0.5; + var ay = t[1] * 0.5; + var az = t[2] * 0.5; + var bx = q[0]; + var by = q[1]; + var bz = q[2]; + var bw = q[3]; + out[0] = bx; + out[1] = by; + out[2] = bz; + out[3] = bw; + out[4] = ax * bw + ay * bz - az * by; + out[5] = ay * bw + az * bx - ax * bz; + out[6] = az * bw + ax * by - ay * bx; + out[7] = -ax * bx - ay * by - az * bz; + return out; + } + /** + * Sets a {@link Quat2} from a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param t - translation vector + * @returns `out` + */ + }, { + key: "fromTranslation", + value: function fromTranslation(out, t) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = t[0] * 0.5; + out[5] = t[1] * 0.5; + out[6] = t[2] * 0.5; + out[7] = 0; + return out; + } + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @returns `out` + */ + }, { + key: "fromRotation", + value: function fromRotation(out, q) { + out[0] = q[0]; + out[1] = q[1]; + out[2] = q[2]; + out[3] = q[3]; + out[4] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + return out; + } + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param a - the matrix + * @returns `out` + */ + }, { + key: "fromMat4", + value: function fromMat4(out, a) { + Mat4.getRotation(__privateGet(_Quat2, _TMP_QUAT), a); + Mat4.getTranslation(__privateGet(_Quat2, _TMP_VEC33), a); + return _Quat2.fromRotationTranslation(out, __privateGet(_Quat2, _TMP_QUAT), __privateGet(_Quat2, _TMP_VEC33)); + } + /** + * Copy the values from one {@link Quat2} to another + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the source dual quaternion + * @returns `out` + */ + }, { + key: "copy", + value: function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + return out; + } + /** + * Set a {@link Quat2} to the identity dual quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @returns `out` + */ + }, { + key: "identity", + value: function identity(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + return out; + } + /** + * Set the components of a {@link Quat2} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns `out` + */ + }, { + key: "set", + value: function set(out, x1, y1, z1, w1, x2, y2, z2, w2) { + out[0] = x1; + out[1] = y1; + out[2] = z1; + out[3] = w1; + out[4] = x2; + out[5] = y2; + out[6] = z2; + out[7] = w2; + return out; + } + /** + * Gets the real part of a dual quat + * @category Static + * + * @param out - real part + * @param a - Dual Quaternion + * @return `out` + */ + }, { + key: "getReal", + value: function getReal(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Gets the dual part of a dual quat + * @category Static + * + * @param out - dual part + * @param a - Dual Quaternion + * @return `out` + */ + }, { + key: "getDual", + value: function getDual(out, a) { + out[0] = a[4]; + out[1] = a[5]; + out[2] = a[6]; + out[3] = a[7]; + return out; + } + /** + * Set the real component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the real part + * @return `out` + */ + }, { + key: "setReal", + value: function setReal(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the dual component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the dual part + * @return `out` + */ + }, { + key: "setDual", + value: function setDual(out, a) { + out[4] = a[0]; + out[5] = a[1]; + out[6] = a[2]; + out[7] = a[3]; + return out; + } + /** + * Gets the translation of a normalized {@link Quat2} + * @category Static + * + * @param out - the receiving translation vector + * @param a - Dual Quaternion to be decomposed + * @return `out` + */ + }, { + key: "getTranslation", + value: function getTranslation(out, a) { + var ax = a[4]; + var ay = a[5]; + var az = a[6]; + var aw = a[7]; + var bx = -a[0]; + var by = -a[1]; + var bz = -a[2]; + var bw = a[3]; + out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; + out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; + out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + return out; + } + /** + * Translates a {@link Quat2} by the given vector + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to translate + * @param v - vector to translate by + * @returns `out` + */ + }, { + key: "translate", + value: function translate(out, a, v) { + var ax1 = a[0]; + var ay1 = a[1]; + var az1 = a[2]; + var aw1 = a[3]; + var bx1 = v[0] * 0.5; + var by1 = v[1] * 0.5; + var bz1 = v[2] * 0.5; + var ax2 = a[4]; + var ay2 = a[5]; + var az2 = a[6]; + var aw2 = a[7]; + out[0] = ax1; + out[1] = ay1; + out[2] = az1; + out[3] = aw1; + out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2; + out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2; + out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2; + out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2; + return out; + } + /** + * Rotates a {@link Quat2} around the X axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + }, { + key: "rotateX", + value: function rotateX(out, a, rad) { + var bx = -a[0]; + var by = -a[1]; + var bz = -a[2]; + var bw = a[3]; + var ax = a[4]; + var ay = a[5]; + var az = a[6]; + var aw = a[7]; + var ax1 = ax * bw + aw * bx + ay * bz - az * by; + var ay1 = ay * bw + aw * by + az * bx - ax * bz; + var az1 = az * bw + aw * bz + ax * by - ay * bx; + var aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateX(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} around the Y axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + }, { + key: "rotateY", + value: function rotateY(out, a, rad) { + var bx = -a[0]; + var by = -a[1]; + var bz = -a[2]; + var bw = a[3]; + var ax = a[4]; + var ay = a[5]; + var az = a[6]; + var aw = a[7]; + var ax1 = ax * bw + aw * bx + ay * bz - az * by; + var ay1 = ay * bw + aw * by + az * bx - ax * bz; + var az1 = az * bw + aw * bz + ax * by - ay * bx; + var aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateY(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} around the Z axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + }, { + key: "rotateZ", + value: function rotateZ(out, a, rad) { + var bx = -a[0]; + var by = -a[1]; + var bz = -a[2]; + var bw = a[3]; + var ax = a[4]; + var ay = a[5]; + var az = a[6]; + var aw = a[7]; + var ax1 = ax * bw + aw * bx + ay * bz - az * by; + var ay1 = ay * bw + aw * by + az * bx - ax * bz; + var az1 = az * bw + aw * bz + ax * by - ay * bx; + var aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateZ(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} by a given quaternion (a * q) + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param q - quaternion to rotate by + * @returns `out` + */ + }, { + key: "rotateByQuatAppend", + value: function rotateByQuatAppend(out, a, q) { + var qx = q[0]; + var qy = q[1]; + var qz = q[2]; + var qw = q[3]; + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + var aw = a[3]; + out[0] = ax * qw + aw * qx + ay * qz - az * qy; + out[1] = ay * qw + aw * qy + az * qx - ax * qz; + out[2] = az * qw + aw * qz + ax * qy - ay * qx; + out[3] = aw * qw - ax * qx - ay * qy - az * qz; + ax = a[4]; + ay = a[5]; + az = a[6]; + aw = a[7]; + out[4] = ax * qw + aw * qx + ay * qz - az * qy; + out[5] = ay * qw + aw * qy + az * qx - ax * qz; + out[6] = az * qw + aw * qz + ax * qy - ay * qx; + out[7] = aw * qw - ax * qx - ay * qy - az * qz; + return out; + } + /** + * Rotates a {@link Quat2} by a given quaternion (q * a) + * @category Static + * + * @param out - the receiving dual quaternion + * @param q - quaternion to rotate by + * @param a - the dual quaternion to rotate + * @returns `out` + */ + }, { + key: "rotateByQuatPrepend", + value: function rotateByQuatPrepend(out, q, a) { + var qx = q[0]; + var qy = q[1]; + var qz = q[2]; + var qw = q[3]; + var bx = a[0]; + var by = a[1]; + var bz = a[2]; + var bw = a[3]; + out[0] = qx * bw + qw * bx + qy * bz - qz * by; + out[1] = qy * bw + qw * by + qz * bx - qx * bz; + out[2] = qz * bw + qw * bz + qx * by - qy * bx; + out[3] = qw * bw - qx * bx - qy * by - qz * bz; + bx = a[4]; + by = a[5]; + bz = a[6]; + bw = a[7]; + out[4] = qx * bw + qw * bx + qy * bz - qz * by; + out[5] = qy * bw + qw * by + qz * bx - qx * bz; + out[6] = qz * bw + qw * bz + qx * by - qy * bx; + out[7] = qw * bw - qx * bx - qy * by - qz * bz; + return out; + } + /** + * Rotates a {@link Quat2} around a given axis. Does the normalization automatically + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param axis - the axis to rotate around + * @param rad - how far the rotation should be + * @returns `out` + */ + }, { + key: "rotateAroundAxis", + value: function rotateAroundAxis(out, a, axis, rad) { + if (Math.abs(rad) < GLM_EPSILON) { + return _Quat2.copy(out, a); + } + var axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]); + rad *= 0.5; + var s = Math.sin(rad); + var bx = s * axis[0] / axisLength; + var by = s * axis[1] / axisLength; + var bz = s * axis[2] / axisLength; + var bw = Math.cos(rad); + var ax1 = a[0]; + var ay1 = a[1]; + var az1 = a[2]; + var aw1 = a[3]; + out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + var ax = a[4]; + var ay = a[5]; + var az = a[6]; + var aw = a[7]; + out[4] = ax * bw + aw * bx + ay * bz - az * by; + out[5] = ay * bw + aw * by + az * bx - ax * bz; + out[6] = az * bw + aw * bz + ax * by - ay * bx; + out[7] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + /** + * Adds two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "add", + value: function add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + return out; + } + /** + * Multiplies two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns {quat2} out + */ + }, { + key: "multiply", + value: function multiply(out, a, b) { + var ax0 = a[0]; + var ay0 = a[1]; + var az0 = a[2]; + var aw0 = a[3]; + var bx1 = b[4]; + var by1 = b[5]; + var bz1 = b[6]; + var bw1 = b[7]; + var ax1 = a[4]; + var ay1 = a[5]; + var az1 = a[6]; + var aw1 = a[7]; + var bx0 = b[0]; + var by0 = b[1]; + var bz0 = b[2]; + var bw0 = b[3]; + out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0; + out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0; + out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0; + out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0; + out[4] = ax0 * bw1 + aw0 * bx1 + ay0 * bz1 - az0 * by1 + ax1 * bw0 + aw1 * bx0 + ay1 * bz0 - az1 * by0; + out[5] = ay0 * bw1 + aw0 * by1 + az0 * bx1 - ax0 * bz1 + ay1 * bw0 + aw1 * by0 + az1 * bx0 - ax1 * bz0; + out[6] = az0 * bw1 + aw0 * bz1 + ax0 * by1 - ay0 * bx1 + az1 * bw0 + aw1 * bz0 + ax1 * by0 - ay1 * bx0; + out[7] = aw0 * bw1 - ax0 * bx1 - ay0 * by1 - az0 * bz1 + aw1 * bw0 - ax1 * bx0 - ay1 * by0 - az1 * bz0; + return out; + } + /** + * Alias for {@link Quat2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "mul", + value: function mul(out, a, b) { + return out; + } + /** + * Scales a {@link Quat2} by a scalar value + * @category Static + * + * @param out - the receiving dual quaterion + * @param a - the dual quaternion to scale + * @param b - scalar value to scale the dual quaterion by + * @returns `out` + */ + }, { + key: "scale", + value: function scale(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + return out; + } + /** + * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts) + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "dot", + value: function dot(a, b) { + return 0; + } + /** + * Performs a linear interpolation between two {@link Quat2}s + * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`) + * @category Static + * + * @param out - the receiving dual quat + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + }, { + key: "lerp", + value: function lerp(out, a, b, t) { + var mt = 1 - t; + if (_Quat2.dot(a, b) < 0) { + t = -t; + } + out[0] = a[0] * mt + b[0] * t; + out[1] = a[1] * mt + b[1] * t; + out[2] = a[2] * mt + b[2] * t; + out[3] = a[3] * mt + b[3] * t; + out[4] = a[4] * mt + b[4] * t; + out[5] = a[5] * mt + b[5] * t; + out[6] = a[6] * mt + b[6] * t; + out[7] = a[7] * mt + b[7] * t; + return out; + } + /** + * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quat to calculate inverse of + * @returns `out` + */ + }, { + key: "invert", + value: function invert(out, a) { + var sqlen = _Quat2.squaredLength(a); + out[0] = -a[0] / sqlen; + out[1] = -a[1] / sqlen; + out[2] = -a[2] / sqlen; + out[3] = a[3] / sqlen; + out[4] = -a[4] / sqlen; + out[5] = -a[5] / sqlen; + out[6] = -a[6] / sqlen; + out[7] = a[7] / sqlen; + return out; + } + /** + * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than + * {@link Quat2.invert} and produces the same result. + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to calculate conjugate of + * @returns `out` + */ + }, { + key: "conjugate", + value: function conjugate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + out[4] = -a[4]; + out[5] = -a[5]; + out[6] = -a[6]; + out[7] = a[7]; + return out; + } + /** + * Calculates the magnitude (length) of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate length of + * @returns length of `a` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "magnitude", + value: function magnitude(a) { + return 0; + } + /** + * Alias for {@link Quat2.magnitude} + * @category Static + */ + }, { + key: "mag", + value: function mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + }, { + key: "length", + value: function length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.mag} + */ + }, { + key: "len", + value: function len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate squared length of + * @returns squared length of a + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "squaredLength", + value: function squaredLength(a) { + return 0; + } + /** + * Alias for {@link Quat2.squaredLength} + * @category Static + */ + }, { + key: "sqrLen", + value: function sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Normalize a {@link Quat2} + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to normalize + * @returns `out` + */ + }, { + key: "normalize", + value: function normalize(out, a) { + var magnitude = _Quat2.squaredLength(a); + if (magnitude > 0) { + magnitude = Math.sqrt(magnitude); + var a0 = a[0] / magnitude; + var a1 = a[1] / magnitude; + var a2 = a[2] / magnitude; + var a3 = a[3] / magnitude; + var b0 = a[4]; + var b1 = a[5]; + var b2 = a[6]; + var b3 = a[7]; + var a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3; + out[0] = a0; + out[1] = a1; + out[2] = a2; + out[3] = a3; + out[4] = (b0 - a0 * a_dot_b) / magnitude; + out[5] = (b1 - a1 * a_dot_b) / magnitude; + out[6] = (b2 - a2 * a_dot_b) / magnitude; + out[7] = (b3 - a3 * a_dot_b) / magnitude; + } + return out; + } + /** + * Returns a string representation of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to represent as a string + * @returns string representation of the vector + */ + }, { + key: "str", + value: function str(a) { + return "Quat2(".concat(a.join(", "), ")"); + } + /** + * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + }, { + key: "exactEquals", + value: function exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7]; + } + /** + * Returns whether the {@link Quat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + }, { + key: "equals", + value: function equals(a, b) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var a4 = a[4]; + var a5 = a[5]; + var a6 = a[6]; + var a7 = a[7]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; + var b4 = b[4]; + var b5 = b[5]; + var b6 = b[6]; + var b7 = b[7]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float32Array)); + _TMP_QUAT = new WeakMap(); + _TMP_VEC33 = new WeakMap(); + // Temporary variables to prevent repeated allocations in the algorithms within Quat2. + // These are declared as TypedArrays to aid in tree-shaking. + __privateAdd(_Quat2, _TMP_QUAT, new Float32Array(4)); + __privateAdd(_Quat2, _TMP_VEC33, new Float32Array(3)); + var Quat2 = _Quat2; + Quat2.dot = Quat.dot; + Quat2.squaredLength = Quat.squaredLength; + Quat2.sqrLen = Quat.squaredLength; + Quat2.mag = Quat.magnitude; + Quat2.length = Quat.magnitude; + Quat2.len = Quat.magnitude; + Quat2.mul = Quat2.multiply; + + // src/_lib/f32/Vec2.ts + var Vec2 = /*#__PURE__*/function (_Float32Array9) { + /** + * Create a {@link Vec2}. + * + * @category Constructor + */ + function _Vec2() { + var _this9; + _classCallCheck(this, _Vec2); + switch (arguments.length) { + case 2: + { + var v = arguments.length <= 0 ? undefined : arguments[0]; + if (typeof v === "number") { + _this9 = _callSuper(this, _Vec2, [[v, arguments.length <= 1 ? undefined : arguments[1]]]); + } else { + _this9 = _callSuper(this, _Vec2, [v, arguments.length <= 1 ? undefined : arguments[1], 2]); + } + break; + } + case 1: + { + var _v = arguments.length <= 0 ? undefined : arguments[0]; + if (typeof _v === "number") { + _this9 = _callSuper(this, _Vec2, [[_v, _v]]); + } else { + _this9 = _callSuper(this, _Vec2, [_v, 0, 2]); + } + break; + } + default: + _this9 = _callSuper(this, _Vec2, [2]); + break; + } + return _assertThisInitialized(_this9); + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + _inherits(_Vec2, _Float32Array9); + return _createClass(_Vec2, [{ + key: "x", + get: function get() { + return this[0]; + }, + set: function set(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + }, { + key: "y", + get: function get() { + return this[1]; + }, + set: function set(value) { + this[1] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + }, { + key: "r", + get: function get() { + return this[0]; + }, + set: function set(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + }, { + key: "g", + get: function get() { + return this[1]; + }, + set: function set(value) { + this[1] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec2.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + }, { + key: "magnitude", + get: function get() { + return Math.hypot(this[0], this[1]); + } + /** + * Alias for {@link Vec2.magnitude} + * + * @category Accessors + */ + }, { + key: "mag", + get: function get() { + return this.magnitude; + } + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec2.squaredMagnitude(this);` + * + * @category Accessors + */ + }, { + key: "squaredMagnitude", + get: function get() { + var x = this[0]; + var y = this[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.squaredMagnitude} + * + * @category Accessors + */ + }, { + key: "sqrMag", + get: function get() { + return this.squaredMagnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec2.str(this);` + * + * @category Accessors + */ + }, { + key: "str", + get: function get() { + return _Vec2.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec2} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + }, { + key: "copy", + value: function copy(a) { + this.set(a); + return this; + } + // Instead of zero(), use a.fill(0) for instances; + /** + * Adds a {@link Vec2} to `this`. + * Equivalent to `Vec2.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + }, { + key: "add", + value: function add(b) { + this[0] += b[0]; + this[1] += b[1]; + return this; + } + /** + * Subtracts a {@link Vec2} from `this`. + * Equivalent to `Vec2.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + }, { + key: "subtract", + value: function subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + return this; + } + /** + * Alias for {@link Vec2.subtract} + * @category Methods + */ + }, { + key: "sub", + value: function sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec2}. + * Equivalent to `Vec2.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + }, { + key: "multiply", + value: function multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + return this; + } + /** + * Alias for {@link Vec2.multiply} + * @category Methods + */ + }, { + key: "mul", + value: function mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec2}. + * Equivalent to `Vec2.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + }, { + key: "divide", + value: function divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + return this; + } + /** + * Alias for {@link Vec2.divide} + * @category Methods + */ + }, { + key: "div", + value: function div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec2.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + }, { + key: "scale", + value: function scale(b) { + this[0] *= b; + this[1] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + }, { + key: "distance", + value: function distance(b) { + return _Vec2.distance(this, b); + } + /** + * Alias for {@link Vec2.distance} + * @category Methods + */ + }, { + key: "dist", + value: function dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + }, { + key: "squaredDistance", + value: function squaredDistance(b) { + return _Vec2.squaredDistance(this, b); + } + /** + * Alias for {@link Vec2.squaredDistance} + * @category Methods + */ + }, { + key: "sqrDist", + value: function sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec2.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "negate", + value: function negate() { + this[0] *= -1; + this[1] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec2.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "invert", + value: function invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + return this; + } + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec2.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "abs", + value: function abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec2}. + * Equivalent to `Vec2.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + }, { + key: "dot", + value: function dot(b) { + return this[0] * b[0] + this[1] * b[1]; + } + /** + * Normalize `this`. + * Equivalent to `Vec2.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "normalize", + value: function normalize() { + return _Vec2.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec2}. + */ + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 2 * Float32Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty {@link Vec2} + * @category Static + * + * @returns A new 2D vector + */ + }, { + key: "create", + value: function create() { + return new _Vec2(); + } + /** + * Creates a new {@link Vec2} initialized with values from an existing vector + * @category Static + * + * @param a - Vector to clone + * @returns A new 2D vector + */ + }, { + key: "clone", + value: function clone(a) { + return new _Vec2(a); + } + /** + * Creates a new {@link Vec2} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @returns A new 2D vector + */ + }, { + key: "fromValues", + value: function fromValues(x, y) { + return new _Vec2(x, y); + } + /** + * Copy the values from one {@link Vec2} to another + * @category Static + * + * @param out - the receiving vector + * @param a - The source vector + * @returns `out` + */ + }, { + key: "copy", + value: function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + return out; + } + /** + * Set the components of a {@link Vec2} to the given values + * @category Static + * + * @param out - The receiving vector + * @param x - X component + * @param y - Y component + * @returns `out` + */ + }, { + key: "set", + value: function set(out, x, y) { + out[0] = x; + out[1] = y; + return out; + } + /** + * Adds two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "add", + value: function add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "subtract", + value: function subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + return out; + } + /** + * Alias for {@link Vec2.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sub", + value: function sub(out, a, b) { + return [0, 0]; + } + /** + * Multiplies two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "multiply", + value: function multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + return out; + } + /** + * Alias for {@link Vec2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "mul", + value: function mul(out, a, b) { + return [0, 0]; + } + /** + * Divides two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "divide", + value: function divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + return out; + } + /** + * Alias for {@link Vec2.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "div", + value: function div(out, a, b) { + return [0, 0]; + } + /** + * Math.ceil the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to ceil + * @returns `out` + */ + }, { + key: "ceil", + value: function ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + return out; + } + /** + * Math.floor the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to floor + * @returns `out` + */ + }, { + key: "floor", + value: function floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + return out; + } + /** + * Returns the minimum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "min", + value: function min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + return out; + } + /** + * Returns the maximum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "max", + value: function max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + return out; + } + /** + * Math.round the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to round + * @returns `out` + */ + }, { + key: "round", + value: function round(out, a) { + out[0] = Math.round(a[0]); + out[1] = Math.round(a[1]); + return out; + } + /** + * Scales a {@link Vec2} by a scalar number + * @category Static + * + * @param out - The receiving vector + * @param a - The vector to scale + * @param b - Amount to scale the vector by + * @returns `out` + */ + }, { + key: "scale", + value: function scale(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + return out; + } + /** + * Adds two Vec2's after scaling the second operand by a scalar value + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param scale - The amount to scale b by before adding + * @returns `out` + */ + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns distance between `a` and `b` + */ + }, { + key: "distance", + value: function distance(a, b) { + return Math.hypot(b[0] - a[0], b[1] - a[1]); + } + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "dist", + value: function dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Squared distance between `a` and `b` + */ + }, { + key: "squaredDistance", + value: function squaredDistance(a, b) { + var x = b[0] - a[0]; + var y = b[1] - a[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sqrDist", + value: function sqrDist(a, b) { + return 0; + } + /** + * Calculates the magnitude (length) of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + }, { + key: "magnitude", + value: function magnitude(a) { + var x = a[0]; + var y = a[1]; + return Math.sqrt(x * x + y * y); + } + /** + * Alias for {@link Vec2.magnitude} + * @category Static + */ + }, { + key: "mag", + value: function mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + // Length conflicts with Function.length + }, { + key: "length", + value: function length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.mag} + */ + }, { + key: "len", + value: function len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate squared length of + * @returns Squared length of a + */ + }, { + key: "squaredLength", + value: function squaredLength(a) { + var x = a[0]; + var y = a[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.squaredLength} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sqrLen", + value: function sqrLen(a, b) { + return 0; + } + /** + * Negates the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to negate + * @returns `out` + */ + }, { + key: "negate", + value: function negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + return out; + } + /** + * Returns the inverse of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to invert + * @returns `out` + */ + }, { + key: "inverse", + value: function inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + }, { + key: "abs", + value: function abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + return out; + } + /** + * Normalize a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to normalize + * @returns `out` + */ + }, { + key: "normalize", + value: function normalize(out, a) { + var x = a[0]; + var y = a[1]; + var len = x * x + y * y; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + return out; + } + /** + * Calculates the dot product of two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Dot product of `a` and `b` + */ + }, { + key: "dot", + value: function dot(a, b) { + return a[0] * b[0] + a[1] * b[1]; + } + /** + * Computes the cross product of two {@link Vec2}s + * Note that the cross product must by definition produce a 3D vector. + * For this reason there is also not instance equivalent for this function. + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "cross", + value: function cross(out, a, b) { + var z = a[0] * b[1] - a[1] * b[0]; + out[0] = out[1] = 0; + out[2] = z; + return out; + } + /** + * Performs a linear interpolation between two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param t - Interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + }, { + key: "lerp", + value: function lerp(out, a, b, t) { + var ax = a[0]; + var ay = a[1]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat2} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + }, { + key: "transformMat2", + value: function transformMat2(out, a, m) { + var x = a[0]; + var y = a[1]; + out[0] = m[0] * x + m[2] * y; + out[1] = m[1] * x + m[3] * y; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat2d} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + }, { + key: "transformMat2d", + value: function transformMat2d(out, a, m) { + var x = a[0]; + var y = a[1]; + out[0] = m[0] * x + m[2] * y + m[4]; + out[1] = m[1] * x + m[3] * y + m[5]; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat3} + * 3rd vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + }, { + key: "transformMat3", + value: function transformMat3(out, a, m) { + var x = a[0]; + var y = a[1]; + out[0] = m[0] * x + m[3] * y + m[6]; + out[1] = m[1] * x + m[4] * y + m[7]; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat4} + * 3rd vector component is implicitly '0' + * 4th vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + }, { + key: "transformMat4", + value: function transformMat4(out, a, m) { + var x = a[0]; + var y = a[1]; + out[0] = m[0] * x + m[4] * y + m[12]; + out[1] = m[1] * x + m[5] * y + m[13]; + return out; + } + /** + * Rotate a 2D vector + * @category Static + * + * @param out - The receiving {@link Vec2} + * @param a - The {@link Vec2} point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + }, { + key: "rotate", + value: function rotate(out, a, b, rad) { + var p0 = a[0] - b[0]; + var p1 = a[1] - b[1]; + var sinC = Math.sin(rad); + var cosC = Math.cos(rad); + out[0] = p0 * cosC - p1 * sinC + b[0]; + out[1] = p0 * sinC + p1 * cosC + b[1]; + return out; + } + /** + * Get the angle between two 2D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + }, { + key: "angle", + value: function angle(a, b) { + var x1 = a[0]; + var y1 = a[1]; + var x2 = b[0]; + var y2 = b[1]; + var mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2); + var cosine = mag && (x1 * x2 + y1 * y2) / mag; + return Math.acos(Math.min(Math.max(cosine, -1), 1)); + } + /** + * Set the components of a {@link Vec2} to zero + * @category Static + * + * @param out - The receiving vector + * @returns `out` + */ + }, { + key: "zero", + value: function zero(out) { + out[0] = 0; + out[1] = 0; + return out; + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors components are ===, `false` otherwise. + */ + }, { + key: "exactEquals", + value: function exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors are approximately equal, `false` otherwise. + */ + }, { + key: "equals", + value: function equals(a, b) { + var a0 = a[0]; + var a1 = a[1]; + var b0 = b[0]; + var b1 = b[1]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)); + } + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - Vector to represent as a string + * @returns String representation of the vector + */ + }, { + key: "str", + value: function str(a) { + return "Vec2(".concat(a.join(", "), ")"); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float32Array)); + Vec2.prototype.sub = Vec2.prototype.subtract; + Vec2.prototype.mul = Vec2.prototype.multiply; + Vec2.prototype.div = Vec2.prototype.divide; + Vec2.prototype.dist = Vec2.prototype.distance; + Vec2.prototype.sqrDist = Vec2.prototype.squaredDistance; + Vec2.sub = Vec2.subtract; + Vec2.mul = Vec2.multiply; + Vec2.div = Vec2.divide; + Vec2.dist = Vec2.distance; + Vec2.sqrDist = Vec2.squaredDistance; + Vec2.sqrLen = Vec2.squaredLength; + Vec2.mag = Vec2.magnitude; + Vec2.length = Vec2.magnitude; + Vec2.len = Vec2.magnitude; + + // src/swizzle/index.ts + var GLM_SWIZZLES_ENABLED_F32 = false; + function EnableSwizzles() { + if (GLM_SWIZZLES_ENABLED_F32) { + return; + } + var VEC2_SWIZZLES = ["xx", "xy", "yx", "yy", "xxx", "xxy", "xyx", "xyy", "yxx", "yxy", "yyx", "yyy", "xxxx", "xxxy", "xxyx", "xxyy", "xyxx", "xyxy", "xyyx", "xyyy", "yxxx", "yxxy", "yxyx", "yxyy", "yyxx", "yyxy", "yyyx", "yyyy", "rr", "rg", "gr", "gg", "rrr", "rrg", "rgr", "rgg", "grr", "grg", "ggr", "ggg", "rrrr", "rrrg", "rrgr", "rrgg", "rgrr", "rgrg", "rggr", "rggg", "grrr", "grrg", "grgr", "grgg", "ggrr", "ggrg", "gggr", "gggg"]; + var VEC3_SWIZZLES = ["xz", "yz", "zx", "zy", "zz", "xxz", "xyz", "xzx", "xzy", "xzz", "yxz", "yyz", "yzx", "yzy", "yzz", "zxx", "zxy", "zxz", "zyx", "zyy", "zyz", "zzx", "zzy", "zzz", "xxxz", "xxyz", "xxzx", "xxzy", "xxzz", "xyxz", "xyyz", "xyzx", "xyzy", "xyzz", "xzxx", "xzxy", "xzxz", "xzyx", "xzyy", "xzyz", "xzzx", "xzzy", "xzzz", "yxxz", "yxyz", "yxzx", "yxzy", "yxzz", "yyxz", "yyyz", "yyzx", "yyzy", "yyzz", "yzxx", "yzxy", "yzxz", "yzyx", "yzyy", "yzyz", "yzzx", "yzzy", "yzzz", "zxxx", "zxxy", "zxxz", "zxyx", "zxyy", "zxyz", "zxzx", "zxzy", "zxzz", "zyxx", "zyxy", "zyxz", "zyyx", "zyyy", "zyyz", "zyzx", "zyzy", "zyzz", "zzxx", "zzxy", "zzxz", "zzyx", "zzyy", "zzyz", "zzzx", "zzzy", "zzzz", "rb", "gb", "br", "bg", "bb", "rrb", "rgb", "rbr", "rbg", "rbb", "grb", "ggb", "gbr", "gbg", "gbb", "brr", "brg", "brb", "bgr", "bgg", "bgb", "bbr", "bbg", "bbb", "rrrb", "rrgb", "rrbr", "rrbg", "rrbb", "rgrb", "rggb", "rgbr", "rgbg", "rgbb", "rbrr", "rbrg", "rbrb", "rbgr", "rbgg", "rbgb", "rbbr", "rbbg", "rbbb", "grrb", "grgb", "grbr", "grbg", "grbb", "ggrb", "gggb", "ggbr", "ggbg", "ggbb", "gbrr", "gbrg", "gbrb", "gbgr", "gbgg", "gbgb", "gbbr", "gbbg", "gbbb", "brrr", "brrg", "brrb", "brgr", "brgg", "brgb", "brbr", "brbg", "brbb", "bgrr", "bgrg", "bgrb", "bggr", "bggg", "bggb", "bgbr", "bgbg", "bgbb", "bbrr", "bbrg", "bbrb", "bbgr", "bbgg", "bbgb", "bbbr", "bbbg", "bbbb"]; + var VEC4_SWIZZLES = ["xw", "yw", "zw", "wx", "wy", "wz", "ww", "xxw", "xyw", "xzw", "xwx", "xwy", "xwz", "xww", "yxw", "yyw", "yzw", "ywx", "ywy", "ywz", "yww", "zxw", "zyw", "zzw", "zwx", "zwy", "zwz", "zww", "wxx", "wxy", "wxz", "wxw", "wyx", "wyy", "wyz", "wyw", "wzx", "wzy", "wzz", "wzw", "wwx", "wwy", "wwz", "www", "xxxw", "xxyw", "xxzw", "xxwx", "xxwy", "xxwz", "xxww", "xyxw", "xyyw", "xyzw", "xywx", "xywy", "xywz", "xyww", "xzxw", "xzyw", "xzzw", "xzwx", "xzwy", "xzwz", "xzww", "xwxx", "xwxy", "xwxz", "xwxw", "xwyx", "xwyy", "xwyz", "xwyw", "xwzx", "xwzy", "xwzz", "xwzw", "xwwx", "xwwy", "xwwz", "xwww", "yxxw", "yxyw", "yxzw", "yxwx", "yxwy", "yxwz", "yxww", "yyxw", "yyyw", "yyzw", "yywx", "yywy", "yywz", "yyww", "yzxw", "yzyw", "yzzw", "yzwx", "yzwy", "yzwz", "yzww", "ywxx", "ywxy", "ywxz", "ywxw", "ywyx", "ywyy", "ywyz", "ywyw", "ywzx", "ywzy", "ywzz", "ywzw", "ywwx", "ywwy", "ywwz", "ywww", "zxxw", "zxyw", "zxzw", "zxwx", "zxwy", "zxwz", "zxww", "zyxw", "zyyw", "zyzw", "zywx", "zywy", "zywz", "zyww", "zzxw", "zzyw", "zzzw", "zzwx", "zzwy", "zzwz", "zzww", "zwxx", "zwxy", "zwxz", "zwxw", "zwyx", "zwyy", "zwyz", "zwyw", "zwzx", "zwzy", "zwzz", "zwzw", "zwwx", "zwwy", "zwwz", "zwww", "wxxx", "wxxy", "wxxz", "wxxw", "wxyx", "wxyy", "wxyz", "wxyw", "wxzx", "wxzy", "wxzz", "wxzw", "wxwx", "wxwy", "wxwz", "wxww", "wyxx", "wyxy", "wyxz", "wyxw", "wyyx", "wyyy", "wyyz", "wyyw", "wyzx", "wyzy", "wyzz", "wyzw", "wywx", "wywy", "wywz", "wyww", "wzxx", "wzxy", "wzxz", "wzxw", "wzyx", "wzyy", "wzyz", "wzyw", "wzzx", "wzzy", "wzzz", "wzzw", "wzwx", "wzwy", "wzwz", "wzww", "wwxx", "wwxy", "wwxz", "wwxw", "wwyx", "wwyy", "wwyz", "wwyw", "wwzx", "wwzy", "wwzz", "wwzw", "wwwx", "wwwy", "wwwz", "wwww", "ra", "ga", "ba", "ar", "ag", "ab", "aa", "rra", "rga", "rba", "rar", "rag", "rab", "raa", "gra", "gga", "gba", "gar", "gag", "gab", "gaa", "bra", "bga", "bba", "bar", "bag", "bab", "baa", "arr", "arg", "arb", "ara", "agr", "agg", "agb", "aga", "abr", "abg", "abb", "aba", "aar", "aag", "aab", "aaa", "rrra", "rrga", "rrba", "rrar", "rrag", "rrab", "rraa", "rgra", "rgga", "rgba", "rgar", "rgag", "rgab", "rgaa", "rbra", "rbga", "rbba", "rbar", "rbag", "rbab", "rbaa", "rarr", "rarg", "rarb", "rara", "ragr", "ragg", "ragb", "raga", "rabr", "rabg", "rabb", "raba", "raar", "raag", "raab", "raaa", "grra", "grga", "grba", "grar", "grag", "grab", "graa", "ggra", "ggga", "ggba", "ggar", "ggag", "ggab", "ggaa", "gbra", "gbga", "gbba", "gbar", "gbag", "gbab", "gbaa", "garr", "garg", "garb", "gara", "gagr", "gagg", "gagb", "gaga", "gabr", "gabg", "gabb", "gaba", "gaar", "gaag", "gaab", "gaaa", "brra", "brga", "brba", "brar", "brag", "brab", "braa", "bgra", "bgga", "bgba", "bgar", "bgag", "bgab", "bgaa", "bbra", "bbga", "bbba", "bbar", "bbag", "bbab", "bbaa", "barr", "barg", "barb", "bara", "bagr", "bagg", "bagb", "baga", "babr", "babg", "babb", "baba", "baar", "baag", "baab", "baaa", "arrr", "arrg", "arrb", "arra", "argr", "argg", "argb", "arga", "arbr", "arbg", "arbb", "arba", "arar", "arag", "arab", "araa", "agrr", "agrg", "agrb", "agra", "aggr", "aggg", "aggb", "agga", "agbr", "agbg", "agbb", "agba", "agar", "agag", "agab", "agaa", "abrr", "abrg", "abrb", "abra", "abgr", "abgg", "abgb", "abga", "abbr", "abbg", "abbb", "abba", "abar", "abag", "abab", "abaa", "aarr", "aarg", "aarb", "aara", "aagr", "aagg", "aagb", "aaga", "aabr", "aabg", "aabb", "aaba", "aaar", "aaag", "aaab", "aaaa"]; + var SWIZZLE_INDEX = { + x: 0, + r: 0, + y: 1, + g: 1, + z: 2, + b: 2, + w: 3, + a: 3 + }; + function getSwizzleImpl(swizzle) { + switch (swizzle.length) { + case 2: + return function () { + return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]); + }; + case 3: + return function () { + return new Vec3(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]], this[SWIZZLE_INDEX[swizzle[2]]]); + }; + case 4: + return function () { + return new Vec4(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]], this[SWIZZLE_INDEX[swizzle[2]]], this[SWIZZLE_INDEX[swizzle[3]]]); + }; + } + throw new Error("Illegal swizzle length"); + } + for (var _i = 0, _VEC2_SWIZZLES = VEC2_SWIZZLES; _i < _VEC2_SWIZZLES.length; _i++) { + var swizzle = _VEC2_SWIZZLES[_i]; + var impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec2.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec3.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + for (var _i2 = 0, _VEC3_SWIZZLES = VEC3_SWIZZLES; _i2 < _VEC3_SWIZZLES.length; _i2++) { + var _swizzle = _VEC3_SWIZZLES[_i2]; + var _impl = getSwizzleImpl(_swizzle); + Object.defineProperty(Vec3.prototype, _swizzle, { + get: _impl + }); + Object.defineProperty(Vec4.prototype, _swizzle, { + get: _impl + }); + } + for (var _i3 = 0, _VEC4_SWIZZLES = VEC4_SWIZZLES; _i3 < _VEC4_SWIZZLES.length; _i3++) { + var _swizzle2 = _VEC4_SWIZZLES[_i3]; + var _impl2 = getSwizzleImpl(_swizzle2); + Object.defineProperty(Vec4.prototype, _swizzle2, { + get: _impl2 + }); + } + GLM_SWIZZLES_ENABLED_F32 = true; + } + + // src/util/angleConversion.ts + var GLM_DEG_TO_RAD = Math.PI / 180; + var GLM_RAD_TO_DEG = 180 / Math.PI; + function toDegree(value) { + return value * GLM_RAD_TO_DEG; + } + function toRadian(value) { + return value * GLM_DEG_TO_RAD; + } + + exports.EnableSwizzles = EnableSwizzles; + exports.Mat2 = Mat2; + exports.Mat2d = Mat2d; + exports.Mat3 = Mat3; + exports.Mat4 = Mat4; + exports.Quat = Quat; + exports.Quat2 = Quat2; + exports.Vec2 = Vec2; + exports.Vec3 = Vec3; + exports.Vec4 = Vec4; + exports.mat2 = Mat2; + exports.mat2d = Mat2d; + exports.mat3 = Mat3; + exports.mat4 = Mat4; + exports.quat = Quat; + exports.quat2 = Quat2; + exports.toDegree = toDegree; + exports.toRadian = toRadian; + exports.vec2 = Vec2; + exports.vec3 = Vec3; + exports.vec4 = Vec4; + +})); +//# sourceMappingURL=gl-matrix-f32.js.map diff --git a/dist-cdn/umd/gl-matrix-f32.js.map b/dist-cdn/umd/gl-matrix-f32.js.map new file mode 100644 index 00000000..aec686f4 --- /dev/null +++ b/dist-cdn/umd/gl-matrix-f32.js.map @@ -0,0 +1 @@ +{"version":3,"file":"gl-matrix-f32.js","sources":["../esm/2016/gl-matrix-f32.js"],"sourcesContent":["// gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library.\n// @author Brandon Jones\n// @author Colin MacKenzie IV\n// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md)\nvar __typeError = (msg) => {\n throw TypeError(msg);\n};\nvar __accessCheck = (obj, member, msg) => member.has(obj) || __typeError(\"Cannot \" + msg);\nvar __privateGet = (obj, member, getter) => (__accessCheck(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj));\nvar __privateAdd = (obj, member, value) => member.has(obj) ? __typeError(\"Cannot add the same private member more than once\") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n\n// src/common/index.ts\nvar GLM_EPSILON = 1e-6;\n\n// src/_lib/f32/Mat2.ts\nvar _IDENTITY_2X2;\nvar _Mat2 = class _Mat2 extends Float32Array {\n /**\n * Create a {@link Mat2}.\n *\n * @category Constructor\n */\n constructor(...values) {\n switch (values.length) {\n case 4:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 4);\n break;\n case 1:\n const v = values[0];\n if (typeof v === \"number\") {\n super([\n v,\n v,\n v,\n v\n ]);\n } else {\n super(v, 0, 4);\n }\n break;\n default:\n super(__privateGet(_Mat2, _IDENTITY_2X2));\n break;\n }\n }\n // ============\n // Accessors\n // ============\n /**\n * A string representation of `this`\n * Equivalent to `Mat2.str(this);`\n *\n * @category Accessors\n */\n get str() {\n return _Mat2.str(this);\n }\n // ===================\n // Instance methods\n // ===================\n /**\n * Copy the values from another {@link Mat2} into `this`.\n *\n * @param a the source vector\n * @returns `this`\n * @category Methods\n */\n copy(a) {\n this.set(a);\n return this;\n }\n /**\n * Set `this` to the identity matrix\n * Equivalent to Mat2.identity(this)\n *\n * @returns `this`\n * @category Methods\n */\n identity() {\n this.set(__privateGet(_Mat2, _IDENTITY_2X2));\n return this;\n }\n /**\n * Multiplies this {@link Mat2} against another one\n * Equivalent to `Mat2.multiply(this, this, b);`\n *\n * @param b - The second operand\n * @returns `this`\n * @category Methods\n */\n multiply(b) {\n return _Mat2.multiply(this, this, b);\n }\n /**\n * Alias for {@link Mat2.multiply}\n * @category Methods\n */\n mul(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Transpose this {@link Mat2}\n * Equivalent to `Mat2.transpose(this, this);`\n *\n * @returns `this`\n * @category Methods\n */\n transpose() {\n return _Mat2.transpose(this, this);\n }\n /**\n * Inverts this {@link Mat2}\n * Equivalent to `Mat4.invert(this, this);`\n *\n * @returns `this`\n * @category Methods\n */\n invert() {\n return _Mat2.invert(this, this);\n }\n /**\n * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization\n * Equivalent to `Mat2.scale(this, this, v);`\n *\n * @param v - The {@link Vec2} to scale the matrix by\n * @returns `this`\n * @category Methods\n */\n scale(v) {\n return _Mat2.scale(this, this, v);\n }\n /**\n * Rotates this {@link Mat2} by the given angle around the given axis\n * Equivalent to `Mat2.rotate(this, this, rad);`\n *\n * @param rad - the angle to rotate the matrix by\n * @returns `this`\n * @category Methods\n */\n rotate(rad) {\n return _Mat2.rotate(this, this, rad);\n }\n // ===================\n // Static accessors\n // ===================\n /**\n * @category Static\n *\n * @returns The number of bytes in a {@link Mat2}.\n */\n static get BYTE_LENGTH() {\n return 4 * Float32Array.BYTES_PER_ELEMENT;\n }\n // ===================\n // Static methods\n // ===================\n /**\n * Creates a new, identity {@link Mat2}\n * @category Static\n *\n * @returns A new {@link Mat2}\n */\n static create() {\n return new _Mat2();\n }\n /**\n * Creates a new {@link Mat2} initialized with values from an existing matrix\n * @category Static\n *\n * @param a - Matrix to clone\n * @returns A new {@link Mat2}\n */\n static clone(a) {\n return new _Mat2(a);\n }\n /**\n * Copy the values from one {@link Mat2} to another\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - Matrix to copy\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n }\n /**\n * Create a new {@link Mat2} with the given values\n * @category Static\n *\n * @param values - Matrix components\n * @returns A new {@link Mat2}\n */\n static fromValues(...values) {\n return new _Mat2(...values);\n }\n /**\n * Set the components of a {@link Mat2} to the given values\n * @category Static\n *\n * @param out - The receiving matrix\n * @param values - Matrix components\n * @returns `out`\n */\n static set(out, ...values) {\n out[0] = values[0];\n out[1] = values[1];\n out[2] = values[2];\n out[3] = values[3];\n return out;\n }\n /**\n * Set a {@link Mat2} to the identity matrix\n * @category Static\n *\n * @param out - The receiving matrix\n * @returns `out`\n */\n static identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n }\n /**\n * Transpose the values of a {@link Mat2}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static transpose(out, a) {\n if (out === a) {\n const a1 = a[1];\n out[1] = a[2];\n out[2] = a1;\n } else {\n out[0] = a[0];\n out[1] = a[2];\n out[2] = a[1];\n out[3] = a[3];\n }\n return out;\n }\n /**\n * Inverts a {@link Mat2}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out` or `null` if the matrix is not invertible\n */\n static invert(out, a) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n let det = a0 * a3 - a2 * a1;\n if (!det) {\n return null;\n }\n det = 1 / det;\n out[0] = a3 * det;\n out[1] = -a1 * det;\n out[2] = -a2 * det;\n out[3] = a0 * det;\n return out;\n }\n /**\n * Calculates the adjugate of a {@link Mat2}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static adjoint(out, a) {\n const a0 = a[0];\n out[0] = a[3];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a0;\n return out;\n }\n /**\n * Calculates the determinant of a {@link Mat2}\n * @category Static\n *\n * @param a - the source matrix\n * @returns determinant of a\n */\n static determinant(a) {\n return a[0] * a[3] - a[2] * a[1];\n }\n /**\n * Adds two {@link Mat2}'s\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n }\n /**\n * Subtracts matrix b from matrix a\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n }\n /**\n * Alias for {@link Mat2.subtract}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sub(out, a, b) {\n return out;\n }\n /**\n * Multiplies two {@link Mat2}s\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n return out;\n }\n /**\n * Alias for {@link Mat2.multiply}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static mul(out, a, b) {\n return out;\n }\n /**\n * Rotates a {@link Mat2} by the given angle\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static rotate(out, a, rad) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n return out;\n }\n /**\n * Scales the {@link Mat2} by the dimensions in the given {@link Vec2}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param v - the {@link Vec2} to scale the matrix by\n * @returns `out`\n **/\n static scale(out, a, v) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const v0 = v[0];\n const v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n return out;\n }\n /**\n * Creates a {@link Mat2} from a given angle around a given axis\n * This is equivalent to (but much faster than):\n * ```js\n * mat2.identity(dest);\n * mat2.rotate(dest, dest, rad);\n * ```\n * @category Static\n *\n * @param out - {@link Mat2} receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static fromRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = -s;\n out[3] = c;\n return out;\n }\n /**\n * Creates a {@link Mat2} from a vector scaling\n * This is equivalent to (but much faster than):\n * ```js\n * mat2.identity(dest);\n * mat2.scale(dest, dest, vec);\n * ```\n * @category Static\n *\n * @param out - {@link Mat2} receiving operation result\n * @param v - Scaling vector\n * @returns `out`\n */\n static fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = v[1];\n return out;\n }\n /**\n * Returns Frobenius norm of a {@link Mat2}\n * @category Static\n *\n * @param a - the matrix to calculate Frobenius norm of\n * @returns Frobenius norm\n */\n static frob(a) {\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]);\n }\n /**\n * Multiply each element of a {@link Mat2} by a scalar.\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param b - amount to scale the matrix's elements by\n * @returns `out`\n */\n static multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n }\n /**\n * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value.\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param scale - the amount to scale b's elements by before adding\n * @returns `out`\n */\n static multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n }\n /**\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\n * @category Static\n *\n * @param L - the lower triangular matrix\n * @param D - the diagonal matrix\n * @param U - the upper triangular matrix\n * @param a - the input matrix to factorize\n */\n static LDU(L, D, U, a) {\n L[2] = a[2] / a[0];\n U[0] = a[0];\n U[1] = a[1];\n U[3] = a[3] - L[2] * U[1];\n return [L, D, U];\n }\n /**\n * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n }\n /**\n * Returns whether two {@link Mat2}s have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3));\n }\n /**\n * Returns a string representation of a {@link Mat2}\n * @category Static\n *\n * @param a - matrix to represent as a string\n * @returns string representation of the matrix\n */\n static str(a) {\n return `Mat2(${a.join(\", \")})`;\n }\n};\n_IDENTITY_2X2 = new WeakMap();\n__privateAdd(_Mat2, _IDENTITY_2X2, new Float32Array([\n 1,\n 0,\n 0,\n 1\n]));\nvar Mat2 = _Mat2;\nMat2.prototype.mul = Mat2.prototype.multiply;\nMat2.mul = Mat2.multiply;\nMat2.sub = Mat2.subtract;\n\n// src/_lib/f32/Mat2d.ts\nvar _IDENTITY_2X3;\nvar _Mat2d = class _Mat2d extends Float32Array {\n /**\n * Create a {@link Mat2}.\n *\n * @category Constructor\n */\n constructor(...values) {\n switch (values.length) {\n case 6:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 6);\n break;\n case 1:\n const v = values[0];\n if (typeof v === \"number\") {\n super([\n v,\n v,\n v,\n v,\n v,\n v\n ]);\n } else {\n super(v, 0, 6);\n }\n break;\n default:\n super(__privateGet(_Mat2d, _IDENTITY_2X3));\n break;\n }\n }\n // ============\n // Accessors\n // ============\n /**\n * A string representation of `this`\n * Equivalent to `Mat2d.str(this);`\n *\n * @category Accessors\n */\n get str() {\n return _Mat2d.str(this);\n }\n // ===================\n // Instances methods\n // ===================\n /**\n * Copy the values from another {@link Mat2d} into `this`.\n * @category Methods\n *\n * @param a the source vector\n * @returns `this`\n */\n copy(a) {\n this.set(a);\n return this;\n }\n /**\n * Set `this` to the identity matrix\n * Equivalent to Mat2d.identity(this)\n * @category Methods\n *\n * @returns `this`\n */\n identity() {\n this.set(__privateGet(_Mat2d, _IDENTITY_2X3));\n return this;\n }\n /**\n * Multiplies this {@link Mat2d} against another one\n * Equivalent to `Mat2d.multiply(this, this, b);`\n * @category Methods\n *\n * @param out - The receiving Matrix\n * @param a - The first operand\n * @param b - The second operand\n * @returns `this`\n */\n multiply(b) {\n return _Mat2d.multiply(this, this, b);\n }\n /**\n * Alias for {@link Mat2d.multiply}\n * @category Methods\n */\n mul(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Translate this {@link Mat2d} by the given vector\n * Equivalent to `Mat2d.translate(this, this, v);`\n * @category Methods\n *\n * @param v - The {@link Vec2} to translate by\n * @returns `this`\n */\n translate(v) {\n return _Mat2d.translate(this, this, v);\n }\n /**\n * Rotates this {@link Mat2d} by the given angle around the given axis\n * Equivalent to `Mat2d.rotate(this, this, rad);`\n * @category Methods\n *\n * @param rad - the angle to rotate the matrix by\n * @returns `this`\n */\n rotate(rad) {\n return _Mat2d.rotate(this, this, rad);\n }\n /**\n * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization\n * Equivalent to `Mat2d.scale(this, this, v);`\n * @category Methods\n *\n * @param v - The {@link Vec2} to scale the matrix by\n * @returns `this`\n */\n scale(v) {\n return _Mat2d.scale(this, this, v);\n }\n // ===================\n // Static accessors\n // ===================\n /**\n * @category Static\n *\n * @returns The number of bytes in a {@link Mat2d}.\n */\n static get BYTE_LENGTH() {\n return 6 * Float32Array.BYTES_PER_ELEMENT;\n }\n // ===================\n // Static methods\n // ===================\n /**\n * Creates a new, identity {@link Mat2d}\n * @category Static\n *\n * @returns A new {@link Mat2d}\n */\n static create() {\n return new _Mat2d();\n }\n /**\n * Creates a new {@link Mat2d} initialized with values from an existing matrix\n * @category Static\n *\n * @param a - Matrix to clone\n * @returns A new {@link Mat2d}\n */\n static clone(a) {\n return new _Mat2d(a);\n }\n /**\n * Copy the values from one {@link Mat2d} to another\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - Matrix to copy\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n return out;\n }\n /**\n * Create a new {@link Mat2d} with the given values\n * @category Static\n *\n * @param values - Matrix components\n * @returns A new {@link Mat2d}\n */\n static fromValues(...values) {\n return new _Mat2d(...values);\n }\n /**\n * Set the components of a {@link Mat2d} to the given values\n * @category Static\n *\n * @param out - The receiving matrix\n * @param values - Matrix components\n * @returns `out`\n */\n static set(out, ...values) {\n out[0] = values[0];\n out[1] = values[1];\n out[2] = values[2];\n out[3] = values[3];\n out[4] = values[4];\n out[5] = values[5];\n return out;\n }\n /**\n * Set a {@link Mat2d} to the identity matrix\n * @category Static\n *\n * @param out - The receiving matrix\n * @returns `out`\n */\n static identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n return out;\n }\n /**\n * Inverts a {@link Mat2d}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out` or `null` if the matrix is not invertible\n */\n static invert(out, a) {\n const aa = a[0];\n const ab = a[1];\n const ac = a[2];\n const ad = a[3];\n const atx = a[4];\n const aty = a[5];\n let det = aa * ad - ab * ac;\n if (!det) {\n return null;\n }\n det = 1 / det;\n out[0] = ad * det;\n out[1] = -ab * det;\n out[2] = -ac * det;\n out[3] = aa * det;\n out[4] = (ac * aty - ad * atx) * det;\n out[5] = (ab * atx - aa * aty) * det;\n return out;\n }\n /**\n * Calculates the determinant of a {@link Mat2d}\n * @category Static\n *\n * @param a - the source matrix\n * @returns determinant of a\n */\n static determinant(a) {\n return a[0] * a[3] - a[1] * a[2];\n }\n /**\n * Adds two {@link Mat2d}'s\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n return out;\n }\n /**\n * Subtracts matrix b from matrix a\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n return out;\n }\n /**\n * Alias for {@link Mat2d.subtract}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sub(out, a, b) {\n return out;\n }\n /**\n * Multiplies two {@link Mat2d}s\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n out[4] = a0 * b4 + a2 * b5 + a4;\n out[5] = a1 * b4 + a3 * b5 + a5;\n return out;\n }\n /**\n * Alias for {@link Mat2d.multiply}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static mul(out, a, b) {\n return out;\n }\n /**\n * Translate a {@link Mat2d} by the given vector\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to translate\n * @param v - vector to translate by\n * @returns `out`\n */\n static translate(out, a, v) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const v0 = v[0];\n const v1 = v[1];\n out[0] = a0;\n out[1] = a1;\n out[2] = a2;\n out[3] = a3;\n out[4] = a0 * v0 + a2 * v1 + a4;\n out[5] = a1 * v0 + a3 * v1 + a5;\n return out;\n }\n /**\n * Rotates a {@link Mat2d} by the given angle\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static rotate(out, a, rad) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n out[4] = a4;\n out[5] = a5;\n return out;\n }\n /**\n * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param v - the {@link Vec2} to scale the matrix by\n * @returns `out`\n **/\n static scale(out, a, v) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const v0 = v[0];\n const v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n out[4] = a4;\n out[5] = a5;\n return out;\n }\n // TODO: Got to fromRotation\n /**\n * Creates a {@link Mat2d} from a vector translation\n * This is equivalent to (but much faster than):\n * ```js\n * Mat2d.identity(dest);\n * Mat2d.translate(dest, dest, vec);\n * ```\n * @category Static\n *\n * @param out - {@link Mat2d} receiving operation result\n * @param v - Translation vector\n * @returns `out`\n */\n static fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = v[0];\n out[5] = v[1];\n return out;\n }\n /**\n * Creates a {@link Mat2d} from a given angle around a given axis\n * This is equivalent to (but much faster than):\n * ```js\n * Mat2d.identity(dest);\n * Mat2d.rotate(dest, dest, rad);\n * ```\n * @category Static\n *\n * @param out - {@link Mat2d} receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static fromRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = -s;\n out[3] = c;\n out[4] = 0;\n out[5] = 0;\n return out;\n }\n /**\n * Creates a {@link Mat2d} from a vector scaling\n * This is equivalent to (but much faster than):\n * ```js\n * Mat2d.identity(dest);\n * Mat2d.scale(dest, dest, vec);\n * ```\n * @category Static\n *\n * @param out - {@link Mat2d} receiving operation result\n * @param v - Scaling vector\n * @returns `out`\n */\n static fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = v[1];\n out[4] = 0;\n out[5] = 0;\n return out;\n }\n /**\n * Returns Frobenius norm of a {@link Mat2d}\n * @category Static\n *\n * @param a - the matrix to calculate Frobenius norm of\n * @returns Frobenius norm\n */\n static frob(a) {\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1);\n }\n /**\n * Multiply each element of a {@link Mat2d} by a scalar.\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param b - amount to scale the matrix's elements by\n * @returns `out`\n */\n static multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n return out;\n }\n /**\n * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value.\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param scale - the amount to scale b's elements by before adding\n * @returns `out`\n */\n static multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n return out;\n }\n /**\n * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===).\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5];\n }\n /**\n * Returns whether two {@link Mat2d}s have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\n return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5));\n }\n /**\n * Returns a string representation of a {@link Mat2d}\n * @category Static\n *\n * @param a - matrix to represent as a string\n * @returns string representation of the matrix\n */\n static str(a) {\n return `Mat2d(${a.join(\", \")})`;\n }\n};\n_IDENTITY_2X3 = new WeakMap();\n__privateAdd(_Mat2d, _IDENTITY_2X3, new Float32Array([\n 1,\n 0,\n 0,\n 1,\n 0,\n 0\n]));\nvar Mat2d = _Mat2d;\nMat2d.mul = Mat2d.multiply;\nMat2d.sub = Mat2d.subtract;\n\n// src/_lib/f32/Mat3.ts\nvar _IDENTITY_3X3;\nvar _Mat3 = class _Mat3 extends Float32Array {\n /**\n * Create a {@link Mat3}.\n *\n * @category Constructor\n */\n constructor(...values) {\n switch (values.length) {\n case 9:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 9);\n break;\n case 1:\n const v = values[0];\n if (typeof v === \"number\") {\n super([\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v\n ]);\n } else {\n super(v, 0, 9);\n }\n break;\n default:\n super(__privateGet(_Mat3, _IDENTITY_3X3));\n break;\n }\n }\n // ============\n // Accessors\n // ============\n /**\n * A string representation of `this`\n * Equivalent to `Mat3.str(this);`\n *\n * @category Accessors\n */\n get str() {\n return _Mat3.str(this);\n }\n // ===================\n // Instance methods\n // ===================\n /**\n * Copy the values from another {@link Mat3} into `this`.\n * @category Methods\n *\n * @param a the source vector\n * @returns `this`\n */\n copy(a) {\n this.set(a);\n return this;\n }\n /**\n * Set `this` to the identity matrix\n * Equivalent to Mat3.identity(this)\n * @category Methods\n *\n * @returns `this`\n */\n identity() {\n this.set(__privateGet(_Mat3, _IDENTITY_3X3));\n return this;\n }\n /**\n * Multiplies this {@link Mat3} against another one\n * Equivalent to `Mat3.multiply(this, this, b);`\n * @category Methods\n *\n * @param out - The receiving Matrix\n * @param a - The first operand\n * @param b - The second operand\n * @returns `this`\n */\n multiply(b) {\n return _Mat3.multiply(this, this, b);\n }\n /**\n * Alias for {@link Mat3.multiply}\n * @category Methods\n */\n mul(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Transpose this {@link Mat3}\n * Equivalent to `Mat3.transpose(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n transpose() {\n return _Mat3.transpose(this, this);\n }\n /**\n * Inverts this {@link Mat3}\n * Equivalent to `Mat4.invert(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n invert() {\n return _Mat3.invert(this, this);\n }\n /**\n * Translate this {@link Mat3} by the given vector\n * Equivalent to `Mat3.translate(this, this, v);`\n * @category Methods\n *\n * @param v - The {@link Vec2} to translate by\n * @returns `this`\n */\n translate(v) {\n return _Mat3.translate(this, this, v);\n }\n /**\n * Rotates this {@link Mat3} by the given angle around the given axis\n * Equivalent to `Mat3.rotate(this, this, rad);`\n * @category Methods\n *\n * @param rad - the angle to rotate the matrix by\n * @returns `this`\n */\n rotate(rad) {\n return _Mat3.rotate(this, this, rad);\n }\n /**\n * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization\n * Equivalent to `Mat3.scale(this, this, v);`\n * @category Methods\n *\n * @param v - The {@link Vec2} to scale the matrix by\n * @returns `this`\n */\n scale(v) {\n return _Mat3.scale(this, this, v);\n }\n // ===================\n // Static accessors\n // ===================\n /**\n * @category Static\n *\n * @returns The number of bytes in a {@link Mat3}.\n */\n static get BYTE_LENGTH() {\n return 9 * Float32Array.BYTES_PER_ELEMENT;\n }\n // ===================\n // Static methods\n // ===================\n /**\n * Creates a new, identity {@link Mat3}\n * @category Static\n *\n * @returns A new {@link Mat3}\n */\n static create() {\n return new _Mat3();\n }\n /**\n * Creates a new {@link Mat3} initialized with values from an existing matrix\n * @category Static\n *\n * @param a - Matrix to clone\n * @returns A new {@link Mat3}\n */\n static clone(a) {\n return new _Mat3(a);\n }\n /**\n * Copy the values from one {@link Mat3} to another\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - Matrix to copy\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n }\n /**\n * Create a new {@link Mat3} with the given values\n * @category Static\n *\n * @param values - Matrix components\n * @returns A new {@link Mat3}\n */\n static fromValues(...values) {\n return new _Mat3(...values);\n }\n /**\n * Set the components of a {@link Mat3} to the given values\n * @category Static\n *\n * @param out - The receiving matrix\n * @param values - Matrix components\n * @returns `out`\n */\n static set(out, ...values) {\n out[0] = values[0];\n out[1] = values[1];\n out[2] = values[2];\n out[3] = values[3];\n out[4] = values[4];\n out[5] = values[5];\n out[6] = values[6];\n out[7] = values[7];\n out[8] = values[8];\n return out;\n }\n /**\n * Set a {@link Mat3} to the identity matrix\n * @category Static\n *\n * @param out - The receiving matrix\n * @returns `out`\n */\n static identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n }\n /**\n * Transpose the values of a {@link Mat3}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static transpose(out, a) {\n if (out === a) {\n const a01 = a[1], a02 = a[2], a12 = a[5];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a01;\n out[5] = a[7];\n out[6] = a02;\n out[7] = a12;\n } else {\n out[0] = a[0];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a[1];\n out[4] = a[4];\n out[5] = a[7];\n out[6] = a[2];\n out[7] = a[5];\n out[8] = a[8];\n }\n return out;\n }\n /**\n * Inverts a {@link Mat3}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out` or `null` if the matrix is not invertible\n */\n static invert(out, a) {\n const a00 = a[0], a01 = a[1], a02 = a[2];\n const a10 = a[3], a11 = a[4], a12 = a[5];\n const a20 = a[6], a21 = a[7], a22 = a[8];\n const b01 = a22 * a11 - a12 * a21;\n const b11 = -a22 * a10 + a12 * a20;\n const b21 = a21 * a10 - a11 * a20;\n let det = a00 * b01 + a01 * b11 + a02 * b21;\n if (!det) {\n return null;\n }\n det = 1 / det;\n out[0] = b01 * det;\n out[1] = (-a22 * a01 + a02 * a21) * det;\n out[2] = (a12 * a01 - a02 * a11) * det;\n out[3] = b11 * det;\n out[4] = (a22 * a00 - a02 * a20) * det;\n out[5] = (-a12 * a00 + a02 * a10) * det;\n out[6] = b21 * det;\n out[7] = (-a21 * a00 + a01 * a20) * det;\n out[8] = (a11 * a00 - a01 * a10) * det;\n return out;\n }\n /**\n * Calculates the adjugate of a {@link Mat3}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static adjoint(out, a) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n out[0] = a11 * a22 - a12 * a21;\n out[1] = a02 * a21 - a01 * a22;\n out[2] = a01 * a12 - a02 * a11;\n out[3] = a12 * a20 - a10 * a22;\n out[4] = a00 * a22 - a02 * a20;\n out[5] = a02 * a10 - a00 * a12;\n out[6] = a10 * a21 - a11 * a20;\n out[7] = a01 * a20 - a00 * a21;\n out[8] = a00 * a11 - a01 * a10;\n return out;\n }\n /**\n * Calculates the determinant of a {@link Mat3}\n * @category Static\n *\n * @param a - the source matrix\n * @returns determinant of a\n */\n static determinant(a) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);\n }\n /**\n * Adds two {@link Mat3}'s\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n return out;\n }\n /**\n * Subtracts matrix b from matrix a\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n return out;\n }\n /**\n * Alias for {@link Mat3.subtract}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sub(out, a, b) {\n return out;\n }\n /**\n * Multiplies two {@link Mat3}s\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n let b0 = b[0];\n let b1 = b[1];\n let b2 = b[2];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22;\n b0 = b[3];\n b1 = b[4];\n b2 = b[5];\n out[3] = b0 * a00 + b1 * a10 + b2 * a20;\n out[4] = b0 * a01 + b1 * a11 + b2 * a21;\n out[5] = b0 * a02 + b1 * a12 + b2 * a22;\n b0 = b[6];\n b1 = b[7];\n b2 = b[8];\n out[6] = b0 * a00 + b1 * a10 + b2 * a20;\n out[7] = b0 * a01 + b1 * a11 + b2 * a21;\n out[8] = b0 * a02 + b1 * a12 + b2 * a22;\n return out;\n }\n /**\n * Alias for {@link Mat3.multiply}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static mul(out, a, b) {\n return out;\n }\n /**\n * Translate a {@link Mat3} by the given vector\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to translate\n * @param v - vector to translate by\n * @returns `out`\n */\n static translate(out, a, v) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n const x = v[0];\n const y = v[1];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a10;\n out[4] = a11;\n out[5] = a12;\n out[6] = x * a00 + y * a10 + a20;\n out[7] = x * a01 + y * a11 + a21;\n out[8] = x * a02 + y * a12 + a22;\n return out;\n }\n /**\n * Rotates a {@link Mat3} by the given angle\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static rotate(out, a, rad) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c * a00 + s * a10;\n out[1] = c * a01 + s * a11;\n out[2] = c * a02 + s * a12;\n out[3] = c * a10 - s * a00;\n out[4] = c * a11 - s * a01;\n out[5] = c * a12 - s * a02;\n out[6] = a20;\n out[7] = a21;\n out[8] = a22;\n return out;\n }\n /**\n * Scales the {@link Mat3} by the dimensions in the given {@link Vec2}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param v - the {@link Vec2} to scale the matrix by\n * @returns `out`\n **/\n static scale(out, a, v) {\n const x = v[0];\n const y = v[1];\n out[0] = x * a[0];\n out[1] = x * a[1];\n out[2] = x * a[2];\n out[3] = y * a[3];\n out[4] = y * a[4];\n out[5] = y * a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n }\n /**\n * Creates a {@link Mat3} from a vector translation\n * This is equivalent to (but much faster than):\n * ```js\n * mat3.identity(dest);\n * mat3.translate(dest, dest, vec);\n * ```\n * @category Static\n *\n * @param out - {@link Mat3} receiving operation result\n * @param v - Translation vector\n * @returns `out`\n */\n static fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = v[0];\n out[7] = v[1];\n out[8] = 1;\n return out;\n }\n /**\n * Creates a {@link Mat3} from a given angle around a given axis\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.rotate(dest, dest, rad);\n * @category Static\n *\n * @param out - {@link Mat3} receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static fromRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = -s;\n out[4] = c;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n }\n /**\n * Creates a {@link Mat3} from a vector scaling\n * This is equivalent to (but much faster than):\n * ```js\n * mat3.identity(dest);\n * mat3.scale(dest, dest, vec);\n * ```\n * @category Static\n *\n * @param out - {@link Mat3} receiving operation result\n * @param v - Scaling vector\n * @returns `out`\n */\n static fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = v[1];\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n }\n /**\n * Copies the upper-left 3x3 values of a {@link Mat2d} into the given\n * {@link Mat3}.\n * @category Static\n *\n * @param out - the receiving 3x3 matrix\n * @param a - the source 2x3 matrix\n * @returns `out`\n */\n static fromMat2d(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = 0;\n out[3] = a[2];\n out[4] = a[3];\n out[5] = 0;\n out[6] = a[4];\n out[7] = a[5];\n out[8] = 1;\n return out;\n }\n /**\n * Calculates a {@link Mat3} from the given quaternion\n * @category Static\n *\n * @param out - {@link Mat3} receiving operation result\n * @param q - {@link Quat} to create matrix from\n * @returns `out`\n */\n static fromQuat(out, q) {\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\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 out[0] = 1 - yy - zz;\n out[3] = yx - wz;\n out[6] = zx + wy;\n out[1] = yx + wz;\n out[4] = 1 - xx - zz;\n out[7] = zy - wx;\n out[2] = zx - wy;\n out[5] = zy + wx;\n out[8] = 1 - xx - yy;\n return out;\n }\n /**\n * Copies the upper-left 3x3 values of a {@link Mat4} into the given\n * {@link Mat3}.\n * @category Static\n *\n * @param out - the receiving 3x3 matrix\n * @param a - the source 4x4 matrix\n * @returns `out`\n */\n static fromMat4(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[4];\n out[4] = a[5];\n out[5] = a[6];\n out[6] = a[8];\n out[7] = a[9];\n out[8] = a[10];\n return out;\n }\n /**\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\n * @category Static\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from\n * @returns `out` or `null` if the matrix is not invertible\n */\n static normalFromMat4(out, a) {\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];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n const a30 = a[12];\n const a31 = a[13];\n const a32 = a[14];\n const a33 = a[15];\n const b00 = a00 * a11 - a01 * a10;\n const b01 = a00 * a12 - a02 * a10;\n const b02 = a00 * a13 - a03 * a10;\n const b03 = a01 * a12 - a02 * a11;\n const b04 = a01 * a13 - a03 * a11;\n const b05 = a02 * a13 - a03 * a12;\n const b06 = a20 * a31 - a21 * a30;\n const b07 = a20 * a32 - a22 * a30;\n const b08 = a20 * a33 - a23 * a30;\n const b09 = a21 * a32 - a22 * a31;\n const b10 = a21 * a33 - a23 * a31;\n const b11 = a22 * a33 - a23 * a32;\n let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n if (!det) {\n return null;\n }\n det = 1 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n return out;\n }\n /**\n * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4}\n * This version omits the calculation of the constant factor (1/determinant), so\n * any normals transformed with it will need to be renormalized.\n * From https://stackoverflow.com/a/27616419/25968\n * @category Static\n *\n * @param out - Matrix receiving operation result\n * @param a - Mat4 to derive the normal matrix from\n * @returns `out`\n */\n static normalFromMat4Fast(out, a) {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = a[4];\n const by = a[5];\n const bz = a[6];\n const cx = a[8];\n const cy = a[9];\n const cz = a[10];\n out[0] = by * cz - cz * cy;\n out[1] = bz * cx - cx * cz;\n out[2] = bx * cy - cy * cx;\n out[3] = cy * az - cz * ay;\n out[4] = cz * ax - cx * az;\n out[5] = cx * ay - cy * ax;\n out[6] = ay * bz - az * by;\n out[7] = az * bx - ax * bz;\n out[8] = ax * by - ay * bx;\n return out;\n }\n /**\n * Generates a 2D projection matrix with the given bounds\n * @category Static\n *\n * @param out mat3 frustum matrix will be written into\n * @param width Width of your gl context\n * @param height Height of gl context\n * @returns `out`\n */\n static projection(out, width, height) {\n out[0] = 2 / width;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = -2 / height;\n out[5] = 0;\n out[6] = -1;\n out[7] = 1;\n out[8] = 1;\n return out;\n }\n /**\n * Returns Frobenius norm of a {@link Mat3}\n * @category Static\n *\n * @param a - the matrix to calculate Frobenius norm of\n * @returns Frobenius norm\n */\n static frob(a) {\n return Math.sqrt(\n a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8]\n );\n }\n /**\n * Multiply each element of a {@link Mat3} by a scalar.\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param b - amount to scale the matrix's elements by\n * @returns `out`\n */\n static multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n return out;\n }\n /**\n * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value.\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param scale - the amount to scale b's elements by before adding\n * @returns `out`\n */\n static multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n return out;\n }\n /**\n * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===).\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8];\n }\n /**\n * Returns whether two {@link Mat3}s have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const a6 = a[6];\n const a7 = a[7];\n const a8 = a[8];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\n const b6 = b[6];\n const b7 = b[7];\n const b8 = b[8];\n return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8));\n }\n /**\n * Returns a string representation of a {@link Mat3}\n * @category Static\n *\n * @param a - matrix to represent as a string\n * @returns string representation of the matrix\n */\n static str(a) {\n return `Mat3(${a.join(\", \")})`;\n }\n};\n_IDENTITY_3X3 = new WeakMap();\n__privateAdd(_Mat3, _IDENTITY_3X3, new Float32Array([\n 1,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 1\n]));\nvar Mat3 = _Mat3;\nMat3.prototype.mul = Mat3.prototype.multiply;\nMat3.mul = Mat3.multiply;\nMat3.sub = Mat3.subtract;\n\n// src/_lib/f32/Mat4.ts\nvar _IDENTITY_4X4, _TMP_VEC3;\nvar _Mat4 = class _Mat4 extends Float32Array {\n /**\n * Create a {@link Mat4}.\n *\n * @category Constructor\n */\n constructor(...values) {\n switch (values.length) {\n case 16:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 16);\n break;\n case 1:\n const v = values[0];\n if (typeof v === \"number\") {\n super([\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v\n ]);\n } else {\n super(v, 0, 16);\n }\n break;\n default:\n super(__privateGet(_Mat4, _IDENTITY_4X4));\n break;\n }\n }\n // ============\n // Accessors\n // ============\n /**\n * A string representation of `this`\n * Equivalent to `Mat4.str(this);`\n *\n * @category Accessors\n */\n get str() {\n return _Mat4.str(this);\n }\n // ===================\n // Instance methods\n // ===================\n /**\n * Copy the values from another {@link Mat4} into `this`.\n * @category Methods\n *\n * @param a the source vector\n * @returns `this`\n */\n copy(a) {\n this.set(a);\n return this;\n }\n /**\n * Set `this` to the identity matrix\n * Equivalent to Mat4.identity(this)\n * @category Methods\n *\n * @returns `this`\n */\n identity() {\n this.set(__privateGet(_Mat4, _IDENTITY_4X4));\n return this;\n }\n /**\n * Multiplies this {@link Mat4} against another one\n * Equivalent to `Mat4.multiply(this, this, b);`\n * @category Methods\n *\n * @param b - The second operand\n * @returns `this`\n */\n multiply(b) {\n return _Mat4.multiply(this, this, b);\n }\n /**\n * Alias for {@link Mat4.multiply}\n * @category Methods\n */\n mul(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Transpose this {@link Mat4}\n * Equivalent to `Mat4.transpose(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n transpose() {\n return _Mat4.transpose(this, this);\n }\n /**\n * Inverts this {@link Mat4}\n * Equivalent to `Mat4.invert(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n invert() {\n return _Mat4.invert(this, this);\n }\n /**\n * Translate this {@link Mat4} by the given vector\n * Equivalent to `Mat4.translate(this, this, v);`\n * @category Methods\n *\n * @param v - The {@link Vec3} to translate by\n * @returns `this`\n */\n translate(v) {\n return _Mat4.translate(this, this, v);\n }\n /**\n * Rotates this {@link Mat4} by the given angle around the given axis\n * Equivalent to `Mat4.rotate(this, this, rad, axis);`\n * @category Methods\n *\n * @param rad - the angle to rotate the matrix by\n * @param axis - the axis to rotate around\n * @returns `this`\n */\n rotate(rad, axis) {\n return _Mat4.rotate(this, this, rad, axis);\n }\n /**\n * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization\n * Equivalent to `Mat4.scale(this, this, v);`\n * @category Methods\n *\n * @param v - The {@link Vec3} to scale the matrix by\n * @returns `this`\n */\n scale(v) {\n return _Mat4.scale(this, this, v);\n }\n /**\n * Rotates this {@link Mat4} by the given angle around the X axis\n * Equivalent to `Mat4.rotateX(this, this, rad);`\n * @category Methods\n *\n * @param rad - the angle to rotate the matrix by\n * @returns `this`\n */\n rotateX(rad) {\n return _Mat4.rotateX(this, this, rad);\n }\n /**\n * Rotates this {@link Mat4} by the given angle around the Y axis\n * Equivalent to `Mat4.rotateY(this, this, rad);`\n * @category Methods\n *\n * @param rad - the angle to rotate the matrix by\n * @returns `this`\n */\n rotateY(rad) {\n return _Mat4.rotateY(this, this, rad);\n }\n /**\n * Rotates this {@link Mat4} by the given angle around the Z axis\n * Equivalent to `Mat4.rotateZ(this, this, rad);`\n * @category Methods\n *\n * @param rad - the angle to rotate the matrix by\n * @returns `this`\n */\n rotateZ(rad) {\n return _Mat4.rotateZ(this, this, rad);\n }\n /**\n * Generates a perspective projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);`\n * @category Methods\n *\n * @param fovy - Vertical field of view in radians\n * @param aspect - Aspect ratio. typically viewport width/height\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum, can be null or Infinity\n * @returns `this`\n */\n perspectiveNO(fovy, aspect, near, far) {\n return _Mat4.perspectiveNO(this, fovy, aspect, near, far);\n }\n /**\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);`\n * @category Methods\n *\n * @param fovy - Vertical field of view in radians\n * @param aspect - Aspect ratio. typically viewport width/height\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum, can be null or Infinity\n * @returns `this`\n */\n perspectiveZO(fovy, aspect, near, far) {\n return _Mat4.perspectiveZO(this, fovy, aspect, near, far);\n }\n /**\n * Generates a orthogonal projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);`\n * @category Methods\n *\n * @param left - Left bound of the frustum\n * @param right - Right bound of the frustum\n * @param bottom - Bottom bound of the frustum\n * @param top - Top bound of the frustum\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum\n * @returns `this`\n */\n orthoNO(left, right, bottom, top, near, far) {\n return _Mat4.orthoNO(this, left, right, bottom, top, near, far);\n }\n /**\n * Generates a orthogonal projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);`\n * @category Methods\n *\n * @param left - Left bound of the frustum\n * @param right - Right bound of the frustum\n * @param bottom - Bottom bound of the frustum\n * @param top - Top bound of the frustum\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum\n * @returns `this`\n */\n orthoZO(left, right, bottom, top, near, far) {\n return _Mat4.orthoZO(this, left, right, bottom, top, near, far);\n }\n // ===================\n // Static accessors\n // ===================\n /**\n * @category Static\n *\n * @returns The number of bytes in a {@link Mat4}.\n */\n static get BYTE_LENGTH() {\n return 16 * Float32Array.BYTES_PER_ELEMENT;\n }\n // ===================\n // Static methods\n // ===================\n /**\n * Creates a new, identity {@link Mat4}\n * @category Static\n *\n * @returns A new {@link Mat4}\n */\n static create() {\n return new _Mat4();\n }\n /**\n * Creates a new {@link Mat4} initialized with values from an existing matrix\n * @category Static\n *\n * @param a - Matrix to clone\n * @returns A new {@link Mat4}\n */\n static clone(a) {\n return new _Mat4(a);\n }\n /**\n * Copy the values from one {@link Mat4} to another\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - Matrix to copy\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n }\n /**\n * Create a new mat4 with the given values\n * @category Static\n *\n * @param values - Matrix components\n * @returns A new {@link Mat4}\n */\n static fromValues(...values) {\n return new _Mat4(...values);\n }\n /**\n * Set the components of a mat4 to the given values\n * @category Static\n *\n * @param out - The receiving matrix\n * @param values - Matrix components\n * @returns `out`\n */\n static set(out, ...values) {\n out[0] = values[0];\n out[1] = values[1];\n out[2] = values[2];\n out[3] = values[3];\n out[4] = values[4];\n out[5] = values[5];\n out[6] = values[6];\n out[7] = values[7];\n out[8] = values[8];\n out[9] = values[9];\n out[10] = values[10];\n out[11] = values[11];\n out[12] = values[12];\n out[13] = values[13];\n out[14] = values[14];\n out[15] = values[15];\n return out;\n }\n /**\n * Set a {@link Mat4} to the identity matrix\n * @category Static\n *\n * @param out - The receiving Matrix\n * @returns `out`\n */\n static identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Transpose the values of a {@link Mat4}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static transpose(out, a) {\n if (out === a) {\n const a01 = a[1], a02 = a[2], a03 = a[3];\n const a12 = a[6], a13 = a[7];\n const a23 = a[11];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n } else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n return out;\n }\n /**\n * Inverts a {@link Mat4}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out` or `null` if the matrix is not invertible\n */\n static invert(out, a) {\n const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3];\n const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7];\n const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];\n const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n const b00 = a00 * a11 - a01 * a10;\n const b01 = a00 * a12 - a02 * a10;\n const b02 = a00 * a13 - a03 * a10;\n const b03 = a01 * a12 - a02 * a11;\n const b04 = a01 * a13 - a03 * a11;\n const b05 = a02 * a13 - a03 * a12;\n const b06 = a20 * a31 - a21 * a30;\n const b07 = a20 * a32 - a22 * a30;\n const b08 = a20 * a33 - a23 * a30;\n const b09 = a21 * a32 - a22 * a31;\n const b10 = a21 * a33 - a23 * a31;\n const b11 = a22 * a33 - a23 * a32;\n let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n if (!det) {\n return null;\n }\n det = 1 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n return out;\n }\n /**\n * Calculates the adjugate of a {@link Mat4}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static adjoint(out, a) {\n const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3];\n const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7];\n const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];\n const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n const b00 = a00 * a11 - a01 * a10;\n const b01 = a00 * a12 - a02 * a10;\n const b02 = a00 * a13 - a03 * a10;\n const b03 = a01 * a12 - a02 * a11;\n const b04 = a01 * a13 - a03 * a11;\n const b05 = a02 * a13 - a03 * a12;\n const b06 = a20 * a31 - a21 * a30;\n const b07 = a20 * a32 - a22 * a30;\n const b08 = a20 * a33 - a23 * a30;\n const b09 = a21 * a32 - a22 * a31;\n const b10 = a21 * a33 - a23 * a31;\n const b11 = a22 * a33 - a23 * a32;\n out[0] = a11 * b11 - a12 * b10 + a13 * b09;\n out[1] = a02 * b10 - a01 * b11 - a03 * b09;\n out[2] = a31 * b05 - a32 * b04 + a33 * b03;\n out[3] = a22 * b04 - a21 * b05 - a23 * b03;\n out[4] = a12 * b08 - a10 * b11 - a13 * b07;\n out[5] = a00 * b11 - a02 * b08 + a03 * b07;\n out[6] = a32 * b02 - a30 * b05 - a33 * b01;\n out[7] = a20 * b05 - a22 * b02 + a23 * b01;\n out[8] = a10 * b10 - a11 * b08 + a13 * b06;\n out[9] = a01 * b08 - a00 * b10 - a03 * b06;\n out[10] = a30 * b04 - a31 * b02 + a33 * b00;\n out[11] = a21 * b02 - a20 * b04 - a23 * b00;\n out[12] = a11 * b07 - a10 * b09 - a12 * b06;\n out[13] = a00 * b09 - a01 * b07 + a02 * b06;\n out[14] = a31 * b01 - a30 * b03 - a32 * b00;\n out[15] = a20 * b03 - a21 * b01 + a22 * b00;\n return out;\n }\n /**\n * Calculates the determinant of a {@link Mat4}\n * @category Static\n *\n * @param a - the source matrix\n * @returns determinant of a\n */\n static determinant(a) {\n const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3];\n const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7];\n const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];\n const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n const b0 = a00 * a11 - a01 * a10;\n const b1 = a00 * a12 - a02 * a10;\n const b2 = a01 * a12 - a02 * a11;\n const b3 = a20 * a31 - a21 * a30;\n const b4 = a20 * a32 - a22 * a30;\n const b5 = a21 * a32 - a22 * a31;\n const b6 = a00 * b5 - a01 * b4 + a02 * b3;\n const b7 = a10 * b5 - a11 * b4 + a12 * b3;\n const b8 = a20 * b2 - a21 * b1 + a22 * b0;\n const b9 = a30 * b2 - a31 * b1 + a32 * b0;\n return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9;\n }\n /**\n * Multiplies two {@link Mat4}s\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\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];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n const a30 = a[12];\n const a31 = a[13];\n const a32 = a[14];\n const a33 = a[15];\n let b0 = b[0];\n let b1 = b[1];\n let b2 = b[2];\n let b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4];\n b1 = b[5];\n b2 = b[6];\n b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8];\n b1 = b[9];\n b2 = b[10];\n b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12];\n b1 = b[13];\n b2 = b[14];\n b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n }\n /**\n * Alias for {@link Mat4.multiply}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static mul(out, a, b) {\n return out;\n }\n /**\n * Translate a {@link Mat4} by the given vector\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to translate\n * @param v - vector to translate by\n * @returns `out`\n */\n static translate(out, a, v) {\n const x = v[0];\n const y = v[1];\n const z = v[2];\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\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];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a03;\n out[4] = a10;\n out[5] = a11;\n out[6] = a12;\n out[7] = a13;\n out[8] = a20;\n out[9] = a21;\n out[10] = a22;\n out[11] = a23;\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n return out;\n }\n /**\n * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param v - the {@link Vec3} to scale the matrix by\n * @returns `out`\n **/\n static scale(out, a, v) {\n const x = v[0];\n const y = v[1];\n const z = v[2];\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n }\n /**\n * Rotates a {@link Mat4} by the given angle around the given axis\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @param axis - the axis to rotate around\n * @returns `out` or `null` if axis has a length of 0\n */\n static rotate(out, a, rad, axis) {\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n let len = Math.sqrt(x * x + y * y + z * z);\n if (len < GLM_EPSILON) {\n return null;\n }\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n const t = 1 - c;\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];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n const b00 = x * x * t + c;\n const b01 = y * x * t + z * s;\n const b02 = z * x * t - y * s;\n const b10 = x * y * t - z * s;\n const b11 = y * y * t + c;\n const b12 = z * y * t + x * s;\n const b20 = x * z * t + y * s;\n const b21 = y * z * t - x * s;\n const b22 = z * z * t + c;\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n if (a !== out) {\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n return out;\n }\n /**\n * Rotates a matrix by the given angle around the X axis\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static rotateX(out, a, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n const a10 = a[4];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n if (a !== out) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n }\n /**\n * Rotates a matrix by the given angle around the Y axis\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static rotateY(out, a, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n if (a !== out) {\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n }\n /**\n * Rotates a matrix by the given angle around the Z axis\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static rotateZ(out, a, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\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];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n if (a !== out) {\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n }\n /**\n * Creates a {@link Mat4} from a vector translation\n * This is equivalent to (but much faster than):\n * ```js\n * mat4.identity(dest);\n * mat4.translate(dest, dest, vec);\n * ```\n * @category Static\n *\n * @param out - {@link Mat4} receiving operation result\n * @param v - Translation vector\n * @returns `out`\n */\n static fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n }\n /**\n * Creates a {@link Mat4} from a vector scaling\n * This is equivalent to (but much faster than):\n * ```js\n * mat4.identity(dest);\n * mat4.scale(dest, dest, vec);\n * ```\n * @category Static\n *\n * @param out - {@link Mat4} receiving operation result\n * @param v - Scaling vector\n * @returns `out`\n */\n static fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = v[1];\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = v[2];\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Creates a {@link Mat4} from a given angle around a given axis\n * This is equivalent to (but much faster than):\n * ```js\n * mat4.identity(dest);\n * mat4.rotate(dest, dest, rad, axis);\n * ```\n * @category Static\n *\n * @param out - {@link Mat4} receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @param axis - the axis to rotate around\n * @returns `out` or `null` if `axis` has a length of 0\n */\n static fromRotation(out, rad, axis) {\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n let len = Math.sqrt(x * x + y * y + z * z);\n if (len < GLM_EPSILON) {\n return null;\n }\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n const t = 1 - c;\n out[0] = x * x * t + c;\n out[1] = y * x * t + z * s;\n out[2] = z * x * t - y * s;\n out[3] = 0;\n out[4] = x * y * t - z * s;\n out[5] = y * y * t + c;\n out[6] = z * y * t + x * s;\n out[7] = 0;\n out[8] = x * z * t + y * s;\n out[9] = y * z * t - x * s;\n out[10] = z * z * t + c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Creates a matrix from the given angle around the X axis\n * This is equivalent to (but much faster than):\n * ```js\n * mat4.identity(dest);\n * mat4.rotateX(dest, dest, rad);\n * ```\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static fromXRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = c;\n out[6] = s;\n out[7] = 0;\n out[8] = 0;\n out[9] = -s;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Creates a matrix from the given angle around the Y axis\n * This is equivalent to (but much faster than):\n * ```js\n * mat4.identity(dest);\n * mat4.rotateY(dest, dest, rad);\n * ```\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static fromYRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c;\n out[1] = 0;\n out[2] = -s;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = s;\n out[9] = 0;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Creates a matrix from the given angle around the Z axis\n * This is equivalent to (but much faster than):\n * ```js\n * mat4.identity(dest);\n * mat4.rotateZ(dest, dest, rad);\n * ```\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static fromZRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = 0;\n out[4] = -s;\n out[5] = c;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Creates a matrix from a quaternion rotation and vector translation\n * This is equivalent to (but much faster than):\n * ```js\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * ```\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param q - Rotation quaternion\n * @param v - Translation vector\n * @returns `out`\n */\n static fromRotationTranslation(out, q, v) {\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const xy = x * y2;\n const xz = x * z2;\n const yy = y * y2;\n const yz = y * z2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n }\n /**\n * Sets a {@link Mat4} from a {@link Quat2}.\n * @category Static\n *\n * @param out - Matrix\n * @param a - Dual Quaternion\n * @returns `out`\n */\n static fromQuat2(out, a) {\n const bx = -a[0];\n const by = -a[1];\n const bz = -a[2];\n const bw = a[3];\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n const magnitude = bx * bx + by * by + bz * bz + bw * bw;\n if (magnitude > 0) {\n __privateGet(_Mat4, _TMP_VEC3)[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude;\n __privateGet(_Mat4, _TMP_VEC3)[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude;\n __privateGet(_Mat4, _TMP_VEC3)[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude;\n } else {\n __privateGet(_Mat4, _TMP_VEC3)[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n __privateGet(_Mat4, _TMP_VEC3)[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n __privateGet(_Mat4, _TMP_VEC3)[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n }\n _Mat4.fromRotationTranslation(out, a, __privateGet(_Mat4, _TMP_VEC3));\n return out;\n }\n /**\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\n * @category Static\n *\n * @param out - Matrix receiving operation result\n * @param a - Mat4 to derive the normal matrix from\n * @returns `out` or `null` if the matrix is not invertible\n */\n static normalFromMat4(out, a) {\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];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n const a30 = a[12];\n const a31 = a[13];\n const a32 = a[14];\n const a33 = a[15];\n const b00 = a00 * a11 - a01 * a10;\n const b01 = a00 * a12 - a02 * a10;\n const b02 = a00 * a13 - a03 * a10;\n const b03 = a01 * a12 - a02 * a11;\n const b04 = a01 * a13 - a03 * a11;\n const b05 = a02 * a13 - a03 * a12;\n const b06 = a20 * a31 - a21 * a30;\n const b07 = a20 * a32 - a22 * a30;\n const b08 = a20 * a33 - a23 * a30;\n const b09 = a21 * a32 - a22 * a31;\n const b10 = a21 * a33 - a23 * a31;\n const b11 = a22 * a33 - a23 * a32;\n let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n if (!det) {\n return null;\n }\n det = 1 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[3] = 0;\n out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[7] = 0;\n out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\n * This version omits the calculation of the constant factor (1/determinant), so\n * any normals transformed with it will need to be renormalized.\n * From https://stackoverflow.com/a/27616419/25968\n * @category Static\n *\n * @param out - Matrix receiving operation result\n * @param a - Mat4 to derive the normal matrix from\n * @returns `out`\n */\n static normalFromMat4Fast(out, a) {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = a[4];\n const by = a[5];\n const bz = a[6];\n const cx = a[8];\n const cy = a[9];\n const cz = a[10];\n out[0] = by * cz - cz * cy;\n out[1] = bz * cx - cx * cz;\n out[2] = bx * cy - cy * cx;\n out[3] = 0;\n out[4] = cy * az - cz * ay;\n out[5] = cz * ax - cx * az;\n out[6] = cx * ay - cy * ax;\n out[7] = 0;\n out[8] = ay * bz - az * by;\n out[9] = az * bx - ax * bz;\n out[10] = ax * by - ay * bx;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Returns the translation vector component of a transformation\n * matrix. If a matrix is built with fromRotationTranslation,\n * the returned vector will be the same as the translation vector\n * originally supplied.\n * @category Static\n *\n * @param {vec3} out Vector to receive translation component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {vec3} out\n */\n static getTranslation(out, mat) {\n out[0] = mat[12];\n out[1] = mat[13];\n out[2] = mat[14];\n return out;\n }\n /**\n * Returns the scaling factor component of a transformation\n * matrix. If a matrix is built with fromRotationTranslationScale\n * with a normalized Quaternion parameter, the returned vector will be\n * the same as the scaling vector\n * originally supplied.\n * @category Static\n *\n * @param {vec3} out Vector to receive scaling factor component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {vec3} out\n */\n static getScaling(out, mat) {\n const m11 = mat[0];\n const m12 = mat[1];\n const m13 = mat[2];\n const m21 = mat[4];\n const m22 = mat[5];\n const m23 = mat[6];\n const m31 = mat[8];\n const m32 = mat[9];\n const m33 = mat[10];\n out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\n out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\n out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\n return out;\n }\n /**\n * Returns a quaternion representing the rotational component\n * of a transformation matrix. If a matrix is built with\n * fromRotationTranslation, the returned quaternion will be the\n * same as the quaternion originally supplied.\n * @category Static\n *\n * @param out - Quaternion to receive the rotation component\n * @param mat - Matrix to be decomposed (input)\n * @return `out`\n */\n static getRotation(out, mat) {\n _Mat4.getScaling(__privateGet(_Mat4, _TMP_VEC3), mat);\n const is1 = 1 / __privateGet(_Mat4, _TMP_VEC3)[0];\n const is2 = 1 / __privateGet(_Mat4, _TMP_VEC3)[1];\n const is3 = 1 / __privateGet(_Mat4, _TMP_VEC3)[2];\n const sm11 = mat[0] * is1;\n const sm12 = mat[1] * is2;\n const sm13 = mat[2] * is3;\n const sm21 = mat[4] * is1;\n const sm22 = mat[5] * is2;\n const sm23 = mat[6] * is3;\n const sm31 = mat[8] * is1;\n const sm32 = mat[9] * is2;\n const sm33 = mat[10] * is3;\n const trace = sm11 + sm22 + sm33;\n let S = 0;\n if (trace > 0) {\n S = Math.sqrt(trace + 1) * 2;\n out[3] = 0.25 * S;\n out[0] = (sm23 - sm32) / S;\n out[1] = (sm31 - sm13) / S;\n out[2] = (sm12 - sm21) / S;\n } else if (sm11 > sm22 && sm11 > sm33) {\n S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2;\n out[3] = (sm23 - sm32) / S;\n out[0] = 0.25 * S;\n out[1] = (sm12 + sm21) / S;\n out[2] = (sm31 + sm13) / S;\n } else if (sm22 > sm33) {\n S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2;\n out[3] = (sm31 - sm13) / S;\n out[0] = (sm12 + sm21) / S;\n out[1] = 0.25 * S;\n out[2] = (sm23 + sm32) / S;\n } else {\n S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2;\n out[3] = (sm12 - sm21) / S;\n out[0] = (sm31 + sm13) / S;\n out[1] = (sm23 + sm32) / S;\n out[2] = 0.25 * S;\n }\n return out;\n }\n /**\n * Decomposes a transformation matrix into its rotation, translation\n * and scale components. Returns only the rotation component\n * @category Static\n *\n * @param out_r - Quaternion to receive the rotation component\n * @param out_t - Vector to receive the translation vector\n * @param out_s - Vector to receive the scaling factor\n * @param mat - Matrix to be decomposed (input)\n * @returns `out_r`\n */\n static decompose(out_r, out_t, out_s, mat) {\n out_t[0] = mat[12];\n out_t[1] = mat[13];\n out_t[2] = mat[14];\n const m11 = mat[0];\n const m12 = mat[1];\n const m13 = mat[2];\n const m21 = mat[4];\n const m22 = mat[5];\n const m23 = mat[6];\n const m31 = mat[8];\n const m32 = mat[9];\n const m33 = mat[10];\n out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\n out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\n out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\n const is1 = 1 / out_s[0];\n const is2 = 1 / out_s[1];\n const is3 = 1 / out_s[2];\n const sm11 = m11 * is1;\n const sm12 = m12 * is2;\n const sm13 = m13 * is3;\n const sm21 = m21 * is1;\n const sm22 = m22 * is2;\n const sm23 = m23 * is3;\n const sm31 = m31 * is1;\n const sm32 = m32 * is2;\n const sm33 = m33 * is3;\n const trace = sm11 + sm22 + sm33;\n let S = 0;\n if (trace > 0) {\n S = Math.sqrt(trace + 1) * 2;\n out_r[3] = 0.25 * S;\n out_r[0] = (sm23 - sm32) / S;\n out_r[1] = (sm31 - sm13) / S;\n out_r[2] = (sm12 - sm21) / S;\n } else if (sm11 > sm22 && sm11 > sm33) {\n S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2;\n out_r[3] = (sm23 - sm32) / S;\n out_r[0] = 0.25 * S;\n out_r[1] = (sm12 + sm21) / S;\n out_r[2] = (sm31 + sm13) / S;\n } else if (sm22 > sm33) {\n S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2;\n out_r[3] = (sm31 - sm13) / S;\n out_r[0] = (sm12 + sm21) / S;\n out_r[1] = 0.25 * S;\n out_r[2] = (sm23 + sm32) / S;\n } else {\n S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2;\n out_r[3] = (sm12 - sm21) / S;\n out_r[0] = (sm31 + sm13) / S;\n out_r[1] = (sm23 + sm32) / S;\n out_r[2] = 0.25 * S;\n }\n return out_r;\n }\n /**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\n * This is equivalent to (but much faster than):\n * ```js\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale);\n * ```\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param q - Rotation quaternion\n * @param v - Translation vector\n * @param s - Scaling vector\n * @returns `out`\n */\n static fromRotationTranslationScale(out, q, v, s) {\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const xy = x * y2;\n const xz = x * z2;\n const yy = y * y2;\n const yz = y * z2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n const sx = s[0];\n const sy = s[1];\n const sz = s[2];\n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n }\n /**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the\n * given origin. This is equivalent to (but much faster than):\n * ```js\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * mat4.translate(dest, origin);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale)\n * mat4.translate(dest, negativeOrigin);\n * ```\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param q - Rotation quaternion\n * @param v - Translation vector\n * @param s - Scaling vector\n * @param o - The origin vector around which to scale and rotate\n * @returns `out`\n */\n static fromRotationTranslationScaleOrigin(out, q, v, s, o) {\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const xy = x * y2;\n const xz = x * z2;\n const yy = y * y2;\n const yz = y * z2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n const sx = s[0];\n const sy = s[1];\n const sz = s[2];\n const ox = o[0];\n const oy = o[1];\n const oz = o[2];\n const out0 = (1 - (yy + zz)) * sx;\n const out1 = (xy + wz) * sx;\n const out2 = (xz - wy) * sx;\n const out4 = (xy - wz) * sy;\n const out5 = (1 - (xx + zz)) * sy;\n const out6 = (yz + wx) * sy;\n const out8 = (xz + wy) * sz;\n const out9 = (yz - wx) * sz;\n const out10 = (1 - (xx + yy)) * sz;\n out[0] = out0;\n out[1] = out1;\n out[2] = out2;\n out[3] = 0;\n out[4] = out4;\n out[5] = out5;\n out[6] = out6;\n out[7] = 0;\n out[8] = out8;\n out[9] = out9;\n out[10] = out10;\n out[11] = 0;\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\n out[15] = 1;\n return out;\n }\n /**\n * Calculates a 4x4 matrix from the given quaternion\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param q - Quaternion to create matrix from\n * @returns `out`\n */\n static fromQuat(out, q) {\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\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 out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Generates a frustum matrix with the given bounds\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param left - Left bound of the frustum\n * @param right - Right bound of the frustum\n * @param bottom - Bottom bound of the frustum\n * @param top - Top bound of the frustum\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum, can be null or Infinity\n * @returns `out`\n */\n static frustumNO(out, left, right, bottom, top, near, far = Infinity) {\n const rl = 1 / (right - left);\n const tb = 1 / (top - bottom);\n out[0] = near * 2 * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = near * 2 * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n if (far != null && far !== Infinity) {\n const nf = 1 / (near - far);\n out[10] = (far + near) * nf;\n out[14] = 2 * far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -2 * near;\n }\n return out;\n }\n /**\n * Alias for {@link Mat4.frustumNO}\n * @category Static\n * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly\n */\n static frustum(out, left, right, bottom, top, near, far = Infinity) {\n return out;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Generates a frustum matrix with the given bounds\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param left - Left bound of the frustum\n * @param right - Right bound of the frustum\n * @param bottom - Bottom bound of the frustum\n * @param top - Top bound of the frustum\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum, can be null or Infinity\n * @returns `out`\n */\n static frustumZO(out, left, right, bottom, top, near, far = Infinity) {\n const rl = 1 / (right - left);\n const tb = 1 / (top - bottom);\n out[0] = near * 2 * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = near * 2 * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n if (far != null && far !== Infinity) {\n const nf = 1 / (near - far);\n out[10] = far * nf;\n out[14] = far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -near;\n }\n return out;\n }\n /**\n * Generates a perspective projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param fovy - Vertical field of view in radians\n * @param aspect - Aspect ratio. typically viewport width/height\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum, can be null or Infinity\n * @returns `out`\n */\n static perspectiveNO(out, fovy, aspect, near, far = Infinity) {\n const f = 1 / Math.tan(fovy / 2);\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n if (far != null && far !== Infinity) {\n const nf = 1 / (near - far);\n out[10] = (far + near) * nf;\n out[14] = 2 * far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -2 * near;\n }\n return out;\n }\n /**\n * Alias for {@link Mat4.perspectiveNO}\n * @category Static\n * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static perspective(out, fovy, aspect, near, far = Infinity) {\n return out;\n }\n /**\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param fovy - Vertical field of view in radians\n * @param aspect - Aspect ratio. typically viewport width/height\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum, can be null or Infinity\n * @returns `out`\n */\n static perspectiveZO(out, fovy, aspect, near, far = Infinity) {\n const f = 1 / Math.tan(fovy / 2);\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n if (far != null && far !== Infinity) {\n const nf = 1 / (near - far);\n out[10] = far * nf;\n out[14] = far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -near;\n }\n return out;\n }\n /**\n * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating\n * projection matrices to be used with the still experimental WebVR API.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum\n * @returns `out`\n * @deprecated\n */\n static perspectiveFromFieldOfView(out, fov, near, far) {\n const upTan = Math.tan(fov.upDegrees * Math.PI / 180);\n const downTan = Math.tan(fov.downDegrees * Math.PI / 180);\n const leftTan = Math.tan(fov.leftDegrees * Math.PI / 180);\n const rightTan = Math.tan(fov.rightDegrees * Math.PI / 180);\n const xScale = 2 / (leftTan + rightTan);\n const yScale = 2 / (upTan + downTan);\n out[0] = xScale;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = yScale;\n out[6] = 0;\n out[7] = 0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = (upTan - downTan) * yScale * 0.5;\n out[10] = far / (near - far);\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = far * near / (near - far);\n out[15] = 0;\n return out;\n }\n /**\n * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\n * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param left - Left bound of the frustum\n * @param right - Right bound of the frustum\n * @param bottom - Bottom bound of the frustum\n * @param top - Top bound of the frustum\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum\n * @returns `out`\n */\n static orthoNO(out, left, right, bottom, top, near, far) {\n const lr = 1 / (left - right);\n const bt = 1 / (bottom - top);\n const nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n }\n /**\n * Alias for {@link Mat4.orthoNO}\n * @category Static\n * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static ortho(out, left, right, bottom, top, near, far) {\n return out;\n }\n /**\n * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\n * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param left - Left bound of the frustum\n * @param right - Right bound of the frustum\n * @param bottom - Bottom bound of the frustum\n * @param top - Top bound of the frustum\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum\n * @returns `out`\n */\n static orthoZO(out, left, right, bottom, top, near, far) {\n const lr = 1 / (left - right);\n const bt = 1 / (bottom - top);\n const nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = near * nf;\n out[15] = 1;\n return out;\n }\n /**\n * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that\n * actually makes an object look at another object, you should use targetTo instead.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param eye - Position of the viewer\n * @param center - Point the viewer is looking at\n * @param up - vec3 pointing up\n * @returns `out`\n */\n static lookAt(out, eye, center, up) {\n const eyex = eye[0];\n const eyey = eye[1];\n const eyez = eye[2];\n const upx = up[0];\n const upy = up[1];\n const upz = up[2];\n const centerx = center[0];\n const centery = center[1];\n const centerz = center[2];\n if (Math.abs(eyex - centerx) < GLM_EPSILON && Math.abs(eyey - centery) < GLM_EPSILON && Math.abs(eyez - centerz) < GLM_EPSILON) {\n return _Mat4.identity(out);\n }\n let z0 = eyex - centerx;\n let z1 = eyey - centery;\n let z2 = eyez - centerz;\n let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n let x0 = upy * z2 - upz * z1;\n let x1 = upz * z0 - upx * z2;\n let x2 = upx * z1 - upy * z0;\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n let y0 = z1 * x2 - z2 * x1;\n let y1 = z2 * x0 - z0 * x2;\n let y2 = z0 * x1 - z1 * x0;\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n return out;\n }\n /**\n * Generates a matrix that makes something look at something else.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param eye - Position of the viewer\n * @param target - Point the viewer is looking at\n * @param up - vec3 pointing up\n * @returns `out`\n */\n static targetTo(out, eye, target, up) {\n const eyex = eye[0];\n const eyey = eye[1];\n const eyez = eye[2];\n const upx = up[0];\n const upy = up[1];\n const upz = up[2];\n let z0 = eyex - target[0];\n let z1 = eyey - target[1];\n let z2 = eyez - target[2];\n let len = z0 * z0 + z1 * z1 + z2 * z2;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n }\n let x0 = upy * z2 - upz * z1;\n let x1 = upz * z0 - upx * z2;\n let x2 = upx * z1 - upy * z0;\n len = x0 * x0 + x1 * x1 + x2 * x2;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n out[0] = x0;\n out[1] = x1;\n out[2] = x2;\n out[3] = 0;\n out[4] = z1 * x2 - z2 * x1;\n out[5] = z2 * x0 - z0 * x2;\n out[6] = z0 * x1 - z1 * x0;\n out[7] = 0;\n out[8] = z0;\n out[9] = z1;\n out[10] = z2;\n out[11] = 0;\n out[12] = eyex;\n out[13] = eyey;\n out[14] = eyez;\n out[15] = 1;\n return out;\n }\n /**\n * Returns Frobenius norm of a {@link Mat4}\n * @category Static\n *\n * @param a - the matrix to calculate Frobenius norm of\n * @returns Frobenius norm\n */\n static frob(a) {\n return Math.sqrt(\n a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + a[9] * a[9] + a[10] * a[10] + a[11] * a[11] + a[12] * a[12] + a[13] * a[13] + a[14] * a[14] + a[15] * a[15]\n );\n }\n /**\n * Adds two {@link Mat4}'s\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n out[9] = a[9] + b[9];\n out[10] = a[10] + b[10];\n out[11] = a[11] + b[11];\n out[12] = a[12] + b[12];\n out[13] = a[13] + b[13];\n out[14] = a[14] + b[14];\n out[15] = a[15] + b[15];\n return out;\n }\n /**\n * Subtracts matrix b from matrix a\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n out[9] = a[9] - b[9];\n out[10] = a[10] - b[10];\n out[11] = a[11] - b[11];\n out[12] = a[12] - b[12];\n out[13] = a[13] - b[13];\n out[14] = a[14] - b[14];\n out[15] = a[15] - b[15];\n return out;\n }\n /**\n * Alias for {@link Mat4.subtract}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sub(out, a, b) {\n return out;\n }\n /**\n * Multiply each element of the matrix by a scalar.\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param b - amount to scale the matrix's elements by\n * @returns `out`\n */\n static multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n out[9] = a[9] * b;\n out[10] = a[10] * b;\n out[11] = a[11] * b;\n out[12] = a[12] * b;\n out[13] = a[13] * b;\n out[14] = a[14] * b;\n out[15] = a[15] * b;\n return out;\n }\n /**\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param scale - the amount to scale b's elements by before adding\n * @returns `out`\n */\n static multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n out[9] = a[9] + b[9] * scale;\n out[10] = a[10] + b[10] * scale;\n out[11] = a[11] + b[11] * scale;\n out[12] = a[12] + b[12] * scale;\n out[13] = a[13] + b[13] * scale;\n out[14] = a[14] + b[14] * scale;\n out[15] = a[15] + b[15] * scale;\n return out;\n }\n /**\n * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===).\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15];\n }\n /**\n * Returns whether two {@link Mat4}s have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const a6 = a[6];\n const a7 = a[7];\n const a8 = a[8];\n const a9 = a[9];\n const a10 = a[10];\n const a11 = a[11];\n const a12 = a[12];\n const a13 = a[13];\n const a14 = a[14];\n const a15 = a[15];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\n const b6 = b[6];\n const b7 = b[7];\n const b8 = b[8];\n const b9 = b[9];\n const b10 = b[10];\n const b11 = b[11];\n const b12 = b[12];\n const b13 = b[13];\n const b14 = b[14];\n const b15 = b[15];\n return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15));\n }\n /**\n * Returns a string representation of a {@link Mat4}\n * @category Static\n *\n * @param a - matrix to represent as a string\n * @returns string representation of the matrix\n */\n static str(a) {\n return `Mat4(${a.join(\", \")})`;\n }\n};\n_IDENTITY_4X4 = new WeakMap();\n_TMP_VEC3 = new WeakMap();\n__privateAdd(_Mat4, _IDENTITY_4X4, new Float32Array([\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n]));\n/**\n * Temporary variable to prevent repeated allocations in the algorithms within Mat4.\n * These are declared as TypedArrays to aid in tree-shaking.\n */\n__privateAdd(_Mat4, _TMP_VEC3, new Float32Array(3));\nvar Mat4 = _Mat4;\nMat4.prototype.mul = Mat4.prototype.multiply;\nMat4.sub = Mat4.subtract;\nMat4.mul = Mat4.multiply;\nMat4.frustum = Mat4.frustumNO;\nMat4.perspective = Mat4.perspectiveNO;\nMat4.ortho = Mat4.orthoNO;\n\n// src/_lib/f32/Vec3.ts\nvar Vec3 = class _Vec3 extends Float32Array {\n /**\n * Create a {@link Vec3}.\n *\n * @category Constructor\n */\n constructor(...values) {\n switch (values.length) {\n case 3:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 3);\n break;\n case 1: {\n const v = values[0];\n if (typeof v === \"number\") {\n super([v, v, v]);\n } else {\n super(v, 0, 3);\n }\n break;\n }\n default:\n super(3);\n break;\n }\n }\n // ============\n // Accessors\n // ============\n // Getters and setters to make component access read better.\n // These are likely to be a little bit slower than direct array access.\n /**\n * The x component of the vector. Equivalent to `this[0];`\n * @category Vector Components\n */\n get x() {\n return this[0];\n }\n set x(value) {\n this[0] = value;\n }\n /**\n * The y component of the vector. Equivalent to `this[1];`\n * @category Vector Components\n */\n get y() {\n return this[1];\n }\n set y(value) {\n this[1] = value;\n }\n /**\n * The z component of the vector. Equivalent to `this[2];`\n * @category Vector Components\n */\n get z() {\n return this[2];\n }\n set z(value) {\n this[2] = value;\n }\n // Alternate set of getters and setters in case this is being used to define\n // a color.\n /**\n * The r component of the vector. Equivalent to `this[0];`\n * @category Color Components\n */\n get r() {\n return this[0];\n }\n set r(value) {\n this[0] = value;\n }\n /**\n * The g component of the vector. Equivalent to `this[1];`\n * @category Color Components\n */\n get g() {\n return this[1];\n }\n set g(value) {\n this[1] = value;\n }\n /**\n * The b component of the vector. Equivalent to `this[2];`\n * @category Color Components\n */\n get b() {\n return this[2];\n }\n set b(value) {\n this[2] = value;\n }\n /**\n * The magnitude (length) of this.\n * Equivalent to `Vec3.magnitude(this);`\n *\n * Magnitude is used because the `length` attribute is already defined by\n * TypedArrays to mean the number of elements in the array.\n *\n * @category Accessors\n */\n get magnitude() {\n const x = this[0];\n const y = this[1];\n const z = this[2];\n return Math.sqrt(x * x + y * y + z * z);\n }\n /**\n * Alias for {@link Vec3.magnitude}\n *\n * @category Accessors\n */\n get mag() {\n return this.magnitude;\n }\n /**\n * The squared magnitude (length) of `this`.\n * Equivalent to `Vec3.squaredMagnitude(this);`\n *\n * @category Accessors\n */\n get squaredMagnitude() {\n const x = this[0];\n const y = this[1];\n const z = this[2];\n return x * x + y * y + z * z;\n }\n /**\n * Alias for {@link Vec3.squaredMagnitude}\n *\n * @category Accessors\n */\n get sqrMag() {\n return this.squaredMagnitude;\n }\n /**\n * A string representation of `this`\n * Equivalent to `Vec3.str(this);`\n *\n * @category Accessors\n */\n get str() {\n return _Vec3.str(this);\n }\n // ===================\n // Instances methods\n // ===================\n /**\n * Copy the values from another {@link Vec3} into `this`.\n * @category Methods\n *\n * @param a the source vector\n * @returns `this`\n */\n copy(a) {\n this.set(a);\n return this;\n }\n /**\n * Adds a {@link Vec3} to `this`.\n * Equivalent to `Vec3.add(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to add to `this`\n * @returns `this`\n */\n add(b) {\n this[0] += b[0];\n this[1] += b[1];\n this[2] += b[2];\n return this;\n }\n /**\n * Subtracts a {@link Vec3} from `this`.\n * Equivalent to `Vec3.subtract(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to subtract from `this`\n * @returns `this`\n */\n subtract(b) {\n this[0] -= b[0];\n this[1] -= b[1];\n this[2] -= b[2];\n return this;\n }\n /**\n * Alias for {@link Vec3.subtract}\n * @category Methods\n */\n sub(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Multiplies `this` by a {@link Vec3}.\n * Equivalent to `Vec3.multiply(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to multiply `this` by\n * @returns `this`\n */\n multiply(b) {\n this[0] *= b[0];\n this[1] *= b[1];\n this[2] *= b[2];\n return this;\n }\n /**\n * Alias for {@link Vec3.multiply}\n * @category Methods\n */\n mul(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Divides `this` by a {@link Vec3}.\n * Equivalent to `Vec3.divide(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to divide `this` by\n * @returns `this`\n */\n divide(b) {\n this[0] /= b[0];\n this[1] /= b[1];\n this[2] /= b[2];\n return this;\n }\n /**\n * Alias for {@link Vec3.divide}\n * @category Methods\n */\n div(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Scales `this` by a scalar number.\n * Equivalent to `Vec3.scale(this, this, b);`\n * @category Methods\n *\n * @param b - Amount to scale `this` by\n * @returns `this`\n */\n scale(b) {\n this[0] *= b;\n this[1] *= b;\n this[2] *= b;\n return this;\n }\n /**\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\n * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);`\n * @category Methods\n *\n * @param b - The vector to add to `this`\n * @param scale - The amount to scale `b` by before adding\n * @returns `this`\n */\n scaleAndAdd(b, scale) {\n this[0] += b[0] * scale;\n this[1] += b[1] * scale;\n this[2] += b[2] * scale;\n return this;\n }\n /**\n * Calculates the Euclidean distance between another {@link Vec3} and `this`.\n * Equivalent to `Vec3.distance(this, b);`\n * @category Methods\n *\n * @param b - The vector to calculate the distance to\n * @returns Distance between `this` and `b`\n */\n distance(b) {\n return _Vec3.distance(this, b);\n }\n /**\n * Alias for {@link Vec3.distance}\n * @category Methods\n */\n dist(b) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Calculates the squared Euclidean distance between another {@link Vec3} and `this`.\n * Equivalent to `Vec3.squaredDistance(this, b);`\n * @category Methods\n *\n * @param b The vector to calculate the squared distance to\n * @returns Squared distance between `this` and `b`\n */\n squaredDistance(b) {\n return _Vec3.squaredDistance(this, b);\n }\n /**\n * Alias for {@link Vec3.squaredDistance}\n * @category Methods\n */\n sqrDist(b) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Negates the components of `this`.\n * Equivalent to `Vec3.negate(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n negate() {\n this[0] *= -1;\n this[1] *= -1;\n this[2] *= -1;\n return this;\n }\n /**\n * Inverts the components of `this`.\n * Equivalent to `Vec3.inverse(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n invert() {\n this[0] = 1 / this[0];\n this[1] = 1 / this[1];\n this[2] = 1 / this[2];\n return this;\n }\n /**\n * Sets each component of `this` to its absolute value.\n * Equivalent to `Vec3.abs(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n abs() {\n this[0] = Math.abs(this[0]);\n this[1] = Math.abs(this[1]);\n this[2] = Math.abs(this[2]);\n return this;\n }\n /**\n * Calculates the dot product of this and another {@link Vec3}.\n * Equivalent to `Vec3.dot(this, b);`\n * @category Methods\n *\n * @param b - The second operand\n * @returns Dot product of `this` and `b`\n */\n dot(b) {\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2];\n }\n /**\n * Normalize `this`.\n * Equivalent to `Vec3.normalize(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n normalize() {\n return _Vec3.normalize(this, this);\n }\n // ===================\n // Static accessors\n // ===================\n /**\n * @category Static\n *\n * @returns The number of bytes in a {@link Vec3}.\n */\n static get BYTE_LENGTH() {\n return 3 * Float32Array.BYTES_PER_ELEMENT;\n }\n // ===================\n // Static methods\n // ===================\n /**\n * Creates a new, empty vec3\n * @category Static\n *\n * @returns a new 3D vector\n */\n static create() {\n return new _Vec3();\n }\n /**\n * Creates a new vec3 initialized with values from an existing vector\n * @category Static\n *\n * @param a - vector to clone\n * @returns a new 3D vector\n */\n static clone(a) {\n return new _Vec3(a);\n }\n /**\n * Calculates the magnitude (length) of a {@link Vec3}\n * @category Static\n *\n * @param a - Vector to calculate magnitude of\n * @returns Magnitude of a\n */\n static magnitude(a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n return Math.sqrt(x * x + y * y + z * z);\n }\n /**\n * Alias for {@link Vec3.magnitude}\n * @category Static\n */\n static mag(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Alias for {@link Vec3.magnitude}\n * @category Static\n * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs\n *\n * @param a - vector to calculate length of\n * @returns length of a\n */\n // Length conflicts with Function.length\n static length(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Alias for {@link Vec3.magnitude}\n * @category Static\n * @deprecated Use {@link Vec3.mag}\n */\n static len(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Creates a new vec3 initialized with the given values\n * @category Static\n *\n * @param x - X component\n * @param y - Y component\n * @param z - Z component\n * @returns a new 3D vector\n */\n static fromValues(x, y, z) {\n return new _Vec3(x, y, z);\n }\n /**\n * Copy the values from one vec3 to another\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the source vector\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n }\n /**\n * Set the components of a vec3 to the given values\n * @category Static\n *\n * @param out - the receiving vector\n * @param x - X component\n * @param y - Y component\n * @param z - Z component\n * @returns `out`\n */\n static set(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n }\n /**\n * Adds two {@link Vec3}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n }\n /**\n * Subtracts vector b from vector a\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n }\n /**\n * Alias for {@link Vec3.subtract}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sub(out, a, b) {\n return [0, 0, 0];\n }\n /**\n * Multiplies two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n }\n /**\n * Alias for {@link Vec3.multiply}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static mul(out, a, b) {\n return [0, 0, 0];\n }\n /**\n * Divides two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n }\n /**\n * Alias for {@link Vec3.divide}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static div(out, a, b) {\n return [0, 0, 0];\n }\n /**\n * Math.ceil the components of a vec3\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to ceil\n * @returns `out`\n */\n static ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n return out;\n }\n /**\n * Math.floor the components of a vec3\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to floor\n * @returns `out`\n */\n static floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n return out;\n }\n /**\n * Returns the minimum of two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n }\n /**\n * Returns the maximum of two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n }\n /**\n * symmetric round the components of a vec3\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to round\n * @returns `out`\n */\n /*\n static round(out: Vec3Like, a: Readonly): Vec3Like {\n out[0] = glMatrix.round(a[0]);\n out[1] = glMatrix.round(a[1]);\n out[2] = glMatrix.round(a[2]);\n return out;\n }*/\n /**\n * Scales a vec3 by a scalar number\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to scale\n * @param scale - amount to scale the vector by\n * @returns `out`\n */\n static scale(out, a, scale) {\n out[0] = a[0] * scale;\n out[1] = a[1] * scale;\n out[2] = a[2] * scale;\n return out;\n }\n /**\n * Adds two vec3's after scaling the second operand by a scalar value\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param scale - the amount to scale b by before adding\n * @returns `out`\n */\n static scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n return out;\n }\n /**\n * Calculates the Euclidean distance between two vec3's\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns distance between a and b\n */\n static distance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n const z = b[2] - a[2];\n return Math.sqrt(x * x + y * y + z * z);\n }\n /**\n * Alias for {@link Vec3.distance}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static dist(a, b) {\n return 0;\n }\n /**\n * Calculates the squared Euclidean distance between two vec3's\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns squared distance between a and b\n */\n static squaredDistance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n const z = b[2] - a[2];\n return x * x + y * y + z * z;\n }\n /**\n * Alias for {@link Vec3.squaredDistance}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sqrDist(a, b) {\n return 0;\n }\n /**\n * Calculates the squared length of a vec3\n * @category Static\n *\n * @param a - vector to calculate squared length of\n * @returns squared length of a\n */\n static squaredLength(a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n return x * x + y * y + z * z;\n }\n /**\n * Alias for {@link Vec3.squaredLength}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sqrLen(a, b) {\n return 0;\n }\n /**\n * Negates the components of a vec3\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to negate\n * @returns `out`\n */\n static negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n }\n /**\n * Returns the inverse of the components of a vec3\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to invert\n * @returns `out`\n */\n static inverse(out, a) {\n out[0] = 1 / a[0];\n out[1] = 1 / a[1];\n out[2] = 1 / a[2];\n return out;\n }\n /**\n * Returns the absolute value of the components of a {@link Vec3}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to compute the absolute values of\n * @returns `out`\n */\n static abs(out, a) {\n out[0] = Math.abs(a[0]);\n out[1] = Math.abs(a[1]);\n out[2] = Math.abs(a[2]);\n return out;\n }\n /**\n * Normalize a vec3\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to normalize\n * @returns `out`\n */\n static normalize(out, a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n let len = x * x + y * y + z * z;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n return out;\n }\n /**\n * Calculates the dot product of two vec3's\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns dot product of a and b\n */\n static dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n }\n /**\n * Computes the cross product of two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static cross(out, a, b) {\n const ax = a[0], ay = a[1], az = a[2];\n const bx = b[0], by = b[1], bz = b[2];\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n }\n /**\n * Performs a linear interpolation between two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static lerp(out, a, b, t) {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n }\n /**\n * Performs a spherical linear interpolation between two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static slerp(out, a, b, t) {\n const angle = Math.acos(Math.min(Math.max(_Vec3.dot(a, b), -1), 1));\n const sinTotal = Math.sin(angle);\n const ratioA = Math.sin((1 - t) * angle) / sinTotal;\n const ratioB = Math.sin(t * angle) / sinTotal;\n out[0] = ratioA * a[0] + ratioB * b[0];\n out[1] = ratioA * a[1] + ratioB * b[1];\n out[2] = ratioA * a[2] + ratioB * b[2];\n return out;\n }\n /**\n * Performs a hermite interpolation with two control points\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param c - the third operand\n * @param d - the fourth operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static hermite(out, a, b, c, d, t) {\n const factorTimes2 = t * t;\n const factor1 = factorTimes2 * (2 * t - 3) + 1;\n const factor2 = factorTimes2 * (t - 2) + t;\n const factor3 = factorTimes2 * (t - 1);\n const factor4 = factorTimes2 * (3 - 2 * t);\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n }\n /**\n * Performs a bezier interpolation with two control points\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param c - the third operand\n * @param d - the fourth operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static bezier(out, a, b, c, d, t) {\n const inverseFactor = 1 - t;\n const inverseFactorTimesTwo = inverseFactor * inverseFactor;\n const factorTimes2 = t * t;\n const factor1 = inverseFactorTimesTwo * inverseFactor;\n const factor2 = 3 * t * inverseFactorTimesTwo;\n const factor3 = 3 * factorTimes2 * inverseFactor;\n const factor4 = factorTimes2 * t;\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n }\n /**\n * Generates a random vector with the given scale\n * @category Static\n *\n * @param out - the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned\n * @returns `out`\n */\n /*\n static random(out: Vec3Like, scale) {\n scale = scale === undefined ? 1.0 : scale;\n \n let r = glMatrix.RANDOM() * 2.0 * Math.PI;\n let z = glMatrix.RANDOM() * 2.0 - 1.0;\n let zScale = Math.sqrt(1.0 - z * z) * scale;\n \n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n }*/\n /**\n * Transforms the vec3 with a mat4.\n * 4th vector component is implicitly '1'\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to transform\n * @param m - matrix to transform with\n * @returns `out`\n */\n static transformMat4(out, a, m) {\n const x = a[0], y = a[1], z = a[2];\n const w = m[3] * x + m[7] * y + m[11] * z + m[15] || 1;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n }\n /**\n * Transforms the vec3 with a mat3.\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to transform\n * @param m - the 3x3 matrix to transform with\n * @returns `out`\n */\n static transformMat3(out, a, m) {\n const x = a[0], y = a[1], z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n }\n /**\n * Transforms the vec3 with a quat\n * Can also be used for dual quaternions. (Multiply it with the real part)\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to transform\n * @param q - quaternion to transform with\n * @returns `out`\n */\n static transformQuat(out, a, q) {\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const w2 = q[3] * 2;\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const uvx = qy * z - qz * y;\n const uvy = qz * x - qx * z;\n const uvz = qx * y - qy * x;\n const uuvx = (qy * uvz - qz * uvy) * 2;\n const uuvy = (qz * uvx - qx * uvz) * 2;\n const uuvz = (qx * uvy - qy * uvx) * 2;\n out[0] = x + uvx * w2 + uuvx;\n out[1] = y + uvy * w2 + uuvy;\n out[2] = z + uvz * w2 + uuvz;\n return out;\n }\n /**\n * Rotate a 3D vector around the x-axis\n * @category Static\n *\n * @param out - The receiving vec3\n * @param a - The vec3 point to rotate\n * @param b - The origin of the rotation\n * @param rad - The angle of rotation in radians\n * @returns `out`\n */\n static rotateX(out, a, b, rad) {\n const by = b[1];\n const bz = b[2];\n const py = a[1] - by;\n const pz = a[2] - bz;\n out[0] = a[0];\n out[1] = py * Math.cos(rad) - pz * Math.sin(rad) + by;\n out[2] = py * Math.sin(rad) + pz * Math.cos(rad) + bz;\n return out;\n }\n /**\n * Rotate a 3D vector around the y-axis\n * @category Static\n *\n * @param out - The receiving vec3\n * @param a - The vec3 point to rotate\n * @param b - The origin of the rotation\n * @param rad - The angle of rotation in radians\n * @returns `out`\n */\n static rotateY(out, a, b, rad) {\n const bx = b[0];\n const bz = b[2];\n const px = a[0] - bx;\n const pz = a[2] - bz;\n out[0] = pz * Math.sin(rad) + px * Math.cos(rad) + bx;\n out[1] = a[1];\n out[2] = pz * Math.cos(rad) - px * Math.sin(rad) + bz;\n return out;\n }\n /**\n * Rotate a 3D vector around the z-axis\n * @category Static\n *\n * @param out - The receiving vec3\n * @param a - The vec3 point to rotate\n * @param b - The origin of the rotation\n * @param rad - The angle of rotation in radians\n * @returns `out`\n */\n static rotateZ(out, a, b, rad) {\n const bx = b[0];\n const by = b[1];\n const px = a[0] - bx;\n const py = a[1] - by;\n out[0] = px * Math.cos(rad) - py * Math.sin(rad) + bx;\n out[1] = px * Math.sin(rad) + py * Math.cos(rad) + by;\n out[2] = b[2];\n return out;\n }\n /**\n * Get the angle between two 3D vectors\n * @category Static\n *\n * @param a - The first operand\n * @param b - The second operand\n * @returns The angle in radians\n */\n static angle(a, b) {\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 mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz));\n const cosine = mag && _Vec3.dot(a, b) / mag;\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n }\n /**\n * Set the components of a vec3 to zero\n * @category Static\n *\n * @param out - the receiving vector\n * @returns `out`\n */\n static zero(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n return out;\n }\n /**\n * Returns a string representation of a vector\n * @category Static\n *\n * @param a - vector to represent as a string\n * @returns string representation of the vector\n */\n static str(a) {\n return `Vec3(${a.join(\", \")})`;\n }\n /**\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n }\n /**\n * Returns whether the vectors have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2));\n }\n};\nVec3.prototype.sub = Vec3.prototype.subtract;\nVec3.prototype.mul = Vec3.prototype.multiply;\nVec3.prototype.div = Vec3.prototype.divide;\nVec3.prototype.dist = Vec3.prototype.distance;\nVec3.prototype.sqrDist = Vec3.prototype.squaredDistance;\nVec3.sub = Vec3.subtract;\nVec3.mul = Vec3.multiply;\nVec3.div = Vec3.divide;\nVec3.dist = Vec3.distance;\nVec3.sqrDist = Vec3.squaredDistance;\nVec3.sqrLen = Vec3.squaredLength;\nVec3.mag = Vec3.magnitude;\nVec3.length = Vec3.magnitude;\nVec3.len = Vec3.magnitude;\n\n// src/_lib/f32/Vec4.ts\nvar Vec4 = class _Vec4 extends Float32Array {\n /**\n * Create a {@link Vec4}.\n *\n * @category Constructor\n */\n constructor(...values) {\n switch (values.length) {\n case 4:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 4);\n break;\n case 1: {\n const v = values[0];\n if (typeof v === \"number\") {\n super([v, v, v, v]);\n } else {\n super(v, 0, 4);\n }\n break;\n }\n default:\n super(4);\n break;\n }\n }\n // ============\n // Accessors\n // ============\n // Getters and setters to make component access read better.\n // These are likely to be a little bit slower than direct array access.\n /**\n * The x component of the vector. Equivalent to `this[0];`\n * @category Vector Components\n */\n get x() {\n return this[0];\n }\n set x(value) {\n this[0] = value;\n }\n /**\n * The y component of the vector. Equivalent to `this[1];`\n * @category Vector Components\n */\n get y() {\n return this[1];\n }\n set y(value) {\n this[1] = value;\n }\n /**\n * The z component of the vector. Equivalent to `this[2];`\n * @category Vector Components\n */\n get z() {\n return this[2];\n }\n set z(value) {\n this[2] = value;\n }\n /**\n * The w component of the vector. Equivalent to `this[3];`\n * @category Vector Components\n */\n get w() {\n return this[3];\n }\n set w(value) {\n this[3] = value;\n }\n // Alternate set of getters and setters in case this is being used to define\n // a color.\n /**\n * The r component of the vector. Equivalent to `this[0];`\n * @category Color Components\n */\n get r() {\n return this[0];\n }\n set r(value) {\n this[0] = value;\n }\n /**\n * The g component of the vector. Equivalent to `this[1];`\n * @category Color Components\n */\n get g() {\n return this[1];\n }\n set g(value) {\n this[1] = value;\n }\n /**\n * The b component of the vector. Equivalent to `this[2];`\n * @category Color Components\n */\n get b() {\n return this[2];\n }\n set b(value) {\n this[2] = value;\n }\n /**\n * The a component of the vector. Equivalent to `this[3];`\n * @category Color Components\n */\n get a() {\n return this[3];\n }\n set a(value) {\n this[3] = value;\n }\n /**\n * The magnitude (length) of this.\n * Equivalent to `Vec4.magnitude(this);`\n *\n * Magnitude is used because the `length` attribute is already defined by\n * TypedArrays to mean the number of elements in the array.\n *\n * @category Accessors\n */\n get magnitude() {\n const x = this[0];\n const y = this[1];\n const z = this[2];\n const w = this[3];\n return Math.sqrt(x * x + y * y + z * z + w * w);\n }\n /**\n * Alias for {@link Vec4.magnitude}\n *\n * @category Accessors\n */\n get mag() {\n return this.magnitude;\n }\n /**\n * A string representation of `this`\n * Equivalent to `Vec4.str(this);`\n *\n * @category Accessors\n */\n get str() {\n return _Vec4.str(this);\n }\n // ===================\n // Instances methods\n // ===================\n /**\n * Copy the values from another {@link Vec4} into `this`.\n * @category Methods\n *\n * @param a the source vector\n * @returns `this`\n */\n copy(a) {\n super.set(a);\n return this;\n }\n /**\n * Adds a {@link Vec4} to `this`.\n * Equivalent to `Vec4.add(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to add to `this`\n * @returns `this`\n */\n add(b) {\n this[0] += b[0];\n this[1] += b[1];\n this[2] += b[2];\n this[3] += b[3];\n return this;\n }\n /**\n * Subtracts a {@link Vec4} from `this`.\n * Equivalent to `Vec4.subtract(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to subtract from `this`\n * @returns `this`\n */\n subtract(b) {\n this[0] -= b[0];\n this[1] -= b[1];\n this[2] -= b[2];\n this[3] -= b[3];\n return this;\n }\n /**\n * Alias for {@link Vec4.subtract}\n * @category Methods\n */\n sub(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Multiplies `this` by a {@link Vec4}.\n * Equivalent to `Vec4.multiply(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to multiply `this` by\n * @returns `this`\n */\n multiply(b) {\n this[0] *= b[0];\n this[1] *= b[1];\n this[2] *= b[2];\n this[3] *= b[3];\n return this;\n }\n /**\n * Alias for {@link Vec4.multiply}\n * @category Methods\n */\n mul(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Divides `this` by a {@link Vec4}.\n * Equivalent to `Vec4.divide(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to divide `this` by\n * @returns `this`\n */\n divide(b) {\n this[0] /= b[0];\n this[1] /= b[1];\n this[2] /= b[2];\n this[3] /= b[3];\n return this;\n }\n /**\n * Alias for {@link Vec4.divide}\n * @category Methods\n */\n div(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Scales `this` by a scalar number.\n * Equivalent to `Vec4.scale(this, this, b);`\n * @category Methods\n *\n * @param b - Amount to scale `this` by\n * @returns `this`\n */\n scale(b) {\n this[0] *= b;\n this[1] *= b;\n this[2] *= b;\n this[3] *= b;\n return this;\n }\n /**\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\n * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);`\n * @category Methods\n *\n * @param b - The vector to add to `this`\n * @param scale - The amount to scale `b` by before adding\n * @returns `this`\n */\n scaleAndAdd(b, scale) {\n this[0] += b[0] * scale;\n this[1] += b[1] * scale;\n this[2] += b[2] * scale;\n this[3] += b[3] * scale;\n return this;\n }\n /**\n * Calculates the Euclidean distance between another {@link Vec4} and `this`.\n * Equivalent to `Vec4.distance(this, b);`\n * @category Methods\n *\n * @param b - The vector to calculate the distance to\n * @returns Distance between `this` and `b`\n */\n distance(b) {\n return _Vec4.distance(this, b);\n }\n /**\n * Alias for {@link Vec4.distance}\n * @category Methods\n */\n dist(b) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Calculates the squared Euclidean distance between another {@link Vec4} and `this`.\n * Equivalent to `Vec4.squaredDistance(this, b);`\n * @category Methods\n *\n * @param b The vector to calculate the squared distance to\n * @returns Squared distance between `this` and `b`\n */\n squaredDistance(b) {\n return _Vec4.squaredDistance(this, b);\n }\n /**\n * Alias for {@link Vec4.squaredDistance}\n * @category Methods\n */\n sqrDist(b) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Negates the components of `this`.\n * Equivalent to `Vec4.negate(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n negate() {\n this[0] *= -1;\n this[1] *= -1;\n this[2] *= -1;\n this[3] *= -1;\n return this;\n }\n /**\n * Inverts the components of `this`.\n * Equivalent to `Vec4.inverse(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n invert() {\n this[0] = 1 / this[0];\n this[1] = 1 / this[1];\n this[2] = 1 / this[2];\n this[3] = 1 / this[3];\n return this;\n }\n /**\n * Sets each component of `this` to it's absolute value.\n * Equivalent to `Vec4.abs(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n abs() {\n this[0] = Math.abs(this[0]);\n this[1] = Math.abs(this[1]);\n this[2] = Math.abs(this[2]);\n this[3] = Math.abs(this[3]);\n return this;\n }\n /**\n * Calculates the dot product of this and another {@link Vec4}.\n * Equivalent to `Vec4.dot(this, b);`\n * @category Methods\n *\n * @param b - The second operand\n * @returns Dot product of `this` and `b`\n */\n dot(b) {\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3];\n }\n /**\n * Normalize `this`.\n * Equivalent to `Vec4.normalize(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n normalize() {\n return _Vec4.normalize(this, this);\n }\n // ===================\n // Static accessors\n // ===================\n /**\n * @category Static\n *\n * @returns The number of bytes in a {@link Vec4}.\n */\n static get BYTE_LENGTH() {\n return 4 * Float32Array.BYTES_PER_ELEMENT;\n }\n // ===================\n // Static methods\n // ===================\n /**\n * Creates a new, empty {@link Vec4}\n * @category Static\n *\n * @returns a new 4D vector\n */\n static create() {\n return new _Vec4();\n }\n /**\n * Creates a new {@link Vec4} initialized with values from an existing vector\n * @category Static\n *\n * @param a - vector to clone\n * @returns a new 4D vector\n */\n static clone(a) {\n return new _Vec4(a);\n }\n /**\n * Creates a new {@link Vec4} initialized with the given values\n * @category Static\n *\n * @param x - X component\n * @param y - Y component\n * @param z - Z component\n * @param w - W component\n * @returns a new 4D vector\n */\n static fromValues(x, y, z, w) {\n return new _Vec4(x, y, z, w);\n }\n /**\n * Copy the values from one {@link Vec4} to another\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the source vector\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n }\n /**\n * Set the components of a {@link Vec4} to the given values\n * @category Static\n *\n * @param out - the receiving vector\n * @param x - X component\n * @param y - Y component\n * @param z - Z component\n * @param w - W component\n * @returns `out`\n */\n static set(out, x, y, z, w) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n }\n /**\n * Adds two {@link Vec4}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n }\n /**\n * Subtracts vector b from vector a\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n }\n /**\n * Alias for {@link Vec4.subtract}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sub(out, a, b) {\n return out;\n }\n /**\n * Multiplies two {@link Vec4}'s\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n out[3] = a[3] * b[3];\n return out;\n }\n /**\n * Alias for {@link Vec4.multiply}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static mul(out, a, b) {\n return out;\n }\n /**\n * Divides two {@link Vec4}'s\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n out[3] = a[3] / b[3];\n return out;\n }\n /**\n * Alias for {@link Vec4.divide}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static div(out, a, b) {\n return out;\n }\n /**\n * Math.ceil the components of a {@link Vec4}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to ceil\n * @returns `out`\n */\n static ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n out[3] = Math.ceil(a[3]);\n return out;\n }\n /**\n * Math.floor the components of a {@link Vec4}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to floor\n * @returns `out`\n */\n static floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n out[3] = Math.floor(a[3]);\n return out;\n }\n /**\n * Returns the minimum of two {@link Vec4}'s\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n out[3] = Math.min(a[3], b[3]);\n return out;\n }\n /**\n * Returns the maximum of two {@link Vec4}'s\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n out[3] = Math.max(a[3], b[3]);\n return out;\n }\n /**\n * Math.round the components of a {@link Vec4}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to round\n * @returns `out`\n */\n static round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n out[3] = Math.round(a[3]);\n return out;\n }\n /**\n * Scales a {@link Vec4} by a scalar number\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to scale\n * @param scale - amount to scale the vector by\n * @returns `out`\n */\n static scale(out, a, scale) {\n out[0] = a[0] * scale;\n out[1] = a[1] * scale;\n out[2] = a[2] * scale;\n out[3] = a[3] * scale;\n return out;\n }\n /**\n * Adds two {@link Vec4}'s after scaling the second operand by a scalar value\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param scale - the amount to scale b by before adding\n * @returns `out`\n */\n static scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n }\n /**\n * Calculates the Euclidean distance between two {@link Vec4}'s\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns distance between a and b\n */\n static distance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n const z = b[2] - a[2];\n const w = b[3] - a[3];\n return Math.hypot(x, y, z, w);\n }\n /**\n * Alias for {@link Vec4.distance}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static dist(a, b) {\n return 0;\n }\n /**\n * Calculates the squared Euclidean distance between two {@link Vec4}'s\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns squared distance between a and b\n */\n static squaredDistance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n const z = b[2] - a[2];\n const w = b[3] - a[3];\n return x * x + y * y + z * z + w * w;\n }\n /**\n * Alias for {@link Vec4.squaredDistance}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sqrDist(a, b) {\n return 0;\n }\n /**\n * Calculates the magnitude (length) of a {@link Vec4}\n * @category Static\n *\n * @param a - vector to calculate length of\n * @returns length of `a`\n */\n static magnitude(a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n return Math.sqrt(x * x + y * y + z * z + w * w);\n }\n /**\n * Alias for {@link Vec4.magnitude}\n * @category Static\n */\n static mag(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Alias for {@link Vec4.magnitude}\n * @category Static\n * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs\n */\n // Length conflicts with Function.length\n static length(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Alias for {@link Vec4.magnitude}\n * @category Static\n * @deprecated Use {@link Vec4.mag}\n */\n static len(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Calculates the squared length of a {@link Vec4}\n * @category Static\n *\n * @param a - vector to calculate squared length of\n * @returns squared length of a\n */\n static squaredLength(a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n return x * x + y * y + z * z + w * w;\n }\n /**\n * Alias for {@link Vec4.squaredLength}\n * @category Static\n */\n static sqrLen(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Negates the components of a {@link Vec4}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to negate\n * @returns `out`\n */\n static negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = -a[3];\n return out;\n }\n /**\n * Returns the inverse of the components of a {@link Vec4}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to invert\n * @returns `out`\n */\n static inverse(out, a) {\n out[0] = 1 / a[0];\n out[1] = 1 / a[1];\n out[2] = 1 / a[2];\n out[3] = 1 / a[3];\n return out;\n }\n /**\n * Returns the absolute value of the components of a {@link Vec4}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to compute the absolute values of\n * @returns `out`\n */\n static abs(out, a) {\n out[0] = Math.abs(a[0]);\n out[1] = Math.abs(a[1]);\n out[2] = Math.abs(a[2]);\n out[3] = Math.abs(a[3]);\n return out;\n }\n /**\n * Normalize a {@link Vec4}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to normalize\n * @returns `out`\n */\n static normalize(out, a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n let len = x * x + y * y + z * z + w * w;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n out[0] = x * len;\n out[1] = y * len;\n out[2] = z * len;\n out[3] = w * len;\n return out;\n }\n /**\n * Calculates the dot product of two {@link Vec4}'s\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns dot product of a and b\n */\n static dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n }\n /**\n * Returns the cross-product of three vectors in a 4-dimensional space\n * @category Static\n *\n * @param out the receiving vector\n * @param u - the first vector\n * @param v - the second vector\n * @param w - the third vector\n * @returns result\n */\n static cross(out, u, v, w) {\n const a = v[0] * w[1] - v[1] * w[0];\n const b = v[0] * w[2] - v[2] * w[0];\n const c = v[0] * w[3] - v[3] * w[0];\n const d = v[1] * w[2] - v[2] * w[1];\n const e = v[1] * w[3] - v[3] * w[1];\n const f = v[2] * w[3] - v[3] * w[2];\n const g = u[0];\n const h = u[1];\n const i = u[2];\n const j = u[3];\n out[0] = h * f - i * e + j * d;\n out[1] = -(g * f) + i * c - j * b;\n out[2] = g * e - h * c + j * a;\n out[3] = -(g * d) + h * b - i * a;\n return out;\n }\n /**\n * Performs a linear interpolation between two {@link Vec4}'s\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static lerp(out, a, b, t) {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n out[3] = aw + t * (b[3] - aw);\n return out;\n }\n /**\n * Generates a random vector with the given scale\n * @category Static\n *\n * @param out - the receiving vector\n * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns `out`\n */\n /*\n static random(out: Vec4Like, scale): Vec4Like {\n scale = scale || 1.0;\n \n // Marsaglia, George. Choosing a Point from the Surface of a\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\n // http://projecteuclid.org/euclid.aoms/1177692644;\n var v1, v2, v3, v4;\n var s1, s2;\n do {\n v1 = glMatrix.RANDOM() * 2 - 1;\n v2 = glMatrix.RANDOM() * 2 - 1;\n s1 = v1 * v1 + v2 * v2;\n } while (s1 >= 1);\n do {\n v3 = glMatrix.RANDOM() * 2 - 1;\n v4 = glMatrix.RANDOM() * 2 - 1;\n s2 = v3 * v3 + v4 * v4;\n } while (s2 >= 1);\n \n var d = Math.sqrt((1 - s1) / s2);\n out[0] = scale * v1;\n out[1] = scale * v2;\n out[2] = scale * v3 * d;\n out[3] = scale * v4 * d;\n return out;\n }*/\n /**\n * Transforms the {@link Vec4} with a {@link Mat4}.\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to transform\n * @param m - matrix to transform with\n * @returns `out`\n */\n static transformMat4(out, a, m) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n }\n /**\n * Transforms the {@link Vec4} with a {@link Quat}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to transform\n * @param q - quaternion to transform with\n * @returns `out`\n */\n static transformQuat(out, a, q) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n const ix = qw * x + qy * z - qz * y;\n const iy = qw * y + qz * x - qx * z;\n const iz = qw * z + qx * y - qy * x;\n const iw = -qx * x - qy * y - qz * z;\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n out[3] = a[3];\n return out;\n }\n /**\n * Set the components of a {@link Vec4} to zero\n * @category Static\n *\n * @param out - the receiving vector\n * @returns `out`\n */\n static zero(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n return out;\n }\n /**\n * Returns a string representation of a {@link Vec4}\n * @category Static\n *\n * @param a - vector to represent as a string\n * @returns string representation of the vector\n */\n static str(a) {\n return `Vec4(${a.join(\", \")})`;\n }\n /**\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n }\n /**\n * Returns whether the vectors have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3));\n }\n};\nVec4.prototype.sub = Vec4.prototype.subtract;\nVec4.prototype.mul = Vec4.prototype.multiply;\nVec4.prototype.div = Vec4.prototype.divide;\nVec4.prototype.dist = Vec4.prototype.distance;\nVec4.prototype.sqrDist = Vec4.prototype.squaredDistance;\nVec4.sub = Vec4.subtract;\nVec4.mul = Vec4.multiply;\nVec4.div = Vec4.divide;\nVec4.dist = Vec4.distance;\nVec4.sqrDist = Vec4.squaredDistance;\nVec4.sqrLen = Vec4.squaredLength;\nVec4.mag = Vec4.magnitude;\nVec4.length = Vec4.magnitude;\nVec4.len = Vec4.magnitude;\n\n// src/_lib/f32/Quat.ts\nvar _DEFAULT_ANGLE_ORDER, _TMP_QUAT1, _TMP_QUAT2, _TMP_MAT3, _TMP_VEC32, _X_UNIT_VEC3, _Y_UNIT_VEC3;\nvar _Quat = class _Quat extends Float32Array {\n /**\n * Create a {@link Quat}.\n *\n * @category Constructor\n */\n constructor(...values) {\n switch (values.length) {\n case 4:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 4);\n break;\n case 1: {\n const v = values[0];\n if (typeof v === \"number\") {\n super([v, v, v, v]);\n } else {\n super(v, 0, 4);\n }\n break;\n }\n default:\n super(4);\n this[3] = 1;\n break;\n }\n }\n // ============\n // Accessors\n // ============\n // Getters and setters to make component access read better.\n // These are likely to be a little bit slower than direct array access.\n /**\n * The x component of the quaternion. Equivalent to `this[0];`\n * @category Quaternion Components\n */\n get x() {\n return this[0];\n }\n set x(value) {\n this[0] = value;\n }\n /**\n * The y component of the quaternion. Equivalent to `this[1];`\n * @category Quaternion Components\n */\n get y() {\n return this[1];\n }\n set y(value) {\n this[1] = value;\n }\n /**\n * The z component of the quaternion. Equivalent to `this[2];`\n * @category Quaternion Components\n */\n get z() {\n return this[2];\n }\n set z(value) {\n this[2] = value;\n }\n /**\n * The w component of the quaternion. Equivalent to `this[3];`\n * @category Quaternion Components\n */\n get w() {\n return this[3];\n }\n set w(value) {\n this[3] = value;\n }\n /**\n * The magnitude (length) of this.\n * Equivalent to `Quat.magnitude(this);`\n *\n * Magnitude is used because the `length` attribute is already defined by\n * TypedArrays to mean the number of elements in the array.\n *\n * @category Accessors\n */\n get magnitude() {\n const x = this[0];\n const y = this[1];\n const z = this[2];\n const w = this[3];\n return Math.sqrt(x * x + y * y + z * z + w * w);\n }\n /**\n * Alias for {@link Quat.magnitude}\n *\n * @category Accessors\n */\n get mag() {\n return this.magnitude;\n }\n /**\n * A string representation of `this`\n * Equivalent to `Quat.str(this);`\n *\n * @category Accessors\n */\n get str() {\n return _Quat.str(this);\n }\n // ===================\n // Instances methods\n // ===================\n /**\n * Copy the values from another {@link Quat} into `this`.\n * @category Methods\n *\n * @param a the source quaternion\n * @returns `this`\n */\n copy(a) {\n super.set(a);\n return this;\n }\n /**\n * Set `this` to the identity quaternion\n * Equivalent to Quat.identity(this)\n * @category Methods\n *\n * @returns `this`\n */\n identity() {\n this[0] = 0;\n this[1] = 0;\n this[2] = 0;\n this[3] = 1;\n return this;\n }\n /**\n * Multiplies `this` by a {@link Quat}.\n * Equivalent to `Quat.multiply(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to multiply `this` by\n * @returns `this`\n */\n multiply(b) {\n return _Quat.multiply(this, this, b);\n }\n /**\n * Alias for {@link Quat.multiply}\n * @category Methods\n */\n mul(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Rotates `this` by the given angle about the X axis\n * Equivalent to `Quat.rotateX(this, this, rad);`\n * @category Methods\n *\n * @param rad - angle (in radians) to rotate\n * @returns `this`\n */\n rotateX(rad) {\n return _Quat.rotateX(this, this, rad);\n }\n /**\n * Rotates `this` by the given angle about the Y axis\n * Equivalent to `Quat.rotateY(this, this, rad);`\n * @category Methods\n *\n * @param rad - angle (in radians) to rotate\n * @returns `this`\n */\n rotateY(rad) {\n return _Quat.rotateY(this, this, rad);\n }\n /**\n * Rotates `this` by the given angle about the Z axis\n * Equivalent to `Quat.rotateZ(this, this, rad);`\n * @category Methods\n *\n * @param rad - angle (in radians) to rotate\n * @returns `this`\n */\n rotateZ(rad) {\n return _Quat.rotateZ(this, this, rad);\n }\n /**\n * Inverts `this`\n * Equivalent to `Quat.invert(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n invert() {\n return _Quat.invert(this, this);\n }\n /**\n * Scales `this` by a scalar number\n * Equivalent to `Quat.scale(this, this, scale);`\n * @category Methods\n *\n * @param scale - amount to scale the vector by\n * @returns `this`\n */\n scale(scale) {\n this[0] *= scale;\n this[1] *= scale;\n this[2] *= scale;\n this[3] *= scale;\n return this;\n }\n /**\n * Calculates the dot product of `this` and another {@link Quat}\n * Equivalent to `Quat.dot(this, b);`\n * @category Methods\n *\n * @param b - the second operand\n * @returns dot product of `this` and b\n */\n dot(b) {\n return _Quat.dot(this, b);\n }\n // ===================\n // Static accessors\n // ===================\n /**\n * @category Static\n *\n * @returns The number of bytes in a {@link Quat}.\n */\n static get BYTE_LENGTH() {\n return 4 * Float32Array.BYTES_PER_ELEMENT;\n }\n // ===================\n // Static methods\n // ===================\n /**\n * Creates a new identity quat\n * @category Static\n *\n * @returns a new quaternion\n */\n static create() {\n return new _Quat();\n }\n /**\n * Set a quat to the identity quaternion\n * @category Static\n *\n * @param out - the receiving quaternion\n * @returns `out`\n */\n static identity(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n }\n /**\n * Sets a quat from the given angle and rotation axis,\n * then returns it.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param axis - the axis around which to rotate\n * @param rad - the angle in radians\n * @returns `out`\n **/\n static setAxisAngle(out, axis, rad) {\n rad *= 0.5;\n const s = Math.sin(rad);\n out[0] = s * axis[0];\n out[1] = s * axis[1];\n out[2] = s * axis[2];\n out[3] = Math.cos(rad);\n return out;\n }\n /**\n * Gets the rotation axis and angle for a given\n * quaternion. If a quaternion is created with\n * setAxisAngle, this method will return the same\n * values as provided in the original parameter list\n * OR functionally equivalent values.\n * Example: The quaternion formed by axis [0, 0, 1] and\n * angle -90 is the same as the quaternion formed by\n * [0, 0, 1] and 270. This method favors the latter.\n * @category Static\n *\n * @param out_axis - Vector receiving the axis of rotation\n * @param q - Quaternion to be decomposed\n * @return Angle, in radians, of the rotation\n */\n static getAxisAngle(out_axis, q) {\n const rad = Math.acos(q[3]) * 2;\n const s = Math.sin(rad / 2);\n if (s > GLM_EPSILON) {\n out_axis[0] = q[0] / s;\n out_axis[1] = q[1] / s;\n out_axis[2] = q[2] / s;\n } else {\n out_axis[0] = 1;\n out_axis[1] = 0;\n out_axis[2] = 0;\n }\n return rad;\n }\n /**\n * Gets the angular distance between two unit quaternions\n * @category Static\n *\n * @param {ReadonlyQuat} a Origin unit quaternion\n * @param {ReadonlyQuat} b Destination unit quaternion\n * @return {Number} Angle, in radians, between the two quaternions\n */\n static getAngle(a, b) {\n const dotproduct = _Quat.dot(a, b);\n return Math.acos(2 * dotproduct * dotproduct - 1);\n }\n /**\n * Multiplies two quaternions.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n }\n /**\n * Rotates a quaternion by the given angle about the X axis\n * @category Static\n *\n * @param out - quat receiving operation result\n * @param a - quat to rotate\n * @param rad - angle (in radians) to rotate\n * @returns `out`\n */\n static rotateX(out, a, rad) {\n rad *= 0.5;\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n const bx = Math.sin(rad);\n const bw = Math.cos(rad);\n out[0] = ax * bw + aw * bx;\n out[1] = ay * bw + az * bx;\n out[2] = az * bw - ay * bx;\n out[3] = aw * bw - ax * bx;\n return out;\n }\n /**\n * Rotates a quaternion by the given angle about the Y axis\n * @category Static\n *\n * @param out - quat receiving operation result\n * @param a - quat to rotate\n * @param rad - angle (in radians) to rotate\n * @returns `out`\n */\n static rotateY(out, a, rad) {\n rad *= 0.5;\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n const by = Math.sin(rad);\n const bw = Math.cos(rad);\n out[0] = ax * bw - az * by;\n out[1] = ay * bw + aw * by;\n out[2] = az * bw + ax * by;\n out[3] = aw * bw - ay * by;\n return out;\n }\n /**\n * Rotates a quaternion by the given angle about the Z axis\n * @category Static\n *\n * @param out - quat receiving operation result\n * @param a - quat to rotate\n * @param rad - angle (in radians) to rotate\n * @returns `out`\n */\n static rotateZ(out, a, rad) {\n rad *= 0.5;\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n const bz = Math.sin(rad);\n const bw = Math.cos(rad);\n out[0] = ax * bw + ay * bz;\n out[1] = ay * bw - ax * bz;\n out[2] = az * bw + aw * bz;\n out[3] = aw * bw - az * bz;\n return out;\n }\n /**\n * Calculates the W component of a quat from the X, Y, and Z components.\n * Assumes that quaternion is 1 unit in length.\n * Any existing W component will be ignored.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quat to calculate W component of\n * @returns `out`\n */\n static calculateW(out, a) {\n const x = a[0], y = a[1], z = a[2];\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = Math.sqrt(Math.abs(1 - x * x - y * y - z * z));\n return out;\n }\n /**\n * Calculate the exponential of a unit quaternion.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quat to calculate the exponential of\n * @returns `out`\n */\n static exp(out, a) {\n const x = a[0], y = a[1], z = a[2], w = a[3];\n const r = Math.sqrt(x * x + y * y + z * z);\n const et = Math.exp(w);\n const s = r > 0 ? et * Math.sin(r) / r : 0;\n out[0] = x * s;\n out[1] = y * s;\n out[2] = z * s;\n out[3] = et * Math.cos(r);\n return out;\n }\n /**\n * Calculate the natural logarithm of a unit quaternion.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quat to calculate the exponential of\n * @returns `out`\n */\n static ln(out, a) {\n const x = a[0], y = a[1], z = a[2], w = a[3];\n const r = Math.sqrt(x * x + y * y + z * z);\n const t = r > 0 ? Math.atan2(r, w) / r : 0;\n out[0] = x * t;\n out[1] = y * t;\n out[2] = z * t;\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\n return out;\n }\n /**\n * Calculate the scalar power of a unit quaternion.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quat to calculate the exponential of\n * @param b - amount to scale the quaternion by\n * @returns `out`\n */\n static pow(out, a, b) {\n _Quat.ln(out, a);\n _Quat.scale(out, out, b);\n _Quat.exp(out, out);\n return out;\n }\n /**\n * Performs a spherical linear interpolation between two quat\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static slerp(out, a, b, t) {\n const ax = a[0], ay = a[1], az = a[2], aw = a[3];\n let bx = b[0], by = b[1], bz = b[2], bw = b[3];\n let scale0;\n let scale1;\n let cosom = ax * bx + ay * by + az * bz + aw * bw;\n if (cosom < 0) {\n cosom = -cosom;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n if (1 - cosom > GLM_EPSILON) {\n const omega = Math.acos(cosom);\n const sinom = Math.sin(omega);\n scale0 = Math.sin((1 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n } else {\n scale0 = 1 - t;\n scale1 = t;\n }\n out[0] = scale0 * ax + scale1 * bx;\n out[1] = scale0 * ay + scale1 * by;\n out[2] = scale0 * az + scale1 * bz;\n out[3] = scale0 * aw + scale1 * bw;\n return out;\n }\n /**\n * Generates a random unit quaternion\n * @category Static\n *\n * @param out - the receiving quaternion\n * @returns `out`\n */\n /* static random(out: QuatLike): QuatLike {\n // Implementation of http://planning.cs.uiuc.edu/node198.html\n // TODO: Calling random 3 times is probably not the fastest solution\n let u1 = glMatrix.RANDOM();\n let u2 = glMatrix.RANDOM();\n let u3 = glMatrix.RANDOM();\n \n let sqrt1MinusU1 = Math.sqrt(1 - u1);\n let sqrtU1 = Math.sqrt(u1);\n \n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\n return out;\n }*/\n /**\n * Calculates the inverse of a quat\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quat to calculate inverse of\n * @returns `out`\n */\n static invert(out, a) {\n const a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3];\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1 / dot : 0;\n out[0] = -a0 * invDot;\n out[1] = -a1 * invDot;\n out[2] = -a2 * invDot;\n out[3] = a3 * invDot;\n return out;\n }\n /**\n * Calculates the conjugate of a quat\n * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quat to calculate conjugate of\n * @returns `out`\n */\n static conjugate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n return out;\n }\n /**\n * Creates a quaternion from the given 3x3 rotation matrix.\n *\n * NOTE: The resultant quaternion is not normalized, so you should be sure\n * to re-normalize the quaternion yourself where necessary.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param m - rotation matrix\n * @returns `out`\n */\n static fromMat3(out, m) {\n const fTrace = m[0] + m[4] + m[8];\n let fRoot;\n if (fTrace > 0) {\n fRoot = Math.sqrt(fTrace + 1);\n out[3] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot;\n out[0] = (m[5] - m[7]) * fRoot;\n out[1] = (m[6] - m[2]) * fRoot;\n out[2] = (m[1] - m[3]) * fRoot;\n } else {\n let i = 0;\n if (m[4] > m[0]) {\n i = 1;\n }\n if (m[8] > m[i * 3 + i]) {\n i = 2;\n }\n const j = (i + 1) % 3;\n const k = (i + 2) % 3;\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1);\n out[i] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot;\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\n }\n return out;\n }\n /**\n * Creates a quaternion from the given euler angle x, y, z.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param x - Angle to rotate around X axis in degrees.\n * @param y - Angle to rotate around Y axis in degrees.\n * @param z - Angle to rotate around Z axis in degrees.\n * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx.\n * @returns `out`\n */\n static fromEuler(out, x, y, z, order = __privateGet(_Quat, _DEFAULT_ANGLE_ORDER)) {\n const halfToRad = 0.5 * Math.PI / 180;\n x *= halfToRad;\n y *= halfToRad;\n z *= halfToRad;\n const sx = Math.sin(x);\n const cx = Math.cos(x);\n const sy = Math.sin(y);\n const cy = Math.cos(y);\n const sz = Math.sin(z);\n const cz = Math.cos(z);\n switch (order) {\n case \"xyz\":\n out[0] = sx * cy * cz + cx * sy * sz;\n out[1] = cx * sy * cz - sx * cy * sz;\n out[2] = cx * cy * sz + sx * sy * cz;\n out[3] = cx * cy * cz - sx * sy * sz;\n break;\n case \"xzy\":\n out[0] = sx * cy * cz - cx * sy * sz;\n out[1] = cx * sy * cz - sx * cy * sz;\n out[2] = cx * cy * sz + sx * sy * cz;\n out[3] = cx * cy * cz + sx * sy * sz;\n break;\n case \"yxz\":\n out[0] = sx * cy * cz + cx * sy * sz;\n out[1] = cx * sy * cz - sx * cy * sz;\n out[2] = cx * cy * sz - sx * sy * cz;\n out[3] = cx * cy * cz + sx * sy * sz;\n break;\n case \"yzx\":\n out[0] = sx * cy * cz + cx * sy * sz;\n out[1] = cx * sy * cz + sx * cy * sz;\n out[2] = cx * cy * sz - sx * sy * cz;\n out[3] = cx * cy * cz - sx * sy * sz;\n break;\n case \"zxy\":\n out[0] = sx * cy * cz - cx * sy * sz;\n out[1] = cx * sy * cz + sx * cy * sz;\n out[2] = cx * cy * sz + sx * sy * cz;\n out[3] = cx * cy * cz - sx * sy * sz;\n break;\n case \"zyx\":\n out[0] = sx * cy * cz - cx * sy * sz;\n out[1] = cx * sy * cz + sx * cy * sz;\n out[2] = cx * cy * sz - sx * sy * cz;\n out[3] = cx * cy * cz + sx * sy * sz;\n break;\n default:\n throw new Error(`Unknown angle order ${order}`);\n }\n return out;\n }\n /**\n * Returns a string representation of a quatenion\n * @category Static\n *\n * @param a - vector to represent as a string\n * @returns string representation of the vector\n */\n static str(a) {\n return `Quat(${a.join(\", \")})`;\n }\n /**\n * Creates a new quat initialized with values from an existing quaternion\n * @category Static\n *\n * @param a - quaternion to clone\n * @returns a new quaternion\n */\n static clone(a) {\n return new _Quat(a);\n }\n /**\n * Creates a new quat initialized with the given values\n * @category Static\n *\n * @param x - X component\n * @param y - Y component\n * @param z - Z component\n * @param w - W component\n * @returns a new quaternion\n */\n static fromValues(x, y, z, w) {\n return new _Quat(x, y, z, w);\n }\n /**\n * Copy the values from one quat to another\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - the source quaternion\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n }\n /**\n * Set the components of a {@link Quat} to the given values\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param x - X component\n * @param y - Y component\n * @param z - Z component\n * @param w - W component\n * @returns `out`\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static set(out, x, y, z, w) {\n return out;\n }\n /**\n * Adds two {@link Quat}'s\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static add(out, a, b) {\n return out;\n }\n /**\n * Alias for {@link Quat.multiply}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static mul(out, a, b) {\n return out;\n }\n /**\n * Scales a quat by a scalar number\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to scale\n * @param b - amount to scale the vector by\n * @returns `out`\n */\n static scale(out, a, scale) {\n out[0] = a[0] * scale;\n out[1] = a[1] * scale;\n out[2] = a[2] * scale;\n out[3] = a[3] * scale;\n return out;\n }\n /**\n * Calculates the dot product of two quat's\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns dot product of a and b\n */\n static dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n }\n /**\n * Performs a linear interpolation between two quat's\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static lerp(out, a, b, t) {\n return out;\n }\n /**\n * Calculates the magnitude (length) of a {@link Quat}\n * @category Static\n *\n * @param a - quaternion to calculate length of\n * @returns length of `a`\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static magnitude(a) {\n return 0;\n }\n /**\n * Alias for {@link Quat.magnitude}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static mag(a) {\n return 0;\n }\n /**\n * Alias for {@link Quat.magnitude}\n * @category Static\n * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs\n */\n // Length conflicts with Function.length\n static length(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Alias for {@link Quat.magnitude}\n * @category Static\n * @deprecated Use {@link Quat.mag}\n */\n static len(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Calculates the squared length of a {@link Quat}\n * @category Static\n *\n * @param a - quaternion to calculate squared length of\n * @returns squared length of a\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static squaredLength(a) {\n return 0;\n }\n /**\n * Alias for {@link Quat.squaredLength}\n * @category Static\n */\n static sqrLen(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Normalize a {@link Quat}\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quaternion to normalize\n * @returns `out`\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static normalize(out, a) {\n return out;\n }\n /**\n * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first quaternion.\n * @param b - The second quaternion.\n * @returns True if the vectors are equal, false otherwise.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static exactEquals(a, b) {\n return false;\n }\n /**\n * Returns whether the quaternions have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static equals(a, b) {\n return false;\n }\n /**\n * Sets a quaternion to represent the shortest rotation from one\n * vector to another.\n *\n * Both vectors are assumed to be unit length.\n * @category Static\n *\n * @param out - the receiving quaternion.\n * @param a - the initial vector\n * @param b - the destination vector\n * @returns `out`\n */\n static rotationTo(out, a, b) {\n const dot = Vec3.dot(a, b);\n if (dot < -0.999999) {\n Vec3.cross(__privateGet(_Quat, _TMP_VEC32), __privateGet(_Quat, _X_UNIT_VEC3), a);\n if (Vec3.mag(__privateGet(_Quat, _TMP_VEC32)) < 1e-6) {\n Vec3.cross(__privateGet(_Quat, _TMP_VEC32), __privateGet(_Quat, _Y_UNIT_VEC3), a);\n }\n Vec3.normalize(__privateGet(_Quat, _TMP_VEC32), __privateGet(_Quat, _TMP_VEC32));\n _Quat.setAxisAngle(out, __privateGet(_Quat, _TMP_VEC32), Math.PI);\n return out;\n } else if (dot > 0.999999) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n } else {\n Vec3.cross(__privateGet(_Quat, _TMP_VEC32), a, b);\n out[0] = __privateGet(_Quat, _TMP_VEC32)[0];\n out[1] = __privateGet(_Quat, _TMP_VEC32)[1];\n out[2] = __privateGet(_Quat, _TMP_VEC32)[2];\n out[3] = 1 + dot;\n return _Quat.normalize(out, out);\n }\n }\n /**\n * Performs a spherical linear interpolation with two control points\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @param c - the third operand\n * @param d - the fourth operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static sqlerp(out, a, b, c, d, t) {\n _Quat.slerp(__privateGet(_Quat, _TMP_QUAT1), a, d, t);\n _Quat.slerp(__privateGet(_Quat, _TMP_QUAT2), b, c, t);\n _Quat.slerp(out, __privateGet(_Quat, _TMP_QUAT1), __privateGet(_Quat, _TMP_QUAT2), 2 * t * (1 - t));\n return out;\n }\n /**\n * Sets the specified quaternion with values corresponding to the given\n * axes. Each axis is a vec3 and is expected to be unit length and\n * perpendicular to all other specified axes.\n * @category Static\n *\n * @param out - The receiving quaternion\n * @param view - the vector representing the viewing direction\n * @param right - the vector representing the local `right` direction\n * @param up - the vector representing the local `up` direction\n * @returns `out`\n */\n static setAxes(out, view, right, up) {\n __privateGet(_Quat, _TMP_MAT3)[0] = right[0];\n __privateGet(_Quat, _TMP_MAT3)[3] = right[1];\n __privateGet(_Quat, _TMP_MAT3)[6] = right[2];\n __privateGet(_Quat, _TMP_MAT3)[1] = up[0];\n __privateGet(_Quat, _TMP_MAT3)[4] = up[1];\n __privateGet(_Quat, _TMP_MAT3)[7] = up[2];\n __privateGet(_Quat, _TMP_MAT3)[2] = -view[0];\n __privateGet(_Quat, _TMP_MAT3)[5] = -view[1];\n __privateGet(_Quat, _TMP_MAT3)[8] = -view[2];\n return _Quat.normalize(out, _Quat.fromMat3(out, __privateGet(_Quat, _TMP_MAT3)));\n }\n};\n_DEFAULT_ANGLE_ORDER = new WeakMap();\n_TMP_QUAT1 = new WeakMap();\n_TMP_QUAT2 = new WeakMap();\n_TMP_MAT3 = new WeakMap();\n_TMP_VEC32 = new WeakMap();\n_X_UNIT_VEC3 = new WeakMap();\n_Y_UNIT_VEC3 = new WeakMap();\n__privateAdd(_Quat, _DEFAULT_ANGLE_ORDER, \"zyx\");\n// Temporary variables to prevent repeated allocations in the algorithms within Quat.\n// These are declared as TypedArrays to aid in tree-shaking.\n__privateAdd(_Quat, _TMP_QUAT1, new Float32Array(4));\n__privateAdd(_Quat, _TMP_QUAT2, new Float32Array(4));\n__privateAdd(_Quat, _TMP_MAT3, new Float32Array(9));\n__privateAdd(_Quat, _TMP_VEC32, new Float32Array(3));\n__privateAdd(_Quat, _X_UNIT_VEC3, new Float32Array([1, 0, 0]));\n__privateAdd(_Quat, _Y_UNIT_VEC3, new Float32Array([0, 1, 0]));\nvar Quat = _Quat;\nQuat.set = Vec4.set;\nQuat.add = Vec4.add;\nQuat.lerp = Vec4.lerp;\nQuat.normalize = Vec4.normalize;\nQuat.squaredLength = Vec4.squaredLength;\nQuat.sqrLen = Vec4.squaredLength;\nQuat.exactEquals = Vec4.exactEquals;\nQuat.equals = Vec4.equals;\nQuat.magnitude = Vec4.magnitude;\nQuat.prototype.mul = Quat.prototype.multiply;\nQuat.mul = Quat.multiply;\nQuat.mag = Quat.magnitude;\nQuat.length = Quat.magnitude;\nQuat.len = Quat.magnitude;\n\n// src/_lib/f32/Quat2.ts\nvar _TMP_QUAT, _TMP_VEC33;\nvar _Quat2 = class _Quat2 extends Float32Array {\n /**\n * Create a {@link Quat2}.\n *\n * @category Constructor\n */\n constructor(...values) {\n switch (values.length) {\n case 8:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 8);\n break;\n case 1: {\n const v = values[0];\n if (typeof v === \"number\") {\n super([v, v, v, v, v, v, v, v]);\n } else {\n super(v, 0, 8);\n }\n break;\n }\n default:\n super(8);\n this[3] = 1;\n break;\n }\n }\n // ============\n // Accessors\n // ============\n /**\n * A string representation of `this`\n * Equivalent to `Quat2.str(this);`\n *\n * @category Accessors\n */\n get str() {\n return _Quat2.str(this);\n }\n // ===================\n // Instances methods\n // ===================\n /**\n * Copy the values from another {@link Quat2} into `this`.\n * @category Methods\n *\n * @param a the source dual quaternion\n * @returns `this`\n */\n copy(a) {\n super.set(a);\n return this;\n }\n // ===================\n // Static accessors\n // ===================\n /**\n * @category Static\n *\n * @returns The number of bytes in a {@link Quat2}.\n */\n static get BYTE_LENGTH() {\n return 8 * Float32Array.BYTES_PER_ELEMENT;\n }\n // ===================\n // Static methods\n // ===================\n /**\n * Creates a new identity {@link Quat2}\n * @category Static\n *\n * @returns a new dual quaternion [real -> rotation, dual -> translation]\n */\n static create() {\n return new _Quat2();\n }\n /**\n * Creates a {@link Quat2} quat initialized with values from an existing quaternion\n * @category Static\n *\n * @param a - dual quaternion to clone\n * @returns a new dual quaternion\n */\n static clone(a) {\n return new _Quat2(a);\n }\n /**\n * Creates a new {@link Quat2} initialized with the given values\n * @category Static\n *\n * @param x1 - 1st X component\n * @param y1 - 1st Y component\n * @param z1 - 1st Z component\n * @param w1 - 1st W component\n * @param x2 - 2nd X component\n * @param y2 - 2nd Y component\n * @param z2 - 2nd Z component\n * @param w2 - 2nd W component\n * @returns a new dual quaternion\n */\n static fromValues(x1, y1, z1, w1, x2, y2, z2, w2) {\n return new _Quat2(x1, y1, z1, w1, x2, y2, z2, w2);\n }\n /**\n * Creates a new {@link Quat2} from the given values (quat and translation)\n * @category Static\n *\n * @param x1 - X component (rotation)\n * @param y1 - Y component (rotation)\n * @param z1 - Z component (rotation)\n * @param w1 - W component (rotation)\n * @param x2 - X component (translation)\n * @param y2 - Y component (translation)\n * @param z2 - Z component (translation)\n * @returns a new dual quaternion\n */\n static fromRotationTranslationValues(x1, y1, z1, w1, x2, y2, z2) {\n const ax = x2 * 0.5;\n const ay = y2 * 0.5;\n const az = z2 * 0.5;\n return new _Quat2(\n x1,\n y1,\n z1,\n w1,\n ax * w1 + ay * z1 - az * y1,\n ay * w1 + az * x1 - ax * z1,\n az * w1 + ax * y1 - ay * x1,\n -ax * x1 - ay * y1 - az * z1\n );\n }\n /**\n * Sets a {@link Quat2} from a quaternion and a translation\n * @category Static\n *\n * @param out - dual quaternion receiving operation result\n * @param q - a normalized quaternion\n * @param t - translation vector\n * @returns `out`\n */\n static fromRotationTranslation(out, q, t) {\n const ax = t[0] * 0.5;\n const ay = t[1] * 0.5;\n const az = t[2] * 0.5;\n const bx = q[0];\n const by = q[1];\n const bz = q[2];\n const bw = q[3];\n out[0] = bx;\n out[1] = by;\n out[2] = bz;\n out[3] = bw;\n out[4] = ax * bw + ay * bz - az * by;\n out[5] = ay * bw + az * bx - ax * bz;\n out[6] = az * bw + ax * by - ay * bx;\n out[7] = -ax * bx - ay * by - az * bz;\n return out;\n }\n /**\n * Sets a {@link Quat2} from a translation\n * @category Static\n *\n * @param out - dual quaternion receiving operation result\n * @param t - translation vector\n * @returns `out`\n */\n static fromTranslation(out, t) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = t[0] * 0.5;\n out[5] = t[1] * 0.5;\n out[6] = t[2] * 0.5;\n out[7] = 0;\n return out;\n }\n /**\n * Sets a {@link Quat2} from a quaternion\n * @category Static\n *\n * @param out - dual quaternion receiving operation result\n * @param q - a normalized quaternion\n * @returns `out`\n */\n static fromRotation(out, q) {\n out[0] = q[0];\n out[1] = q[1];\n out[2] = q[2];\n out[3] = q[3];\n out[4] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n return out;\n }\n /**\n * Sets a {@link Quat2} from a quaternion\n * @category Static\n *\n * @param out - dual quaternion receiving operation result\n * @param a - the matrix\n * @returns `out`\n */\n static fromMat4(out, a) {\n Mat4.getRotation(__privateGet(_Quat2, _TMP_QUAT), a);\n Mat4.getTranslation(__privateGet(_Quat2, _TMP_VEC33), a);\n return _Quat2.fromRotationTranslation(out, __privateGet(_Quat2, _TMP_QUAT), __privateGet(_Quat2, _TMP_VEC33));\n }\n /**\n * Copy the values from one {@link Quat2} to another\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the source dual quaternion\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n return out;\n }\n /**\n * Set a {@link Quat2} to the identity dual quaternion\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @returns `out`\n */\n static identity(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n return out;\n }\n /**\n * Set the components of a {@link Quat2} to the given values\n * @category Static\n *\n * @param out - the receiving vector\n * @param x1 - 1st X component\n * @param y1 - 1st Y component\n * @param z1 - 1st Z component\n * @param w1 - 1st W component\n * @param x2 - 2nd X component\n * @param y2 - 2nd Y component\n * @param z2 - 2nd Z component\n * @param w2 - 2nd W component\n * @returns `out`\n */\n static set(out, x1, y1, z1, w1, x2, y2, z2, w2) {\n out[0] = x1;\n out[1] = y1;\n out[2] = z1;\n out[3] = w1;\n out[4] = x2;\n out[5] = y2;\n out[6] = z2;\n out[7] = w2;\n return out;\n }\n /**\n * Gets the real part of a dual quat\n * @category Static\n *\n * @param out - real part\n * @param a - Dual Quaternion\n * @return `out`\n */\n static getReal(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n }\n /**\n * Gets the dual part of a dual quat\n * @category Static\n *\n * @param out - dual part\n * @param a - Dual Quaternion\n * @return `out`\n */\n static getDual(out, a) {\n out[0] = a[4];\n out[1] = a[5];\n out[2] = a[6];\n out[3] = a[7];\n return out;\n }\n /**\n * Set the real component of a {@link Quat2} to the given quaternion\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - a quaternion representing the real part\n * @return `out`\n */\n static setReal(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n }\n /**\n * Set the dual component of a {@link Quat2} to the given quaternion\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - a quaternion representing the dual part\n * @return `out`\n */\n static setDual(out, a) {\n out[4] = a[0];\n out[5] = a[1];\n out[6] = a[2];\n out[7] = a[3];\n return out;\n }\n /**\n * Gets the translation of a normalized {@link Quat2}\n * @category Static\n *\n * @param out - the receiving translation vector\n * @param a - Dual Quaternion to be decomposed\n * @return `out`\n */\n static getTranslation(out, a) {\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n const bx = -a[0];\n const by = -a[1];\n const bz = -a[2];\n const bw = a[3];\n out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n return out;\n }\n /**\n * Translates a {@link Quat2} by the given vector\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the dual quaternion to translate\n * @param v - vector to translate by\n * @returns `out`\n */\n static translate(out, a, v) {\n const ax1 = a[0];\n const ay1 = a[1];\n const az1 = a[2];\n const aw1 = a[3];\n const bx1 = v[0] * 0.5;\n const by1 = v[1] * 0.5;\n const bz1 = v[2] * 0.5;\n const ax2 = a[4];\n const ay2 = a[5];\n const az2 = a[6];\n const aw2 = a[7];\n out[0] = ax1;\n out[1] = ay1;\n out[2] = az1;\n out[3] = aw1;\n out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2;\n out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2;\n out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2;\n out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2;\n return out;\n }\n /**\n * Rotates a {@link Quat2} around the X axis\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the dual quaternion to rotate\n * @param rad - angle (in radians) to rotate\n * @returns `out`\n */\n static rotateX(out, a, rad) {\n let bx = -a[0];\n let by = -a[1];\n let bz = -a[2];\n let bw = a[3];\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\n Quat.rotateX(out, a, rad);\n bx = out[0];\n by = out[1];\n bz = out[2];\n bw = out[3];\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n return out;\n }\n /**\n * Rotates a {@link Quat2} around the Y axis\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the dual quaternion to rotate\n * @param rad - angle (in radians) to rotate\n * @returns `out`\n */\n static rotateY(out, a, rad) {\n let bx = -a[0];\n let by = -a[1];\n let bz = -a[2];\n let bw = a[3];\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\n Quat.rotateY(out, a, rad);\n bx = out[0];\n by = out[1];\n bz = out[2];\n bw = out[3];\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n return out;\n }\n /**\n * Rotates a {@link Quat2} around the Z axis\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the dual quaternion to rotate\n * @param rad - angle (in radians) to rotate\n * @returns `out`\n */\n static rotateZ(out, a, rad) {\n let bx = -a[0];\n let by = -a[1];\n let bz = -a[2];\n let bw = a[3];\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\n Quat.rotateZ(out, a, rad);\n bx = out[0];\n by = out[1];\n bz = out[2];\n bw = out[3];\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n return out;\n }\n /**\n * Rotates a {@link Quat2} by a given quaternion (a * q)\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the dual quaternion to rotate\n * @param q - quaternion to rotate by\n * @returns `out`\n */\n static rotateByQuatAppend(out, a, q) {\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n let ax = a[0];\n let ay = a[1];\n let az = a[2];\n let aw = a[3];\n out[0] = ax * qw + aw * qx + ay * qz - az * qy;\n out[1] = ay * qw + aw * qy + az * qx - ax * qz;\n out[2] = az * qw + aw * qz + ax * qy - ay * qx;\n out[3] = aw * qw - ax * qx - ay * qy - az * qz;\n ax = a[4];\n ay = a[5];\n az = a[6];\n aw = a[7];\n out[4] = ax * qw + aw * qx + ay * qz - az * qy;\n out[5] = ay * qw + aw * qy + az * qx - ax * qz;\n out[6] = az * qw + aw * qz + ax * qy - ay * qx;\n out[7] = aw * qw - ax * qx - ay * qy - az * qz;\n return out;\n }\n /**\n * Rotates a {@link Quat2} by a given quaternion (q * a)\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param q - quaternion to rotate by\n * @param a - the dual quaternion to rotate\n * @returns `out`\n */\n static rotateByQuatPrepend(out, q, a) {\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n let bx = a[0];\n let by = a[1];\n let bz = a[2];\n let bw = a[3];\n out[0] = qx * bw + qw * bx + qy * bz - qz * by;\n out[1] = qy * bw + qw * by + qz * bx - qx * bz;\n out[2] = qz * bw + qw * bz + qx * by - qy * bx;\n out[3] = qw * bw - qx * bx - qy * by - qz * bz;\n bx = a[4];\n by = a[5];\n bz = a[6];\n bw = a[7];\n out[4] = qx * bw + qw * bx + qy * bz - qz * by;\n out[5] = qy * bw + qw * by + qz * bx - qx * bz;\n out[6] = qz * bw + qw * bz + qx * by - qy * bx;\n out[7] = qw * bw - qx * bx - qy * by - qz * bz;\n return out;\n }\n /**\n * Rotates a {@link Quat2} around a given axis. Does the normalization automatically\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the dual quaternion to rotate\n * @param axis - the axis to rotate around\n * @param rad - how far the rotation should be\n * @returns `out`\n */\n static rotateAroundAxis(out, a, axis, rad) {\n if (Math.abs(rad) < GLM_EPSILON) {\n return _Quat2.copy(out, a);\n }\n const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);\n rad *= 0.5;\n const s = Math.sin(rad);\n const bx = s * axis[0] / axisLength;\n const by = s * axis[1] / axisLength;\n const bz = s * axis[2] / axisLength;\n const bw = Math.cos(rad);\n const ax1 = a[0];\n const ay1 = a[1];\n const az1 = a[2];\n const aw1 = a[3];\n out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n out[4] = ax * bw + aw * bx + ay * bz - az * by;\n out[5] = ay * bw + aw * by + az * bx - ax * bz;\n out[6] = az * bw + aw * bz + ax * by - ay * bx;\n out[7] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n }\n /**\n * Adds two {@link Quat2}s\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n return out;\n }\n /**\n * Multiplies two {@link Quat2}s\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @returns {quat2} out\n */\n static multiply(out, a, b) {\n const ax0 = a[0];\n const ay0 = a[1];\n const az0 = a[2];\n const aw0 = a[3];\n const bx1 = b[4];\n const by1 = b[5];\n const bz1 = b[6];\n const bw1 = b[7];\n const ax1 = a[4];\n const ay1 = a[5];\n const az1 = a[6];\n const aw1 = a[7];\n const bx0 = b[0];\n const by0 = b[1];\n const bz0 = b[2];\n const bw0 = b[3];\n out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0;\n out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0;\n out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0;\n out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0;\n out[4] = ax0 * bw1 + aw0 * bx1 + ay0 * bz1 - az0 * by1 + ax1 * bw0 + aw1 * bx0 + ay1 * bz0 - az1 * by0;\n out[5] = ay0 * bw1 + aw0 * by1 + az0 * bx1 - ax0 * bz1 + ay1 * bw0 + aw1 * by0 + az1 * bx0 - ax1 * bz0;\n out[6] = az0 * bw1 + aw0 * bz1 + ax0 * by1 - ay0 * bx1 + az1 * bw0 + aw1 * bz0 + ax1 * by0 - ay1 * bx0;\n out[7] = aw0 * bw1 - ax0 * bx1 - ay0 * by1 - az0 * bz1 + aw1 * bw0 - ax1 * bx0 - ay1 * by0 - az1 * bz0;\n return out;\n }\n /**\n * Alias for {@link Quat2.multiply}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static mul(out, a, b) {\n return out;\n }\n /**\n * Scales a {@link Quat2} by a scalar value\n * @category Static\n *\n * @param out - the receiving dual quaterion\n * @param a - the dual quaternion to scale\n * @param b - scalar value to scale the dual quaterion by\n * @returns `out`\n */\n static scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n return out;\n }\n /**\n * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts)\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns dot product of a and b\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static dot(a, b) {\n return 0;\n }\n /**\n * Performs a linear interpolation between two {@link Quat2}s\n * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`)\n * @category Static\n *\n * @param out - the receiving dual quat\n * @param a - the first operand\n * @param b - the second operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static lerp(out, a, b, t) {\n const mt = 1 - t;\n if (_Quat2.dot(a, b) < 0) {\n t = -t;\n }\n out[0] = a[0] * mt + b[0] * t;\n out[1] = a[1] * mt + b[1] * t;\n out[2] = a[2] * mt + b[2] * t;\n out[3] = a[3] * mt + b[3] * t;\n out[4] = a[4] * mt + b[4] * t;\n out[5] = a[5] * mt + b[5] * t;\n out[6] = a[6] * mt + b[6] * t;\n out[7] = a[7] * mt + b[7] * t;\n return out;\n }\n /**\n * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - dual quat to calculate inverse of\n * @returns `out`\n */\n static invert(out, a) {\n const sqlen = _Quat2.squaredLength(a);\n out[0] = -a[0] / sqlen;\n out[1] = -a[1] / sqlen;\n out[2] = -a[2] / sqlen;\n out[3] = a[3] / sqlen;\n out[4] = -a[4] / sqlen;\n out[5] = -a[5] / sqlen;\n out[6] = -a[6] / sqlen;\n out[7] = a[7] / sqlen;\n return out;\n }\n /**\n * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than\n * {@link Quat2.invert} and produces the same result.\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - dual quaternion to calculate conjugate of\n * @returns `out`\n */\n static conjugate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n out[4] = -a[4];\n out[5] = -a[5];\n out[6] = -a[6];\n out[7] = a[7];\n return out;\n }\n /**\n * Calculates the magnitude (length) of a {@link Quat2}\n * @category Static\n *\n * @param a - dual quaternion to calculate length of\n * @returns length of `a`\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static magnitude(a) {\n return 0;\n }\n /**\n * Alias for {@link Quat2.magnitude}\n * @category Static\n */\n static mag(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Alias for {@link Quat2.magnitude}\n * @category Static\n * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs\n */\n // Length conflicts with Function.length\n static length(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Alias for {@link Quat2.magnitude}\n * @category Static\n * @deprecated Use {@link Quat2.mag}\n */\n static len(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Calculates the squared length of a {@link Quat2}\n * @category Static\n *\n * @param a - dual quaternion to calculate squared length of\n * @returns squared length of a\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static squaredLength(a) {\n return 0;\n }\n /**\n * Alias for {@link Quat2.squaredLength}\n * @category Static\n */\n static sqrLen(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Normalize a {@link Quat2}\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - dual quaternion to normalize\n * @returns `out`\n */\n static normalize(out, a) {\n let magnitude = _Quat2.squaredLength(a);\n if (magnitude > 0) {\n magnitude = Math.sqrt(magnitude);\n const a0 = a[0] / magnitude;\n const a1 = a[1] / magnitude;\n const a2 = a[2] / magnitude;\n const a3 = a[3] / magnitude;\n const b0 = a[4];\n const b1 = a[5];\n const b2 = a[6];\n const b3 = a[7];\n const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3;\n out[0] = a0;\n out[1] = a1;\n out[2] = a2;\n out[3] = a3;\n out[4] = (b0 - a0 * a_dot_b) / magnitude;\n out[5] = (b1 - a1 * a_dot_b) / magnitude;\n out[6] = (b2 - a2 * a_dot_b) / magnitude;\n out[7] = (b3 - a3 * a_dot_b) / magnitude;\n }\n return out;\n }\n /**\n * Returns a string representation of a {@link Quat2}\n * @category Static\n *\n * @param a - dual quaternion to represent as a string\n * @returns string representation of the vector\n */\n static str(a) {\n return `Quat2(${a.join(\", \")})`;\n }\n /**\n * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first dual quaternion.\n * @param b - The second dual quaternion.\n * @returns True if the dual quaternions are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7];\n }\n /**\n * Returns whether the {@link Quat2}s have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first dual quaternion.\n * @param b - The second dual quaternion.\n * @returns True if the dual quaternions are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const a6 = a[6];\n const a7 = a[7];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\n const b6 = b[6];\n const b7 = b[7];\n return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7));\n }\n};\n_TMP_QUAT = new WeakMap();\n_TMP_VEC33 = new WeakMap();\n// Temporary variables to prevent repeated allocations in the algorithms within Quat2.\n// These are declared as TypedArrays to aid in tree-shaking.\n__privateAdd(_Quat2, _TMP_QUAT, new Float32Array(4));\n__privateAdd(_Quat2, _TMP_VEC33, new Float32Array(3));\nvar Quat2 = _Quat2;\nQuat2.dot = Quat.dot;\nQuat2.squaredLength = Quat.squaredLength;\nQuat2.sqrLen = Quat.squaredLength;\nQuat2.mag = Quat.magnitude;\nQuat2.length = Quat.magnitude;\nQuat2.len = Quat.magnitude;\nQuat2.mul = Quat2.multiply;\n\n// src/_lib/f32/Vec2.ts\nvar Vec2 = class _Vec2 extends Float32Array {\n /**\n * Create a {@link Vec2}.\n *\n * @category Constructor\n */\n constructor(...values) {\n switch (values.length) {\n case 2: {\n const v = values[0];\n if (typeof v === \"number\") {\n super([v, values[1]]);\n } else {\n super(v, values[1], 2);\n }\n break;\n }\n case 1: {\n const v = values[0];\n if (typeof v === \"number\") {\n super([v, v]);\n } else {\n super(v, 0, 2);\n }\n break;\n }\n default:\n super(2);\n break;\n }\n }\n // ============\n // Accessors\n // ============\n // Getters and setters to make component access read better.\n // These are likely to be a little bit slower than direct array access.\n /**\n * The x component of the vector. Equivalent to `this[0];`\n * @category Vector Components\n */\n get x() {\n return this[0];\n }\n set x(value) {\n this[0] = value;\n }\n /**\n * The y component of the vector. Equivalent to `this[1];`\n * @category Vector Components\n */\n get y() {\n return this[1];\n }\n set y(value) {\n this[1] = value;\n }\n // Alternate set of getters and setters in case this is being used to define\n // a color.\n /**\n * The r component of the vector. Equivalent to `this[0];`\n * @category Color Components\n */\n get r() {\n return this[0];\n }\n set r(value) {\n this[0] = value;\n }\n /**\n * The g component of the vector. Equivalent to `this[1];`\n * @category Color Components\n */\n get g() {\n return this[1];\n }\n set g(value) {\n this[1] = value;\n }\n /**\n * The magnitude (length) of this.\n * Equivalent to `Vec2.magnitude(this);`\n *\n * Magnitude is used because the `length` attribute is already defined by\n * TypedArrays to mean the number of elements in the array.\n *\n * @category Accessors\n */\n get magnitude() {\n return Math.hypot(this[0], this[1]);\n }\n /**\n * Alias for {@link Vec2.magnitude}\n *\n * @category Accessors\n */\n get mag() {\n return this.magnitude;\n }\n /**\n * The squared magnitude (length) of `this`.\n * Equivalent to `Vec2.squaredMagnitude(this);`\n *\n * @category Accessors\n */\n get squaredMagnitude() {\n const x = this[0];\n const y = this[1];\n return x * x + y * y;\n }\n /**\n * Alias for {@link Vec2.squaredMagnitude}\n *\n * @category Accessors\n */\n get sqrMag() {\n return this.squaredMagnitude;\n }\n /**\n * A string representation of `this`\n * Equivalent to `Vec2.str(this);`\n *\n * @category Accessors\n */\n get str() {\n return _Vec2.str(this);\n }\n // ===================\n // Instances methods\n // ===================\n /**\n * Copy the values from another {@link Vec2} into `this`.\n * @category Methods\n *\n * @param a the source vector\n * @returns `this`\n */\n copy(a) {\n this.set(a);\n return this;\n }\n // Instead of zero(), use a.fill(0) for instances;\n /**\n * Adds a {@link Vec2} to `this`.\n * Equivalent to `Vec2.add(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to add to `this`\n * @returns `this`\n */\n add(b) {\n this[0] += b[0];\n this[1] += b[1];\n return this;\n }\n /**\n * Subtracts a {@link Vec2} from `this`.\n * Equivalent to `Vec2.subtract(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to subtract from `this`\n * @returns `this`\n */\n subtract(b) {\n this[0] -= b[0];\n this[1] -= b[1];\n return this;\n }\n /**\n * Alias for {@link Vec2.subtract}\n * @category Methods\n */\n sub(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Multiplies `this` by a {@link Vec2}.\n * Equivalent to `Vec2.multiply(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to multiply `this` by\n * @returns `this`\n */\n multiply(b) {\n this[0] *= b[0];\n this[1] *= b[1];\n return this;\n }\n /**\n * Alias for {@link Vec2.multiply}\n * @category Methods\n */\n mul(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Divides `this` by a {@link Vec2}.\n * Equivalent to `Vec2.divide(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to divide `this` by\n * @returns `this`\n */\n divide(b) {\n this[0] /= b[0];\n this[1] /= b[1];\n return this;\n }\n /**\n * Alias for {@link Vec2.divide}\n * @category Methods\n */\n div(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Scales `this` by a scalar number.\n * Equivalent to `Vec2.scale(this, this, b);`\n * @category Methods\n *\n * @param b - Amount to scale `this` by\n * @returns `this`\n */\n scale(b) {\n this[0] *= b;\n this[1] *= b;\n return this;\n }\n /**\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\n * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);`\n * @category Methods\n *\n * @param b - The vector to add to `this`\n * @param scale - The amount to scale `b` by before adding\n * @returns `this`\n */\n scaleAndAdd(b, scale) {\n this[0] += b[0] * scale;\n this[1] += b[1] * scale;\n return this;\n }\n /**\n * Calculates the Euclidean distance between another {@link Vec2} and `this`.\n * Equivalent to `Vec2.distance(this, b);`\n * @category Methods\n *\n * @param b - The vector to calculate the distance to\n * @returns Distance between `this` and `b`\n */\n distance(b) {\n return _Vec2.distance(this, b);\n }\n /**\n * Alias for {@link Vec2.distance}\n * @category Methods\n */\n dist(b) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Calculates the squared Euclidean distance between another {@link Vec2} and `this`.\n * Equivalent to `Vec2.squaredDistance(this, b);`\n * @category Methods\n *\n * @param b The vector to calculate the squared distance to\n * @returns Squared distance between `this` and `b`\n */\n squaredDistance(b) {\n return _Vec2.squaredDistance(this, b);\n }\n /**\n * Alias for {@link Vec2.squaredDistance}\n * @category Methods\n */\n sqrDist(b) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Negates the components of `this`.\n * Equivalent to `Vec2.negate(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n negate() {\n this[0] *= -1;\n this[1] *= -1;\n return this;\n }\n /**\n * Inverts the components of `this`.\n * Equivalent to `Vec2.inverse(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n invert() {\n this[0] = 1 / this[0];\n this[1] = 1 / this[1];\n return this;\n }\n /**\n * Sets each component of `this` to it's absolute value.\n * Equivalent to `Vec2.abs(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n abs() {\n this[0] = Math.abs(this[0]);\n this[1] = Math.abs(this[1]);\n return this;\n }\n /**\n * Calculates the dot product of this and another {@link Vec2}.\n * Equivalent to `Vec2.dot(this, b);`\n * @category Methods\n *\n * @param b - The second operand\n * @returns Dot product of `this` and `b`\n */\n dot(b) {\n return this[0] * b[0] + this[1] * b[1];\n }\n /**\n * Normalize `this`.\n * Equivalent to `Vec2.normalize(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n normalize() {\n return _Vec2.normalize(this, this);\n }\n // ===================\n // Static accessors\n // ===================\n /**\n * @category Static\n *\n * @returns The number of bytes in a {@link Vec2}.\n */\n static get BYTE_LENGTH() {\n return 2 * Float32Array.BYTES_PER_ELEMENT;\n }\n // ===================\n // Static methods\n // ===================\n /**\n * Creates a new, empty {@link Vec2}\n * @category Static\n *\n * @returns A new 2D vector\n */\n static create() {\n return new _Vec2();\n }\n /**\n * Creates a new {@link Vec2} initialized with values from an existing vector\n * @category Static\n *\n * @param a - Vector to clone\n * @returns A new 2D vector\n */\n static clone(a) {\n return new _Vec2(a);\n }\n /**\n * Creates a new {@link Vec2} initialized with the given values\n * @category Static\n *\n * @param x - X component\n * @param y - Y component\n * @returns A new 2D vector\n */\n static fromValues(x, y) {\n return new _Vec2(x, y);\n }\n /**\n * Copy the values from one {@link Vec2} to another\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - The source vector\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n return out;\n }\n /**\n * Set the components of a {@link Vec2} to the given values\n * @category Static\n *\n * @param out - The receiving vector\n * @param x - X component\n * @param y - Y component\n * @returns `out`\n */\n static set(out, x, y) {\n out[0] = x;\n out[1] = y;\n return out;\n }\n /**\n * Adds two {@link Vec2}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n return out;\n }\n /**\n * Subtracts vector b from vector a\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n return out;\n }\n /**\n * Alias for {@link Vec2.subtract}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sub(out, a, b) {\n return [0, 0];\n }\n /**\n * Multiplies two {@link Vec2}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n return out;\n }\n /**\n * Alias for {@link Vec2.multiply}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static mul(out, a, b) {\n return [0, 0];\n }\n /**\n * Divides two {@link Vec2}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n return out;\n }\n /**\n * Alias for {@link Vec2.divide}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static div(out, a, b) {\n return [0, 0];\n }\n /**\n * Math.ceil the components of a {@link Vec2}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to ceil\n * @returns `out`\n */\n static ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n return out;\n }\n /**\n * Math.floor the components of a {@link Vec2}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to floor\n * @returns `out`\n */\n static floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n return out;\n }\n /**\n * Returns the minimum of two {@link Vec2}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n return out;\n }\n /**\n * Returns the maximum of two {@link Vec2}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n return out;\n }\n /**\n * Math.round the components of a {@link Vec2}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to round\n * @returns `out`\n */\n static round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n return out;\n }\n /**\n * Scales a {@link Vec2} by a scalar number\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The vector to scale\n * @param b - Amount to scale the vector by\n * @returns `out`\n */\n static scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n return out;\n }\n /**\n * Adds two Vec2's after scaling the second operand by a scalar value\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @param scale - The amount to scale b by before adding\n * @returns `out`\n */\n static scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n return out;\n }\n /**\n * Calculates the Euclidean distance between two {@link Vec2}s\n * @category Static\n *\n * @param a - The first operand\n * @param b - The second operand\n * @returns distance between `a` and `b`\n */\n static distance(a, b) {\n return Math.hypot(b[0] - a[0], b[1] - a[1]);\n }\n /**\n * Alias for {@link Vec2.distance}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static dist(a, b) {\n return 0;\n }\n /**\n * Calculates the squared Euclidean distance between two {@link Vec2}s\n * @category Static\n *\n * @param a - The first operand\n * @param b - The second operand\n * @returns Squared distance between `a` and `b`\n */\n static squaredDistance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n return x * x + y * y;\n }\n /**\n * Alias for {@link Vec2.distance}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sqrDist(a, b) {\n return 0;\n }\n /**\n * Calculates the magnitude (length) of a {@link Vec2}\n * @category Static\n *\n * @param a - Vector to calculate magnitude of\n * @returns Magnitude of a\n */\n static magnitude(a) {\n const x = a[0];\n const y = a[1];\n return Math.sqrt(x * x + y * y);\n }\n /**\n * Alias for {@link Vec2.magnitude}\n * @category Static\n */\n static mag(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Alias for {@link Vec2.magnitude}\n * @category Static\n * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs\n *\n * @param a - vector to calculate length of\n * @returns length of a\n */\n // Length conflicts with Function.length\n static length(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Alias for {@link Vec2.magnitude}\n * @category Static\n * @deprecated Use {@link Vec2.mag}\n */\n static len(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Calculates the squared length of a {@link Vec2}\n * @category Static\n *\n * @param a - Vector to calculate squared length of\n * @returns Squared length of a\n */\n static squaredLength(a) {\n const x = a[0];\n const y = a[1];\n return x * x + y * y;\n }\n /**\n * Alias for {@link Vec2.squaredLength}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sqrLen(a, b) {\n return 0;\n }\n /**\n * Negates the components of a {@link Vec2}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to negate\n * @returns `out`\n */\n static negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n return out;\n }\n /**\n * Returns the inverse of the components of a {@link Vec2}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to invert\n * @returns `out`\n */\n static inverse(out, a) {\n out[0] = 1 / a[0];\n out[1] = 1 / a[1];\n return out;\n }\n /**\n * Returns the absolute value of the components of a {@link Vec2}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to compute the absolute values of\n * @returns `out`\n */\n static abs(out, a) {\n out[0] = Math.abs(a[0]);\n out[1] = Math.abs(a[1]);\n return out;\n }\n /**\n * Normalize a {@link Vec2}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to normalize\n * @returns `out`\n */\n static normalize(out, a) {\n const x = a[0];\n const y = a[1];\n let len = x * x + y * y;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n return out;\n }\n /**\n * Calculates the dot product of two {@link Vec2}s\n * @category Static\n *\n * @param a - The first operand\n * @param b - The second operand\n * @returns Dot product of `a` and `b`\n */\n static dot(a, b) {\n return a[0] * b[0] + a[1] * b[1];\n }\n /**\n * Computes the cross product of two {@link Vec2}s\n * Note that the cross product must by definition produce a 3D vector.\n * For this reason there is also not instance equivalent for this function.\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static cross(out, a, b) {\n const z = a[0] * b[1] - a[1] * b[0];\n out[0] = out[1] = 0;\n out[2] = z;\n return out;\n }\n /**\n * Performs a linear interpolation between two {@link Vec2}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @param t - Interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static lerp(out, a, b, t) {\n const ax = a[0];\n const ay = a[1];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n return out;\n }\n /**\n * Transforms the {@link Vec2} with a {@link Mat2}\n *\n * @param out - The receiving vector\n * @param a - The vector to transform\n * @param m - Matrix to transform with\n * @returns `out`\n * @category Static\n */\n static transformMat2(out, a, m) {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n return out;\n }\n /**\n * Transforms the {@link Vec2} with a {@link Mat2d}\n *\n * @param out - The receiving vector\n * @param a - The vector to transform\n * @param m - Matrix to transform with\n * @returns `out`\n * @category Static\n */\n static transformMat2d(out, a, m) {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[2] * y + m[4];\n out[1] = m[1] * x + m[3] * y + m[5];\n return out;\n }\n /**\n * Transforms the {@link Vec2} with a {@link Mat3}\n * 3rd vector component is implicitly '1'\n *\n * @param out - The receiving vector\n * @param a - The vector to transform\n * @param m - Matrix to transform with\n * @returns `out`\n * @category Static\n */\n static transformMat3(out, a, m) {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[3] * y + m[6];\n out[1] = m[1] * x + m[4] * y + m[7];\n return out;\n }\n /**\n * Transforms the {@link Vec2} with a {@link Mat4}\n * 3rd vector component is implicitly '0'\n * 4th vector component is implicitly '1'\n *\n * @param out - The receiving vector\n * @param a - The vector to transform\n * @param m - Matrix to transform with\n * @returns `out`\n * @category Static\n */\n static transformMat4(out, a, m) {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[4] * y + m[12];\n out[1] = m[1] * x + m[5] * y + m[13];\n return out;\n }\n /**\n * Rotate a 2D vector\n * @category Static\n *\n * @param out - The receiving {@link Vec2}\n * @param a - The {@link Vec2} point to rotate\n * @param b - The origin of the rotation\n * @param rad - The angle of rotation in radians\n * @returns `out`\n */\n static rotate(out, a, b, rad) {\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 out[0] = p0 * cosC - p1 * sinC + b[0];\n out[1] = p0 * sinC + p1 * cosC + b[1];\n return out;\n }\n /**\n * Get the angle between two 2D vectors\n * @category Static\n *\n * @param a - The first operand\n * @param b - The second operand\n * @returns The angle in radians\n */\n static angle(a, b) {\n const x1 = a[0];\n const y1 = a[1];\n const x2 = b[0];\n const y2 = b[1];\n const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2);\n const cosine = mag && (x1 * x2 + y1 * y2) / mag;\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n }\n /**\n * Set the components of a {@link Vec2} to zero\n * @category Static\n *\n * @param out - The receiving vector\n * @returns `out`\n */\n static zero(out) {\n out[0] = 0;\n out[1] = 0;\n return out;\n }\n /**\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns `true` if the vectors components are ===, `false` otherwise.\n */\n static exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1];\n }\n /**\n * Returns whether the vectors have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns `true` if the vectors are approximately equal, `false` otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const b0 = b[0];\n const b1 = b[1];\n return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1));\n }\n /**\n * Returns a string representation of a vector\n * @category Static\n *\n * @param a - Vector to represent as a string\n * @returns String representation of the vector\n */\n static str(a) {\n return `Vec2(${a.join(\", \")})`;\n }\n};\nVec2.prototype.sub = Vec2.prototype.subtract;\nVec2.prototype.mul = Vec2.prototype.multiply;\nVec2.prototype.div = Vec2.prototype.divide;\nVec2.prototype.dist = Vec2.prototype.distance;\nVec2.prototype.sqrDist = Vec2.prototype.squaredDistance;\nVec2.sub = Vec2.subtract;\nVec2.mul = Vec2.multiply;\nVec2.div = Vec2.divide;\nVec2.dist = Vec2.distance;\nVec2.sqrDist = Vec2.squaredDistance;\nVec2.sqrLen = Vec2.squaredLength;\nVec2.mag = Vec2.magnitude;\nVec2.length = Vec2.magnitude;\nVec2.len = Vec2.magnitude;\n\n// src/swizzle/index.ts\nvar GLM_SWIZZLES_ENABLED_F32 = false;\nfunction EnableSwizzles() {\n if (GLM_SWIZZLES_ENABLED_F32) {\n return;\n }\n const VEC2_SWIZZLES = [\"xx\", \"xy\", \"yx\", \"yy\", \"xxx\", \"xxy\", \"xyx\", \"xyy\", \"yxx\", \"yxy\", \"yyx\", \"yyy\", \"xxxx\", \"xxxy\", \"xxyx\", \"xxyy\", \"xyxx\", \"xyxy\", \"xyyx\", \"xyyy\", \"yxxx\", \"yxxy\", \"yxyx\", \"yxyy\", \"yyxx\", \"yyxy\", \"yyyx\", \"yyyy\", \"rr\", \"rg\", \"gr\", \"gg\", \"rrr\", \"rrg\", \"rgr\", \"rgg\", \"grr\", \"grg\", \"ggr\", \"ggg\", \"rrrr\", \"rrrg\", \"rrgr\", \"rrgg\", \"rgrr\", \"rgrg\", \"rggr\", \"rggg\", \"grrr\", \"grrg\", \"grgr\", \"grgg\", \"ggrr\", \"ggrg\", \"gggr\", \"gggg\"];\n const VEC3_SWIZZLES = [\"xz\", \"yz\", \"zx\", \"zy\", \"zz\", \"xxz\", \"xyz\", \"xzx\", \"xzy\", \"xzz\", \"yxz\", \"yyz\", \"yzx\", \"yzy\", \"yzz\", \"zxx\", \"zxy\", \"zxz\", \"zyx\", \"zyy\", \"zyz\", \"zzx\", \"zzy\", \"zzz\", \"xxxz\", \"xxyz\", \"xxzx\", \"xxzy\", \"xxzz\", \"xyxz\", \"xyyz\", \"xyzx\", \"xyzy\", \"xyzz\", \"xzxx\", \"xzxy\", \"xzxz\", \"xzyx\", \"xzyy\", \"xzyz\", \"xzzx\", \"xzzy\", \"xzzz\", \"yxxz\", \"yxyz\", \"yxzx\", \"yxzy\", \"yxzz\", \"yyxz\", \"yyyz\", \"yyzx\", \"yyzy\", \"yyzz\", \"yzxx\", \"yzxy\", \"yzxz\", \"yzyx\", \"yzyy\", \"yzyz\", \"yzzx\", \"yzzy\", \"yzzz\", \"zxxx\", \"zxxy\", \"zxxz\", \"zxyx\", \"zxyy\", \"zxyz\", \"zxzx\", \"zxzy\", \"zxzz\", \"zyxx\", \"zyxy\", \"zyxz\", \"zyyx\", \"zyyy\", \"zyyz\", \"zyzx\", \"zyzy\", \"zyzz\", \"zzxx\", \"zzxy\", \"zzxz\", \"zzyx\", \"zzyy\", \"zzyz\", \"zzzx\", \"zzzy\", \"zzzz\", \"rb\", \"gb\", \"br\", \"bg\", \"bb\", \"rrb\", \"rgb\", \"rbr\", \"rbg\", \"rbb\", \"grb\", \"ggb\", \"gbr\", \"gbg\", \"gbb\", \"brr\", \"brg\", \"brb\", \"bgr\", \"bgg\", \"bgb\", \"bbr\", \"bbg\", \"bbb\", \"rrrb\", \"rrgb\", \"rrbr\", \"rrbg\", \"rrbb\", \"rgrb\", \"rggb\", \"rgbr\", \"rgbg\", \"rgbb\", \"rbrr\", \"rbrg\", \"rbrb\", \"rbgr\", \"rbgg\", \"rbgb\", \"rbbr\", \"rbbg\", \"rbbb\", \"grrb\", \"grgb\", \"grbr\", \"grbg\", \"grbb\", \"ggrb\", \"gggb\", \"ggbr\", \"ggbg\", \"ggbb\", \"gbrr\", \"gbrg\", \"gbrb\", \"gbgr\", \"gbgg\", \"gbgb\", \"gbbr\", \"gbbg\", \"gbbb\", \"brrr\", \"brrg\", \"brrb\", \"brgr\", \"brgg\", \"brgb\", \"brbr\", \"brbg\", \"brbb\", \"bgrr\", \"bgrg\", \"bgrb\", \"bggr\", \"bggg\", \"bggb\", \"bgbr\", \"bgbg\", \"bgbb\", \"bbrr\", \"bbrg\", \"bbrb\", \"bbgr\", \"bbgg\", \"bbgb\", \"bbbr\", \"bbbg\", \"bbbb\"];\n const VEC4_SWIZZLES = [\"xw\", \"yw\", \"zw\", \"wx\", \"wy\", \"wz\", \"ww\", \"xxw\", \"xyw\", \"xzw\", \"xwx\", \"xwy\", \"xwz\", \"xww\", \"yxw\", \"yyw\", \"yzw\", \"ywx\", \"ywy\", \"ywz\", \"yww\", \"zxw\", \"zyw\", \"zzw\", \"zwx\", \"zwy\", \"zwz\", \"zww\", \"wxx\", \"wxy\", \"wxz\", \"wxw\", \"wyx\", \"wyy\", \"wyz\", \"wyw\", \"wzx\", \"wzy\", \"wzz\", \"wzw\", \"wwx\", \"wwy\", \"wwz\", \"www\", \"xxxw\", \"xxyw\", \"xxzw\", \"xxwx\", \"xxwy\", \"xxwz\", \"xxww\", \"xyxw\", \"xyyw\", \"xyzw\", \"xywx\", \"xywy\", \"xywz\", \"xyww\", \"xzxw\", \"xzyw\", \"xzzw\", \"xzwx\", \"xzwy\", \"xzwz\", \"xzww\", \"xwxx\", \"xwxy\", \"xwxz\", \"xwxw\", \"xwyx\", \"xwyy\", \"xwyz\", \"xwyw\", \"xwzx\", \"xwzy\", \"xwzz\", \"xwzw\", \"xwwx\", \"xwwy\", \"xwwz\", \"xwww\", \"yxxw\", \"yxyw\", \"yxzw\", \"yxwx\", \"yxwy\", \"yxwz\", \"yxww\", \"yyxw\", \"yyyw\", \"yyzw\", \"yywx\", \"yywy\", \"yywz\", \"yyww\", \"yzxw\", \"yzyw\", \"yzzw\", \"yzwx\", \"yzwy\", \"yzwz\", \"yzww\", \"ywxx\", \"ywxy\", \"ywxz\", \"ywxw\", \"ywyx\", \"ywyy\", \"ywyz\", \"ywyw\", \"ywzx\", \"ywzy\", \"ywzz\", \"ywzw\", \"ywwx\", \"ywwy\", \"ywwz\", \"ywww\", \"zxxw\", \"zxyw\", \"zxzw\", \"zxwx\", \"zxwy\", \"zxwz\", \"zxww\", \"zyxw\", \"zyyw\", \"zyzw\", \"zywx\", \"zywy\", \"zywz\", \"zyww\", \"zzxw\", \"zzyw\", \"zzzw\", \"zzwx\", \"zzwy\", \"zzwz\", \"zzww\", \"zwxx\", \"zwxy\", \"zwxz\", \"zwxw\", \"zwyx\", \"zwyy\", \"zwyz\", \"zwyw\", \"zwzx\", \"zwzy\", \"zwzz\", \"zwzw\", \"zwwx\", \"zwwy\", \"zwwz\", \"zwww\", \"wxxx\", \"wxxy\", \"wxxz\", \"wxxw\", \"wxyx\", \"wxyy\", \"wxyz\", \"wxyw\", \"wxzx\", \"wxzy\", \"wxzz\", \"wxzw\", \"wxwx\", \"wxwy\", \"wxwz\", \"wxww\", \"wyxx\", \"wyxy\", \"wyxz\", \"wyxw\", \"wyyx\", \"wyyy\", \"wyyz\", \"wyyw\", \"wyzx\", \"wyzy\", \"wyzz\", \"wyzw\", \"wywx\", \"wywy\", \"wywz\", \"wyww\", \"wzxx\", \"wzxy\", \"wzxz\", \"wzxw\", \"wzyx\", \"wzyy\", \"wzyz\", \"wzyw\", \"wzzx\", \"wzzy\", \"wzzz\", \"wzzw\", \"wzwx\", \"wzwy\", \"wzwz\", \"wzww\", \"wwxx\", \"wwxy\", \"wwxz\", \"wwxw\", \"wwyx\", \"wwyy\", \"wwyz\", \"wwyw\", \"wwzx\", \"wwzy\", \"wwzz\", \"wwzw\", \"wwwx\", \"wwwy\", \"wwwz\", \"wwww\", \"ra\", \"ga\", \"ba\", \"ar\", \"ag\", \"ab\", \"aa\", \"rra\", \"rga\", \"rba\", \"rar\", \"rag\", \"rab\", \"raa\", \"gra\", \"gga\", \"gba\", \"gar\", \"gag\", \"gab\", \"gaa\", \"bra\", \"bga\", \"bba\", \"bar\", \"bag\", \"bab\", \"baa\", \"arr\", \"arg\", \"arb\", \"ara\", \"agr\", \"agg\", \"agb\", \"aga\", \"abr\", \"abg\", \"abb\", \"aba\", \"aar\", \"aag\", \"aab\", \"aaa\", \"rrra\", \"rrga\", \"rrba\", \"rrar\", \"rrag\", \"rrab\", \"rraa\", \"rgra\", \"rgga\", \"rgba\", \"rgar\", \"rgag\", \"rgab\", \"rgaa\", \"rbra\", \"rbga\", \"rbba\", \"rbar\", \"rbag\", \"rbab\", \"rbaa\", \"rarr\", \"rarg\", \"rarb\", \"rara\", \"ragr\", \"ragg\", \"ragb\", \"raga\", \"rabr\", \"rabg\", \"rabb\", \"raba\", \"raar\", \"raag\", \"raab\", \"raaa\", \"grra\", \"grga\", \"grba\", \"grar\", \"grag\", \"grab\", \"graa\", \"ggra\", \"ggga\", \"ggba\", \"ggar\", \"ggag\", \"ggab\", \"ggaa\", \"gbra\", \"gbga\", \"gbba\", \"gbar\", \"gbag\", \"gbab\", \"gbaa\", \"garr\", \"garg\", \"garb\", \"gara\", \"gagr\", \"gagg\", \"gagb\", \"gaga\", \"gabr\", \"gabg\", \"gabb\", \"gaba\", \"gaar\", \"gaag\", \"gaab\", \"gaaa\", \"brra\", \"brga\", \"brba\", \"brar\", \"brag\", \"brab\", \"braa\", \"bgra\", \"bgga\", \"bgba\", \"bgar\", \"bgag\", \"bgab\", \"bgaa\", \"bbra\", \"bbga\", \"bbba\", \"bbar\", \"bbag\", \"bbab\", \"bbaa\", \"barr\", \"barg\", \"barb\", \"bara\", \"bagr\", \"bagg\", \"bagb\", \"baga\", \"babr\", \"babg\", \"babb\", \"baba\", \"baar\", \"baag\", \"baab\", \"baaa\", \"arrr\", \"arrg\", \"arrb\", \"arra\", \"argr\", \"argg\", \"argb\", \"arga\", \"arbr\", \"arbg\", \"arbb\", \"arba\", \"arar\", \"arag\", \"arab\", \"araa\", \"agrr\", \"agrg\", \"agrb\", \"agra\", \"aggr\", \"aggg\", \"aggb\", \"agga\", \"agbr\", \"agbg\", \"agbb\", \"agba\", \"agar\", \"agag\", \"agab\", \"agaa\", \"abrr\", \"abrg\", \"abrb\", \"abra\", \"abgr\", \"abgg\", \"abgb\", \"abga\", \"abbr\", \"abbg\", \"abbb\", \"abba\", \"abar\", \"abag\", \"abab\", \"abaa\", \"aarr\", \"aarg\", \"aarb\", \"aara\", \"aagr\", \"aagg\", \"aagb\", \"aaga\", \"aabr\", \"aabg\", \"aabb\", \"aaba\", \"aaar\", \"aaag\", \"aaab\", \"aaaa\"];\n const SWIZZLE_INDEX = {\n x: 0,\n r: 0,\n y: 1,\n g: 1,\n z: 2,\n b: 2,\n w: 3,\n a: 3\n };\n function getSwizzleImpl(swizzle) {\n switch (swizzle.length) {\n case 2:\n return function() {\n return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]);\n };\n case 3:\n return function() {\n return new Vec3(\n this[SWIZZLE_INDEX[swizzle[0]]],\n this[SWIZZLE_INDEX[swizzle[1]]],\n this[SWIZZLE_INDEX[swizzle[2]]]\n );\n };\n case 4:\n return function() {\n return new Vec4(\n this[SWIZZLE_INDEX[swizzle[0]]],\n this[SWIZZLE_INDEX[swizzle[1]]],\n this[SWIZZLE_INDEX[swizzle[2]]],\n this[SWIZZLE_INDEX[swizzle[3]]]\n );\n };\n }\n throw new Error(\"Illegal swizzle length\");\n }\n for (const swizzle of VEC2_SWIZZLES) {\n const impl = getSwizzleImpl(swizzle);\n Object.defineProperty(Vec2.prototype, swizzle, {\n get: impl\n });\n Object.defineProperty(Vec3.prototype, swizzle, {\n get: impl\n });\n Object.defineProperty(Vec4.prototype, swizzle, {\n get: impl\n });\n }\n for (const swizzle of VEC3_SWIZZLES) {\n const impl = getSwizzleImpl(swizzle);\n Object.defineProperty(Vec3.prototype, swizzle, {\n get: impl\n });\n Object.defineProperty(Vec4.prototype, swizzle, {\n get: impl\n });\n }\n for (const swizzle of VEC4_SWIZZLES) {\n const impl = getSwizzleImpl(swizzle);\n Object.defineProperty(Vec4.prototype, swizzle, {\n get: impl\n });\n }\n GLM_SWIZZLES_ENABLED_F32 = true;\n}\n\n// src/util/angleConversion.ts\nvar GLM_DEG_TO_RAD = Math.PI / 180;\nvar GLM_RAD_TO_DEG = 180 / Math.PI;\nfunction toDegree(value) {\n return value * GLM_RAD_TO_DEG;\n}\nfunction toRadian(value) {\n return value * GLM_DEG_TO_RAD;\n}\nexport {\n EnableSwizzles,\n Mat2,\n Mat2d,\n Mat3,\n Mat4,\n Quat,\n Quat2,\n Vec2,\n Vec3,\n Vec4,\n Mat2 as mat2,\n Mat2d as mat2d,\n Mat3 as mat3,\n Mat4 as mat4,\n Quat as quat,\n Quat2 as quat2,\n toDegree,\n toRadian,\n Vec2 as vec2,\n Vec3 as vec3,\n Vec4 as vec4\n};\n//# sourceMappingURL=gl-matrix-f32.js.map\n"],"names":["GLM_EPSILON"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASO,IAAMA,WAAA,GAAc,IAAA;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist-cdn/umd/gl-matrix-f32.min.js b/dist-cdn/umd/gl-matrix-f32.min.js new file mode 100644 index 00000000..2bcb18df --- /dev/null +++ b/dist-cdn/umd/gl-matrix-f32.min.js @@ -0,0 +1,4458 @@ +// gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library. +// @author Brandon Jones +// @author Colin MacKenzie IV +// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md) +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.glMatrix = {})); +})(this, (function (exports) { 'use strict'; + + function _assertThisInitialized(e) { + if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return e; + } + function _callSuper(t, o, e) { + return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); + } + function _classCallCheck(a, n) { + if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); + } + function _construct(t, e, r) { + if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); + var o = [null]; + o.push.apply(o, e); + var p = new (t.bind.apply(t, o))(); + return r && _setPrototypeOf(p, r.prototype), p; + } + function _defineProperties(e, r) { + for (var t = 0; t < r.length; t++) { + var o = r[t]; + o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); + } + } + function _createClass(e, r, t) { + return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { + writable: !1 + }), e; + } + function _get() { + return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { + var p = _superPropBase(e, t); + if (p) { + var n = Object.getOwnPropertyDescriptor(p, t); + return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; + } + }, _get.apply(null, arguments); + } + function _getPrototypeOf(t) { + return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { + return t.__proto__ || Object.getPrototypeOf(t); + }, _getPrototypeOf(t); + } + function _inherits(t, e) { + if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); + t.prototype = Object.create(e && e.prototype, { + constructor: { + value: t, + writable: !0, + configurable: !0 + } + }), Object.defineProperty(t, "prototype", { + writable: !1 + }), e && _setPrototypeOf(t, e); + } + function _isNativeFunction(t) { + try { + return -1 !== Function.toString.call(t).indexOf("[native code]"); + } catch (n) { + return "function" == typeof t; + } + } + function _isNativeReflectConstruct() { + try { + var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (t) {} + return (_isNativeReflectConstruct = function () { + return !!t; + })(); + } + function _possibleConstructorReturn(t, e) { + if (e && ("object" == typeof e || "function" == typeof e)) return e; + if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); + return _assertThisInitialized(t); + } + function _setPrototypeOf(t, e) { + return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { + return t.__proto__ = e, t; + }, _setPrototypeOf(t, e); + } + function _superPropBase(t, o) { + for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); + return t; + } + function _superPropGet(t, o, e, r) { + var p = _get(_getPrototypeOf(t.prototype ), o, e); + return "function" == typeof p ? function (t) { + return p.apply(e, t); + } : p; + } + function _toPrimitive(t, r) { + if ("object" != typeof t || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r); + if ("object" != typeof i) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return (String )(t); + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == typeof i ? i : i + ""; + } + function _wrapNativeSuper(t) { + var r = "function" == typeof Map ? new Map() : void 0; + return _wrapNativeSuper = function (t) { + if (null === t || !_isNativeFunction(t)) return t; + if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); + if (void 0 !== r) { + if (r.has(t)) return r.get(t); + r.set(t, Wrapper); + } + function Wrapper() { + return _construct(t, arguments, _getPrototypeOf(this).constructor); + } + return Wrapper.prototype = Object.create(t.prototype, { + constructor: { + value: Wrapper, + enumerable: !1, + writable: !0, + configurable: !0 + } + }), _setPrototypeOf(Wrapper, t); + }, _wrapNativeSuper(t); + } + + // gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library. + // @author Brandon Jones + // @author Colin MacKenzie IV + // @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md) + var de = function de(A) { + throw TypeError(A); + }; + var oe = function oe(A, e, t) { + return e.has(A) || de("Cannot " + t); + }; + var E = function E(A, e, t) { + return oe(A, e, "read from private field"), t ? t.call(A) : e.get(A); + }, + Z = function Z(A, e, t) { + return e.has(A) ? de("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(A) : e.set(A, t); + }; + var ne, + C = /*#__PURE__*/function (_Float32Array) { + function C() { + var _this; + _classCallCheck(this, C); + for (var _len = arguments.length, e = new Array(_len), _key = 0; _key < _len; _key++) { + e[_key] = arguments[_key]; + } + switch (e.length) { + case 4: + _this = _callSuper(this, C, [e]); + break; + case 2: + _this = _callSuper(this, C, [e[0], e[1], 4]); + break; + case 1: + var t = e[0]; + typeof t == "number" ? _this = _callSuper(this, C, [[t, t, t, t]]) : _this = _callSuper(this, C, [t, 0, 4]); + break; + default: + _this = _callSuper(this, C, [E(C, ne)]); + break; + } + return _assertThisInitialized(_this); + } + _inherits(C, _Float32Array); + return _createClass(C, [{ + key: "str", + get: function get() { + return C.str(this); + } + }, { + key: "copy", + value: function copy(e) { + return this.set(e), this; + } + }, { + key: "identity", + value: function identity() { + return this.set(E(C, ne)), this; + } + }, { + key: "multiply", + value: function multiply(e) { + return C.multiply(this, this, e); + } + }, { + key: "mul", + value: function mul(e) { + return this; + } + }, { + key: "transpose", + value: function transpose() { + return C.transpose(this, this); + } + }, { + key: "invert", + value: function invert() { + return C.invert(this, this); + } + }, { + key: "scale", + value: function scale(e) { + return C.scale(this, this, e); + } + }, { + key: "rotate", + value: function rotate(e) { + return C.rotate(this, this, e); + } + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 4 * Float32Array.BYTES_PER_ELEMENT; + } + }, { + key: "create", + value: function create() { + return new C(); + } + }, { + key: "clone", + value: function clone(e) { + return new C(e); + } + }, { + key: "copy", + value: function copy(e, t) { + return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e; + } + }, { + key: "fromValues", + value: function fromValues() { + for (var _len2 = arguments.length, e = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + e[_key2] = arguments[_key2]; + } + return _construct(C, e); + } + }, { + key: "set", + value: function set(e) { + return e[0] = arguments.length <= 1 ? undefined : arguments[1], e[1] = arguments.length <= 2 ? undefined : arguments[2], e[2] = arguments.length <= 3 ? undefined : arguments[3], e[3] = arguments.length <= 4 ? undefined : arguments[4], e; + } + }, { + key: "identity", + value: function identity(e) { + return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 1, e; + } + }, { + key: "transpose", + value: function transpose(e, t) { + if (e === t) { + var n = t[1]; + e[1] = t[2], e[2] = n; + } else e[0] = t[0], e[1] = t[2], e[2] = t[1], e[3] = t[3]; + return e; + } + }, { + key: "invert", + value: function invert(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = n * a - r * s; + return i ? (i = 1 / i, e[0] = a * i, e[1] = -s * i, e[2] = -r * i, e[3] = n * i, e) : null; + } + }, { + key: "adjoint", + value: function adjoint(e, t) { + var n = t[0]; + return e[0] = t[3], e[1] = -t[1], e[2] = -t[2], e[3] = n, e; + } + }, { + key: "determinant", + value: function determinant(e) { + return e[0] * e[3] - e[2] * e[1]; + } + }, { + key: "add", + value: function add(e, t, n) { + return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e[2] = t[2] + n[2], e[3] = t[3] + n[3], e; + } + }, { + key: "subtract", + value: function subtract(e, t, n) { + return e[0] = t[0] - n[0], e[1] = t[1] - n[1], e[2] = t[2] - n[2], e[3] = t[3] - n[3], e; + } + }, { + key: "sub", + value: function sub(e, t, n) { + return e; + } + }, { + key: "multiply", + value: function multiply(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = n[0], + y = n[1], + L = n[2], + k = n[3]; + return e[0] = s * c + a * y, e[1] = r * c + i * y, e[2] = s * L + a * k, e[3] = r * L + i * k, e; + } + }, { + key: "mul", + value: function mul(e, t, n) { + return e; + } + }, { + key: "rotate", + value: function rotate(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = Math.sin(n), + y = Math.cos(n); + return e[0] = s * y + a * c, e[1] = r * y + i * c, e[2] = s * -c + a * y, e[3] = r * -c + i * y, e; + } + }, { + key: "scale", + value: function scale(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = n[0], + y = n[1]; + return e[0] = s * c, e[1] = r * c, e[2] = a * y, e[3] = i * y, e; + } + }, { + key: "fromRotation", + value: function fromRotation(e, t) { + var n = Math.sin(t), + s = Math.cos(t); + return e[0] = s, e[1] = n, e[2] = -n, e[3] = s, e; + } + }, { + key: "fromScaling", + value: function fromScaling(e, t) { + return e[0] = t[0], e[1] = 0, e[2] = 0, e[3] = t[1], e; + } + }, { + key: "frob", + value: function frob(e) { + return Math.sqrt(e[0] * e[0] + e[1] * e[1] + e[2] * e[2] + e[3] * e[3]); + } + }, { + key: "multiplyScalar", + value: function multiplyScalar(e, t, n) { + return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e[3] = t[3] * n, e; + } + }, { + key: "multiplyScalarAndAdd", + value: function multiplyScalarAndAdd(e, t, n, s) { + return e[0] = t[0] + n[0] * s, e[1] = t[1] + n[1] * s, e[2] = t[2] + n[2] * s, e[3] = t[3] + n[3] * s, e; + } + }, { + key: "LDU", + value: function LDU(e, t, n, s) { + return e[2] = s[2] / s[0], n[0] = s[0], n[1] = s[1], n[3] = s[3] - e[2] * n[1], [e, t, n]; + } + }, { + key: "exactEquals", + value: function exactEquals(e, t) { + return e[0] === t[0] && e[1] === t[1] && e[2] === t[2] && e[3] === t[3]; + } + }, { + key: "equals", + value: function equals(e, t) { + var n = e[0], + s = e[1], + r = e[2], + a = e[3], + i = t[0], + c = t[1], + y = t[2], + L = t[3]; + return Math.abs(n - i) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(i)) && Math.abs(s - c) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(c)) && Math.abs(r - y) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(y)) && Math.abs(a - L) <= 1e-6 * Math.max(1, Math.abs(a), Math.abs(L)); + } + }, { + key: "str", + value: function str(e) { + return "Mat2(".concat(e.join(", "), ")"); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float32Array)); + ne = new WeakMap(), Z(C, ne, new Float32Array([1, 0, 0, 1])); + var v = C; + v.prototype.mul = v.prototype.multiply; + v.mul = v.multiply; + v.sub = v.subtract; + var se, + H = /*#__PURE__*/function (_Float32Array2) { + function H() { + var _this2; + _classCallCheck(this, H); + for (var _len3 = arguments.length, e = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + e[_key3] = arguments[_key3]; + } + switch (e.length) { + case 6: + _this2 = _callSuper(this, H, [e]); + break; + case 2: + _this2 = _callSuper(this, H, [e[0], e[1], 6]); + break; + case 1: + var t = e[0]; + typeof t == "number" ? _this2 = _callSuper(this, H, [[t, t, t, t, t, t]]) : _this2 = _callSuper(this, H, [t, 0, 6]); + break; + default: + _this2 = _callSuper(this, H, [E(H, se)]); + break; + } + return _assertThisInitialized(_this2); + } + _inherits(H, _Float32Array2); + return _createClass(H, [{ + key: "str", + get: function get() { + return H.str(this); + } + }, { + key: "copy", + value: function copy(e) { + return this.set(e), this; + } + }, { + key: "identity", + value: function identity() { + return this.set(E(H, se)), this; + } + }, { + key: "multiply", + value: function multiply(e) { + return H.multiply(this, this, e); + } + }, { + key: "mul", + value: function mul(e) { + return this; + } + }, { + key: "translate", + value: function translate(e) { + return H.translate(this, this, e); + } + }, { + key: "rotate", + value: function rotate(e) { + return H.rotate(this, this, e); + } + }, { + key: "scale", + value: function scale(e) { + return H.scale(this, this, e); + } + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 6 * Float32Array.BYTES_PER_ELEMENT; + } + }, { + key: "create", + value: function create() { + return new H(); + } + }, { + key: "clone", + value: function clone(e) { + return new H(e); + } + }, { + key: "copy", + value: function copy(e, t) { + 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; + } + }, { + key: "fromValues", + value: function fromValues() { + for (var _len4 = arguments.length, e = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + e[_key4] = arguments[_key4]; + } + return _construct(H, e); + } + }, { + key: "set", + value: function set(e) { + return e[0] = arguments.length <= 1 ? undefined : arguments[1], e[1] = arguments.length <= 2 ? undefined : arguments[2], e[2] = arguments.length <= 3 ? undefined : arguments[3], e[3] = arguments.length <= 4 ? undefined : arguments[4], e[4] = arguments.length <= 5 ? undefined : arguments[5], e[5] = arguments.length <= 6 ? undefined : arguments[6], e; + } + }, { + key: "identity", + value: function identity(e) { + return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 1, e[4] = 0, e[5] = 0, e; + } + }, { + key: "invert", + value: function invert(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = t[4], + c = t[5], + y = n * a - s * r; + return y ? (y = 1 / y, e[0] = a * y, e[1] = -s * y, e[2] = -r * y, e[3] = n * y, e[4] = (r * c - a * i) * y, e[5] = (s * i - n * c) * y, e) : null; + } + }, { + key: "determinant", + value: function determinant(e) { + return e[0] * e[3] - e[1] * e[2]; + } + }, { + key: "add", + value: function add(e, t, n) { + return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e[2] = t[2] + n[2], e[3] = t[3] + n[3], e[4] = t[4] + n[4], e[5] = t[5] + n[5], e; + } + }, { + key: "subtract", + value: function subtract(e, t, n) { + return e[0] = t[0] - n[0], e[1] = t[1] - n[1], e[2] = t[2] - n[2], e[3] = t[3] - n[3], e[4] = t[4] - n[4], e[5] = t[5] - n[5], e; + } + }, { + key: "sub", + value: function sub(e, t, n) { + return e; + } + }, { + key: "multiply", + value: function multiply(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = t[4], + y = t[5], + L = n[0], + k = n[1], + l = n[2], + M = n[3], + h = n[4], + b = n[5]; + return e[0] = s * L + a * k, e[1] = r * L + i * k, e[2] = s * l + a * M, e[3] = r * l + i * M, e[4] = s * h + a * b + c, e[5] = r * h + i * b + y, e; + } + }, { + key: "mul", + value: function mul(e, t, n) { + return e; + } + }, { + key: "translate", + value: function translate(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = t[4], + y = t[5], + L = n[0], + k = n[1]; + return e[0] = s, e[1] = r, e[2] = a, e[3] = i, e[4] = s * L + a * k + c, e[5] = r * L + i * k + y, e; + } + }, { + key: "rotate", + value: function rotate(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = t[4], + y = t[5], + L = Math.sin(n), + k = Math.cos(n); + return e[0] = s * k + a * L, e[1] = r * k + i * L, e[2] = s * -L + a * k, e[3] = r * -L + i * k, e[4] = c, e[5] = y, e; + } + }, { + key: "scale", + value: function scale(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = t[4], + y = t[5], + L = n[0], + k = n[1]; + return e[0] = s * L, e[1] = r * L, e[2] = a * k, e[3] = i * k, e[4] = c, e[5] = y, e; + } + }, { + key: "fromTranslation", + value: function fromTranslation(e, t) { + return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 1, e[4] = t[0], e[5] = t[1], e; + } + }, { + key: "fromRotation", + value: function fromRotation(e, t) { + var n = Math.sin(t), + s = Math.cos(t); + return e[0] = s, e[1] = n, e[2] = -n, e[3] = s, e[4] = 0, e[5] = 0, e; + } + }, { + key: "fromScaling", + value: function fromScaling(e, t) { + return e[0] = t[0], e[1] = 0, e[2] = 0, e[3] = t[1], e[4] = 0, e[5] = 0, e; + } + }, { + key: "frob", + value: function frob(e) { + return Math.sqrt(e[0] * e[0] + e[1] * e[1] + e[2] * e[2] + e[3] * e[3] + e[4] * e[4] + e[5] * e[5] + 1); + } + }, { + key: "multiplyScalar", + value: function multiplyScalar(e, t, n) { + return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e[3] = t[3] * n, e[4] = t[4] * n, e[5] = t[5] * n, e; + } + }, { + key: "multiplyScalarAndAdd", + value: function multiplyScalarAndAdd(e, t, n, s) { + return e[0] = t[0] + n[0] * s, e[1] = t[1] + n[1] * s, e[2] = t[2] + n[2] * s, e[3] = t[3] + n[3] * s, e[4] = t[4] + n[4] * s, e[5] = t[5] + n[5] * s, e; + } + }, { + key: "exactEquals", + value: function exactEquals(e, t) { + 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]; + } + }, { + key: "equals", + value: function equals(e, t) { + var n = e[0], + s = e[1], + r = e[2], + a = e[3], + i = e[4], + c = e[5], + y = t[0], + L = t[1], + k = t[2], + l = t[3], + M = t[4], + h = t[5]; + return Math.abs(n - y) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(y)) && Math.abs(s - L) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(L)) && Math.abs(r - k) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(k)) && Math.abs(a - l) <= 1e-6 * Math.max(1, Math.abs(a), Math.abs(l)) && Math.abs(i - M) <= 1e-6 * Math.max(1, Math.abs(i), Math.abs(M)) && Math.abs(c - h) <= 1e-6 * Math.max(1, Math.abs(c), Math.abs(h)); + } + }, { + key: "str", + value: function str(e) { + return "Mat2d(".concat(e.join(", "), ")"); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float32Array)); + se = new WeakMap(), Z(H, se, new Float32Array([1, 0, 0, 1, 0, 0])); + var _ = H; + _.mul = _.multiply; + _.sub = _.subtract; + var re, + X = /*#__PURE__*/function (_Float32Array3) { + function X() { + var _this3; + _classCallCheck(this, X); + for (var _len5 = arguments.length, e = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { + e[_key5] = arguments[_key5]; + } + switch (e.length) { + case 9: + _this3 = _callSuper(this, X, [e]); + break; + case 2: + _this3 = _callSuper(this, X, [e[0], e[1], 9]); + break; + case 1: + var t = e[0]; + typeof t == "number" ? _this3 = _callSuper(this, X, [[t, t, t, t, t, t, t, t, t]]) : _this3 = _callSuper(this, X, [t, 0, 9]); + break; + default: + _this3 = _callSuper(this, X, [E(X, re)]); + break; + } + return _assertThisInitialized(_this3); + } + _inherits(X, _Float32Array3); + return _createClass(X, [{ + key: "str", + get: function get() { + return X.str(this); + } + }, { + key: "copy", + value: function copy(e) { + return this.set(e), this; + } + }, { + key: "identity", + value: function identity() { + return this.set(E(X, re)), this; + } + }, { + key: "multiply", + value: function multiply(e) { + return X.multiply(this, this, e); + } + }, { + key: "mul", + value: function mul(e) { + return this; + } + }, { + key: "transpose", + value: function transpose() { + return X.transpose(this, this); + } + }, { + key: "invert", + value: function invert() { + return X.invert(this, this); + } + }, { + key: "translate", + value: function translate(e) { + return X.translate(this, this, e); + } + }, { + key: "rotate", + value: function rotate(e) { + return X.rotate(this, this, e); + } + }, { + key: "scale", + value: function scale(e) { + return X.scale(this, this, e); + } + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 9 * Float32Array.BYTES_PER_ELEMENT; + } + }, { + key: "create", + value: function create() { + return new X(); + } + }, { + key: "clone", + value: function clone(e) { + return new X(e); + } + }, { + key: "copy", + value: function copy(e, t) { + 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; + } + }, { + key: "fromValues", + value: function fromValues() { + for (var _len6 = arguments.length, e = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { + e[_key6] = arguments[_key6]; + } + return _construct(X, e); + } + }, { + key: "set", + value: function set(e) { + return e[0] = arguments.length <= 1 ? undefined : arguments[1], e[1] = arguments.length <= 2 ? undefined : arguments[2], e[2] = arguments.length <= 3 ? undefined : arguments[3], e[3] = arguments.length <= 4 ? undefined : arguments[4], e[4] = arguments.length <= 5 ? undefined : arguments[5], e[5] = arguments.length <= 6 ? undefined : arguments[6], e[6] = arguments.length <= 7 ? undefined : arguments[7], e[7] = arguments.length <= 8 ? undefined : arguments[8], e[8] = arguments.length <= 9 ? undefined : arguments[9], e; + } + }, { + key: "identity", + value: function identity(e) { + return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 1, e[5] = 0, e[6] = 0, e[7] = 0, e[8] = 1, e; + } + }, { + key: "transpose", + value: function transpose(e, t) { + if (e === t) { + var n = t[1], + s = t[2], + r = t[5]; + e[1] = t[3], e[2] = t[6], e[3] = n, e[5] = t[7], e[6] = s, e[7] = r; + } else e[0] = t[0], e[1] = t[3], e[2] = t[6], e[3] = t[1], e[4] = t[4], e[5] = t[7], e[6] = t[2], e[7] = t[5], e[8] = t[8]; + return e; + } + }, { + key: "invert", + value: function invert(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = t[4], + c = t[5], + y = t[6], + L = t[7], + k = t[8], + l = k * i - c * L, + M = -k * a + c * y, + h = L * a - i * y, + b = n * l + s * M + r * h; + return b ? (b = 1 / b, e[0] = l * b, e[1] = (-k * s + r * L) * b, e[2] = (c * s - r * i) * b, e[3] = M * b, e[4] = (k * n - r * y) * b, e[5] = (-c * n + r * a) * b, e[6] = h * b, e[7] = (-L * n + s * y) * b, e[8] = (i * n - s * a) * b, e) : null; + } + }, { + key: "adjoint", + value: function adjoint(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = t[4], + c = t[5], + y = t[6], + L = t[7], + k = t[8]; + return e[0] = i * k - c * L, e[1] = r * L - s * k, e[2] = s * c - r * i, e[3] = c * y - a * k, e[4] = n * k - r * y, e[5] = r * a - n * c, e[6] = a * L - i * y, e[7] = s * y - n * L, e[8] = n * i - s * a, e; + } + }, { + key: "determinant", + value: function determinant(e) { + var t = e[0], + n = e[1], + s = e[2], + r = e[3], + a = e[4], + i = e[5], + c = e[6], + y = e[7], + L = e[8]; + return t * (L * a - i * y) + n * (-L * r + i * c) + s * (y * r - a * c); + } + }, { + key: "add", + value: function add(e, t, n) { + return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e[2] = t[2] + n[2], e[3] = t[3] + n[3], e[4] = t[4] + n[4], e[5] = t[5] + n[5], e[6] = t[6] + n[6], e[7] = t[7] + n[7], e[8] = t[8] + n[8], e; + } + }, { + key: "subtract", + value: function subtract(e, t, n) { + return e[0] = t[0] - n[0], e[1] = t[1] - n[1], e[2] = t[2] - n[2], e[3] = t[3] - n[3], e[4] = t[4] - n[4], e[5] = t[5] - n[5], e[6] = t[6] - n[6], e[7] = t[7] - n[7], e[8] = t[8] - n[8], e; + } + }, { + key: "sub", + value: function sub(e, t, n) { + return e; + } + }, { + key: "multiply", + value: function multiply(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = t[4], + y = t[5], + L = t[6], + k = t[7], + l = t[8], + M = n[0], + h = n[1], + b = n[2]; + return e[0] = M * s + h * i + b * L, e[1] = M * r + h * c + b * k, e[2] = M * a + h * y + b * l, M = n[3], h = n[4], b = n[5], e[3] = M * s + h * i + b * L, e[4] = M * r + h * c + b * k, e[5] = M * a + h * y + b * l, M = n[6], h = n[7], b = n[8], e[6] = M * s + h * i + b * L, e[7] = M * r + h * c + b * k, e[8] = M * a + h * y + b * l, e; + } + }, { + key: "mul", + value: function mul(e, t, n) { + return e; + } + }, { + key: "translate", + value: function translate(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = t[4], + y = t[5], + L = t[6], + k = t[7], + l = t[8], + M = n[0], + h = n[1]; + return e[0] = s, e[1] = r, e[2] = a, e[3] = i, e[4] = c, e[5] = y, e[6] = M * s + h * i + L, e[7] = M * r + h * c + k, e[8] = M * a + h * y + l, e; + } + }, { + key: "rotate", + value: function rotate(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = t[4], + y = t[5], + L = t[6], + k = t[7], + l = t[8], + M = Math.sin(n), + h = Math.cos(n); + return e[0] = h * s + M * i, e[1] = h * r + M * c, e[2] = h * a + M * y, e[3] = h * i - M * s, e[4] = h * c - M * r, e[5] = h * y - M * a, e[6] = L, e[7] = k, e[8] = l, e; + } + }, { + key: "scale", + value: function scale(e, t, n) { + var s = n[0], + r = n[1]; + return e[0] = s * t[0], e[1] = s * t[1], e[2] = s * t[2], e[3] = r * t[3], e[4] = r * t[4], e[5] = r * t[5], e[6] = t[6], e[7] = t[7], e[8] = t[8], e; + } + }, { + key: "fromTranslation", + value: function fromTranslation(e, t) { + return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 1, e[5] = 0, e[6] = t[0], e[7] = t[1], e[8] = 1, e; + } + }, { + key: "fromRotation", + value: function fromRotation(e, t) { + var n = Math.sin(t), + s = Math.cos(t); + return e[0] = s, e[1] = n, e[2] = 0, e[3] = -n, e[4] = s, e[5] = 0, e[6] = 0, e[7] = 0, e[8] = 1, e; + } + }, { + key: "fromScaling", + value: function fromScaling(e, t) { + return e[0] = t[0], e[1] = 0, e[2] = 0, e[3] = 0, e[4] = t[1], e[5] = 0, e[6] = 0, e[7] = 0, e[8] = 1, e; + } + }, { + key: "fromMat2d", + value: function fromMat2d(e, t) { + return e[0] = t[0], e[1] = t[1], e[2] = 0, e[3] = t[2], e[4] = t[3], e[5] = 0, e[6] = t[4], e[7] = t[5], e[8] = 1, e; + } + }, { + key: "fromQuat", + value: function fromQuat(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = n + n, + c = s + s, + y = r + r, + L = n * i, + k = s * i, + l = s * c, + M = r * i, + h = r * c, + b = r * y, + d = a * i, + m = a * c, + o = a * y; + return e[0] = 1 - l - b, e[3] = k - o, e[6] = M + m, e[1] = k + o, e[4] = 1 - L - b, e[7] = h - d, e[2] = M - m, e[5] = h + d, e[8] = 1 - L - l, e; + } + }, { + key: "fromMat4", + value: function fromMat4(e, t) { + return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[4], e[4] = t[5], e[5] = t[6], e[6] = t[8], e[7] = t[9], e[8] = t[10], e; + } + }, { + key: "normalFromMat4", + value: function normalFromMat4(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = t[4], + c = t[5], + y = t[6], + L = t[7], + k = t[8], + l = t[9], + M = t[10], + h = t[11], + b = t[12], + d = t[13], + m = t[14], + o = t[15], + V = n * c - s * i, + x = n * y - r * i, + R = n * L - a * i, + z = s * y - r * c, + g = s * L - a * c, + B = r * L - a * y, + D = k * d - l * b, + F = k * m - M * b, + p = k * o - h * b, + Y = l * m - M * d, + I = l * o - h * d, + P = M * o - h * m, + Q = V * P - x * I + R * Y + z * p - g * F + B * D; + return Q ? (Q = 1 / Q, e[0] = (c * P - y * I + L * Y) * Q, e[1] = (y * p - i * P - L * F) * Q, e[2] = (i * I - c * p + L * D) * Q, e[3] = (r * I - s * P - a * Y) * Q, e[4] = (n * P - r * p + a * F) * Q, e[5] = (s * p - n * I - a * D) * Q, e[6] = (d * B - m * g + o * z) * Q, e[7] = (m * R - b * B - o * x) * Q, e[8] = (b * g - d * R + o * V) * Q, e) : null; + } + }, { + key: "normalFromMat4Fast", + value: function normalFromMat4Fast(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[4], + i = t[5], + c = t[6], + y = t[8], + L = t[9], + k = t[10]; + return e[0] = i * k - k * L, e[1] = c * y - y * k, e[2] = a * L - L * y, e[3] = L * r - k * s, e[4] = k * n - y * r, e[5] = y * s - L * n, e[6] = s * c - r * i, e[7] = r * a - n * c, e[8] = n * i - s * a, e; + } + }, { + key: "projection", + value: function projection(e, t, n) { + return e[0] = 2 / t, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = -2 / n, e[5] = 0, e[6] = -1, e[7] = 1, e[8] = 1, e; + } + }, { + key: "frob", + value: function frob(e) { + return Math.sqrt(e[0] * e[0] + e[1] * e[1] + e[2] * e[2] + e[3] * e[3] + e[4] * e[4] + e[5] * e[5] + e[6] * e[6] + e[7] * e[7] + e[8] * e[8]); + } + }, { + key: "multiplyScalar", + value: function multiplyScalar(e, t, n) { + return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e[3] = t[3] * n, e[4] = t[4] * n, e[5] = t[5] * n, e[6] = t[6] * n, e[7] = t[7] * n, e[8] = t[8] * n, e; + } + }, { + key: "multiplyScalarAndAdd", + value: function multiplyScalarAndAdd(e, t, n, s) { + return e[0] = t[0] + n[0] * s, e[1] = t[1] + n[1] * s, e[2] = t[2] + n[2] * s, e[3] = t[3] + n[3] * s, e[4] = t[4] + n[4] * s, e[5] = t[5] + n[5] * s, e[6] = t[6] + n[6] * s, e[7] = t[7] + n[7] * s, e[8] = t[8] + n[8] * s, e; + } + }, { + key: "exactEquals", + value: function exactEquals(e, t) { + 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]; + } + }, { + key: "equals", + value: function equals(e, t) { + var n = e[0], + s = e[1], + r = e[2], + a = e[3], + i = e[4], + c = e[5], + y = e[6], + L = e[7], + k = e[8], + l = t[0], + M = t[1], + h = t[2], + b = t[3], + d = t[4], + m = t[5], + o = t[6], + V = t[7], + x = t[8]; + return Math.abs(n - l) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(l)) && Math.abs(s - M) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(M)) && Math.abs(r - h) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(h)) && Math.abs(a - b) <= 1e-6 * Math.max(1, Math.abs(a), Math.abs(b)) && Math.abs(i - d) <= 1e-6 * Math.max(1, Math.abs(i), Math.abs(d)) && Math.abs(c - m) <= 1e-6 * Math.max(1, Math.abs(c), Math.abs(m)) && Math.abs(y - o) <= 1e-6 * Math.max(1, Math.abs(y), Math.abs(o)) && Math.abs(L - V) <= 1e-6 * Math.max(1, Math.abs(L), Math.abs(V)) && Math.abs(k - x) <= 1e-6 * Math.max(1, Math.abs(k), Math.abs(x)); + } + }, { + key: "str", + value: function str(e) { + return "Mat3(".concat(e.join(", "), ")"); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float32Array)); + re = new WeakMap(), Z(X, re, new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1])); + var u = X; + u.prototype.mul = u.prototype.multiply; + u.mul = u.multiply; + u.sub = u.subtract; + var ae, + $, + S = /*#__PURE__*/function (_Float32Array4) { + function S() { + var _this4; + _classCallCheck(this, S); + for (var _len7 = arguments.length, e = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { + e[_key7] = arguments[_key7]; + } + switch (e.length) { + case 16: + _this4 = _callSuper(this, S, [e]); + break; + case 2: + _this4 = _callSuper(this, S, [e[0], e[1], 16]); + break; + case 1: + var t = e[0]; + typeof t == "number" ? _this4 = _callSuper(this, S, [[t, t, t, t, t, t, t, t, t, t, t, t, t, t, t, t]]) : _this4 = _callSuper(this, S, [t, 0, 16]); + break; + default: + _this4 = _callSuper(this, S, [E(S, ae)]); + break; + } + return _assertThisInitialized(_this4); + } + _inherits(S, _Float32Array4); + return _createClass(S, [{ + key: "str", + get: function get() { + return S.str(this); + } + }, { + key: "copy", + value: function copy(e) { + return this.set(e), this; + } + }, { + key: "identity", + value: function identity() { + return this.set(E(S, ae)), this; + } + }, { + key: "multiply", + value: function multiply(e) { + return S.multiply(this, this, e); + } + }, { + key: "mul", + value: function mul(e) { + return this; + } + }, { + key: "transpose", + value: function transpose() { + return S.transpose(this, this); + } + }, { + key: "invert", + value: function invert() { + return S.invert(this, this); + } + }, { + key: "translate", + value: function translate(e) { + return S.translate(this, this, e); + } + }, { + key: "rotate", + value: function rotate(e, t) { + return S.rotate(this, this, e, t); + } + }, { + key: "scale", + value: function scale(e) { + return S.scale(this, this, e); + } + }, { + key: "rotateX", + value: function rotateX(e) { + return S.rotateX(this, this, e); + } + }, { + key: "rotateY", + value: function rotateY(e) { + return S.rotateY(this, this, e); + } + }, { + key: "rotateZ", + value: function rotateZ(e) { + return S.rotateZ(this, this, e); + } + }, { + key: "perspectiveNO", + value: function perspectiveNO(e, t, n, s) { + return S.perspectiveNO(this, e, t, n, s); + } + }, { + key: "perspectiveZO", + value: function perspectiveZO(e, t, n, s) { + return S.perspectiveZO(this, e, t, n, s); + } + }, { + key: "orthoNO", + value: function orthoNO(e, t, n, s, r, a) { + return S.orthoNO(this, e, t, n, s, r, a); + } + }, { + key: "orthoZO", + value: function orthoZO(e, t, n, s, r, a) { + return S.orthoZO(this, e, t, n, s, r, a); + } + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 16 * Float32Array.BYTES_PER_ELEMENT; + } + }, { + key: "create", + value: function create() { + return new S(); + } + }, { + key: "clone", + value: function clone(e) { + return new S(e); + } + }, { + key: "copy", + value: function copy(e, t) { + 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; + } + }, { + key: "fromValues", + value: function fromValues() { + for (var _len8 = arguments.length, e = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) { + e[_key8] = arguments[_key8]; + } + return _construct(S, e); + } + }, { + key: "set", + value: function set(e) { + return e[0] = arguments.length <= 1 ? undefined : arguments[1], e[1] = arguments.length <= 2 ? undefined : arguments[2], e[2] = arguments.length <= 3 ? undefined : arguments[3], e[3] = arguments.length <= 4 ? undefined : arguments[4], e[4] = arguments.length <= 5 ? undefined : arguments[5], e[5] = arguments.length <= 6 ? undefined : arguments[6], e[6] = arguments.length <= 7 ? undefined : arguments[7], e[7] = arguments.length <= 8 ? undefined : arguments[8], e[8] = arguments.length <= 9 ? undefined : arguments[9], e[9] = arguments.length <= 10 ? undefined : arguments[10], e[10] = arguments.length <= 11 ? undefined : arguments[11], e[11] = arguments.length <= 12 ? undefined : arguments[12], e[12] = arguments.length <= 13 ? undefined : arguments[13], e[13] = arguments.length <= 14 ? undefined : arguments[14], e[14] = arguments.length <= 15 ? undefined : arguments[15], e[15] = arguments.length <= 16 ? undefined : arguments[16], e; + } + }, { + key: "identity", + value: function identity(e) { + 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; + } + }, { + key: "transpose", + value: function transpose(e, t) { + if (e === t) { + var n = t[1], + s = t[2], + r = t[3], + a = t[6], + i = t[7], + c = t[11]; + e[1] = t[4], e[2] = t[8], e[3] = t[12], e[4] = n, e[6] = t[9], e[7] = t[13], e[8] = s, e[9] = a, e[11] = t[14], e[12] = r, e[13] = i, e[14] = c; + } else e[0] = t[0], e[1] = t[4], e[2] = t[8], e[3] = t[12], e[4] = t[1], e[5] = t[5], e[6] = t[9], e[7] = t[13], e[8] = t[2], e[9] = t[6], e[10] = t[10], e[11] = t[14], e[12] = t[3], e[13] = t[7], e[14] = t[11], e[15] = t[15]; + return e; + } + }, { + key: "invert", + value: function invert(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = t[4], + c = t[5], + y = t[6], + L = t[7], + k = t[8], + l = t[9], + M = t[10], + h = t[11], + b = t[12], + d = t[13], + m = t[14], + o = t[15], + V = n * c - s * i, + x = n * y - r * i, + R = n * L - a * i, + z = s * y - r * c, + g = s * L - a * c, + B = r * L - a * y, + D = k * d - l * b, + F = k * m - M * b, + p = k * o - h * b, + Y = l * m - M * d, + I = l * o - h * d, + P = M * o - h * m, + Q = V * P - x * I + R * Y + z * p - g * F + B * D; + return Q ? (Q = 1 / Q, e[0] = (c * P - y * I + L * Y) * Q, e[1] = (r * I - s * P - a * Y) * Q, e[2] = (d * B - m * g + o * z) * Q, e[3] = (M * g - l * B - h * z) * Q, e[4] = (y * p - i * P - L * F) * Q, e[5] = (n * P - r * p + a * F) * Q, e[6] = (m * R - b * B - o * x) * Q, e[7] = (k * B - M * R + h * x) * Q, e[8] = (i * I - c * p + L * D) * Q, e[9] = (s * p - n * I - a * D) * Q, e[10] = (b * g - d * R + o * V) * Q, e[11] = (l * R - k * g - h * V) * Q, e[12] = (c * F - i * Y - y * D) * Q, e[13] = (n * Y - s * F + r * D) * Q, e[14] = (d * x - b * z - m * V) * Q, e[15] = (k * z - l * x + M * V) * Q, e) : null; + } + }, { + key: "adjoint", + value: function adjoint(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = t[4], + c = t[5], + y = t[6], + L = t[7], + k = t[8], + l = t[9], + M = t[10], + h = t[11], + b = t[12], + d = t[13], + m = t[14], + o = t[15], + V = n * c - s * i, + x = n * y - r * i, + R = n * L - a * i, + z = s * y - r * c, + g = s * L - a * c, + B = r * L - a * y, + D = k * d - l * b, + F = k * m - M * b, + p = k * o - h * b, + Y = l * m - M * d, + I = l * o - h * d, + P = M * o - h * m; + return e[0] = c * P - y * I + L * Y, e[1] = r * I - s * P - a * Y, e[2] = d * B - m * g + o * z, e[3] = M * g - l * B - h * z, e[4] = y * p - i * P - L * F, e[5] = n * P - r * p + a * F, e[6] = m * R - b * B - o * x, e[7] = k * B - M * R + h * x, e[8] = i * I - c * p + L * D, e[9] = s * p - n * I - a * D, e[10] = b * g - d * R + o * V, e[11] = l * R - k * g - h * V, e[12] = c * F - i * Y - y * D, e[13] = n * Y - s * F + r * D, e[14] = d * x - b * z - m * V, e[15] = k * z - l * x + M * V, e; + } + }, { + key: "determinant", + value: function determinant(e) { + var t = e[0], + n = e[1], + s = e[2], + r = e[3], + a = e[4], + i = e[5], + c = e[6], + y = e[7], + L = e[8], + k = e[9], + l = e[10], + M = e[11], + h = e[12], + b = e[13], + d = e[14], + m = e[15], + o = t * i - n * a, + V = t * c - s * a, + x = n * c - s * i, + R = L * b - k * h, + z = L * d - l * h, + g = k * d - l * b, + B = t * g - n * z + s * R, + D = a * g - i * z + c * R, + F = L * x - k * V + l * o, + p = h * x - b * V + d * o; + return y * B - r * D + m * F - M * p; + } + }, { + key: "multiply", + value: function multiply(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = t[4], + y = t[5], + L = t[6], + k = t[7], + l = t[8], + M = t[9], + h = t[10], + b = t[11], + d = t[12], + m = t[13], + o = t[14], + V = t[15], + x = n[0], + R = n[1], + z = n[2], + g = n[3]; + return e[0] = x * s + R * c + z * l + g * d, e[1] = x * r + R * y + z * M + g * m, e[2] = x * a + R * L + z * h + g * o, e[3] = x * i + R * k + z * b + g * V, x = n[4], R = n[5], z = n[6], g = n[7], e[4] = x * s + R * c + z * l + g * d, e[5] = x * r + R * y + z * M + g * m, e[6] = x * a + R * L + z * h + g * o, e[7] = x * i + R * k + z * b + g * V, x = n[8], R = n[9], z = n[10], g = n[11], e[8] = x * s + R * c + z * l + g * d, e[9] = x * r + R * y + z * M + g * m, e[10] = x * a + R * L + z * h + g * o, e[11] = x * i + R * k + z * b + g * V, x = n[12], R = n[13], z = n[14], g = n[15], e[12] = x * s + R * c + z * l + g * d, e[13] = x * r + R * y + z * M + g * m, e[14] = x * a + R * L + z * h + g * o, e[15] = x * i + R * k + z * b + g * V, e; + } + }, { + key: "mul", + value: function mul(e, t, n) { + return e; + } + }, { + key: "translate", + value: function translate(e, t, n) { + var s = n[0], + r = n[1], + a = n[2]; + if (t === e) e[12] = t[0] * s + t[4] * r + t[8] * a + t[12], e[13] = t[1] * s + t[5] * r + t[9] * a + t[13], e[14] = t[2] * s + t[6] * r + t[10] * a + t[14], e[15] = t[3] * s + t[7] * r + t[11] * a + t[15];else { + var i = t[0], + c = t[1], + y = t[2], + L = t[3], + k = t[4], + l = t[5], + M = t[6], + h = t[7], + b = t[8], + d = t[9], + m = t[10], + o = t[11]; + e[0] = i, e[1] = c, e[2] = y, e[3] = L, e[4] = k, e[5] = l, e[6] = M, e[7] = h, e[8] = b, e[9] = d, e[10] = m, e[11] = o, e[12] = i * s + k * r + b * a + t[12], e[13] = c * s + l * r + d * a + t[13], e[14] = y * s + M * r + m * a + t[14], e[15] = L * s + h * r + o * a + t[15]; + } + return e; + } + }, { + key: "scale", + value: function scale(e, t, n) { + var s = n[0], + r = n[1], + a = n[2]; + return e[0] = t[0] * s, e[1] = t[1] * s, e[2] = t[2] * s, e[3] = t[3] * s, e[4] = t[4] * r, e[5] = t[5] * r, e[6] = t[6] * r, e[7] = t[7] * r, e[8] = t[8] * a, e[9] = t[9] * a, e[10] = t[10] * a, e[11] = t[11] * a, e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15], e; + } + }, { + key: "rotate", + value: function rotate(e, t, n, s) { + var r = s[0], + a = s[1], + i = s[2], + c = Math.sqrt(r * r + a * a + i * i); + if (c < 1e-6) return null; + c = 1 / c, r *= c, a *= c, i *= c; + var y = Math.sin(n), + L = Math.cos(n), + k = 1 - L, + l = t[0], + M = t[1], + h = t[2], + b = t[3], + d = t[4], + m = t[5], + o = t[6], + V = t[7], + x = t[8], + R = t[9], + z = t[10], + g = t[11], + B = r * r * k + L, + D = a * r * k + i * y, + F = i * r * k - a * y, + p = r * a * k - i * y, + Y = a * a * k + L, + I = i * a * k + r * y, + P = r * i * k + a * y, + Q = a * i * k - r * y, + K = i * i * k + L; + return e[0] = l * B + d * D + x * F, e[1] = M * B + m * D + R * F, e[2] = h * B + o * D + z * F, e[3] = b * B + V * D + g * F, e[4] = l * p + d * Y + x * I, e[5] = M * p + m * Y + R * I, e[6] = h * p + o * Y + z * I, e[7] = b * p + V * Y + g * I, e[8] = l * P + d * Q + x * K, e[9] = M * P + m * Q + R * K, e[10] = h * P + o * Q + z * K, e[11] = b * P + V * Q + g * K, t !== e && (e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e; + } + }, { + key: "rotateX", + value: function rotateX(e, t, n) { + var s = Math.sin(n), + r = Math.cos(n), + a = t[4], + i = t[5], + c = t[6], + y = t[7], + L = t[8], + k = t[9], + l = t[10], + M = t[11]; + return t !== e && (e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[4] = a * r + L * s, e[5] = i * r + k * s, e[6] = c * r + l * s, e[7] = y * r + M * s, e[8] = L * r - a * s, e[9] = k * r - i * s, e[10] = l * r - c * s, e[11] = M * r - y * s, e; + } + }, { + key: "rotateY", + value: function rotateY(e, t, n) { + var s = Math.sin(n), + r = Math.cos(n), + a = t[0], + i = t[1], + c = t[2], + y = t[3], + L = t[8], + k = t[9], + l = t[10], + M = t[11]; + return t !== e && (e[4] = t[4], e[5] = t[5], e[6] = t[6], e[7] = t[7], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[0] = a * r - L * s, e[1] = i * r - k * s, e[2] = c * r - l * s, e[3] = y * r - M * s, e[8] = a * s + L * r, e[9] = i * s + k * r, e[10] = c * s + l * r, e[11] = y * s + M * r, e; + } + }, { + key: "rotateZ", + value: function rotateZ(e, t, n) { + var s = Math.sin(n), + r = Math.cos(n), + a = t[0], + i = t[1], + c = t[2], + y = t[3], + L = t[4], + k = t[5], + l = t[6], + M = t[7]; + return t !== e && (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[0] = a * r + L * s, e[1] = i * r + k * s, e[2] = c * r + l * s, e[3] = y * r + M * s, e[4] = L * r - a * s, e[5] = k * r - i * s, e[6] = l * r - c * s, e[7] = M * r - y * s, e; + } + }, { + key: "fromTranslation", + value: function fromTranslation(e, t) { + 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] = t[0], e[13] = t[1], e[14] = t[2], e[15] = 1, e; + } + }, { + key: "fromScaling", + value: function fromScaling(e, t) { + return e[0] = t[0], e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = t[1], e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = t[2], e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e; + } + }, { + key: "fromRotation", + value: function fromRotation(e, t, n) { + var s = n[0], + r = n[1], + a = n[2], + i = Math.sqrt(s * s + r * r + a * a); + if (i < 1e-6) return null; + i = 1 / i, s *= i, r *= i, a *= i; + var c = Math.sin(t), + y = Math.cos(t), + L = 1 - y; + return e[0] = s * s * L + y, e[1] = r * s * L + a * c, e[2] = a * s * L - r * c, e[3] = 0, e[4] = s * r * L - a * c, e[5] = r * r * L + y, e[6] = a * r * L + s * c, e[7] = 0, e[8] = s * a * L + r * c, e[9] = r * a * L - s * c, e[10] = a * a * L + y, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e; + } + }, { + key: "fromXRotation", + value: function fromXRotation(e, t) { + var n = Math.sin(t), + s = Math.cos(t); + return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = s, e[6] = n, e[7] = 0, e[8] = 0, e[9] = -n, e[10] = s, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e; + } + }, { + key: "fromYRotation", + value: function fromYRotation(e, t) { + var n = Math.sin(t), + s = Math.cos(t); + return e[0] = s, e[1] = 0, e[2] = -n, e[3] = 0, e[4] = 0, e[5] = 1, e[6] = 0, e[7] = 0, e[8] = n, e[9] = 0, e[10] = s, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e; + } + }, { + key: "fromZRotation", + value: function fromZRotation(e, t) { + var n = Math.sin(t), + s = Math.cos(t); + return e[0] = s, e[1] = n, e[2] = 0, e[3] = 0, e[4] = -n, e[5] = s, 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; + } + }, { + key: "fromRotationTranslation", + value: function fromRotationTranslation(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = s + s, + y = r + r, + L = a + a, + k = s * c, + l = s * y, + M = s * L, + h = r * y, + b = r * L, + d = a * L, + m = i * c, + o = i * y, + V = i * L; + return e[0] = 1 - (h + d), e[1] = l + V, e[2] = M - o, e[3] = 0, e[4] = l - V, e[5] = 1 - (k + d), e[6] = b + m, e[7] = 0, e[8] = M + o, e[9] = b - m, e[10] = 1 - (k + h), e[11] = 0, e[12] = n[0], e[13] = n[1], e[14] = n[2], e[15] = 1, e; + } + }, { + key: "fromQuat2", + value: function fromQuat2(e, t) { + var n = -t[0], + s = -t[1], + r = -t[2], + a = t[3], + i = t[4], + c = t[5], + y = t[6], + L = t[7], + k = n * n + s * s + r * r + a * a; + return k > 0 ? (E(S, $)[0] = (i * a + L * n + c * r - y * s) * 2 / k, E(S, $)[1] = (c * a + L * s + y * n - i * r) * 2 / k, E(S, $)[2] = (y * a + L * r + i * s - c * n) * 2 / k) : (E(S, $)[0] = (i * a + L * n + c * r - y * s) * 2, E(S, $)[1] = (c * a + L * s + y * n - i * r) * 2, E(S, $)[2] = (y * a + L * r + i * s - c * n) * 2), S.fromRotationTranslation(e, t, E(S, $)), e; + } + }, { + key: "normalFromMat4", + value: function normalFromMat4(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = t[4], + c = t[5], + y = t[6], + L = t[7], + k = t[8], + l = t[9], + M = t[10], + h = t[11], + b = t[12], + d = t[13], + m = t[14], + o = t[15], + V = n * c - s * i, + x = n * y - r * i, + R = n * L - a * i, + z = s * y - r * c, + g = s * L - a * c, + B = r * L - a * y, + D = k * d - l * b, + F = k * m - M * b, + p = k * o - h * b, + Y = l * m - M * d, + I = l * o - h * d, + P = M * o - h * m, + Q = V * P - x * I + R * Y + z * p - g * F + B * D; + return Q ? (Q = 1 / Q, e[0] = (c * P - y * I + L * Y) * Q, e[1] = (y * p - i * P - L * F) * Q, e[2] = (i * I - c * p + L * D) * Q, e[3] = 0, e[4] = (r * I - s * P - a * Y) * Q, e[5] = (n * P - r * p + a * F) * Q, e[6] = (s * p - n * I - a * D) * Q, e[7] = 0, e[8] = (d * B - m * g + o * z) * Q, e[9] = (m * R - b * B - o * x) * Q, e[10] = (b * g - d * R + o * V) * Q, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e) : null; + } + }, { + key: "normalFromMat4Fast", + value: function normalFromMat4Fast(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[4], + i = t[5], + c = t[6], + y = t[8], + L = t[9], + k = t[10]; + return e[0] = i * k - k * L, e[1] = c * y - y * k, e[2] = a * L - L * y, e[3] = 0, e[4] = L * r - k * s, e[5] = k * n - y * r, e[6] = y * s - L * n, e[7] = 0, e[8] = s * c - r * i, e[9] = r * a - n * c, e[10] = n * i - s * a, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e; + } + }, { + key: "getTranslation", + value: function getTranslation(e, t) { + return e[0] = t[12], e[1] = t[13], e[2] = t[14], e; + } + }, { + key: "getScaling", + value: function getScaling(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[4], + i = t[5], + c = t[6], + y = t[8], + L = t[9], + k = t[10]; + return e[0] = Math.sqrt(n * n + s * s + r * r), e[1] = Math.sqrt(a * a + i * i + c * c), e[2] = Math.sqrt(y * y + L * L + k * k), e; + } + }, { + key: "getRotation", + value: function getRotation(e, t) { + S.getScaling(E(S, $), t); + var n = 1 / E(S, $)[0], + s = 1 / E(S, $)[1], + r = 1 / E(S, $)[2], + a = t[0] * n, + i = t[1] * s, + c = t[2] * r, + y = t[4] * n, + L = t[5] * s, + k = t[6] * r, + l = t[8] * n, + M = t[9] * s, + h = t[10] * r, + b = a + L + h, + d = 0; + return b > 0 ? (d = Math.sqrt(b + 1) * 2, e[3] = .25 * d, e[0] = (k - M) / d, e[1] = (l - c) / d, e[2] = (i - y) / d) : a > L && a > h ? (d = Math.sqrt(1 + a - L - h) * 2, e[3] = (k - M) / d, e[0] = .25 * d, e[1] = (i + y) / d, e[2] = (l + c) / d) : L > h ? (d = Math.sqrt(1 + L - a - h) * 2, e[3] = (l - c) / d, e[0] = (i + y) / d, e[1] = .25 * d, e[2] = (k + M) / d) : (d = Math.sqrt(1 + h - a - L) * 2, e[3] = (i - y) / d, e[0] = (l + c) / d, e[1] = (k + M) / d, e[2] = .25 * d), e; + } + }, { + key: "decompose", + value: function decompose(e, t, n, s) { + t[0] = s[12], t[1] = s[13], t[2] = s[14]; + var r = s[0], + a = s[1], + i = s[2], + c = s[4], + y = s[5], + L = s[6], + k = s[8], + l = s[9], + M = s[10]; + n[0] = Math.sqrt(r * r + a * a + i * i), n[1] = Math.sqrt(c * c + y * y + L * L), n[2] = Math.sqrt(k * k + l * l + M * M); + var h = 1 / n[0], + b = 1 / n[1], + d = 1 / n[2], + m = r * h, + o = a * b, + V = i * d, + x = c * h, + R = y * b, + z = L * d, + g = k * h, + B = l * b, + D = M * d, + F = m + R + D, + p = 0; + return F > 0 ? (p = Math.sqrt(F + 1) * 2, e[3] = .25 * p, e[0] = (z - B) / p, e[1] = (g - V) / p, e[2] = (o - x) / p) : m > R && m > D ? (p = Math.sqrt(1 + m - R - D) * 2, e[3] = (z - B) / p, e[0] = .25 * p, e[1] = (o + x) / p, e[2] = (g + V) / p) : R > D ? (p = Math.sqrt(1 + R - m - D) * 2, e[3] = (g - V) / p, e[0] = (o + x) / p, e[1] = .25 * p, e[2] = (z + B) / p) : (p = Math.sqrt(1 + D - m - R) * 2, e[3] = (o - x) / p, e[0] = (g + V) / p, e[1] = (z + B) / p, e[2] = .25 * p), e; + } + }, { + key: "fromRotationTranslationScale", + value: function fromRotationTranslationScale(e, t, n, s) { + var r = t[0], + a = t[1], + i = t[2], + c = t[3], + y = r + r, + L = a + a, + k = i + i, + l = r * y, + M = r * L, + h = r * k, + b = a * L, + d = a * k, + m = i * k, + o = c * y, + V = c * L, + x = c * k, + R = s[0], + z = s[1], + g = s[2]; + return e[0] = (1 - (b + m)) * R, e[1] = (M + x) * R, e[2] = (h - V) * R, e[3] = 0, e[4] = (M - x) * z, e[5] = (1 - (l + m)) * z, e[6] = (d + o) * z, e[7] = 0, e[8] = (h + V) * g, e[9] = (d - o) * g, e[10] = (1 - (l + b)) * g, e[11] = 0, e[12] = n[0], e[13] = n[1], e[14] = n[2], e[15] = 1, e; + } + }, { + key: "fromRotationTranslationScaleOrigin", + value: function fromRotationTranslationScaleOrigin(e, t, n, s, r) { + var a = t[0], + i = t[1], + c = t[2], + y = t[3], + L = a + a, + k = i + i, + l = c + c, + M = a * L, + h = a * k, + b = a * l, + d = i * k, + m = i * l, + o = c * l, + V = y * L, + x = y * k, + R = y * l, + z = s[0], + g = s[1], + B = s[2], + D = r[0], + F = r[1], + p = r[2], + Y = (1 - (d + o)) * z, + I = (h + R) * z, + P = (b - x) * z, + Q = (h - R) * g, + K = (1 - (M + o)) * g, + ee = (m + V) * g, + te = (b + x) * B, + Me = (m - V) * B, + be = (1 - (M + d)) * B; + return e[0] = Y, e[1] = I, e[2] = P, e[3] = 0, e[4] = Q, e[5] = K, e[6] = ee, e[7] = 0, e[8] = te, e[9] = Me, e[10] = be, e[11] = 0, e[12] = n[0] + D - (Y * D + Q * F + te * p), e[13] = n[1] + F - (I * D + K * F + Me * p), e[14] = n[2] + p - (P * D + ee * F + be * p), e[15] = 1, e; + } + }, { + key: "fromQuat", + value: function fromQuat(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = n + n, + c = s + s, + y = r + r, + L = n * i, + k = s * i, + l = s * c, + M = r * i, + h = r * c, + b = r * y, + d = a * i, + m = a * c, + o = a * y; + return e[0] = 1 - l - b, e[1] = k + o, e[2] = M - m, e[3] = 0, e[4] = k - o, e[5] = 1 - L - b, e[6] = h + d, e[7] = 0, e[8] = M + m, e[9] = h - d, e[10] = 1 - L - l, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e; + } + }, { + key: "frustumNO", + value: function frustumNO(e, t, n, s, r, a) { + var i = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 1 / 0; + var c = 1 / (n - t), + y = 1 / (r - s); + if (e[0] = a * 2 * c, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = a * 2 * y, e[6] = 0, e[7] = 0, e[8] = (n + t) * c, e[9] = (r + s) * y, e[11] = -1, e[12] = 0, e[13] = 0, e[15] = 0, i != null && i !== 1 / 0) { + var L = 1 / (a - i); + e[10] = (i + a) * L, e[14] = 2 * i * a * L; + } else e[10] = -1, e[14] = -2 * a; + return e; + } + }, { + key: "frustum", + value: function frustum(e, t, n, s, r, a) { + return e; + } + }, { + key: "frustumZO", + value: function frustumZO(e, t, n, s, r, a) { + var i = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 1 / 0; + var c = 1 / (n - t), + y = 1 / (r - s); + if (e[0] = a * 2 * c, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = a * 2 * y, e[6] = 0, e[7] = 0, e[8] = (n + t) * c, e[9] = (r + s) * y, e[11] = -1, e[12] = 0, e[13] = 0, e[15] = 0, i != null && i !== 1 / 0) { + var L = 1 / (a - i); + e[10] = i * L, e[14] = i * a * L; + } else e[10] = -1, e[14] = -a; + return e; + } + }, { + key: "perspectiveNO", + value: function perspectiveNO(e, t, n, s) { + var r = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1 / 0; + var a = 1 / Math.tan(t / 2); + if (e[0] = a / n, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = a, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[11] = -1, e[12] = 0, e[13] = 0, e[15] = 0, r != null && r !== 1 / 0) { + var i = 1 / (s - r); + e[10] = (r + s) * i, e[14] = 2 * r * s * i; + } else e[10] = -1, e[14] = -2 * s; + return e; + } + }, { + key: "perspective", + value: function perspective(e, t, n, s) { + return e; + } + }, { + key: "perspectiveZO", + value: function perspectiveZO(e, t, n, s) { + var r = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1 / 0; + var a = 1 / Math.tan(t / 2); + if (e[0] = a / n, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = a, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[11] = -1, e[12] = 0, e[13] = 0, e[15] = 0, r != null && r !== 1 / 0) { + var i = 1 / (s - r); + e[10] = r * i, e[14] = r * s * i; + } else e[10] = -1, e[14] = -s; + return e; + } + }, { + key: "perspectiveFromFieldOfView", + value: function perspectiveFromFieldOfView(e, t, n, s) { + var r = Math.tan(t.upDegrees * Math.PI / 180), + a = Math.tan(t.downDegrees * Math.PI / 180), + i = Math.tan(t.leftDegrees * Math.PI / 180), + c = Math.tan(t.rightDegrees * Math.PI / 180), + y = 2 / (i + c), + L = 2 / (r + a); + return e[0] = y, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = L, e[6] = 0, e[7] = 0, e[8] = -((i - c) * y * .5), e[9] = (r - a) * L * .5, e[10] = s / (n - s), e[11] = -1, e[12] = 0, e[13] = 0, e[14] = s * n / (n - s), e[15] = 0, e; + } + }, { + key: "orthoNO", + value: function orthoNO(e, t, n, s, r, a, i) { + var c = 1 / (t - n), + y = 1 / (s - r), + L = 1 / (a - i); + return e[0] = -2 * c, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = -2 * y, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = 2 * L, e[11] = 0, e[12] = (t + n) * c, e[13] = (r + s) * y, e[14] = (i + a) * L, e[15] = 1, e; + } + }, { + key: "ortho", + value: function ortho(e, t, n, s, r, a, i) { + return e; + } + }, { + key: "orthoZO", + value: function orthoZO(e, t, n, s, r, a, i) { + var c = 1 / (t - n), + y = 1 / (s - r), + L = 1 / (a - i); + return e[0] = -2 * c, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = -2 * y, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = L, e[11] = 0, e[12] = (t + n) * c, e[13] = (r + s) * y, e[14] = a * L, e[15] = 1, e; + } + }, { + key: "lookAt", + value: function lookAt(e, t, n, s) { + var r = t[0], + a = t[1], + i = t[2], + c = s[0], + y = s[1], + L = s[2], + k = n[0], + l = n[1], + M = n[2]; + if (Math.abs(r - k) < 1e-6 && Math.abs(a - l) < 1e-6 && Math.abs(i - M) < 1e-6) return S.identity(e); + var h = r - k, + b = a - l, + d = i - M, + m = 1 / Math.sqrt(h * h + b * b + d * d); + h *= m, b *= m, d *= m; + var o = y * d - L * b, + V = L * h - c * d, + x = c * b - y * h; + m = Math.sqrt(o * o + V * V + x * x), m ? (m = 1 / m, o *= m, V *= m, x *= m) : (o = 0, V = 0, x = 0); + var R = b * x - d * V, + z = d * o - h * x, + g = h * V - b * o; + return m = Math.sqrt(R * R + z * z + g * g), m ? (m = 1 / m, R *= m, z *= m, g *= m) : (R = 0, z = 0, g = 0), e[0] = o, e[1] = R, e[2] = h, e[3] = 0, e[4] = V, e[5] = z, e[6] = b, e[7] = 0, e[8] = x, e[9] = g, e[10] = d, e[11] = 0, e[12] = -(o * r + V * a + x * i), e[13] = -(R * r + z * a + g * i), e[14] = -(h * r + b * a + d * i), e[15] = 1, e; + } + }, { + key: "targetTo", + value: function targetTo(e, t, n, s) { + var r = t[0], + a = t[1], + i = t[2], + c = s[0], + y = s[1], + L = s[2], + k = r - n[0], + l = a - n[1], + M = i - n[2], + h = k * k + l * l + M * M; + h > 0 && (h = 1 / Math.sqrt(h), k *= h, l *= h, M *= h); + var b = y * M - L * l, + d = L * k - c * M, + m = c * l - y * k; + return h = b * b + d * d + m * m, h > 0 && (h = 1 / Math.sqrt(h), b *= h, d *= h, m *= h), e[0] = b, e[1] = d, e[2] = m, e[3] = 0, e[4] = l * m - M * d, e[5] = M * b - k * m, e[6] = k * d - l * b, e[7] = 0, e[8] = k, e[9] = l, e[10] = M, e[11] = 0, e[12] = r, e[13] = a, e[14] = i, e[15] = 1, e; + } + }, { + key: "frob", + value: function frob(e) { + return Math.sqrt(e[0] * e[0] + e[1] * e[1] + e[2] * e[2] + e[3] * e[3] + e[4] * e[4] + e[5] * e[5] + e[6] * e[6] + e[7] * e[7] + e[8] * e[8] + e[9] * e[9] + e[10] * e[10] + e[11] * e[11] + e[12] * e[12] + e[13] * e[13] + e[14] * e[14] + e[15] * e[15]); + } + }, { + key: "add", + value: function add(e, t, n) { + return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e[2] = t[2] + n[2], e[3] = t[3] + n[3], e[4] = t[4] + n[4], e[5] = t[5] + n[5], e[6] = t[6] + n[6], e[7] = t[7] + n[7], e[8] = t[8] + n[8], e[9] = t[9] + n[9], e[10] = t[10] + n[10], e[11] = t[11] + n[11], e[12] = t[12] + n[12], e[13] = t[13] + n[13], e[14] = t[14] + n[14], e[15] = t[15] + n[15], e; + } + }, { + key: "subtract", + value: function subtract(e, t, n) { + return e[0] = t[0] - n[0], e[1] = t[1] - n[1], e[2] = t[2] - n[2], e[3] = t[3] - n[3], e[4] = t[4] - n[4], e[5] = t[5] - n[5], e[6] = t[6] - n[6], e[7] = t[7] - n[7], e[8] = t[8] - n[8], e[9] = t[9] - n[9], e[10] = t[10] - n[10], e[11] = t[11] - n[11], e[12] = t[12] - n[12], e[13] = t[13] - n[13], e[14] = t[14] - n[14], e[15] = t[15] - n[15], e; + } + }, { + key: "sub", + value: function sub(e, t, n) { + return e; + } + }, { + key: "multiplyScalar", + value: function multiplyScalar(e, t, n) { + return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e[3] = t[3] * n, e[4] = t[4] * n, e[5] = t[5] * n, e[6] = t[6] * n, e[7] = t[7] * n, e[8] = t[8] * n, e[9] = t[9] * n, e[10] = t[10] * n, e[11] = t[11] * n, e[12] = t[12] * n, e[13] = t[13] * n, e[14] = t[14] * n, e[15] = t[15] * n, e; + } + }, { + key: "multiplyScalarAndAdd", + value: function multiplyScalarAndAdd(e, t, n, s) { + return e[0] = t[0] + n[0] * s, e[1] = t[1] + n[1] * s, e[2] = t[2] + n[2] * s, e[3] = t[3] + n[3] * s, e[4] = t[4] + n[4] * s, e[5] = t[5] + n[5] * s, e[6] = t[6] + n[6] * s, e[7] = t[7] + n[7] * s, e[8] = t[8] + n[8] * s, e[9] = t[9] + n[9] * s, e[10] = t[10] + n[10] * s, e[11] = t[11] + n[11] * s, e[12] = t[12] + n[12] * s, e[13] = t[13] + n[13] * s, e[14] = t[14] + n[14] * s, e[15] = t[15] + n[15] * s, e; + } + }, { + key: "exactEquals", + value: function exactEquals(e, t) { + 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]; + } + }, { + key: "equals", + value: function equals(e, t) { + var n = e[0], + s = e[1], + r = e[2], + a = e[3], + i = e[4], + c = e[5], + y = e[6], + L = e[7], + k = e[8], + l = e[9], + M = e[10], + h = e[11], + b = e[12], + d = e[13], + m = e[14], + o = e[15], + V = t[0], + x = t[1], + R = t[2], + z = t[3], + g = t[4], + B = t[5], + D = t[6], + F = t[7], + p = t[8], + Y = t[9], + I = t[10], + P = t[11], + Q = t[12], + K = t[13], + ee = t[14], + te = t[15]; + return Math.abs(n - V) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(V)) && Math.abs(s - x) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(x)) && Math.abs(r - R) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(R)) && Math.abs(a - z) <= 1e-6 * Math.max(1, Math.abs(a), Math.abs(z)) && Math.abs(i - g) <= 1e-6 * Math.max(1, Math.abs(i), Math.abs(g)) && Math.abs(c - B) <= 1e-6 * Math.max(1, Math.abs(c), Math.abs(B)) && Math.abs(y - D) <= 1e-6 * Math.max(1, Math.abs(y), Math.abs(D)) && Math.abs(L - F) <= 1e-6 * Math.max(1, Math.abs(L), Math.abs(F)) && Math.abs(k - p) <= 1e-6 * Math.max(1, Math.abs(k), Math.abs(p)) && Math.abs(l - Y) <= 1e-6 * Math.max(1, Math.abs(l), Math.abs(Y)) && Math.abs(M - I) <= 1e-6 * Math.max(1, Math.abs(M), Math.abs(I)) && Math.abs(h - P) <= 1e-6 * Math.max(1, Math.abs(h), Math.abs(P)) && Math.abs(b - Q) <= 1e-6 * Math.max(1, Math.abs(b), Math.abs(Q)) && Math.abs(d - K) <= 1e-6 * Math.max(1, Math.abs(d), Math.abs(K)) && Math.abs(m - ee) <= 1e-6 * Math.max(1, Math.abs(m), Math.abs(ee)) && Math.abs(o - te) <= 1e-6 * Math.max(1, Math.abs(o), Math.abs(te)); + } + }, { + key: "str", + value: function str(e) { + return "Mat4(".concat(e.join(", "), ")"); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float32Array)); + ae = new WeakMap(), $ = new WeakMap(), Z(S, ae, new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])), Z(S, $, new Float32Array(3)); + var G = S; + G.prototype.mul = G.prototype.multiply; + G.sub = G.subtract; + G.mul = G.multiply; + G.frustum = G.frustumNO; + G.perspective = G.perspectiveNO; + G.ortho = G.orthoNO; + var T = /*#__PURE__*/function (_Float32Array5) { + function A() { + var _this5; + _classCallCheck(this, A); + for (var _len9 = arguments.length, e = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) { + e[_key9] = arguments[_key9]; + } + switch (e.length) { + case 3: + _this5 = _callSuper(this, A, [e]); + break; + case 2: + _this5 = _callSuper(this, A, [e[0], e[1], 3]); + break; + case 1: + { + var t = e[0]; + typeof t == "number" ? _this5 = _callSuper(this, A, [[t, t, t]]) : _this5 = _callSuper(this, A, [t, 0, 3]); + break; + } + default: + _this5 = _callSuper(this, A, [3]); + break; + } + return _assertThisInitialized(_this5); + } + _inherits(A, _Float32Array5); + return _createClass(A, [{ + key: "x", + get: function get() { + return this[0]; + }, + set: function set(e) { + this[0] = e; + } + }, { + key: "y", + get: function get() { + return this[1]; + }, + set: function set(e) { + this[1] = e; + } + }, { + key: "z", + get: function get() { + return this[2]; + }, + set: function set(e) { + this[2] = e; + } + }, { + key: "r", + get: function get() { + return this[0]; + }, + set: function set(e) { + this[0] = e; + } + }, { + key: "g", + get: function get() { + return this[1]; + }, + set: function set(e) { + this[1] = e; + } + }, { + key: "b", + get: function get() { + return this[2]; + }, + set: function set(e) { + this[2] = e; + } + }, { + key: "magnitude", + get: function get() { + var e = this[0], + t = this[1], + n = this[2]; + return Math.sqrt(e * e + t * t + n * n); + } + }, { + key: "mag", + get: function get() { + return this.magnitude; + } + }, { + key: "squaredMagnitude", + get: function get() { + var e = this[0], + t = this[1], + n = this[2]; + return e * e + t * t + n * n; + } + }, { + key: "sqrMag", + get: function get() { + return this.squaredMagnitude; + } + }, { + key: "str", + get: function get() { + return A.str(this); + } + }, { + key: "copy", + value: function copy(e) { + return this.set(e), this; + } + }, { + key: "add", + value: function add(e) { + return this[0] += e[0], this[1] += e[1], this[2] += e[2], this; + } + }, { + key: "subtract", + value: function subtract(e) { + return this[0] -= e[0], this[1] -= e[1], this[2] -= e[2], this; + } + }, { + key: "sub", + value: function sub(e) { + return this; + } + }, { + key: "multiply", + value: function multiply(e) { + return this[0] *= e[0], this[1] *= e[1], this[2] *= e[2], this; + } + }, { + key: "mul", + value: function mul(e) { + return this; + } + }, { + key: "divide", + value: function divide(e) { + return this[0] /= e[0], this[1] /= e[1], this[2] /= e[2], this; + } + }, { + key: "div", + value: function div(e) { + return this; + } + }, { + key: "scale", + value: function scale(e) { + return this[0] *= e, this[1] *= e, this[2] *= e, this; + } + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(e, t) { + return this[0] += e[0] * t, this[1] += e[1] * t, this[2] += e[2] * t, this; + } + }, { + key: "distance", + value: function distance(e) { + return A.distance(this, e); + } + }, { + key: "dist", + value: function dist(e) { + return 0; + } + }, { + key: "squaredDistance", + value: function squaredDistance(e) { + return A.squaredDistance(this, e); + } + }, { + key: "sqrDist", + value: function sqrDist(e) { + return 0; + } + }, { + key: "negate", + value: function negate() { + return this[0] *= -1, this[1] *= -1, this[2] *= -1, this; + } + }, { + key: "invert", + value: function invert() { + return this[0] = 1 / this[0], this[1] = 1 / this[1], this[2] = 1 / this[2], this; + } + }, { + key: "abs", + value: function abs() { + return this[0] = Math.abs(this[0]), this[1] = Math.abs(this[1]), this[2] = Math.abs(this[2]), this; + } + }, { + key: "dot", + value: function dot(e) { + return this[0] * e[0] + this[1] * e[1] + this[2] * e[2]; + } + }, { + key: "normalize", + value: function normalize() { + return A.normalize(this, this); + } + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 3 * Float32Array.BYTES_PER_ELEMENT; + } + }, { + key: "create", + value: function create() { + return new A(); + } + }, { + key: "clone", + value: function clone(e) { + return new A(e); + } + }, { + key: "magnitude", + value: function magnitude(e) { + var t = e[0], + n = e[1], + s = e[2]; + return Math.sqrt(t * t + n * n + s * s); + } + }, { + key: "mag", + value: function mag(e) { + return 0; + } + }, { + key: "length", + value: function length(e) { + return 0; + } + }, { + key: "len", + value: function len(e) { + return 0; + } + }, { + key: "fromValues", + value: function fromValues(e, t, n) { + return new A(e, t, n); + } + }, { + key: "copy", + value: function copy(e, t) { + return e[0] = t[0], e[1] = t[1], e[2] = t[2], e; + } + }, { + key: "set", + value: function set(e, t, n, s) { + return e[0] = t, e[1] = n, e[2] = s, e; + } + }, { + key: "add", + value: function add(e, t, n) { + return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e[2] = t[2] + n[2], e; + } + }, { + key: "subtract", + value: function subtract(e, t, n) { + return e[0] = t[0] - n[0], e[1] = t[1] - n[1], e[2] = t[2] - n[2], e; + } + }, { + key: "sub", + value: function sub(e, t, n) { + return [0, 0, 0]; + } + }, { + key: "multiply", + value: function multiply(e, t, n) { + return e[0] = t[0] * n[0], e[1] = t[1] * n[1], e[2] = t[2] * n[2], e; + } + }, { + key: "mul", + value: function mul(e, t, n) { + return [0, 0, 0]; + } + }, { + key: "divide", + value: function divide(e, t, n) { + return e[0] = t[0] / n[0], e[1] = t[1] / n[1], e[2] = t[2] / n[2], e; + } + }, { + key: "div", + value: function div(e, t, n) { + return [0, 0, 0]; + } + }, { + key: "ceil", + value: function ceil(e, t) { + return e[0] = Math.ceil(t[0]), e[1] = Math.ceil(t[1]), e[2] = Math.ceil(t[2]), e; + } + }, { + key: "floor", + value: function floor(e, t) { + return e[0] = Math.floor(t[0]), e[1] = Math.floor(t[1]), e[2] = Math.floor(t[2]), e; + } + }, { + key: "min", + value: function min(e, t, n) { + return e[0] = Math.min(t[0], n[0]), e[1] = Math.min(t[1], n[1]), e[2] = Math.min(t[2], n[2]), e; + } + }, { + key: "max", + value: function max(e, t, n) { + return e[0] = Math.max(t[0], n[0]), e[1] = Math.max(t[1], n[1]), e[2] = Math.max(t[2], n[2]), e; + } + }, { + key: "scale", + value: function scale(e, t, n) { + return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e; + } + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(e, t, n, s) { + return e[0] = t[0] + n[0] * s, e[1] = t[1] + n[1] * s, e[2] = t[2] + n[2] * s, e; + } + }, { + key: "distance", + value: function distance(e, t) { + var n = t[0] - e[0], + s = t[1] - e[1], + r = t[2] - e[2]; + return Math.sqrt(n * n + s * s + r * r); + } + }, { + key: "dist", + value: function dist(e, t) { + return 0; + } + }, { + key: "squaredDistance", + value: function squaredDistance(e, t) { + var n = t[0] - e[0], + s = t[1] - e[1], + r = t[2] - e[2]; + return n * n + s * s + r * r; + } + }, { + key: "sqrDist", + value: function sqrDist(e, t) { + return 0; + } + }, { + key: "squaredLength", + value: function squaredLength(e) { + var t = e[0], + n = e[1], + s = e[2]; + return t * t + n * n + s * s; + } + }, { + key: "sqrLen", + value: function sqrLen(e, t) { + return 0; + } + }, { + key: "negate", + value: function negate(e, t) { + return e[0] = -t[0], e[1] = -t[1], e[2] = -t[2], e; + } + }, { + key: "inverse", + value: function inverse(e, t) { + return e[0] = 1 / t[0], e[1] = 1 / t[1], e[2] = 1 / t[2], e; + } + }, { + key: "abs", + value: function abs(e, t) { + return e[0] = Math.abs(t[0]), e[1] = Math.abs(t[1]), e[2] = Math.abs(t[2]), e; + } + }, { + key: "normalize", + value: function normalize(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = n * n + s * s + r * r; + return a > 0 && (a = 1 / Math.sqrt(a)), e[0] = t[0] * a, e[1] = t[1] * a, e[2] = t[2] * a, e; + } + }, { + key: "dot", + value: function dot(e, t) { + return e[0] * t[0] + e[1] * t[1] + e[2] * t[2]; + } + }, { + key: "cross", + value: function cross(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = n[0], + c = n[1], + y = n[2]; + return e[0] = r * y - a * c, e[1] = a * i - s * y, e[2] = s * c - r * i, e; + } + }, { + key: "lerp", + value: function lerp(e, t, n, s) { + var r = t[0], + a = t[1], + i = t[2]; + return e[0] = r + s * (n[0] - r), e[1] = a + s * (n[1] - a), e[2] = i + s * (n[2] - i), e; + } + }, { + key: "slerp", + value: function slerp(e, t, n, s) { + var r = Math.acos(Math.min(Math.max(A.dot(t, n), -1), 1)), + a = Math.sin(r), + i = Math.sin((1 - s) * r) / a, + c = Math.sin(s * r) / a; + return e[0] = i * t[0] + c * n[0], e[1] = i * t[1] + c * n[1], e[2] = i * t[2] + c * n[2], e; + } + }, { + key: "hermite", + value: function hermite(e, t, n, s, r, a) { + var i = a * a, + c = i * (2 * a - 3) + 1, + y = i * (a - 2) + a, + L = i * (a - 1), + k = i * (3 - 2 * a); + return e[0] = t[0] * c + n[0] * y + s[0] * L + r[0] * k, e[1] = t[1] * c + n[1] * y + s[1] * L + r[1] * k, e[2] = t[2] * c + n[2] * y + s[2] * L + r[2] * k, e; + } + }, { + key: "bezier", + value: function bezier(e, t, n, s, r, a) { + var i = 1 - a, + c = i * i, + y = a * a, + L = c * i, + k = 3 * a * c, + l = 3 * y * i, + M = y * a; + return e[0] = t[0] * L + n[0] * k + s[0] * l + r[0] * M, e[1] = t[1] * L + n[1] * k + s[1] * l + r[1] * M, e[2] = t[2] * L + n[2] * k + s[2] * l + r[2] * M, e; + } + }, { + key: "transformMat4", + value: function transformMat4(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = n[3] * s + n[7] * r + n[11] * a + n[15] || 1; + return e[0] = (n[0] * s + n[4] * r + n[8] * a + n[12]) / i, e[1] = (n[1] * s + n[5] * r + n[9] * a + n[13]) / i, e[2] = (n[2] * s + n[6] * r + n[10] * a + n[14]) / i, e; + } + }, { + key: "transformMat3", + value: function transformMat3(e, t, n) { + var s = t[0], + r = t[1], + a = t[2]; + return e[0] = s * n[0] + r * n[3] + a * n[6], e[1] = s * n[1] + r * n[4] + a * n[7], e[2] = s * n[2] + r * n[5] + a * n[8], e; + } + }, { + key: "transformQuat", + value: function transformQuat(e, t, n) { + var s = n[0], + r = n[1], + a = n[2], + i = n[3] * 2, + c = t[0], + y = t[1], + L = t[2], + k = r * L - a * y, + l = a * c - s * L, + M = s * y - r * c, + h = (r * M - a * l) * 2, + b = (a * k - s * M) * 2, + d = (s * l - r * k) * 2; + return e[0] = c + k * i + h, e[1] = y + l * i + b, e[2] = L + M * i + d, e; + } + }, { + key: "rotateX", + value: function rotateX(e, t, n, s) { + var r = n[1], + a = n[2], + i = t[1] - r, + c = t[2] - a; + return e[0] = t[0], e[1] = i * Math.cos(s) - c * Math.sin(s) + r, e[2] = i * Math.sin(s) + c * Math.cos(s) + a, e; + } + }, { + key: "rotateY", + value: function rotateY(e, t, n, s) { + var r = n[0], + a = n[2], + i = t[0] - r, + c = t[2] - a; + return e[0] = c * Math.sin(s) + i * Math.cos(s) + r, e[1] = t[1], e[2] = c * Math.cos(s) - i * Math.sin(s) + a, e; + } + }, { + key: "rotateZ", + value: function rotateZ(e, t, n, s) { + var r = n[0], + a = n[1], + i = t[0] - r, + c = t[1] - a; + return e[0] = i * Math.cos(s) - c * Math.sin(s) + r, e[1] = i * Math.sin(s) + c * Math.cos(s) + a, e[2] = n[2], e; + } + }, { + key: "angle", + value: function angle(e, t) { + var n = e[0], + s = e[1], + r = e[2], + a = t[0], + i = t[1], + c = t[2], + y = Math.sqrt((n * n + s * s + r * r) * (a * a + i * i + c * c)), + L = y && A.dot(e, t) / y; + return Math.acos(Math.min(Math.max(L, -1), 1)); + } + }, { + key: "zero", + value: function zero(e) { + return e[0] = 0, e[1] = 0, e[2] = 0, e; + } + }, { + key: "str", + value: function str(e) { + return "Vec3(".concat(e.join(", "), ")"); + } + }, { + key: "exactEquals", + value: function exactEquals(e, t) { + return e[0] === t[0] && e[1] === t[1] && e[2] === t[2]; + } + }, { + key: "equals", + value: function equals(e, t) { + var n = e[0], + s = e[1], + r = e[2], + a = t[0], + i = t[1], + c = t[2]; + return Math.abs(n - a) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(a)) && Math.abs(s - i) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(i)) && Math.abs(r - c) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(c)); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float32Array)); + T.prototype.sub = T.prototype.subtract; + T.prototype.mul = T.prototype.multiply; + T.prototype.div = T.prototype.divide; + T.prototype.dist = T.prototype.distance; + T.prototype.sqrDist = T.prototype.squaredDistance; + T.sub = T.subtract; + T.mul = T.multiply; + T.div = T.divide; + T.dist = T.distance; + T.sqrDist = T.squaredDistance; + T.sqrLen = T.squaredLength; + T.mag = T.magnitude; + T.length = T.magnitude; + T.len = T.magnitude; + var q = /*#__PURE__*/function (_Float32Array6) { + function A() { + var _this6; + _classCallCheck(this, A); + for (var _len10 = arguments.length, e = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) { + e[_key10] = arguments[_key10]; + } + switch (e.length) { + case 4: + _this6 = _callSuper(this, A, [e]); + break; + case 2: + _this6 = _callSuper(this, A, [e[0], e[1], 4]); + break; + case 1: + { + var t = e[0]; + typeof t == "number" ? _this6 = _callSuper(this, A, [[t, t, t, t]]) : _this6 = _callSuper(this, A, [t, 0, 4]); + break; + } + default: + _this6 = _callSuper(this, A, [4]); + break; + } + return _assertThisInitialized(_this6); + } + _inherits(A, _Float32Array6); + return _createClass(A, [{ + key: "x", + get: function get() { + return this[0]; + }, + set: function set(e) { + this[0] = e; + } + }, { + key: "y", + get: function get() { + return this[1]; + }, + set: function set(e) { + this[1] = e; + } + }, { + key: "z", + get: function get() { + return this[2]; + }, + set: function set(e) { + this[2] = e; + } + }, { + key: "w", + get: function get() { + return this[3]; + }, + set: function set(e) { + this[3] = e; + } + }, { + key: "r", + get: function get() { + return this[0]; + }, + set: function set(e) { + this[0] = e; + } + }, { + key: "g", + get: function get() { + return this[1]; + }, + set: function set(e) { + this[1] = e; + } + }, { + key: "b", + get: function get() { + return this[2]; + }, + set: function set(e) { + this[2] = e; + } + }, { + key: "a", + get: function get() { + return this[3]; + }, + set: function set(e) { + this[3] = e; + } + }, { + key: "magnitude", + get: function get() { + var e = this[0], + t = this[1], + n = this[2], + s = this[3]; + return Math.sqrt(e * e + t * t + n * n + s * s); + } + }, { + key: "mag", + get: function get() { + return this.magnitude; + } + }, { + key: "str", + get: function get() { + return A.str(this); + } + }, { + key: "copy", + value: function copy(e) { + return _superPropGet(A, "set", this)([e]), this; + } + }, { + key: "add", + value: function add(e) { + return this[0] += e[0], this[1] += e[1], this[2] += e[2], this[3] += e[3], this; + } + }, { + key: "subtract", + value: function subtract(e) { + return this[0] -= e[0], this[1] -= e[1], this[2] -= e[2], this[3] -= e[3], this; + } + }, { + key: "sub", + value: function sub(e) { + return this; + } + }, { + key: "multiply", + value: function multiply(e) { + return this[0] *= e[0], this[1] *= e[1], this[2] *= e[2], this[3] *= e[3], this; + } + }, { + key: "mul", + value: function mul(e) { + return this; + } + }, { + key: "divide", + value: function divide(e) { + return this[0] /= e[0], this[1] /= e[1], this[2] /= e[2], this[3] /= e[3], this; + } + }, { + key: "div", + value: function div(e) { + return this; + } + }, { + key: "scale", + value: function scale(e) { + return this[0] *= e, this[1] *= e, this[2] *= e, this[3] *= e, this; + } + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(e, t) { + return this[0] += e[0] * t, this[1] += e[1] * t, this[2] += e[2] * t, this[3] += e[3] * t, this; + } + }, { + key: "distance", + value: function distance(e) { + return A.distance(this, e); + } + }, { + key: "dist", + value: function dist(e) { + return 0; + } + }, { + key: "squaredDistance", + value: function squaredDistance(e) { + return A.squaredDistance(this, e); + } + }, { + key: "sqrDist", + value: function sqrDist(e) { + return 0; + } + }, { + key: "negate", + value: function negate() { + return this[0] *= -1, this[1] *= -1, this[2] *= -1, this[3] *= -1, this; + } + }, { + key: "invert", + value: function invert() { + return this[0] = 1 / this[0], this[1] = 1 / this[1], this[2] = 1 / this[2], this[3] = 1 / this[3], this; + } + }, { + key: "abs", + value: function abs() { + return this[0] = Math.abs(this[0]), this[1] = Math.abs(this[1]), this[2] = Math.abs(this[2]), this[3] = Math.abs(this[3]), this; + } + }, { + key: "dot", + value: function dot(e) { + return this[0] * e[0] + this[1] * e[1] + this[2] * e[2] + this[3] * e[3]; + } + }, { + key: "normalize", + value: function normalize() { + return A.normalize(this, this); + } + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 4 * Float32Array.BYTES_PER_ELEMENT; + } + }, { + key: "create", + value: function create() { + return new A(); + } + }, { + key: "clone", + value: function clone(e) { + return new A(e); + } + }, { + key: "fromValues", + value: function fromValues(e, t, n, s) { + return new A(e, t, n, s); + } + }, { + key: "copy", + value: function copy(e, t) { + return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e; + } + }, { + key: "set", + value: function set(e, t, n, s, r) { + return e[0] = t, e[1] = n, e[2] = s, e[3] = r, e; + } + }, { + key: "add", + value: function add(e, t, n) { + return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e[2] = t[2] + n[2], e[3] = t[3] + n[3], e; + } + }, { + key: "subtract", + value: function subtract(e, t, n) { + return e[0] = t[0] - n[0], e[1] = t[1] - n[1], e[2] = t[2] - n[2], e[3] = t[3] - n[3], e; + } + }, { + key: "sub", + value: function sub(e, t, n) { + return e; + } + }, { + key: "multiply", + value: function multiply(e, t, n) { + return e[0] = t[0] * n[0], e[1] = t[1] * n[1], e[2] = t[2] * n[2], e[3] = t[3] * n[3], e; + } + }, { + key: "mul", + value: function mul(e, t, n) { + return e; + } + }, { + key: "divide", + value: function divide(e, t, n) { + return e[0] = t[0] / n[0], e[1] = t[1] / n[1], e[2] = t[2] / n[2], e[3] = t[3] / n[3], e; + } + }, { + key: "div", + value: function div(e, t, n) { + return e; + } + }, { + key: "ceil", + value: function ceil(e, t) { + 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; + } + }, { + key: "floor", + value: function floor(e, t) { + 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; + } + }, { + key: "min", + value: function min(e, t, n) { + return e[0] = Math.min(t[0], n[0]), e[1] = Math.min(t[1], n[1]), e[2] = Math.min(t[2], n[2]), e[3] = Math.min(t[3], n[3]), e; + } + }, { + key: "max", + value: function max(e, t, n) { + return e[0] = Math.max(t[0], n[0]), e[1] = Math.max(t[1], n[1]), e[2] = Math.max(t[2], n[2]), e[3] = Math.max(t[3], n[3]), e; + } + }, { + key: "round", + value: function round(e, t) { + 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; + } + }, { + key: "scale", + value: function scale(e, t, n) { + return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e[3] = t[3] * n, e; + } + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(e, t, n, s) { + return e[0] = t[0] + n[0] * s, e[1] = t[1] + n[1] * s, e[2] = t[2] + n[2] * s, e[3] = t[3] + n[3] * s, e; + } + }, { + key: "distance", + value: function distance(e, t) { + var n = t[0] - e[0], + s = t[1] - e[1], + r = t[2] - e[2], + a = t[3] - e[3]; + return Math.hypot(n, s, r, a); + } + }, { + key: "dist", + value: function dist(e, t) { + return 0; + } + }, { + key: "squaredDistance", + value: function squaredDistance(e, t) { + var n = t[0] - e[0], + s = t[1] - e[1], + r = t[2] - e[2], + a = t[3] - e[3]; + return n * n + s * s + r * r + a * a; + } + }, { + key: "sqrDist", + value: function sqrDist(e, t) { + return 0; + } + }, { + key: "magnitude", + value: function magnitude(e) { + var t = e[0], + n = e[1], + s = e[2], + r = e[3]; + return Math.sqrt(t * t + n * n + s * s + r * r); + } + }, { + key: "mag", + value: function mag(e) { + return 0; + } + }, { + key: "length", + value: function length(e) { + return 0; + } + }, { + key: "len", + value: function len(e) { + return 0; + } + }, { + key: "squaredLength", + value: function squaredLength(e) { + var t = e[0], + n = e[1], + s = e[2], + r = e[3]; + return t * t + n * n + s * s + r * r; + } + }, { + key: "sqrLen", + value: function sqrLen(e) { + return 0; + } + }, { + key: "negate", + value: function negate(e, t) { + return e[0] = -t[0], e[1] = -t[1], e[2] = -t[2], e[3] = -t[3], e; + } + }, { + key: "inverse", + value: function inverse(e, t) { + return e[0] = 1 / t[0], e[1] = 1 / t[1], e[2] = 1 / t[2], e[3] = 1 / t[3], e; + } + }, { + key: "abs", + value: function abs(e, t) { + return e[0] = Math.abs(t[0]), e[1] = Math.abs(t[1]), e[2] = Math.abs(t[2]), e[3] = Math.abs(t[3]), e; + } + }, { + key: "normalize", + value: function normalize(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = n * n + s * s + r * r + a * a; + return i > 0 && (i = 1 / Math.sqrt(i)), e[0] = n * i, e[1] = s * i, e[2] = r * i, e[3] = a * i, e; + } + }, { + key: "dot", + value: function dot(e, t) { + return e[0] * t[0] + e[1] * t[1] + e[2] * t[2] + e[3] * t[3]; + } + }, { + key: "cross", + value: function cross(e, t, n, s) { + var r = n[0] * s[1] - n[1] * s[0], + a = n[0] * s[2] - n[2] * s[0], + i = n[0] * s[3] - n[3] * s[0], + c = n[1] * s[2] - n[2] * s[1], + y = n[1] * s[3] - n[3] * s[1], + L = n[2] * s[3] - n[3] * s[2], + k = t[0], + l = t[1], + M = t[2], + h = t[3]; + return e[0] = l * L - M * y + h * c, e[1] = -(k * L) + M * i - h * a, e[2] = k * y - l * i + h * r, e[3] = -(k * c) + l * a - M * r, e; + } + }, { + key: "lerp", + value: function lerp(e, t, n, s) { + var r = t[0], + a = t[1], + i = t[2], + c = t[3]; + return e[0] = r + s * (n[0] - r), e[1] = a + s * (n[1] - a), e[2] = i + s * (n[2] - i), e[3] = c + s * (n[3] - c), e; + } + }, { + key: "transformMat4", + value: function transformMat4(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3]; + return e[0] = n[0] * s + n[4] * r + n[8] * a + n[12] * i, e[1] = n[1] * s + n[5] * r + n[9] * a + n[13] * i, e[2] = n[2] * s + n[6] * r + n[10] * a + n[14] * i, e[3] = n[3] * s + n[7] * r + n[11] * a + n[15] * i, e; + } + }, { + key: "transformQuat", + value: function transformQuat(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = n[0], + c = n[1], + y = n[2], + L = n[3], + k = L * s + c * a - y * r, + l = L * r + y * s - i * a, + M = L * a + i * r - c * s, + h = -i * s - c * r - y * a; + return e[0] = k * L + h * -i + l * -y - M * -c, e[1] = l * L + h * -c + M * -i - k * -y, e[2] = M * L + h * -y + k * -c - l * -i, e[3] = t[3], e; + } + }, { + key: "zero", + value: function zero(e) { + return e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 0, e; + } + }, { + key: "str", + value: function str(e) { + return "Vec4(".concat(e.join(", "), ")"); + } + }, { + key: "exactEquals", + value: function exactEquals(e, t) { + return e[0] === t[0] && e[1] === t[1] && e[2] === t[2] && e[3] === t[3]; + } + }, { + key: "equals", + value: function equals(e, t) { + var n = e[0], + s = e[1], + r = e[2], + a = e[3], + i = t[0], + c = t[1], + y = t[2], + L = t[3]; + return Math.abs(n - i) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(i)) && Math.abs(s - c) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(c)) && Math.abs(r - y) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(y)) && Math.abs(a - L) <= 1e-6 * Math.max(1, Math.abs(a), Math.abs(L)); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float32Array)); + q.prototype.sub = q.prototype.subtract; + q.prototype.mul = q.prototype.multiply; + q.prototype.div = q.prototype.divide; + q.prototype.dist = q.prototype.distance; + q.prototype.sqrDist = q.prototype.squaredDistance; + q.sub = q.subtract; + q.mul = q.multiply; + q.div = q.divide; + q.dist = q.distance; + q.sqrDist = q.squaredDistance; + q.sqrLen = q.squaredLength; + q.mag = q.magnitude; + q.length = q.magnitude; + q.len = q.magnitude; + var ke, + ie, + ce, + W, + U, + le, + he, + f = /*#__PURE__*/function (_Float32Array7) { + function f() { + var _this7; + _classCallCheck(this, f); + for (var _len11 = arguments.length, e = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) { + e[_key11] = arguments[_key11]; + } + switch (e.length) { + case 4: + _this7 = _callSuper(this, f, [e]); + break; + case 2: + _this7 = _callSuper(this, f, [e[0], e[1], 4]); + break; + case 1: + { + var t = e[0]; + typeof t == "number" ? _this7 = _callSuper(this, f, [[t, t, t, t]]) : _this7 = _callSuper(this, f, [t, 0, 4]); + break; + } + default: + _this7 = _callSuper(this, f, [4]), _this7[3] = 1; + break; + } + return _assertThisInitialized(_this7); + } + _inherits(f, _Float32Array7); + return _createClass(f, [{ + key: "x", + get: function get() { + return this[0]; + }, + set: function set(e) { + this[0] = e; + } + }, { + key: "y", + get: function get() { + return this[1]; + }, + set: function set(e) { + this[1] = e; + } + }, { + key: "z", + get: function get() { + return this[2]; + }, + set: function set(e) { + this[2] = e; + } + }, { + key: "w", + get: function get() { + return this[3]; + }, + set: function set(e) { + this[3] = e; + } + }, { + key: "magnitude", + get: function get() { + var e = this[0], + t = this[1], + n = this[2], + s = this[3]; + return Math.sqrt(e * e + t * t + n * n + s * s); + } + }, { + key: "mag", + get: function get() { + return this.magnitude; + } + }, { + key: "str", + get: function get() { + return f.str(this); + } + }, { + key: "copy", + value: function copy(e) { + return _superPropGet(f, "set", this)([e]), this; + } + }, { + key: "identity", + value: function identity() { + return this[0] = 0, this[1] = 0, this[2] = 0, this[3] = 1, this; + } + }, { + key: "multiply", + value: function multiply(e) { + return f.multiply(this, this, e); + } + }, { + key: "mul", + value: function mul(e) { + return this; + } + }, { + key: "rotateX", + value: function rotateX(e) { + return f.rotateX(this, this, e); + } + }, { + key: "rotateY", + value: function rotateY(e) { + return f.rotateY(this, this, e); + } + }, { + key: "rotateZ", + value: function rotateZ(e) { + return f.rotateZ(this, this, e); + } + }, { + key: "invert", + value: function invert() { + return f.invert(this, this); + } + }, { + key: "scale", + value: function scale(e) { + return this[0] *= e, this[1] *= e, this[2] *= e, this[3] *= e, this; + } + }, { + key: "dot", + value: function dot(e) { + return f.dot(this, e); + } + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 4 * Float32Array.BYTES_PER_ELEMENT; + } + }, { + key: "create", + value: function create() { + return new f(); + } + }, { + key: "identity", + value: function identity(e) { + return e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 1, e; + } + }, { + key: "setAxisAngle", + value: function setAxisAngle(e, t, n) { + n *= .5; + var s = Math.sin(n); + return e[0] = s * t[0], e[1] = s * t[1], e[2] = s * t[2], e[3] = Math.cos(n), e; + } + }, { + key: "getAxisAngle", + value: function getAxisAngle(e, t) { + var n = Math.acos(t[3]) * 2, + s = Math.sin(n / 2); + return s > 1e-6 ? (e[0] = t[0] / s, e[1] = t[1] / s, e[2] = t[2] / s) : (e[0] = 1, e[1] = 0, e[2] = 0), n; + } + }, { + key: "getAngle", + value: function getAngle(e, t) { + var n = f.dot(e, t); + return Math.acos(2 * n * n - 1); + } + }, { + key: "multiply", + value: function multiply(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = n[0], + y = n[1], + L = n[2], + k = n[3]; + return e[0] = s * k + i * c + r * L - a * y, e[1] = r * k + i * y + a * c - s * L, e[2] = a * k + i * L + s * y - r * c, e[3] = i * k - s * c - r * y - a * L, e; + } + }, { + key: "rotateX", + value: function rotateX(e, t, n) { + n *= .5; + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = Math.sin(n), + y = Math.cos(n); + return e[0] = s * y + i * c, e[1] = r * y + a * c, e[2] = a * y - r * c, e[3] = i * y - s * c, e; + } + }, { + key: "rotateY", + value: function rotateY(e, t, n) { + n *= .5; + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = Math.sin(n), + y = Math.cos(n); + return e[0] = s * y - a * c, e[1] = r * y + i * c, e[2] = a * y + s * c, e[3] = i * y - r * c, e; + } + }, { + key: "rotateZ", + value: function rotateZ(e, t, n) { + n *= .5; + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = Math.sin(n), + y = Math.cos(n); + return e[0] = s * y + r * c, e[1] = r * y - s * c, e[2] = a * y + i * c, e[3] = i * y - a * c, e; + } + }, { + key: "calculateW", + value: function calculateW(e, t) { + var n = t[0], + s = t[1], + r = t[2]; + return e[0] = n, e[1] = s, e[2] = r, e[3] = Math.sqrt(Math.abs(1 - n * n - s * s - r * r)), e; + } + }, { + key: "exp", + value: function exp(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = Math.sqrt(n * n + s * s + r * r), + c = Math.exp(a), + y = i > 0 ? c * Math.sin(i) / i : 0; + return e[0] = n * y, e[1] = s * y, e[2] = r * y, e[3] = c * Math.cos(i), e; + } + }, { + key: "ln", + value: function ln(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = Math.sqrt(n * n + s * s + r * r), + c = i > 0 ? Math.atan2(i, a) / i : 0; + return e[0] = n * c, e[1] = s * c, e[2] = r * c, e[3] = .5 * Math.log(n * n + s * s + r * r + a * a), e; + } + }, { + key: "pow", + value: function pow(e, t, n) { + return f.ln(e, t), f.scale(e, e, n), f.exp(e, e), e; + } + }, { + key: "slerp", + value: function slerp(e, t, n, s) { + var r = t[0], + a = t[1], + i = t[2], + c = t[3], + y = n[0], + L = n[1], + k = n[2], + l = n[3], + M, + h, + b = r * y + a * L + i * k + c * l; + if (b < 0 && (b = -b, y = -y, L = -L, k = -k, l = -l), 1 - b > 1e-6) { + var d = Math.acos(b), + m = Math.sin(d); + M = Math.sin((1 - s) * d) / m, h = Math.sin(s * d) / m; + } else M = 1 - s, h = s; + return e[0] = M * r + h * y, e[1] = M * a + h * L, e[2] = M * i + h * k, e[3] = M * c + h * l, e; + } + }, { + key: "invert", + value: function invert(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = n * n + s * s + r * r + a * a, + c = i ? 1 / i : 0; + return e[0] = -n * c, e[1] = -s * c, e[2] = -r * c, e[3] = a * c, e; + } + }, { + key: "conjugate", + value: function conjugate(e, t) { + return e[0] = -t[0], e[1] = -t[1], e[2] = -t[2], e[3] = t[3], e; + } + }, { + key: "fromMat3", + value: function fromMat3(e, t) { + var n = t[0] + t[4] + t[8], + s; + if (n > 0) s = Math.sqrt(n + 1), e[3] = .5 * s, s = .5 / s, e[0] = (t[5] - t[7]) * s, e[1] = (t[6] - t[2]) * s, e[2] = (t[1] - t[3]) * s;else { + var r = 0; + t[4] > t[0] && (r = 1), t[8] > t[r * 3 + r] && (r = 2); + var a = (r + 1) % 3, + i = (r + 2) % 3; + s = Math.sqrt(t[r * 3 + r] - t[a * 3 + a] - t[i * 3 + i] + 1), e[r] = .5 * s, s = .5 / s, e[3] = (t[a * 3 + i] - t[i * 3 + a]) * s, e[a] = (t[a * 3 + r] + t[r * 3 + a]) * s, e[i] = (t[i * 3 + r] + t[r * 3 + i]) * s; + } + return e; + } + }, { + key: "fromEuler", + value: function fromEuler(e, t, n, s) { + var r = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : E(f, ke); + var a = .5 * Math.PI / 180; + t *= a, n *= a, s *= a; + var i = Math.sin(t), + c = Math.cos(t), + y = Math.sin(n), + L = Math.cos(n), + k = Math.sin(s), + l = Math.cos(s); + switch (r) { + case "xyz": + e[0] = i * L * l + c * y * k, e[1] = c * y * l - i * L * k, e[2] = c * L * k + i * y * l, e[3] = c * L * l - i * y * k; + break; + case "xzy": + e[0] = i * L * l - c * y * k, e[1] = c * y * l - i * L * k, e[2] = c * L * k + i * y * l, e[3] = c * L * l + i * y * k; + break; + case "yxz": + e[0] = i * L * l + c * y * k, e[1] = c * y * l - i * L * k, e[2] = c * L * k - i * y * l, e[3] = c * L * l + i * y * k; + break; + case "yzx": + e[0] = i * L * l + c * y * k, e[1] = c * y * l + i * L * k, e[2] = c * L * k - i * y * l, e[3] = c * L * l - i * y * k; + break; + case "zxy": + e[0] = i * L * l - c * y * k, e[1] = c * y * l + i * L * k, e[2] = c * L * k + i * y * l, e[3] = c * L * l - i * y * k; + break; + case "zyx": + e[0] = i * L * l - c * y * k, e[1] = c * y * l + i * L * k, e[2] = c * L * k - i * y * l, e[3] = c * L * l + i * y * k; + break; + default: + throw new Error("Unknown angle order ".concat(r)); + } + return e; + } + }, { + key: "str", + value: function str(e) { + return "Quat(".concat(e.join(", "), ")"); + } + }, { + key: "clone", + value: function clone(e) { + return new f(e); + } + }, { + key: "fromValues", + value: function fromValues(e, t, n, s) { + return new f(e, t, n, s); + } + }, { + key: "copy", + value: function copy(e, t) { + return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e; + } + }, { + key: "set", + value: function set(e, t, n, s, r) { + return e; + } + }, { + key: "add", + value: function add(e, t, n) { + return e; + } + }, { + key: "mul", + value: function mul(e, t, n) { + return e; + } + }, { + key: "scale", + value: function scale(e, t, n) { + return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e[3] = t[3] * n, e; + } + }, { + key: "dot", + value: function dot(e, t) { + return e[0] * t[0] + e[1] * t[1] + e[2] * t[2] + e[3] * t[3]; + } + }, { + key: "lerp", + value: function lerp(e, t, n, s) { + return e; + } + }, { + key: "magnitude", + value: function magnitude(e) { + return 0; + } + }, { + key: "mag", + value: function mag(e) { + return 0; + } + }, { + key: "length", + value: function length(e) { + return 0; + } + }, { + key: "len", + value: function len(e) { + return 0; + } + }, { + key: "squaredLength", + value: function squaredLength(e) { + return 0; + } + }, { + key: "sqrLen", + value: function sqrLen(e) { + return 0; + } + }, { + key: "normalize", + value: function normalize(e, t) { + return e; + } + }, { + key: "exactEquals", + value: function exactEquals(e, t) { + return !1; + } + }, { + key: "equals", + value: function equals(e, t) { + return !1; + } + }, { + key: "rotationTo", + value: function rotationTo(e, t, n) { + var s = T.dot(t, n); + return s < -.999999 ? (T.cross(E(f, U), E(f, le), t), T.mag(E(f, U)) < 1e-6 && T.cross(E(f, U), E(f, he), t), T.normalize(E(f, U), E(f, U)), f.setAxisAngle(e, E(f, U), Math.PI), e) : s > .999999 ? (e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 1, e) : (T.cross(E(f, U), t, n), e[0] = E(f, U)[0], e[1] = E(f, U)[1], e[2] = E(f, U)[2], e[3] = 1 + s, f.normalize(e, e)); + } + }, { + key: "sqlerp", + value: function sqlerp(e, t, n, s, r, a) { + return f.slerp(E(f, ie), t, r, a), f.slerp(E(f, ce), n, s, a), f.slerp(e, E(f, ie), E(f, ce), 2 * a * (1 - a)), e; + } + }, { + key: "setAxes", + value: function setAxes(e, t, n, s) { + return E(f, W)[0] = n[0], E(f, W)[3] = n[1], E(f, W)[6] = n[2], E(f, W)[1] = s[0], E(f, W)[4] = s[1], E(f, W)[7] = s[2], E(f, W)[2] = -t[0], E(f, W)[5] = -t[1], E(f, W)[8] = -t[2], f.normalize(e, f.fromMat3(e, E(f, W))); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float32Array)); + ke = new WeakMap(), ie = new WeakMap(), ce = new WeakMap(), W = new WeakMap(), U = new WeakMap(), le = new WeakMap(), he = new WeakMap(), Z(f, ke, "zyx"), Z(f, ie, new Float32Array(4)), Z(f, ce, new Float32Array(4)), Z(f, W, new Float32Array(9)), Z(f, U, new Float32Array(3)), Z(f, le, new Float32Array([1, 0, 0])), Z(f, he, new Float32Array([0, 1, 0])); + var O = f; + O.set = q.set; + O.add = q.add; + O.lerp = q.lerp; + O.normalize = q.normalize; + O.squaredLength = q.squaredLength; + O.sqrLen = q.squaredLength; + O.exactEquals = q.exactEquals; + O.equals = q.equals; + O.magnitude = q.magnitude; + O.prototype.mul = O.prototype.multiply; + O.mul = O.multiply; + O.mag = O.magnitude; + O.length = O.magnitude; + O.len = O.magnitude; + var ye, + Le, + j = /*#__PURE__*/function (_Float32Array8) { + function j() { + var _this8; + _classCallCheck(this, j); + for (var _len12 = arguments.length, e = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) { + e[_key12] = arguments[_key12]; + } + switch (e.length) { + case 8: + _this8 = _callSuper(this, j, [e]); + break; + case 2: + _this8 = _callSuper(this, j, [e[0], e[1], 8]); + break; + case 1: + { + var t = e[0]; + typeof t == "number" ? _this8 = _callSuper(this, j, [[t, t, t, t, t, t, t, t]]) : _this8 = _callSuper(this, j, [t, 0, 8]); + break; + } + default: + _this8 = _callSuper(this, j, [8]), _this8[3] = 1; + break; + } + return _assertThisInitialized(_this8); + } + _inherits(j, _Float32Array8); + return _createClass(j, [{ + key: "str", + get: function get() { + return j.str(this); + } + }, { + key: "copy", + value: function copy(e) { + return _superPropGet(j, "set", this)([e]), this; + } + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 8 * Float32Array.BYTES_PER_ELEMENT; + } + }, { + key: "create", + value: function create() { + return new j(); + } + }, { + key: "clone", + value: function clone(e) { + return new j(e); + } + }, { + key: "fromValues", + value: function fromValues(e, t, n, s, r, a, i, c) { + return new j(e, t, n, s, r, a, i, c); + } + }, { + key: "fromRotationTranslationValues", + value: function fromRotationTranslationValues(e, t, n, s, r, a, i) { + var c = r * .5, + y = a * .5, + L = i * .5; + return new j(e, t, n, s, c * s + y * n - L * t, y * s + L * e - c * n, L * s + c * t - y * e, -c * e - y * t - L * n); + } + }, { + key: "fromRotationTranslation", + value: function fromRotationTranslation(e, t, n) { + var s = n[0] * .5, + r = n[1] * .5, + a = n[2] * .5, + i = t[0], + c = t[1], + y = t[2], + L = t[3]; + return e[0] = i, e[1] = c, e[2] = y, e[3] = L, e[4] = s * L + r * y - a * c, e[5] = r * L + a * i - s * y, e[6] = a * L + s * c - r * i, e[7] = -s * i - r * c - a * y, e; + } + }, { + key: "fromTranslation", + value: function fromTranslation(e, t) { + return e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 1, e[4] = t[0] * .5, e[5] = t[1] * .5, e[6] = t[2] * .5, e[7] = 0, e; + } + }, { + key: "fromRotation", + value: function fromRotation(e, t) { + return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[4] = 0, e[5] = 0, e[6] = 0, e[7] = 0, e; + } + }, { + key: "fromMat4", + value: function fromMat4(e, t) { + return G.getRotation(E(j, ye), t), G.getTranslation(E(j, Le), t), j.fromRotationTranslation(e, E(j, ye), E(j, Le)); + } + }, { + key: "copy", + value: function copy(e, t) { + 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; + } + }, { + key: "identity", + value: function identity(e) { + return e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 1, e[4] = 0, e[5] = 0, e[6] = 0, e[7] = 0, e; + } + }, { + key: "set", + value: function set(e, t, n, s, r, a, i, c, y) { + return e[0] = t, e[1] = n, e[2] = s, e[3] = r, e[4] = a, e[5] = i, e[6] = c, e[7] = y, e; + } + }, { + key: "getReal", + value: function getReal(e, t) { + return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e; + } + }, { + key: "getDual", + value: function getDual(e, t) { + return e[0] = t[4], e[1] = t[5], e[2] = t[6], e[3] = t[7], e; + } + }, { + key: "setReal", + value: function setReal(e, t) { + return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e; + } + }, { + key: "setDual", + value: function setDual(e, t) { + return e[4] = t[0], e[5] = t[1], e[6] = t[2], e[7] = t[3], e; + } + }, { + key: "getTranslation", + value: function getTranslation(e, t) { + var n = t[4], + s = t[5], + r = t[6], + a = t[7], + i = -t[0], + c = -t[1], + y = -t[2], + L = t[3]; + return e[0] = (n * L + a * i + s * y - r * c) * 2, e[1] = (s * L + a * c + r * i - n * y) * 2, e[2] = (r * L + a * y + n * c - s * i) * 2, e; + } + }, { + key: "translate", + value: function translate(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = n[0] * .5, + y = n[1] * .5, + L = n[2] * .5, + k = t[4], + l = t[5], + M = t[6], + h = t[7]; + return e[0] = s, e[1] = r, e[2] = a, e[3] = i, e[4] = i * c + r * L - a * y + k, e[5] = i * y + a * c - s * L + l, e[6] = i * L + s * y - r * c + M, e[7] = -s * c - r * y - a * L + h, e; + } + }, { + key: "rotateX", + value: function rotateX(e, t, n) { + var s = -t[0], + r = -t[1], + a = -t[2], + i = t[3], + c = t[4], + y = t[5], + L = t[6], + k = t[7], + l = c * i + k * s + y * a - L * r, + M = y * i + k * r + L * s - c * a, + h = L * i + k * a + c * r - y * s, + b = k * i - c * s - y * r - L * a; + return O.rotateX(e, t, n), s = e[0], r = e[1], a = e[2], i = e[3], e[4] = l * i + b * s + M * a - h * r, e[5] = M * i + b * r + h * s - l * a, e[6] = h * i + b * a + l * r - M * s, e[7] = b * i - l * s - M * r - h * a, e; + } + }, { + key: "rotateY", + value: function rotateY(e, t, n) { + var s = -t[0], + r = -t[1], + a = -t[2], + i = t[3], + c = t[4], + y = t[5], + L = t[6], + k = t[7], + l = c * i + k * s + y * a - L * r, + M = y * i + k * r + L * s - c * a, + h = L * i + k * a + c * r - y * s, + b = k * i - c * s - y * r - L * a; + return O.rotateY(e, t, n), s = e[0], r = e[1], a = e[2], i = e[3], e[4] = l * i + b * s + M * a - h * r, e[5] = M * i + b * r + h * s - l * a, e[6] = h * i + b * a + l * r - M * s, e[7] = b * i - l * s - M * r - h * a, e; + } + }, { + key: "rotateZ", + value: function rotateZ(e, t, n) { + var s = -t[0], + r = -t[1], + a = -t[2], + i = t[3], + c = t[4], + y = t[5], + L = t[6], + k = t[7], + l = c * i + k * s + y * a - L * r, + M = y * i + k * r + L * s - c * a, + h = L * i + k * a + c * r - y * s, + b = k * i - c * s - y * r - L * a; + return O.rotateZ(e, t, n), s = e[0], r = e[1], a = e[2], i = e[3], e[4] = l * i + b * s + M * a - h * r, e[5] = M * i + b * r + h * s - l * a, e[6] = h * i + b * a + l * r - M * s, e[7] = b * i - l * s - M * r - h * a, e; + } + }, { + key: "rotateByQuatAppend", + value: function rotateByQuatAppend(e, t, n) { + var s = n[0], + r = n[1], + a = n[2], + i = n[3], + c = t[0], + y = t[1], + L = t[2], + k = t[3]; + return e[0] = c * i + k * s + y * a - L * r, e[1] = y * i + k * r + L * s - c * a, e[2] = L * i + k * a + c * r - y * s, e[3] = k * i - c * s - y * r - L * a, c = t[4], y = t[5], L = t[6], k = t[7], e[4] = c * i + k * s + y * a - L * r, e[5] = y * i + k * r + L * s - c * a, e[6] = L * i + k * a + c * r - y * s, e[7] = k * i - c * s - y * r - L * a, e; + } + }, { + key: "rotateByQuatPrepend", + value: function rotateByQuatPrepend(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = n[0], + y = n[1], + L = n[2], + k = n[3]; + return e[0] = s * k + i * c + r * L - a * y, e[1] = r * k + i * y + a * c - s * L, e[2] = a * k + i * L + s * y - r * c, e[3] = i * k - s * c - r * y - a * L, c = n[4], y = n[5], L = n[6], k = n[7], e[4] = s * k + i * c + r * L - a * y, e[5] = r * k + i * y + a * c - s * L, e[6] = a * k + i * L + s * y - r * c, e[7] = i * k - s * c - r * y - a * L, e; + } + }, { + key: "rotateAroundAxis", + value: function rotateAroundAxis(e, t, n, s) { + if (Math.abs(s) < 1e-6) return j.copy(e, t); + var r = Math.sqrt(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]); + s *= .5; + var a = Math.sin(s), + i = a * n[0] / r, + c = a * n[1] / r, + y = a * n[2] / r, + L = Math.cos(s), + k = t[0], + l = t[1], + M = t[2], + h = t[3]; + e[0] = k * L + h * i + l * y - M * c, e[1] = l * L + h * c + M * i - k * y, e[2] = M * L + h * y + k * c - l * i, e[3] = h * L - k * i - l * c - M * y; + var b = t[4], + d = t[5], + m = t[6], + o = t[7]; + return e[4] = b * L + o * i + d * y - m * c, e[5] = d * L + o * c + m * i - b * y, e[6] = m * L + o * y + b * c - d * i, e[7] = o * L - b * i - d * c - m * y, e; + } + }, { + key: "add", + value: function add(e, t, n) { + return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e[2] = t[2] + n[2], e[3] = t[3] + n[3], e[4] = t[4] + n[4], e[5] = t[5] + n[5], e[6] = t[6] + n[6], e[7] = t[7] + n[7], e; + } + }, { + key: "multiply", + value: function multiply(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = n[4], + y = n[5], + L = n[6], + k = n[7], + l = t[4], + M = t[5], + h = t[6], + b = t[7], + d = n[0], + m = n[1], + o = n[2], + V = n[3]; + return e[0] = s * V + i * d + r * o - a * m, e[1] = r * V + i * m + a * d - s * o, e[2] = a * V + i * o + s * m - r * d, e[3] = i * V - s * d - r * m - a * o, e[4] = s * k + i * c + r * L - a * y + l * V + b * d + M * o - h * m, e[5] = r * k + i * y + a * c - s * L + M * V + b * m + h * d - l * o, e[6] = a * k + i * L + s * y - r * c + h * V + b * o + l * m - M * d, e[7] = i * k - s * c - r * y - a * L + b * V - l * d - M * m - h * o, e; + } + }, { + key: "mul", + value: function mul(e, t, n) { + return e; + } + }, { + key: "scale", + value: function scale(e, t, n) { + return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e[3] = t[3] * n, e[4] = t[4] * n, e[5] = t[5] * n, e[6] = t[6] * n, e[7] = t[7] * n, e; + } + }, { + key: "dot", + value: function dot(e, t) { + return 0; + } + }, { + key: "lerp", + value: function lerp(e, t, n, s) { + var r = 1 - s; + return j.dot(t, n) < 0 && (s = -s), e[0] = t[0] * r + n[0] * s, e[1] = t[1] * r + n[1] * s, e[2] = t[2] * r + n[2] * s, e[3] = t[3] * r + n[3] * s, e[4] = t[4] * r + n[4] * s, e[5] = t[5] * r + n[5] * s, e[6] = t[6] * r + n[6] * s, e[7] = t[7] * r + n[7] * s, e; + } + }, { + key: "invert", + value: function invert(e, t) { + var n = j.squaredLength(t); + return e[0] = -t[0] / n, e[1] = -t[1] / n, e[2] = -t[2] / n, e[3] = t[3] / n, e[4] = -t[4] / n, e[5] = -t[5] / n, e[6] = -t[6] / n, e[7] = t[7] / n, e; + } + }, { + key: "conjugate", + value: function conjugate(e, t) { + 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; + } + }, { + key: "magnitude", + value: function magnitude(e) { + return 0; + } + }, { + key: "mag", + value: function mag(e) { + return 0; + } + }, { + key: "length", + value: function length(e) { + return 0; + } + }, { + key: "len", + value: function len(e) { + return 0; + } + }, { + key: "squaredLength", + value: function squaredLength(e) { + return 0; + } + }, { + key: "sqrLen", + value: function sqrLen(e) { + return 0; + } + }, { + key: "normalize", + value: function normalize(e, t) { + var n = j.squaredLength(t); + if (n > 0) { + n = Math.sqrt(n); + var s = t[0] / n, + r = t[1] / n, + a = t[2] / n, + i = t[3] / n, + c = t[4], + y = t[5], + L = t[6], + k = t[7], + l = s * c + r * y + a * L + i * k; + e[0] = s, e[1] = r, e[2] = a, e[3] = i, e[4] = (c - s * l) / n, e[5] = (y - r * l) / n, e[6] = (L - a * l) / n, e[7] = (k - i * l) / n; + } + return e; + } + }, { + key: "str", + value: function str(e) { + return "Quat2(".concat(e.join(", "), ")"); + } + }, { + key: "exactEquals", + value: function exactEquals(e, t) { + 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]; + } + }, { + key: "equals", + value: function equals(e, t) { + var n = e[0], + s = e[1], + r = e[2], + a = e[3], + i = e[4], + c = e[5], + y = e[6], + L = e[7], + k = t[0], + l = t[1], + M = t[2], + h = t[3], + b = t[4], + d = t[5], + m = t[6], + o = t[7]; + return Math.abs(n - k) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(k)) && Math.abs(s - l) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(l)) && Math.abs(r - M) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(M)) && Math.abs(a - h) <= 1e-6 * Math.max(1, Math.abs(a), Math.abs(h)) && Math.abs(i - b) <= 1e-6 * Math.max(1, Math.abs(i), Math.abs(b)) && Math.abs(c - d) <= 1e-6 * Math.max(1, Math.abs(c), Math.abs(d)) && Math.abs(y - m) <= 1e-6 * Math.max(1, Math.abs(y), Math.abs(m)) && Math.abs(L - o) <= 1e-6 * Math.max(1, Math.abs(L), Math.abs(o)); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float32Array)); + ye = new WeakMap(), Le = new WeakMap(), Z(j, ye, new Float32Array(4)), Z(j, Le, new Float32Array(3)); + var J = j; + J.dot = O.dot; + J.squaredLength = O.squaredLength; + J.sqrLen = O.squaredLength; + J.mag = O.magnitude; + J.length = O.magnitude; + J.len = O.magnitude; + J.mul = J.multiply; + var N = /*#__PURE__*/function (_Float32Array9) { + function A() { + var _this9; + _classCallCheck(this, A); + switch (arguments.length) { + case 2: + { + var t = arguments.length <= 0 ? undefined : arguments[0]; + typeof t == "number" ? _this9 = _callSuper(this, A, [[t, arguments.length <= 1 ? undefined : arguments[1]]]) : _this9 = _callSuper(this, A, [t, arguments.length <= 1 ? undefined : arguments[1], 2]); + break; + } + case 1: + { + var _t = arguments.length <= 0 ? undefined : arguments[0]; + typeof _t == "number" ? _this9 = _callSuper(this, A, [[_t, _t]]) : _this9 = _callSuper(this, A, [_t, 0, 2]); + break; + } + default: + _this9 = _callSuper(this, A, [2]); + break; + } + return _assertThisInitialized(_this9); + } + _inherits(A, _Float32Array9); + return _createClass(A, [{ + key: "x", + get: function get() { + return this[0]; + }, + set: function set(e) { + this[0] = e; + } + }, { + key: "y", + get: function get() { + return this[1]; + }, + set: function set(e) { + this[1] = e; + } + }, { + key: "r", + get: function get() { + return this[0]; + }, + set: function set(e) { + this[0] = e; + } + }, { + key: "g", + get: function get() { + return this[1]; + }, + set: function set(e) { + this[1] = e; + } + }, { + key: "magnitude", + get: function get() { + return Math.hypot(this[0], this[1]); + } + }, { + key: "mag", + get: function get() { + return this.magnitude; + } + }, { + key: "squaredMagnitude", + get: function get() { + var e = this[0], + t = this[1]; + return e * e + t * t; + } + }, { + key: "sqrMag", + get: function get() { + return this.squaredMagnitude; + } + }, { + key: "str", + get: function get() { + return A.str(this); + } + }, { + key: "copy", + value: function copy(e) { + return this.set(e), this; + } + }, { + key: "add", + value: function add(e) { + return this[0] += e[0], this[1] += e[1], this; + } + }, { + key: "subtract", + value: function subtract(e) { + return this[0] -= e[0], this[1] -= e[1], this; + } + }, { + key: "sub", + value: function sub(e) { + return this; + } + }, { + key: "multiply", + value: function multiply(e) { + return this[0] *= e[0], this[1] *= e[1], this; + } + }, { + key: "mul", + value: function mul(e) { + return this; + } + }, { + key: "divide", + value: function divide(e) { + return this[0] /= e[0], this[1] /= e[1], this; + } + }, { + key: "div", + value: function div(e) { + return this; + } + }, { + key: "scale", + value: function scale(e) { + return this[0] *= e, this[1] *= e, this; + } + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(e, t) { + return this[0] += e[0] * t, this[1] += e[1] * t, this; + } + }, { + key: "distance", + value: function distance(e) { + return A.distance(this, e); + } + }, { + key: "dist", + value: function dist(e) { + return 0; + } + }, { + key: "squaredDistance", + value: function squaredDistance(e) { + return A.squaredDistance(this, e); + } + }, { + key: "sqrDist", + value: function sqrDist(e) { + return 0; + } + }, { + key: "negate", + value: function negate() { + return this[0] *= -1, this[1] *= -1, this; + } + }, { + key: "invert", + value: function invert() { + return this[0] = 1 / this[0], this[1] = 1 / this[1], this; + } + }, { + key: "abs", + value: function abs() { + return this[0] = Math.abs(this[0]), this[1] = Math.abs(this[1]), this; + } + }, { + key: "dot", + value: function dot(e) { + return this[0] * e[0] + this[1] * e[1]; + } + }, { + key: "normalize", + value: function normalize() { + return A.normalize(this, this); + } + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 2 * Float32Array.BYTES_PER_ELEMENT; + } + }, { + key: "create", + value: function create() { + return new A(); + } + }, { + key: "clone", + value: function clone(e) { + return new A(e); + } + }, { + key: "fromValues", + value: function fromValues(e, t) { + return new A(e, t); + } + }, { + key: "copy", + value: function copy(e, t) { + return e[0] = t[0], e[1] = t[1], e; + } + }, { + key: "set", + value: function set(e, t, n) { + return e[0] = t, e[1] = n, e; + } + }, { + key: "add", + value: function add(e, t, n) { + return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e; + } + }, { + key: "subtract", + value: function subtract(e, t, n) { + return e[0] = t[0] - n[0], e[1] = t[1] - n[1], e; + } + }, { + key: "sub", + value: function sub(e, t, n) { + return [0, 0]; + } + }, { + key: "multiply", + value: function multiply(e, t, n) { + return e[0] = t[0] * n[0], e[1] = t[1] * n[1], e; + } + }, { + key: "mul", + value: function mul(e, t, n) { + return [0, 0]; + } + }, { + key: "divide", + value: function divide(e, t, n) { + return e[0] = t[0] / n[0], e[1] = t[1] / n[1], e; + } + }, { + key: "div", + value: function div(e, t, n) { + return [0, 0]; + } + }, { + key: "ceil", + value: function ceil(e, t) { + return e[0] = Math.ceil(t[0]), e[1] = Math.ceil(t[1]), e; + } + }, { + key: "floor", + value: function floor(e, t) { + return e[0] = Math.floor(t[0]), e[1] = Math.floor(t[1]), e; + } + }, { + key: "min", + value: function min(e, t, n) { + return e[0] = Math.min(t[0], n[0]), e[1] = Math.min(t[1], n[1]), e; + } + }, { + key: "max", + value: function max(e, t, n) { + return e[0] = Math.max(t[0], n[0]), e[1] = Math.max(t[1], n[1]), e; + } + }, { + key: "round", + value: function round(e, t) { + return e[0] = Math.round(t[0]), e[1] = Math.round(t[1]), e; + } + }, { + key: "scale", + value: function scale(e, t, n) { + return e[0] = t[0] * n, e[1] = t[1] * n, e; + } + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(e, t, n, s) { + return e[0] = t[0] + n[0] * s, e[1] = t[1] + n[1] * s, e; + } + }, { + key: "distance", + value: function distance(e, t) { + return Math.hypot(t[0] - e[0], t[1] - e[1]); + } + }, { + key: "dist", + value: function dist(e, t) { + return 0; + } + }, { + key: "squaredDistance", + value: function squaredDistance(e, t) { + var n = t[0] - e[0], + s = t[1] - e[1]; + return n * n + s * s; + } + }, { + key: "sqrDist", + value: function sqrDist(e, t) { + return 0; + } + }, { + key: "magnitude", + value: function magnitude(e) { + var t = e[0], + n = e[1]; + return Math.sqrt(t * t + n * n); + } + }, { + key: "mag", + value: function mag(e) { + return 0; + } + }, { + key: "length", + value: function length(e) { + return 0; + } + }, { + key: "len", + value: function len(e) { + return 0; + } + }, { + key: "squaredLength", + value: function squaredLength(e) { + var t = e[0], + n = e[1]; + return t * t + n * n; + } + }, { + key: "sqrLen", + value: function sqrLen(e, t) { + return 0; + } + }, { + key: "negate", + value: function negate(e, t) { + return e[0] = -t[0], e[1] = -t[1], e; + } + }, { + key: "inverse", + value: function inverse(e, t) { + return e[0] = 1 / t[0], e[1] = 1 / t[1], e; + } + }, { + key: "abs", + value: function abs(e, t) { + return e[0] = Math.abs(t[0]), e[1] = Math.abs(t[1]), e; + } + }, { + key: "normalize", + value: function normalize(e, t) { + var n = t[0], + s = t[1], + r = n * n + s * s; + return r > 0 && (r = 1 / Math.sqrt(r)), e[0] = t[0] * r, e[1] = t[1] * r, e; + } + }, { + key: "dot", + value: function dot(e, t) { + return e[0] * t[0] + e[1] * t[1]; + } + }, { + key: "cross", + value: function cross(e, t, n) { + var s = t[0] * n[1] - t[1] * n[0]; + return e[0] = e[1] = 0, e[2] = s, e; + } + }, { + key: "lerp", + value: function lerp(e, t, n, s) { + var r = t[0], + a = t[1]; + return e[0] = r + s * (n[0] - r), e[1] = a + s * (n[1] - a), e; + } + }, { + key: "transformMat2", + value: function transformMat2(e, t, n) { + var s = t[0], + r = t[1]; + return e[0] = n[0] * s + n[2] * r, e[1] = n[1] * s + n[3] * r, e; + } + }, { + key: "transformMat2d", + value: function transformMat2d(e, t, n) { + var s = t[0], + r = t[1]; + return e[0] = n[0] * s + n[2] * r + n[4], e[1] = n[1] * s + n[3] * r + n[5], e; + } + }, { + key: "transformMat3", + value: function transformMat3(e, t, n) { + var s = t[0], + r = t[1]; + return e[0] = n[0] * s + n[3] * r + n[6], e[1] = n[1] * s + n[4] * r + n[7], e; + } + }, { + key: "transformMat4", + value: function transformMat4(e, t, n) { + var s = t[0], + r = t[1]; + return e[0] = n[0] * s + n[4] * r + n[12], e[1] = n[1] * s + n[5] * r + n[13], e; + } + }, { + key: "rotate", + value: function rotate(e, t, n, s) { + var r = t[0] - n[0], + a = t[1] - n[1], + i = Math.sin(s), + c = Math.cos(s); + return e[0] = r * c - a * i + n[0], e[1] = r * i + a * c + n[1], e; + } + }, { + key: "angle", + value: function angle(e, t) { + var n = e[0], + s = e[1], + r = t[0], + a = t[1], + i = Math.sqrt(n * n + s * s) * Math.sqrt(r * r + a * a), + c = i && (n * r + s * a) / i; + return Math.acos(Math.min(Math.max(c, -1), 1)); + } + }, { + key: "zero", + value: function zero(e) { + return e[0] = 0, e[1] = 0, e; + } + }, { + key: "exactEquals", + value: function exactEquals(e, t) { + return e[0] === t[0] && e[1] === t[1]; + } + }, { + key: "equals", + value: function equals(e, t) { + var n = e[0], + s = e[1], + r = t[0], + a = t[1]; + return Math.abs(n - r) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(r)) && Math.abs(s - a) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(a)); + } + }, { + key: "str", + value: function str(e) { + return "Vec2(".concat(e.join(", "), ")"); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float32Array)); + N.prototype.sub = N.prototype.subtract; + N.prototype.mul = N.prototype.multiply; + N.prototype.div = N.prototype.divide; + N.prototype.dist = N.prototype.distance; + N.prototype.sqrDist = N.prototype.squaredDistance; + N.sub = N.subtract; + N.mul = N.multiply; + N.div = N.divide; + N.dist = N.distance; + N.sqrDist = N.squaredDistance; + N.sqrLen = N.squaredLength; + N.mag = N.magnitude; + N.length = N.magnitude; + N.len = N.magnitude; + var me = !1; + function _e() { + if (me) return; + var A = ["xx", "xy", "yx", "yy", "xxx", "xxy", "xyx", "xyy", "yxx", "yxy", "yyx", "yyy", "xxxx", "xxxy", "xxyx", "xxyy", "xyxx", "xyxy", "xyyx", "xyyy", "yxxx", "yxxy", "yxyx", "yxyy", "yyxx", "yyxy", "yyyx", "yyyy", "rr", "rg", "gr", "gg", "rrr", "rrg", "rgr", "rgg", "grr", "grg", "ggr", "ggg", "rrrr", "rrrg", "rrgr", "rrgg", "rgrr", "rgrg", "rggr", "rggg", "grrr", "grrg", "grgr", "grgg", "ggrr", "ggrg", "gggr", "gggg"], + e = ["xz", "yz", "zx", "zy", "zz", "xxz", "xyz", "xzx", "xzy", "xzz", "yxz", "yyz", "yzx", "yzy", "yzz", "zxx", "zxy", "zxz", "zyx", "zyy", "zyz", "zzx", "zzy", "zzz", "xxxz", "xxyz", "xxzx", "xxzy", "xxzz", "xyxz", "xyyz", "xyzx", "xyzy", "xyzz", "xzxx", "xzxy", "xzxz", "xzyx", "xzyy", "xzyz", "xzzx", "xzzy", "xzzz", "yxxz", "yxyz", "yxzx", "yxzy", "yxzz", "yyxz", "yyyz", "yyzx", "yyzy", "yyzz", "yzxx", "yzxy", "yzxz", "yzyx", "yzyy", "yzyz", "yzzx", "yzzy", "yzzz", "zxxx", "zxxy", "zxxz", "zxyx", "zxyy", "zxyz", "zxzx", "zxzy", "zxzz", "zyxx", "zyxy", "zyxz", "zyyx", "zyyy", "zyyz", "zyzx", "zyzy", "zyzz", "zzxx", "zzxy", "zzxz", "zzyx", "zzyy", "zzyz", "zzzx", "zzzy", "zzzz", "rb", "gb", "br", "bg", "bb", "rrb", "rgb", "rbr", "rbg", "rbb", "grb", "ggb", "gbr", "gbg", "gbb", "brr", "brg", "brb", "bgr", "bgg", "bgb", "bbr", "bbg", "bbb", "rrrb", "rrgb", "rrbr", "rrbg", "rrbb", "rgrb", "rggb", "rgbr", "rgbg", "rgbb", "rbrr", "rbrg", "rbrb", "rbgr", "rbgg", "rbgb", "rbbr", "rbbg", "rbbb", "grrb", "grgb", "grbr", "grbg", "grbb", "ggrb", "gggb", "ggbr", "ggbg", "ggbb", "gbrr", "gbrg", "gbrb", "gbgr", "gbgg", "gbgb", "gbbr", "gbbg", "gbbb", "brrr", "brrg", "brrb", "brgr", "brgg", "brgb", "brbr", "brbg", "brbb", "bgrr", "bgrg", "bgrb", "bggr", "bggg", "bggb", "bgbr", "bgbg", "bgbb", "bbrr", "bbrg", "bbrb", "bbgr", "bbgg", "bbgb", "bbbr", "bbbg", "bbbb"], + t = ["xw", "yw", "zw", "wx", "wy", "wz", "ww", "xxw", "xyw", "xzw", "xwx", "xwy", "xwz", "xww", "yxw", "yyw", "yzw", "ywx", "ywy", "ywz", "yww", "zxw", "zyw", "zzw", "zwx", "zwy", "zwz", "zww", "wxx", "wxy", "wxz", "wxw", "wyx", "wyy", "wyz", "wyw", "wzx", "wzy", "wzz", "wzw", "wwx", "wwy", "wwz", "www", "xxxw", "xxyw", "xxzw", "xxwx", "xxwy", "xxwz", "xxww", "xyxw", "xyyw", "xyzw", "xywx", "xywy", "xywz", "xyww", "xzxw", "xzyw", "xzzw", "xzwx", "xzwy", "xzwz", "xzww", "xwxx", "xwxy", "xwxz", "xwxw", "xwyx", "xwyy", "xwyz", "xwyw", "xwzx", "xwzy", "xwzz", "xwzw", "xwwx", "xwwy", "xwwz", "xwww", "yxxw", "yxyw", "yxzw", "yxwx", "yxwy", "yxwz", "yxww", "yyxw", "yyyw", "yyzw", "yywx", "yywy", "yywz", "yyww", "yzxw", "yzyw", "yzzw", "yzwx", "yzwy", "yzwz", "yzww", "ywxx", "ywxy", "ywxz", "ywxw", "ywyx", "ywyy", "ywyz", "ywyw", "ywzx", "ywzy", "ywzz", "ywzw", "ywwx", "ywwy", "ywwz", "ywww", "zxxw", "zxyw", "zxzw", "zxwx", "zxwy", "zxwz", "zxww", "zyxw", "zyyw", "zyzw", "zywx", "zywy", "zywz", "zyww", "zzxw", "zzyw", "zzzw", "zzwx", "zzwy", "zzwz", "zzww", "zwxx", "zwxy", "zwxz", "zwxw", "zwyx", "zwyy", "zwyz", "zwyw", "zwzx", "zwzy", "zwzz", "zwzw", "zwwx", "zwwy", "zwwz", "zwww", "wxxx", "wxxy", "wxxz", "wxxw", "wxyx", "wxyy", "wxyz", "wxyw", "wxzx", "wxzy", "wxzz", "wxzw", "wxwx", "wxwy", "wxwz", "wxww", "wyxx", "wyxy", "wyxz", "wyxw", "wyyx", "wyyy", "wyyz", "wyyw", "wyzx", "wyzy", "wyzz", "wyzw", "wywx", "wywy", "wywz", "wyww", "wzxx", "wzxy", "wzxz", "wzxw", "wzyx", "wzyy", "wzyz", "wzyw", "wzzx", "wzzy", "wzzz", "wzzw", "wzwx", "wzwy", "wzwz", "wzww", "wwxx", "wwxy", "wwxz", "wwxw", "wwyx", "wwyy", "wwyz", "wwyw", "wwzx", "wwzy", "wwzz", "wwzw", "wwwx", "wwwy", "wwwz", "wwww", "ra", "ga", "ba", "ar", "ag", "ab", "aa", "rra", "rga", "rba", "rar", "rag", "rab", "raa", "gra", "gga", "gba", "gar", "gag", "gab", "gaa", "bra", "bga", "bba", "bar", "bag", "bab", "baa", "arr", "arg", "arb", "ara", "agr", "agg", "agb", "aga", "abr", "abg", "abb", "aba", "aar", "aag", "aab", "aaa", "rrra", "rrga", "rrba", "rrar", "rrag", "rrab", "rraa", "rgra", "rgga", "rgba", "rgar", "rgag", "rgab", "rgaa", "rbra", "rbga", "rbba", "rbar", "rbag", "rbab", "rbaa", "rarr", "rarg", "rarb", "rara", "ragr", "ragg", "ragb", "raga", "rabr", "rabg", "rabb", "raba", "raar", "raag", "raab", "raaa", "grra", "grga", "grba", "grar", "grag", "grab", "graa", "ggra", "ggga", "ggba", "ggar", "ggag", "ggab", "ggaa", "gbra", "gbga", "gbba", "gbar", "gbag", "gbab", "gbaa", "garr", "garg", "garb", "gara", "gagr", "gagg", "gagb", "gaga", "gabr", "gabg", "gabb", "gaba", "gaar", "gaag", "gaab", "gaaa", "brra", "brga", "brba", "brar", "brag", "brab", "braa", "bgra", "bgga", "bgba", "bgar", "bgag", "bgab", "bgaa", "bbra", "bbga", "bbba", "bbar", "bbag", "bbab", "bbaa", "barr", "barg", "barb", "bara", "bagr", "bagg", "bagb", "baga", "babr", "babg", "babb", "baba", "baar", "baag", "baab", "baaa", "arrr", "arrg", "arrb", "arra", "argr", "argg", "argb", "arga", "arbr", "arbg", "arbb", "arba", "arar", "arag", "arab", "araa", "agrr", "agrg", "agrb", "agra", "aggr", "aggg", "aggb", "agga", "agbr", "agbg", "agbb", "agba", "agar", "agag", "agab", "agaa", "abrr", "abrg", "abrb", "abra", "abgr", "abgg", "abgb", "abga", "abbr", "abbg", "abbb", "abba", "abar", "abag", "abab", "abaa", "aarr", "aarg", "aarb", "aara", "aagr", "aagg", "aagb", "aaga", "aabr", "aabg", "aabb", "aaba", "aaar", "aaag", "aaab", "aaaa"], + n = { + x: 0, + r: 0, + y: 1, + g: 1, + z: 2, + b: 2, + w: 3, + a: 3 + }; + function s(r) { + switch (r.length) { + case 2: + return function () { + return new N(this[n[r[0]]], this[n[r[1]]]); + }; + case 3: + return function () { + return new T(this[n[r[0]]], this[n[r[1]]], this[n[r[2]]]); + }; + case 4: + return function () { + return new q(this[n[r[0]]], this[n[r[1]]], this[n[r[2]]], this[n[r[3]]]); + }; + } + throw new Error("Illegal swizzle length"); + } + for (var _i = 0, _A = A; _i < _A.length; _i++) { + var r = _A[_i]; + var a = s(r); + Object.defineProperty(N.prototype, r, { + get: a + }), Object.defineProperty(T.prototype, r, { + get: a + }), Object.defineProperty(q.prototype, r, { + get: a + }); + } + for (var _i2 = 0, _e2 = e; _i2 < _e2.length; _i2++) { + var _r = _e2[_i2]; + var _a = s(_r); + Object.defineProperty(T.prototype, _r, { + get: _a + }), Object.defineProperty(q.prototype, _r, { + get: _a + }); + } + for (var _i3 = 0, _t2 = t; _i3 < _t2.length; _i3++) { + var _r2 = _t2[_i3]; + var _a2 = s(_r2); + Object.defineProperty(q.prototype, _r2, { + get: _a2 + }); + } + me = !0; + } + var xe = Math.PI / 180, + Re = 180 / Math.PI; + function tt(A) { + return A * Re; + } + function nt(A) { + return A * xe; + } + + exports.EnableSwizzles = _e; + exports.Mat2 = v; + exports.Mat2d = _; + exports.Mat3 = u; + exports.Mat4 = G; + exports.Quat = O; + exports.Quat2 = J; + exports.Vec2 = N; + exports.Vec3 = T; + exports.Vec4 = q; + exports.mat2 = v; + exports.mat2d = _; + exports.mat3 = u; + exports.mat4 = G; + exports.quat = O; + exports.quat2 = J; + exports.toDegree = tt; + exports.toRadian = nt; + exports.vec2 = N; + exports.vec3 = T; + exports.vec4 = q; + +})); +//# sourceMappingURL=gl-matrix-f32.min.js.map diff --git a/dist-cdn/umd/gl-matrix-f32.min.js.map b/dist-cdn/umd/gl-matrix-f32.min.js.map new file mode 100644 index 00000000..53c26865 --- /dev/null +++ b/dist-cdn/umd/gl-matrix-f32.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"gl-matrix-f32.min.js","sources":["../esm/2016/gl-matrix-f32.min.js"],"sourcesContent":["// gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library.\n// @author Brandon Jones\n// @author Colin MacKenzie IV\n// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md)\nvar de=A=>{throw TypeError(A)};var oe=(A,e,t)=>e.has(A)||de(\"Cannot \"+t);var E=(A,e,t)=>(oe(A,e,\"read from private field\"),t?t.call(A):e.get(A)),Z=(A,e,t)=>e.has(A)?de(\"Cannot add the same private member more than once\"):e instanceof WeakSet?e.add(A):e.set(A,t);var ne,C=class C extends Float32Array{constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:let t=e[0];typeof t==\"number\"?super([t,t,t,t]):super(t,0,4);break;default:super(E(C,ne));break}}get str(){return C.str(this)}copy(e){return this.set(e),this}identity(){return this.set(E(C,ne)),this}multiply(e){return C.multiply(this,this,e)}mul(e){return this}transpose(){return C.transpose(this,this)}invert(){return C.invert(this,this)}scale(e){return C.scale(this,this,e)}rotate(e){return C.rotate(this,this,e)}static get BYTE_LENGTH(){return 4*Float32Array.BYTES_PER_ELEMENT}static create(){return new C}static clone(e){return new C(e)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static fromValues(...e){return new C(...e)}static set(e,...t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}static transpose(e,t){if(e===t){let n=t[1];e[1]=t[2],e[2]=n}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*a-r*s;return i?(i=1/i,e[0]=a*i,e[1]=-s*i,e[2]=-r*i,e[3]=n*i,e):null}static adjoint(e,t){let n=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=n,e}static determinant(e){return e[0]*e[3]-e[2]*e[1]}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*c+a*y,e[1]=r*c+i*y,e[2]=s*L+a*k,e[3]=r*L+i*k,e}static mul(e,t,n){return e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+a*c,e[1]=r*y+i*c,e[2]=s*-c+a*y,e[3]=r*-c+i*y,e}static scale(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1];return e[0]=s*c,e[1]=r*c,e[2]=a*y,e[3]=i*y,e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=-n,e[3]=s,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3])}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e}static LDU(e,t,n,s){return e[2]=s[2]/s[0],n[0]=s[0],n[1]=s[1],n[3]=s[3]-e[2]*n[1],[e,t,n]}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=t[0],c=t[1],y=t[2],L=t[3];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(a-L)<=1e-6*Math.max(1,Math.abs(a),Math.abs(L))}static str(e){return`Mat2(${e.join(\", \")})`}};ne=new WeakMap,Z(C,ne,new Float32Array([1,0,0,1]));var v=C;v.prototype.mul=v.prototype.multiply;v.mul=v.multiply;v.sub=v.subtract;var se,H=class H extends Float32Array{constructor(...e){switch(e.length){case 6:super(e);break;case 2:super(e[0],e[1],6);break;case 1:let t=e[0];typeof t==\"number\"?super([t,t,t,t,t,t]):super(t,0,6);break;default:super(E(H,se));break}}get str(){return H.str(this)}copy(e){return this.set(e),this}identity(){return this.set(E(H,se)),this}multiply(e){return H.multiply(this,this,e)}mul(e){return this}translate(e){return H.translate(this,this,e)}rotate(e){return H.rotate(this,this,e)}scale(e){return H.scale(this,this,e)}static get BYTE_LENGTH(){return 6*Float32Array.BYTES_PER_ELEMENT}static create(){return new H}static clone(e){return new H(e)}static copy(e,t){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}static fromValues(...e){return new H(...e)}static set(e,...t){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}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=n*a-s*r;return y?(y=1/y,e[0]=a*y,e[1]=-s*y,e[2]=-r*y,e[3]=n*y,e[4]=(r*c-a*i)*y,e[5]=(s*i-n*c)*y,e):null}static determinant(e){return e[0]*e[3]-e[1]*e[2]}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1],l=n[2],M=n[3],h=n[4],b=n[5];return e[0]=s*L+a*k,e[1]=r*L+i*k,e[2]=s*l+a*M,e[3]=r*l+i*M,e[4]=s*h+a*b+c,e[5]=r*h+i*b+y,e}static mul(e,t,n){return e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=s*L+a*k+c,e[5]=r*L+i*k+y,e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=Math.sin(n),k=Math.cos(n);return e[0]=s*k+a*L,e[1]=r*k+i*L,e[2]=s*-L+a*k,e[3]=r*-L+i*k,e[4]=c,e[5]=y,e}static scale(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1];return e[0]=s*L,e[1]=r*L,e[2]=a*k,e[3]=i*k,e[4]=c,e[5]=y,e}static fromTranslation(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0],e[5]=t[1],e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=-n,e[3]=s,e[4]=0,e[5]=0,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e[4]=0,e[5]=0,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+1)}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=t[0],L=t[1],k=t[2],l=t[3],M=t[4],h=t[5];return Math.abs(n-y)<=1e-6*Math.max(1,Math.abs(n),Math.abs(y))&&Math.abs(s-L)<=1e-6*Math.max(1,Math.abs(s),Math.abs(L))&&Math.abs(r-k)<=1e-6*Math.max(1,Math.abs(r),Math.abs(k))&&Math.abs(a-l)<=1e-6*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(i-M)<=1e-6*Math.max(1,Math.abs(i),Math.abs(M))&&Math.abs(c-h)<=1e-6*Math.max(1,Math.abs(c),Math.abs(h))}static str(e){return`Mat2d(${e.join(\", \")})`}};se=new WeakMap,Z(H,se,new Float32Array([1,0,0,1,0,0]));var _=H;_.mul=_.multiply;_.sub=_.subtract;var re,X=class X extends Float32Array{constructor(...e){switch(e.length){case 9:super(e);break;case 2:super(e[0],e[1],9);break;case 1:let t=e[0];typeof t==\"number\"?super([t,t,t,t,t,t,t,t,t]):super(t,0,9);break;default:super(E(X,re));break}}get str(){return X.str(this)}copy(e){return this.set(e),this}identity(){return this.set(E(X,re)),this}multiply(e){return X.multiply(this,this,e)}mul(e){return this}transpose(){return X.transpose(this,this)}invert(){return X.invert(this,this)}translate(e){return X.translate(this,this,e)}rotate(e){return X.rotate(this,this,e)}scale(e){return X.scale(this,this,e)}static get BYTE_LENGTH(){return 9*Float32Array.BYTES_PER_ELEMENT}static create(){return new X}static clone(e){return new X(e)}static copy(e,t){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}static fromValues(...e){return new X(...e)}static set(e,...t){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}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static transpose(e,t){if(e===t){let n=t[1],s=t[2],r=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=s,e[7]=r}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=k*i-c*L,M=-k*a+c*y,h=L*a-i*y,b=n*l+s*M+r*h;return b?(b=1/b,e[0]=l*b,e[1]=(-k*s+r*L)*b,e[2]=(c*s-r*i)*b,e[3]=M*b,e[4]=(k*n-r*y)*b,e[5]=(-c*n+r*a)*b,e[6]=h*b,e[7]=(-L*n+s*y)*b,e[8]=(i*n-s*a)*b,e):null}static adjoint(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8];return e[0]=i*k-c*L,e[1]=r*L-s*k,e[2]=s*c-r*i,e[3]=c*y-a*k,e[4]=n*k-r*y,e[5]=r*a-n*c,e[6]=a*L-i*y,e[7]=s*y-n*L,e[8]=n*i-s*a,e}static determinant(e){let t=e[0],n=e[1],s=e[2],r=e[3],a=e[4],i=e[5],c=e[6],y=e[7],L=e[8];return t*(L*a-i*y)+n*(-L*r+i*c)+s*(y*r-a*c)}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=n[0],h=n[1],b=n[2];return e[0]=M*s+h*i+b*L,e[1]=M*r+h*c+b*k,e[2]=M*a+h*y+b*l,M=n[3],h=n[4],b=n[5],e[3]=M*s+h*i+b*L,e[4]=M*r+h*c+b*k,e[5]=M*a+h*y+b*l,M=n[6],h=n[7],b=n[8],e[6]=M*s+h*i+b*L,e[7]=M*r+h*c+b*k,e[8]=M*a+h*y+b*l,e}static mul(e,t,n){return e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=n[0],h=n[1];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=c,e[5]=y,e[6]=M*s+h*i+L,e[7]=M*r+h*c+k,e[8]=M*a+h*y+l,e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=Math.sin(n),h=Math.cos(n);return e[0]=h*s+M*i,e[1]=h*r+M*c,e[2]=h*a+M*y,e[3]=h*i-M*s,e[4]=h*c-M*r,e[5]=h*y-M*a,e[6]=L,e[7]=k,e[8]=l,e}static scale(e,t,n){let s=n[0],r=n[1];return e[0]=s*t[0],e[1]=s*t[1],e[2]=s*t[2],e[3]=r*t[3],e[4]=r*t[4],e[5]=r*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}static fromTranslation(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=0,e[3]=-n,e[4]=s,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static fromMat2d(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}static fromQuat(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n+n,c=s+s,y=r+r,L=n*i,k=s*i,l=s*c,M=r*i,h=r*c,b=r*y,d=a*i,m=a*c,o=a*y;return e[0]=1-l-b,e[3]=k-o,e[6]=M+m,e[1]=k+o,e[4]=1-L-b,e[7]=h-d,e[2]=M-m,e[5]=h+d,e[8]=1-L-l,e}static fromMat4(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}static normalFromMat4(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],M=t[10],h=t[11],b=t[12],d=t[13],m=t[14],o=t[15],V=n*c-s*i,x=n*y-r*i,R=n*L-a*i,z=s*y-r*c,g=s*L-a*c,B=r*L-a*y,D=k*d-l*b,F=k*m-M*b,p=k*o-h*b,Y=l*m-M*d,I=l*o-h*d,P=M*o-h*m,Q=V*P-x*I+R*Y+z*p-g*F+B*D;return Q?(Q=1/Q,e[0]=(c*P-y*I+L*Y)*Q,e[1]=(y*p-i*P-L*F)*Q,e[2]=(i*I-c*p+L*D)*Q,e[3]=(r*I-s*P-a*Y)*Q,e[4]=(n*P-r*p+a*F)*Q,e[5]=(s*p-n*I-a*D)*Q,e[6]=(d*B-m*g+o*z)*Q,e[7]=(m*R-b*B-o*x)*Q,e[8]=(b*g-d*R+o*V)*Q,e):null}static normalFromMat4Fast(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=i*k-k*L,e[1]=c*y-y*k,e[2]=a*L-L*y,e[3]=L*r-k*s,e[4]=k*n-y*r,e[5]=y*s-L*n,e[6]=s*c-r*i,e[7]=r*a-n*c,e[8]=n*i-s*a,e}static projection(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8])}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e[6]=t[6]+n[6]*s,e[7]=t[7]+n[7]*s,e[8]=t[8]+n[8]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=e[8],l=t[0],M=t[1],h=t[2],b=t[3],d=t[4],m=t[5],o=t[6],V=t[7],x=t[8];return Math.abs(n-l)<=1e-6*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(s-M)<=1e-6*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(r-h)<=1e-6*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(a-b)<=1e-6*Math.max(1,Math.abs(a),Math.abs(b))&&Math.abs(i-d)<=1e-6*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(c-m)<=1e-6*Math.max(1,Math.abs(c),Math.abs(m))&&Math.abs(y-o)<=1e-6*Math.max(1,Math.abs(y),Math.abs(o))&&Math.abs(L-V)<=1e-6*Math.max(1,Math.abs(L),Math.abs(V))&&Math.abs(k-x)<=1e-6*Math.max(1,Math.abs(k),Math.abs(x))}static str(e){return`Mat3(${e.join(\", \")})`}};re=new WeakMap,Z(X,re,new Float32Array([1,0,0,0,1,0,0,0,1]));var u=X;u.prototype.mul=u.prototype.multiply;u.mul=u.multiply;u.sub=u.subtract;var ae,$,S=class S extends Float32Array{constructor(...e){switch(e.length){case 16:super(e);break;case 2:super(e[0],e[1],16);break;case 1:let t=e[0];typeof t==\"number\"?super([t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t]):super(t,0,16);break;default:super(E(S,ae));break}}get str(){return S.str(this)}copy(e){return this.set(e),this}identity(){return this.set(E(S,ae)),this}multiply(e){return S.multiply(this,this,e)}mul(e){return this}transpose(){return S.transpose(this,this)}invert(){return S.invert(this,this)}translate(e){return S.translate(this,this,e)}rotate(e,t){return S.rotate(this,this,e,t)}scale(e){return S.scale(this,this,e)}rotateX(e){return S.rotateX(this,this,e)}rotateY(e){return S.rotateY(this,this,e)}rotateZ(e){return S.rotateZ(this,this,e)}perspectiveNO(e,t,n,s){return S.perspectiveNO(this,e,t,n,s)}perspectiveZO(e,t,n,s){return S.perspectiveZO(this,e,t,n,s)}orthoNO(e,t,n,s,r,a){return S.orthoNO(this,e,t,n,s,r,a)}orthoZO(e,t,n,s,r,a){return S.orthoZO(this,e,t,n,s,r,a)}static get BYTE_LENGTH(){return 16*Float32Array.BYTES_PER_ELEMENT}static create(){return new S}static clone(e){return new S(e)}static copy(e,t){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}static fromValues(...e){return new S(...e)}static set(e,...t){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}static identity(e){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}static transpose(e,t){if(e===t){let n=t[1],s=t[2],r=t[3],a=t[6],i=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=s,e[9]=a,e[11]=t[14],e[12]=r,e[13]=i,e[14]=c}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],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e[8]=i*I-c*p+L*D,e[9]=s*p-n*I-a*D,e[10]=b*g-d*R+o*V,e[11]=l*R-k*g-h*V,e[12]=c*F-i*Y-y*D,e[13]=n*Y-s*F+r*D,e[14]=d*x-b*z-m*V,e[15]=k*z-l*x+M*V,e}static determinant(e){let t=e[0],n=e[1],s=e[2],r=e[3],a=e[4],i=e[5],c=e[6],y=e[7],L=e[8],k=e[9],l=e[10],M=e[11],h=e[12],b=e[13],d=e[14],m=e[15],o=t*i-n*a,V=t*c-s*a,x=n*c-s*i,R=L*b-k*h,z=L*d-l*h,g=k*d-l*b,B=t*g-n*z+s*R,D=a*g-i*z+c*R,F=L*x-k*V+l*o,p=h*x-b*V+d*o;return y*B-r*D+m*F-M*p}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=t[9],h=t[10],b=t[11],d=t[12],m=t[13],o=t[14],V=t[15],x=n[0],R=n[1],z=n[2],g=n[3];return e[0]=x*s+R*c+z*l+g*d,e[1]=x*r+R*y+z*M+g*m,e[2]=x*a+R*L+z*h+g*o,e[3]=x*i+R*k+z*b+g*V,x=n[4],R=n[5],z=n[6],g=n[7],e[4]=x*s+R*c+z*l+g*d,e[5]=x*r+R*y+z*M+g*m,e[6]=x*a+R*L+z*h+g*o,e[7]=x*i+R*k+z*b+g*V,x=n[8],R=n[9],z=n[10],g=n[11],e[8]=x*s+R*c+z*l+g*d,e[9]=x*r+R*y+z*M+g*m,e[10]=x*a+R*L+z*h+g*o,e[11]=x*i+R*k+z*b+g*V,x=n[12],R=n[13],z=n[14],g=n[15],e[12]=x*s+R*c+z*l+g*d,e[13]=x*r+R*y+z*M+g*m,e[14]=x*a+R*L+z*h+g*o,e[15]=x*i+R*k+z*b+g*V,e}static mul(e,t,n){return e}static translate(e,t,n){let s=n[0],r=n[1],a=n[2];if(t===e)e[12]=t[0]*s+t[4]*r+t[8]*a+t[12],e[13]=t[1]*s+t[5]*r+t[9]*a+t[13],e[14]=t[2]*s+t[6]*r+t[10]*a+t[14],e[15]=t[3]*s+t[7]*r+t[11]*a+t[15];else{let i=t[0],c=t[1],y=t[2],L=t[3],k=t[4],l=t[5],M=t[6],h=t[7],b=t[8],d=t[9],m=t[10],o=t[11];e[0]=i,e[1]=c,e[2]=y,e[3]=L,e[4]=k,e[5]=l,e[6]=M,e[7]=h,e[8]=b,e[9]=d,e[10]=m,e[11]=o,e[12]=i*s+k*r+b*a+t[12],e[13]=c*s+l*r+d*a+t[13],e[14]=y*s+M*r+m*a+t[14],e[15]=L*s+h*r+o*a+t[15]}return e}static scale(e,t,n){let s=n[0],r=n[1],a=n[2];return e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e[3]=t[3]*s,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}static rotate(e,t,n,s){let r=s[0],a=s[1],i=s[2],c=Math.sqrt(r*r+a*a+i*i);if(c<1e-6)return null;c=1/c,r*=c,a*=c,i*=c;let y=Math.sin(n),L=Math.cos(n),k=1-L,l=t[0],M=t[1],h=t[2],b=t[3],d=t[4],m=t[5],o=t[6],V=t[7],x=t[8],R=t[9],z=t[10],g=t[11],B=r*r*k+L,D=a*r*k+i*y,F=i*r*k-a*y,p=r*a*k-i*y,Y=a*a*k+L,I=i*a*k+r*y,P=r*i*k+a*y,Q=a*i*k-r*y,K=i*i*k+L;return e[0]=l*B+d*D+x*F,e[1]=M*B+m*D+R*F,e[2]=h*B+o*D+z*F,e[3]=b*B+V*D+g*F,e[4]=l*p+d*Y+x*I,e[5]=M*p+m*Y+R*I,e[6]=h*p+o*Y+z*I,e[7]=b*p+V*Y+g*I,e[8]=l*P+d*Q+x*K,e[9]=M*P+m*Q+R*K,e[10]=h*P+o*Q+z*K,e[11]=b*P+V*Q+g*K,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e}static rotateX(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[4],i=t[5],c=t[6],y=t[7],L=t[8],k=t[9],l=t[10],M=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*r+L*s,e[5]=i*r+k*s,e[6]=c*r+l*s,e[7]=y*r+M*s,e[8]=L*r-a*s,e[9]=k*r-i*s,e[10]=l*r-c*s,e[11]=M*r-y*s,e}static rotateY(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[0],i=t[1],c=t[2],y=t[3],L=t[8],k=t[9],l=t[10],M=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*r-L*s,e[1]=i*r-k*s,e[2]=c*r-l*s,e[3]=y*r-M*s,e[8]=a*s+L*r,e[9]=i*s+k*r,e[10]=c*s+l*r,e[11]=y*s+M*r,e}static rotateZ(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[0],i=t[1],c=t[2],y=t[3],L=t[4],k=t[5],l=t[6],M=t[7];return t!==e&&(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[0]=a*r+L*s,e[1]=i*r+k*s,e[2]=c*r+l*s,e[3]=y*r+M*s,e[4]=L*r-a*s,e[5]=k*r-i*s,e[6]=l*r-c*s,e[7]=M*r-y*s,e}static fromTranslation(e,t){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]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromRotation(e,t,n){let s=n[0],r=n[1],a=n[2],i=Math.sqrt(s*s+r*r+a*a);if(i<1e-6)return null;i=1/i,s*=i,r*=i,a*=i;let c=Math.sin(t),y=Math.cos(t),L=1-y;return e[0]=s*s*L+y,e[1]=r*s*L+a*c,e[2]=a*s*L-r*c,e[3]=0,e[4]=s*r*L-a*c,e[5]=r*r*L+y,e[6]=a*r*L+s*c,e[7]=0,e[8]=s*a*L+r*c,e[9]=r*a*L-s*c,e[10]=a*a*L+y,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromXRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=n,e[7]=0,e[8]=0,e[9]=-n,e[10]=s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromYRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromZRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=0,e[3]=0,e[4]=-n,e[5]=s,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}static fromRotationTranslation(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=s+s,y=r+r,L=a+a,k=s*c,l=s*y,M=s*L,h=r*y,b=r*L,d=a*L,m=i*c,o=i*y,V=i*L;return e[0]=1-(h+d),e[1]=l+V,e[2]=M-o,e[3]=0,e[4]=l-V,e[5]=1-(k+d),e[6]=b+m,e[7]=0,e[8]=M+o,e[9]=b-m,e[10]=1-(k+h),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}static fromQuat2(e,t){let n=-t[0],s=-t[1],r=-t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=n*n+s*s+r*r+a*a;return k>0?(E(S,$)[0]=(i*a+L*n+c*r-y*s)*2/k,E(S,$)[1]=(c*a+L*s+y*n-i*r)*2/k,E(S,$)[2]=(y*a+L*r+i*s-c*n)*2/k):(E(S,$)[0]=(i*a+L*n+c*r-y*s)*2,E(S,$)[1]=(c*a+L*s+y*n-i*r)*2,E(S,$)[2]=(y*a+L*r+i*s-c*n)*2),S.fromRotationTranslation(e,t,E(S,$)),e}static normalFromMat4(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],M=t[10],h=t[11],b=t[12],d=t[13],m=t[14],o=t[15],V=n*c-s*i,x=n*y-r*i,R=n*L-a*i,z=s*y-r*c,g=s*L-a*c,B=r*L-a*y,D=k*d-l*b,F=k*m-M*b,p=k*o-h*b,Y=l*m-M*d,I=l*o-h*d,P=M*o-h*m,Q=V*P-x*I+R*Y+z*p-g*F+B*D;return Q?(Q=1/Q,e[0]=(c*P-y*I+L*Y)*Q,e[1]=(y*p-i*P-L*F)*Q,e[2]=(i*I-c*p+L*D)*Q,e[3]=0,e[4]=(r*I-s*P-a*Y)*Q,e[5]=(n*P-r*p+a*F)*Q,e[6]=(s*p-n*I-a*D)*Q,e[7]=0,e[8]=(d*B-m*g+o*z)*Q,e[9]=(m*R-b*B-o*x)*Q,e[10]=(b*g-d*R+o*V)*Q,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):null}static normalFromMat4Fast(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=i*k-k*L,e[1]=c*y-y*k,e[2]=a*L-L*y,e[3]=0,e[4]=L*r-k*s,e[5]=k*n-y*r,e[6]=y*s-L*n,e[7]=0,e[8]=s*c-r*i,e[9]=r*a-n*c,e[10]=n*i-s*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static getTranslation(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}static getScaling(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=Math.sqrt(n*n+s*s+r*r),e[1]=Math.sqrt(a*a+i*i+c*c),e[2]=Math.sqrt(y*y+L*L+k*k),e}static getRotation(e,t){S.getScaling(E(S,$),t);let n=1/E(S,$)[0],s=1/E(S,$)[1],r=1/E(S,$)[2],a=t[0]*n,i=t[1]*s,c=t[2]*r,y=t[4]*n,L=t[5]*s,k=t[6]*r,l=t[8]*n,M=t[9]*s,h=t[10]*r,b=a+L+h,d=0;return b>0?(d=Math.sqrt(b+1)*2,e[3]=.25*d,e[0]=(k-M)/d,e[1]=(l-c)/d,e[2]=(i-y)/d):a>L&&a>h?(d=Math.sqrt(1+a-L-h)*2,e[3]=(k-M)/d,e[0]=.25*d,e[1]=(i+y)/d,e[2]=(l+c)/d):L>h?(d=Math.sqrt(1+L-a-h)*2,e[3]=(l-c)/d,e[0]=(i+y)/d,e[1]=.25*d,e[2]=(k+M)/d):(d=Math.sqrt(1+h-a-L)*2,e[3]=(i-y)/d,e[0]=(l+c)/d,e[1]=(k+M)/d,e[2]=.25*d),e}static decompose(e,t,n,s){t[0]=s[12],t[1]=s[13],t[2]=s[14];let r=s[0],a=s[1],i=s[2],c=s[4],y=s[5],L=s[6],k=s[8],l=s[9],M=s[10];n[0]=Math.sqrt(r*r+a*a+i*i),n[1]=Math.sqrt(c*c+y*y+L*L),n[2]=Math.sqrt(k*k+l*l+M*M);let h=1/n[0],b=1/n[1],d=1/n[2],m=r*h,o=a*b,V=i*d,x=c*h,R=y*b,z=L*d,g=k*h,B=l*b,D=M*d,F=m+R+D,p=0;return F>0?(p=Math.sqrt(F+1)*2,e[3]=.25*p,e[0]=(z-B)/p,e[1]=(g-V)/p,e[2]=(o-x)/p):m>R&&m>D?(p=Math.sqrt(1+m-R-D)*2,e[3]=(z-B)/p,e[0]=.25*p,e[1]=(o+x)/p,e[2]=(g+V)/p):R>D?(p=Math.sqrt(1+R-m-D)*2,e[3]=(g-V)/p,e[0]=(o+x)/p,e[1]=.25*p,e[2]=(z+B)/p):(p=Math.sqrt(1+D-m-R)*2,e[3]=(o-x)/p,e[0]=(g+V)/p,e[1]=(z+B)/p,e[2]=.25*p),e}static fromRotationTranslationScale(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3],y=r+r,L=a+a,k=i+i,l=r*y,M=r*L,h=r*k,b=a*L,d=a*k,m=i*k,o=c*y,V=c*L,x=c*k,R=s[0],z=s[1],g=s[2];return e[0]=(1-(b+m))*R,e[1]=(M+x)*R,e[2]=(h-V)*R,e[3]=0,e[4]=(M-x)*z,e[5]=(1-(l+m))*z,e[6]=(d+o)*z,e[7]=0,e[8]=(h+V)*g,e[9]=(d-o)*g,e[10]=(1-(l+b))*g,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}static fromRotationTranslationScaleOrigin(e,t,n,s,r){let a=t[0],i=t[1],c=t[2],y=t[3],L=a+a,k=i+i,l=c+c,M=a*L,h=a*k,b=a*l,d=i*k,m=i*l,o=c*l,V=y*L,x=y*k,R=y*l,z=s[0],g=s[1],B=s[2],D=r[0],F=r[1],p=r[2],Y=(1-(d+o))*z,I=(h+R)*z,P=(b-x)*z,Q=(h-R)*g,K=(1-(M+o))*g,ee=(m+V)*g,te=(b+x)*B,Me=(m-V)*B,be=(1-(M+d))*B;return e[0]=Y,e[1]=I,e[2]=P,e[3]=0,e[4]=Q,e[5]=K,e[6]=ee,e[7]=0,e[8]=te,e[9]=Me,e[10]=be,e[11]=0,e[12]=n[0]+D-(Y*D+Q*F+te*p),e[13]=n[1]+F-(I*D+K*F+Me*p),e[14]=n[2]+p-(P*D+ee*F+be*p),e[15]=1,e}static fromQuat(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n+n,c=s+s,y=r+r,L=n*i,k=s*i,l=s*c,M=r*i,h=r*c,b=r*y,d=a*i,m=a*c,o=a*y;return e[0]=1-l-b,e[1]=k+o,e[2]=M-m,e[3]=0,e[4]=k-o,e[5]=1-L-b,e[6]=h+d,e[7]=0,e[8]=M+m,e[9]=h-d,e[10]=1-L-l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static frustumNO(e,t,n,s,r,a,i=1/0){let c=1/(n-t),y=1/(r-s);if(e[0]=a*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*y,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(r+s)*y,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let L=1/(a-i);e[10]=(i+a)*L,e[14]=2*i*a*L}else e[10]=-1,e[14]=-2*a;return e}static frustum(e,t,n,s,r,a,i=1/0){return e}static frustumZO(e,t,n,s,r,a,i=1/0){let c=1/(n-t),y=1/(r-s);if(e[0]=a*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*y,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(r+s)*y,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let L=1/(a-i);e[10]=i*L,e[14]=i*a*L}else e[10]=-1,e[14]=-a;return e}static perspectiveNO(e,t,n,s,r=1/0){let a=1/Math.tan(t/2);if(e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,r!=null&&r!==1/0){let i=1/(s-r);e[10]=(r+s)*i,e[14]=2*r*s*i}else e[10]=-1,e[14]=-2*s;return e}static perspective(e,t,n,s,r=1/0){return e}static perspectiveZO(e,t,n,s,r=1/0){let a=1/Math.tan(t/2);if(e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,r!=null&&r!==1/0){let i=1/(s-r);e[10]=r*i,e[14]=r*s*i}else e[10]=-1,e[14]=-s;return e}static perspectiveFromFieldOfView(e,t,n,s){let r=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),i=Math.tan(t.leftDegrees*Math.PI/180),c=Math.tan(t.rightDegrees*Math.PI/180),y=2/(i+c),L=2/(r+a);return e[0]=y,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=L,e[6]=0,e[7]=0,e[8]=-((i-c)*y*.5),e[9]=(r-a)*L*.5,e[10]=s/(n-s),e[11]=-1,e[12]=0,e[13]=0,e[14]=s*n/(n-s),e[15]=0,e}static orthoNO(e,t,n,s,r,a,i){let c=1/(t-n),y=1/(s-r),L=1/(a-i);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*L,e[11]=0,e[12]=(t+n)*c,e[13]=(r+s)*y,e[14]=(i+a)*L,e[15]=1,e}static ortho(e,t,n,s,r,a,i){return e}static orthoZO(e,t,n,s,r,a,i){let c=1/(t-n),y=1/(s-r),L=1/(a-i);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=L,e[11]=0,e[12]=(t+n)*c,e[13]=(r+s)*y,e[14]=a*L,e[15]=1,e}static lookAt(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=s[0],y=s[1],L=s[2],k=n[0],l=n[1],M=n[2];if(Math.abs(r-k)<1e-6&&Math.abs(a-l)<1e-6&&Math.abs(i-M)<1e-6)return S.identity(e);let h=r-k,b=a-l,d=i-M,m=1/Math.sqrt(h*h+b*b+d*d);h*=m,b*=m,d*=m;let o=y*d-L*b,V=L*h-c*d,x=c*b-y*h;m=Math.sqrt(o*o+V*V+x*x),m?(m=1/m,o*=m,V*=m,x*=m):(o=0,V=0,x=0);let R=b*x-d*V,z=d*o-h*x,g=h*V-b*o;return m=Math.sqrt(R*R+z*z+g*g),m?(m=1/m,R*=m,z*=m,g*=m):(R=0,z=0,g=0),e[0]=o,e[1]=R,e[2]=h,e[3]=0,e[4]=V,e[5]=z,e[6]=b,e[7]=0,e[8]=x,e[9]=g,e[10]=d,e[11]=0,e[12]=-(o*r+V*a+x*i),e[13]=-(R*r+z*a+g*i),e[14]=-(h*r+b*a+d*i),e[15]=1,e}static targetTo(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=s[0],y=s[1],L=s[2],k=r-n[0],l=a-n[1],M=i-n[2],h=k*k+l*l+M*M;h>0&&(h=1/Math.sqrt(h),k*=h,l*=h,M*=h);let b=y*M-L*l,d=L*k-c*M,m=c*l-y*k;return h=b*b+d*d+m*m,h>0&&(h=1/Math.sqrt(h),b*=h,d*=h,m*=h),e[0]=b,e[1]=d,e[2]=m,e[3]=0,e[4]=l*m-M*d,e[5]=M*b-k*m,e[6]=k*d-l*b,e[7]=0,e[8]=k,e[9]=l,e[10]=M,e[11]=0,e[12]=r,e[13]=a,e[14]=i,e[15]=1,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8]+e[9]*e[9]+e[10]*e[10]+e[11]*e[11]+e[12]*e[12]+e[13]*e[13]+e[14]*e[14]+e[15]*e[15])}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}static sub(e,t,n){return e}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e[6]=t[6]+n[6]*s,e[7]=t[7]+n[7]*s,e[8]=t[8]+n[8]*s,e[9]=t[9]+n[9]*s,e[10]=t[10]+n[10]*s,e[11]=t[11]+n[11]*s,e[12]=t[12]+n[12]*s,e[13]=t[13]+n[13]*s,e[14]=t[14]+n[14]*s,e[15]=t[15]+n[15]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=e[8],l=e[9],M=e[10],h=e[11],b=e[12],d=e[13],m=e[14],o=e[15],V=t[0],x=t[1],R=t[2],z=t[3],g=t[4],B=t[5],D=t[6],F=t[7],p=t[8],Y=t[9],I=t[10],P=t[11],Q=t[12],K=t[13],ee=t[14],te=t[15];return Math.abs(n-V)<=1e-6*Math.max(1,Math.abs(n),Math.abs(V))&&Math.abs(s-x)<=1e-6*Math.max(1,Math.abs(s),Math.abs(x))&&Math.abs(r-R)<=1e-6*Math.max(1,Math.abs(r),Math.abs(R))&&Math.abs(a-z)<=1e-6*Math.max(1,Math.abs(a),Math.abs(z))&&Math.abs(i-g)<=1e-6*Math.max(1,Math.abs(i),Math.abs(g))&&Math.abs(c-B)<=1e-6*Math.max(1,Math.abs(c),Math.abs(B))&&Math.abs(y-D)<=1e-6*Math.max(1,Math.abs(y),Math.abs(D))&&Math.abs(L-F)<=1e-6*Math.max(1,Math.abs(L),Math.abs(F))&&Math.abs(k-p)<=1e-6*Math.max(1,Math.abs(k),Math.abs(p))&&Math.abs(l-Y)<=1e-6*Math.max(1,Math.abs(l),Math.abs(Y))&&Math.abs(M-I)<=1e-6*Math.max(1,Math.abs(M),Math.abs(I))&&Math.abs(h-P)<=1e-6*Math.max(1,Math.abs(h),Math.abs(P))&&Math.abs(b-Q)<=1e-6*Math.max(1,Math.abs(b),Math.abs(Q))&&Math.abs(d-K)<=1e-6*Math.max(1,Math.abs(d),Math.abs(K))&&Math.abs(m-ee)<=1e-6*Math.max(1,Math.abs(m),Math.abs(ee))&&Math.abs(o-te)<=1e-6*Math.max(1,Math.abs(o),Math.abs(te))}static str(e){return`Mat4(${e.join(\", \")})`}};ae=new WeakMap,$=new WeakMap,Z(S,ae,new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])),Z(S,$,new Float32Array(3));var G=S;G.prototype.mul=G.prototype.multiply;G.sub=G.subtract;G.mul=G.multiply;G.frustum=G.frustumNO;G.perspective=G.perspectiveNO;G.ortho=G.orthoNO;var T=class A extends Float32Array{constructor(...e){switch(e.length){case 3:super(e);break;case 2:super(e[0],e[1],3);break;case 1:{let t=e[0];typeof t==\"number\"?super([t,t,t]):super(t,0,3);break}default:super(3);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get b(){return this[2]}set b(e){this[2]=e}get magnitude(){let e=this[0],t=this[1],n=this[2];return Math.sqrt(e*e+t*t+n*n)}get mag(){return this.magnitude}get squaredMagnitude(){let e=this[0],t=this[1],n=this[2];return e*e+t*t+n*n}get sqrMag(){return this.squaredMagnitude}get str(){return A.str(this)}copy(e){return this.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this[2]+=e[2],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this[2]-=e[2],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this[2]*=e[2],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this[2]/=e[2],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this[2]+=e[2]*t,this}distance(e){return A.distance(this,e)}dist(e){return 0}squaredDistance(e){return A.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this[2]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this[2]=1/this[2],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this[2]=Math.abs(this[2]),this}dot(e){return this[0]*e[0]+this[1]*e[1]+this[2]*e[2]}normalize(){return A.normalize(this,this)}static get BYTE_LENGTH(){return 3*Float32Array.BYTES_PER_ELEMENT}static create(){return new A}static clone(e){return new A(e)}static magnitude(e){let t=e[0],n=e[1],s=e[2];return Math.sqrt(t*t+n*n+s*s)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static fromValues(e,t,n){return new A(e,t,n)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}static set(e,t,n,s){return e[0]=t,e[1]=n,e[2]=s,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}static sub(e,t,n){return[0,0,0]}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}static mul(e,t,n){return[0,0,0]}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e}static div(e,t,n){return[0,0,0]}static ceil(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}static floor(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e}static distance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2];return Math.sqrt(n*n+s*s+r*r)}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2];return n*n+s*s+r*r}static sqrDist(e,t){return 0}static squaredLength(e){let t=e[0],n=e[1],s=e[2];return t*t+n*n+s*s}static sqrLen(e,t){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e}static normalize(e,t){let n=t[0],s=t[1],r=t[2],a=n*n+s*s+r*r;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}static cross(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[0],c=n[1],y=n[2];return e[0]=r*y-a*c,e[1]=a*i-s*y,e[2]=s*c-r*i,e}static lerp(e,t,n,s){let r=t[0],a=t[1],i=t[2];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e[2]=i+s*(n[2]-i),e}static slerp(e,t,n,s){let r=Math.acos(Math.min(Math.max(A.dot(t,n),-1),1)),a=Math.sin(r),i=Math.sin((1-s)*r)/a,c=Math.sin(s*r)/a;return e[0]=i*t[0]+c*n[0],e[1]=i*t[1]+c*n[1],e[2]=i*t[2]+c*n[2],e}static hermite(e,t,n,s,r,a){let i=a*a,c=i*(2*a-3)+1,y=i*(a-2)+a,L=i*(a-1),k=i*(3-2*a);return e[0]=t[0]*c+n[0]*y+s[0]*L+r[0]*k,e[1]=t[1]*c+n[1]*y+s[1]*L+r[1]*k,e[2]=t[2]*c+n[2]*y+s[2]*L+r[2]*k,e}static bezier(e,t,n,s,r,a){let i=1-a,c=i*i,y=a*a,L=c*i,k=3*a*c,l=3*y*i,M=y*a;return e[0]=t[0]*L+n[0]*k+s[0]*l+r[0]*M,e[1]=t[1]*L+n[1]*k+s[1]*l+r[1]*M,e[2]=t[2]*L+n[2]*k+s[2]*l+r[2]*M,e}static transformMat4(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[3]*s+n[7]*r+n[11]*a+n[15]||1;return e[0]=(n[0]*s+n[4]*r+n[8]*a+n[12])/i,e[1]=(n[1]*s+n[5]*r+n[9]*a+n[13])/i,e[2]=(n[2]*s+n[6]*r+n[10]*a+n[14])/i,e}static transformMat3(e,t,n){let s=t[0],r=t[1],a=t[2];return e[0]=s*n[0]+r*n[3]+a*n[6],e[1]=s*n[1]+r*n[4]+a*n[7],e[2]=s*n[2]+r*n[5]+a*n[8],e}static transformQuat(e,t,n){let s=n[0],r=n[1],a=n[2],i=n[3]*2,c=t[0],y=t[1],L=t[2],k=r*L-a*y,l=a*c-s*L,M=s*y-r*c,h=(r*M-a*l)*2,b=(a*k-s*M)*2,d=(s*l-r*k)*2;return e[0]=c+k*i+h,e[1]=y+l*i+b,e[2]=L+M*i+d,e}static rotateX(e,t,n,s){let r=n[1],a=n[2],i=t[1]-r,c=t[2]-a;return e[0]=t[0],e[1]=i*Math.cos(s)-c*Math.sin(s)+r,e[2]=i*Math.sin(s)+c*Math.cos(s)+a,e}static rotateY(e,t,n,s){let r=n[0],a=n[2],i=t[0]-r,c=t[2]-a;return e[0]=c*Math.sin(s)+i*Math.cos(s)+r,e[1]=t[1],e[2]=c*Math.cos(s)-i*Math.sin(s)+a,e}static rotateZ(e,t,n,s){let r=n[0],a=n[1],i=t[0]-r,c=t[1]-a;return e[0]=i*Math.cos(s)-c*Math.sin(s)+r,e[1]=i*Math.sin(s)+c*Math.cos(s)+a,e[2]=n[2],e}static angle(e,t){let n=e[0],s=e[1],r=e[2],a=t[0],i=t[1],c=t[2],y=Math.sqrt((n*n+s*s+r*r)*(a*a+i*i+c*c)),L=y&&A.dot(e,t)/y;return Math.acos(Math.min(Math.max(L,-1),1))}static zero(e){return e[0]=0,e[1]=0,e[2]=0,e}static str(e){return`Vec3(${e.join(\", \")})`}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=t[0],i=t[1],c=t[2];return Math.abs(n-a)<=1e-6*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(s-i)<=1e-6*Math.max(1,Math.abs(s),Math.abs(i))&&Math.abs(r-c)<=1e-6*Math.max(1,Math.abs(r),Math.abs(c))}};T.prototype.sub=T.prototype.subtract;T.prototype.mul=T.prototype.multiply;T.prototype.div=T.prototype.divide;T.prototype.dist=T.prototype.distance;T.prototype.sqrDist=T.prototype.squaredDistance;T.sub=T.subtract;T.mul=T.multiply;T.div=T.divide;T.dist=T.distance;T.sqrDist=T.squaredDistance;T.sqrLen=T.squaredLength;T.mag=T.magnitude;T.length=T.magnitude;T.len=T.magnitude;var q=class A extends Float32Array{constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:{let t=e[0];typeof t==\"number\"?super([t,t,t,t]):super(t,0,4);break}default:super(4);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get w(){return this[3]}set w(e){this[3]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get b(){return this[2]}set b(e){this[2]=e}get a(){return this[3]}set a(e){this[3]=e}get magnitude(){let e=this[0],t=this[1],n=this[2],s=this[3];return Math.sqrt(e*e+t*t+n*n+s*s)}get mag(){return this.magnitude}get str(){return A.str(this)}copy(e){return super.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this[2]+=e[2],this[3]+=e[3],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this[2]-=e[2],this[3]-=e[3],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this[2]*=e[2],this[3]*=e[3],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this[2]/=e[2],this[3]/=e[3],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this[3]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this[2]+=e[2]*t,this[3]+=e[3]*t,this}distance(e){return A.distance(this,e)}dist(e){return 0}squaredDistance(e){return A.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this[2]*=-1,this[3]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this[2]=1/this[2],this[3]=1/this[3],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this[2]=Math.abs(this[2]),this[3]=Math.abs(this[3]),this}dot(e){return this[0]*e[0]+this[1]*e[1]+this[2]*e[2]+this[3]*e[3]}normalize(){return A.normalize(this,this)}static get BYTE_LENGTH(){return 4*Float32Array.BYTES_PER_ELEMENT}static create(){return new A}static clone(e){return new A(e)}static fromValues(e,t,n,s){return new A(e,t,n,s)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static set(e,t,n,s,r){return e[0]=t,e[1]=n,e[2]=s,e[3]=r,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}static sub(e,t,n){return e}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e[3]=t[3]*n[3],e}static mul(e,t,n){return e}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e[3]=t[3]/n[3],e}static div(e,t,n){return e}static ceil(e,t){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}static floor(e,t){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}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e[3]=Math.min(t[3],n[3]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e[3]=Math.max(t[3],n[3]),e}static round(e,t){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}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e}static distance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2],a=t[3]-e[3];return Math.hypot(n,s,r,a)}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2],a=t[3]-e[3];return n*n+s*s+r*r+a*a}static sqrDist(e,t){return 0}static magnitude(e){let t=e[0],n=e[1],s=e[2],r=e[3];return Math.sqrt(t*t+n*n+s*s+r*r)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){let t=e[0],n=e[1],s=e[2],r=e[3];return t*t+n*n+s*s+r*r}static sqrLen(e){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e}static normalize(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*n+s*s+r*r+a*a;return i>0&&(i=1/Math.sqrt(i)),e[0]=n*i,e[1]=s*i,e[2]=r*i,e[3]=a*i,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}static cross(e,t,n,s){let r=n[0]*s[1]-n[1]*s[0],a=n[0]*s[2]-n[2]*s[0],i=n[0]*s[3]-n[3]*s[0],c=n[1]*s[2]-n[2]*s[1],y=n[1]*s[3]-n[3]*s[1],L=n[2]*s[3]-n[3]*s[2],k=t[0],l=t[1],M=t[2],h=t[3];return e[0]=l*L-M*y+h*c,e[1]=-(k*L)+M*i-h*a,e[2]=k*y-l*i+h*r,e[3]=-(k*c)+l*a-M*r,e}static lerp(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e[2]=i+s*(n[2]-i),e[3]=c+s*(n[3]-c),e}static transformMat4(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3];return e[0]=n[0]*s+n[4]*r+n[8]*a+n[12]*i,e[1]=n[1]*s+n[5]*r+n[9]*a+n[13]*i,e[2]=n[2]*s+n[6]*r+n[10]*a+n[14]*i,e[3]=n[3]*s+n[7]*r+n[11]*a+n[15]*i,e}static transformQuat(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[0],c=n[1],y=n[2],L=n[3],k=L*s+c*a-y*r,l=L*r+y*s-i*a,M=L*a+i*r-c*s,h=-i*s-c*r-y*a;return e[0]=k*L+h*-i+l*-y-M*-c,e[1]=l*L+h*-c+M*-i-k*-y,e[2]=M*L+h*-y+k*-c-l*-i,e[3]=t[3],e}static zero(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}static str(e){return`Vec4(${e.join(\", \")})`}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=t[0],c=t[1],y=t[2],L=t[3];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(a-L)<=1e-6*Math.max(1,Math.abs(a),Math.abs(L))}};q.prototype.sub=q.prototype.subtract;q.prototype.mul=q.prototype.multiply;q.prototype.div=q.prototype.divide;q.prototype.dist=q.prototype.distance;q.prototype.sqrDist=q.prototype.squaredDistance;q.sub=q.subtract;q.mul=q.multiply;q.div=q.divide;q.dist=q.distance;q.sqrDist=q.squaredDistance;q.sqrLen=q.squaredLength;q.mag=q.magnitude;q.length=q.magnitude;q.len=q.magnitude;var ke,ie,ce,W,U,le,he,f=class f extends Float32Array{constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:{let t=e[0];typeof t==\"number\"?super([t,t,t,t]):super(t,0,4);break}default:super(4),this[3]=1;break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get w(){return this[3]}set w(e){this[3]=e}get magnitude(){let e=this[0],t=this[1],n=this[2],s=this[3];return Math.sqrt(e*e+t*t+n*n+s*s)}get mag(){return this.magnitude}get str(){return f.str(this)}copy(e){return super.set(e),this}identity(){return this[0]=0,this[1]=0,this[2]=0,this[3]=1,this}multiply(e){return f.multiply(this,this,e)}mul(e){return this}rotateX(e){return f.rotateX(this,this,e)}rotateY(e){return f.rotateY(this,this,e)}rotateZ(e){return f.rotateZ(this,this,e)}invert(){return f.invert(this,this)}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this[3]*=e,this}dot(e){return f.dot(this,e)}static get BYTE_LENGTH(){return 4*Float32Array.BYTES_PER_ELEMENT}static create(){return new f}static identity(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}static setAxisAngle(e,t,n){n*=.5;let s=Math.sin(n);return e[0]=s*t[0],e[1]=s*t[1],e[2]=s*t[2],e[3]=Math.cos(n),e}static getAxisAngle(e,t){let n=Math.acos(t[3])*2,s=Math.sin(n/2);return s>1e-6?(e[0]=t[0]/s,e[1]=t[1]/s,e[2]=t[2]/s):(e[0]=1,e[1]=0,e[2]=0),n}static getAngle(e,t){let n=f.dot(e,t);return Math.acos(2*n*n-1)}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*k+i*c+r*L-a*y,e[1]=r*k+i*y+a*c-s*L,e[2]=a*k+i*L+s*y-r*c,e[3]=i*k-s*c-r*y-a*L,e}static rotateX(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+i*c,e[1]=r*y+a*c,e[2]=a*y-r*c,e[3]=i*y-s*c,e}static rotateY(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y-a*c,e[1]=r*y+i*c,e[2]=a*y+s*c,e[3]=i*y-r*c,e}static rotateZ(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+r*c,e[1]=r*y-s*c,e[2]=a*y+i*c,e[3]=i*y-a*c,e}static calculateW(e,t){let n=t[0],s=t[1],r=t[2];return e[0]=n,e[1]=s,e[2]=r,e[3]=Math.sqrt(Math.abs(1-n*n-s*s-r*r)),e}static exp(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=Math.sqrt(n*n+s*s+r*r),c=Math.exp(a),y=i>0?c*Math.sin(i)/i:0;return e[0]=n*y,e[1]=s*y,e[2]=r*y,e[3]=c*Math.cos(i),e}static ln(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=Math.sqrt(n*n+s*s+r*r),c=i>0?Math.atan2(i,a)/i:0;return e[0]=n*c,e[1]=s*c,e[2]=r*c,e[3]=.5*Math.log(n*n+s*s+r*r+a*a),e}static pow(e,t,n){return f.ln(e,t),f.scale(e,e,n),f.exp(e,e),e}static slerp(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3],y=n[0],L=n[1],k=n[2],l=n[3],M,h,b=r*y+a*L+i*k+c*l;if(b<0&&(b=-b,y=-y,L=-L,k=-k,l=-l),1-b>1e-6){let d=Math.acos(b),m=Math.sin(d);M=Math.sin((1-s)*d)/m,h=Math.sin(s*d)/m}else M=1-s,h=s;return e[0]=M*r+h*y,e[1]=M*a+h*L,e[2]=M*i+h*k,e[3]=M*c+h*l,e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*n+s*s+r*r+a*a,c=i?1/i:0;return e[0]=-n*c,e[1]=-s*c,e[2]=-r*c,e[3]=a*c,e}static conjugate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}static fromMat3(e,t){let n=t[0]+t[4]+t[8],s;if(n>0)s=Math.sqrt(n+1),e[3]=.5*s,s=.5/s,e[0]=(t[5]-t[7])*s,e[1]=(t[6]-t[2])*s,e[2]=(t[1]-t[3])*s;else{let r=0;t[4]>t[0]&&(r=1),t[8]>t[r*3+r]&&(r=2);let a=(r+1)%3,i=(r+2)%3;s=Math.sqrt(t[r*3+r]-t[a*3+a]-t[i*3+i]+1),e[r]=.5*s,s=.5/s,e[3]=(t[a*3+i]-t[i*3+a])*s,e[a]=(t[a*3+r]+t[r*3+a])*s,e[i]=(t[i*3+r]+t[r*3+i])*s}return e}static fromEuler(e,t,n,s,r=E(f,ke)){let a=.5*Math.PI/180;t*=a,n*=a,s*=a;let i=Math.sin(t),c=Math.cos(t),y=Math.sin(n),L=Math.cos(n),k=Math.sin(s),l=Math.cos(s);switch(r){case\"xyz\":e[0]=i*L*l+c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l-i*y*k;break;case\"xzy\":e[0]=i*L*l-c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l+i*y*k;break;case\"yxz\":e[0]=i*L*l+c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l+i*y*k;break;case\"yzx\":e[0]=i*L*l+c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l-i*y*k;break;case\"zxy\":e[0]=i*L*l-c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l-i*y*k;break;case\"zyx\":e[0]=i*L*l-c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l+i*y*k;break;default:throw new Error(`Unknown angle order ${r}`)}return e}static str(e){return`Quat(${e.join(\", \")})`}static clone(e){return new f(e)}static fromValues(e,t,n,s){return new f(e,t,n,s)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static set(e,t,n,s,r){return e}static add(e,t,n){return e}static mul(e,t,n){return e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}static lerp(e,t,n,s){return e}static magnitude(e){return 0}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){return 0}static sqrLen(e){return 0}static normalize(e,t){return e}static exactEquals(e,t){return!1}static equals(e,t){return!1}static rotationTo(e,t,n){let s=T.dot(t,n);return s<-.999999?(T.cross(E(f,U),E(f,le),t),T.mag(E(f,U))<1e-6&&T.cross(E(f,U),E(f,he),t),T.normalize(E(f,U),E(f,U)),f.setAxisAngle(e,E(f,U),Math.PI),e):s>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(T.cross(E(f,U),t,n),e[0]=E(f,U)[0],e[1]=E(f,U)[1],e[2]=E(f,U)[2],e[3]=1+s,f.normalize(e,e))}static sqlerp(e,t,n,s,r,a){return f.slerp(E(f,ie),t,r,a),f.slerp(E(f,ce),n,s,a),f.slerp(e,E(f,ie),E(f,ce),2*a*(1-a)),e}static setAxes(e,t,n,s){return E(f,W)[0]=n[0],E(f,W)[3]=n[1],E(f,W)[6]=n[2],E(f,W)[1]=s[0],E(f,W)[4]=s[1],E(f,W)[7]=s[2],E(f,W)[2]=-t[0],E(f,W)[5]=-t[1],E(f,W)[8]=-t[2],f.normalize(e,f.fromMat3(e,E(f,W)))}};ke=new WeakMap,ie=new WeakMap,ce=new WeakMap,W=new WeakMap,U=new WeakMap,le=new WeakMap,he=new WeakMap,Z(f,ke,\"zyx\"),Z(f,ie,new Float32Array(4)),Z(f,ce,new Float32Array(4)),Z(f,W,new Float32Array(9)),Z(f,U,new Float32Array(3)),Z(f,le,new Float32Array([1,0,0])),Z(f,he,new Float32Array([0,1,0]));var O=f;O.set=q.set;O.add=q.add;O.lerp=q.lerp;O.normalize=q.normalize;O.squaredLength=q.squaredLength;O.sqrLen=q.squaredLength;O.exactEquals=q.exactEquals;O.equals=q.equals;O.magnitude=q.magnitude;O.prototype.mul=O.prototype.multiply;O.mul=O.multiply;O.mag=O.magnitude;O.length=O.magnitude;O.len=O.magnitude;var ye,Le,j=class j extends Float32Array{constructor(...e){switch(e.length){case 8:super(e);break;case 2:super(e[0],e[1],8);break;case 1:{let t=e[0];typeof t==\"number\"?super([t,t,t,t,t,t,t,t]):super(t,0,8);break}default:super(8),this[3]=1;break}}get str(){return j.str(this)}copy(e){return super.set(e),this}static get BYTE_LENGTH(){return 8*Float32Array.BYTES_PER_ELEMENT}static create(){return new j}static clone(e){return new j(e)}static fromValues(e,t,n,s,r,a,i,c){return new j(e,t,n,s,r,a,i,c)}static fromRotationTranslationValues(e,t,n,s,r,a,i){let c=r*.5,y=a*.5,L=i*.5;return new j(e,t,n,s,c*s+y*n-L*t,y*s+L*e-c*n,L*s+c*t-y*e,-c*e-y*t-L*n)}static fromRotationTranslation(e,t,n){let s=n[0]*.5,r=n[1]*.5,a=n[2]*.5,i=t[0],c=t[1],y=t[2],L=t[3];return e[0]=i,e[1]=c,e[2]=y,e[3]=L,e[4]=s*L+r*y-a*c,e[5]=r*L+a*i-s*y,e[6]=a*L+s*c-r*i,e[7]=-s*i-r*c-a*y,e}static fromTranslation(e,t){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0]*.5,e[5]=t[1]*.5,e[6]=t[2]*.5,e[7]=0,e}static fromRotation(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=0,e[5]=0,e[6]=0,e[7]=0,e}static fromMat4(e,t){return G.getRotation(E(j,ye),t),G.getTranslation(E(j,Le),t),j.fromRotationTranslation(e,E(j,ye),E(j,Le))}static copy(e,t){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}static identity(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e}static set(e,t,n,s,r,a,i,c,y){return e[0]=t,e[1]=n,e[2]=s,e[3]=r,e[4]=a,e[5]=i,e[6]=c,e[7]=y,e}static getReal(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static getDual(e,t){return e[0]=t[4],e[1]=t[5],e[2]=t[6],e[3]=t[7],e}static setReal(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static setDual(e,t){return e[4]=t[0],e[5]=t[1],e[6]=t[2],e[7]=t[3],e}static getTranslation(e,t){let n=t[4],s=t[5],r=t[6],a=t[7],i=-t[0],c=-t[1],y=-t[2],L=t[3];return e[0]=(n*L+a*i+s*y-r*c)*2,e[1]=(s*L+a*c+r*i-n*y)*2,e[2]=(r*L+a*y+n*c-s*i)*2,e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0]*.5,y=n[1]*.5,L=n[2]*.5,k=t[4],l=t[5],M=t[6],h=t[7];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=i*c+r*L-a*y+k,e[5]=i*y+a*c-s*L+l,e[6]=i*L+s*y-r*c+M,e[7]=-s*c-r*y-a*L+h,e}static rotateX(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,M=y*i+k*r+L*s-c*a,h=L*i+k*a+c*r-y*s,b=k*i-c*s-y*r-L*a;return O.rotateX(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+b*s+M*a-h*r,e[5]=M*i+b*r+h*s-l*a,e[6]=h*i+b*a+l*r-M*s,e[7]=b*i-l*s-M*r-h*a,e}static rotateY(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,M=y*i+k*r+L*s-c*a,h=L*i+k*a+c*r-y*s,b=k*i-c*s-y*r-L*a;return O.rotateY(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+b*s+M*a-h*r,e[5]=M*i+b*r+h*s-l*a,e[6]=h*i+b*a+l*r-M*s,e[7]=b*i-l*s-M*r-h*a,e}static rotateZ(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,M=y*i+k*r+L*s-c*a,h=L*i+k*a+c*r-y*s,b=k*i-c*s-y*r-L*a;return O.rotateZ(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+b*s+M*a-h*r,e[5]=M*i+b*r+h*s-l*a,e[6]=h*i+b*a+l*r-M*s,e[7]=b*i-l*s-M*r-h*a,e}static rotateByQuatAppend(e,t,n){let s=n[0],r=n[1],a=n[2],i=n[3],c=t[0],y=t[1],L=t[2],k=t[3];return e[0]=c*i+k*s+y*a-L*r,e[1]=y*i+k*r+L*s-c*a,e[2]=L*i+k*a+c*r-y*s,e[3]=k*i-c*s-y*r-L*a,c=t[4],y=t[5],L=t[6],k=t[7],e[4]=c*i+k*s+y*a-L*r,e[5]=y*i+k*r+L*s-c*a,e[6]=L*i+k*a+c*r-y*s,e[7]=k*i-c*s-y*r-L*a,e}static rotateByQuatPrepend(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*k+i*c+r*L-a*y,e[1]=r*k+i*y+a*c-s*L,e[2]=a*k+i*L+s*y-r*c,e[3]=i*k-s*c-r*y-a*L,c=n[4],y=n[5],L=n[6],k=n[7],e[4]=s*k+i*c+r*L-a*y,e[5]=r*k+i*y+a*c-s*L,e[6]=a*k+i*L+s*y-r*c,e[7]=i*k-s*c-r*y-a*L,e}static rotateAroundAxis(e,t,n,s){if(Math.abs(s)<1e-6)return j.copy(e,t);let r=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);s*=.5;let a=Math.sin(s),i=a*n[0]/r,c=a*n[1]/r,y=a*n[2]/r,L=Math.cos(s),k=t[0],l=t[1],M=t[2],h=t[3];e[0]=k*L+h*i+l*y-M*c,e[1]=l*L+h*c+M*i-k*y,e[2]=M*L+h*y+k*c-l*i,e[3]=h*L-k*i-l*c-M*y;let b=t[4],d=t[5],m=t[6],o=t[7];return e[4]=b*L+o*i+d*y-m*c,e[5]=d*L+o*c+m*i-b*y,e[6]=m*L+o*y+b*c-d*i,e[7]=o*L-b*i-d*c-m*y,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[4],y=n[5],L=n[6],k=n[7],l=t[4],M=t[5],h=t[6],b=t[7],d=n[0],m=n[1],o=n[2],V=n[3];return e[0]=s*V+i*d+r*o-a*m,e[1]=r*V+i*m+a*d-s*o,e[2]=a*V+i*o+s*m-r*d,e[3]=i*V-s*d-r*m-a*o,e[4]=s*k+i*c+r*L-a*y+l*V+b*d+M*o-h*m,e[5]=r*k+i*y+a*c-s*L+M*V+b*m+h*d-l*o,e[6]=a*k+i*L+s*y-r*c+h*V+b*o+l*m-M*d,e[7]=i*k-s*c-r*y-a*L+b*V-l*d-M*m-h*o,e}static mul(e,t,n){return e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e}static dot(e,t){return 0}static lerp(e,t,n,s){let r=1-s;return j.dot(t,n)<0&&(s=-s),e[0]=t[0]*r+n[0]*s,e[1]=t[1]*r+n[1]*s,e[2]=t[2]*r+n[2]*s,e[3]=t[3]*r+n[3]*s,e[4]=t[4]*r+n[4]*s,e[5]=t[5]*r+n[5]*s,e[6]=t[6]*r+n[6]*s,e[7]=t[7]*r+n[7]*s,e}static invert(e,t){let n=j.squaredLength(t);return e[0]=-t[0]/n,e[1]=-t[1]/n,e[2]=-t[2]/n,e[3]=t[3]/n,e[4]=-t[4]/n,e[5]=-t[5]/n,e[6]=-t[6]/n,e[7]=t[7]/n,e}static conjugate(e,t){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}static magnitude(e){return 0}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){return 0}static sqrLen(e){return 0}static normalize(e,t){let n=j.squaredLength(t);if(n>0){n=Math.sqrt(n);let s=t[0]/n,r=t[1]/n,a=t[2]/n,i=t[3]/n,c=t[4],y=t[5],L=t[6],k=t[7],l=s*c+r*y+a*L+i*k;e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=(c-s*l)/n,e[5]=(y-r*l)/n,e[6]=(L-a*l)/n,e[7]=(k-i*l)/n}return e}static str(e){return`Quat2(${e.join(\", \")})`}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=t[0],l=t[1],M=t[2],h=t[3],b=t[4],d=t[5],m=t[6],o=t[7];return Math.abs(n-k)<=1e-6*Math.max(1,Math.abs(n),Math.abs(k))&&Math.abs(s-l)<=1e-6*Math.max(1,Math.abs(s),Math.abs(l))&&Math.abs(r-M)<=1e-6*Math.max(1,Math.abs(r),Math.abs(M))&&Math.abs(a-h)<=1e-6*Math.max(1,Math.abs(a),Math.abs(h))&&Math.abs(i-b)<=1e-6*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(c-d)<=1e-6*Math.max(1,Math.abs(c),Math.abs(d))&&Math.abs(y-m)<=1e-6*Math.max(1,Math.abs(y),Math.abs(m))&&Math.abs(L-o)<=1e-6*Math.max(1,Math.abs(L),Math.abs(o))}};ye=new WeakMap,Le=new WeakMap,Z(j,ye,new Float32Array(4)),Z(j,Le,new Float32Array(3));var J=j;J.dot=O.dot;J.squaredLength=O.squaredLength;J.sqrLen=O.squaredLength;J.mag=O.magnitude;J.length=O.magnitude;J.len=O.magnitude;J.mul=J.multiply;var N=class A extends Float32Array{constructor(...e){switch(e.length){case 2:{let t=e[0];typeof t==\"number\"?super([t,e[1]]):super(t,e[1],2);break}case 1:{let t=e[0];typeof t==\"number\"?super([t,t]):super(t,0,2);break}default:super(2);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get magnitude(){return Math.hypot(this[0],this[1])}get mag(){return this.magnitude}get squaredMagnitude(){let e=this[0],t=this[1];return e*e+t*t}get sqrMag(){return this.squaredMagnitude}get str(){return A.str(this)}copy(e){return this.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this}distance(e){return A.distance(this,e)}dist(e){return 0}squaredDistance(e){return A.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this}dot(e){return this[0]*e[0]+this[1]*e[1]}normalize(){return A.normalize(this,this)}static get BYTE_LENGTH(){return 2*Float32Array.BYTES_PER_ELEMENT}static create(){return new A}static clone(e){return new A(e)}static fromValues(e,t){return new A(e,t)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e}static set(e,t,n){return e[0]=t,e[1]=n,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}static sub(e,t,n){return[0,0]}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e}static mul(e,t,n){return[0,0]}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e}static div(e,t,n){return[0,0]}static ceil(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}static floor(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e}static round(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e}static distance(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1])}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1];return n*n+s*s}static sqrDist(e,t){return 0}static magnitude(e){let t=e[0],n=e[1];return Math.sqrt(t*t+n*n)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){let t=e[0],n=e[1];return t*t+n*n}static sqrLen(e,t){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e}static normalize(e,t){let n=t[0],s=t[1],r=n*n+s*s;return r>0&&(r=1/Math.sqrt(r)),e[0]=t[0]*r,e[1]=t[1]*r,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]}static cross(e,t,n){let s=t[0]*n[1]-t[1]*n[0];return e[0]=e[1]=0,e[2]=s,e}static lerp(e,t,n,s){let r=t[0],a=t[1];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e}static transformMat2(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[2]*r,e[1]=n[1]*s+n[3]*r,e}static transformMat2d(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[2]*r+n[4],e[1]=n[1]*s+n[3]*r+n[5],e}static transformMat3(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[3]*r+n[6],e[1]=n[1]*s+n[4]*r+n[7],e}static transformMat4(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[4]*r+n[12],e[1]=n[1]*s+n[5]*r+n[13],e}static rotate(e,t,n,s){let r=t[0]-n[0],a=t[1]-n[1],i=Math.sin(s),c=Math.cos(s);return e[0]=r*c-a*i+n[0],e[1]=r*i+a*c+n[1],e}static angle(e,t){let n=e[0],s=e[1],r=t[0],a=t[1],i=Math.sqrt(n*n+s*s)*Math.sqrt(r*r+a*a),c=i&&(n*r+s*a)/i;return Math.acos(Math.min(Math.max(c,-1),1))}static zero(e){return e[0]=0,e[1]=0,e}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]}static equals(e,t){let n=e[0],s=e[1],r=t[0],a=t[1];return Math.abs(n-r)<=1e-6*Math.max(1,Math.abs(n),Math.abs(r))&&Math.abs(s-a)<=1e-6*Math.max(1,Math.abs(s),Math.abs(a))}static str(e){return`Vec2(${e.join(\", \")})`}};N.prototype.sub=N.prototype.subtract;N.prototype.mul=N.prototype.multiply;N.prototype.div=N.prototype.divide;N.prototype.dist=N.prototype.distance;N.prototype.sqrDist=N.prototype.squaredDistance;N.sub=N.subtract;N.mul=N.multiply;N.div=N.divide;N.dist=N.distance;N.sqrDist=N.squaredDistance;N.sqrLen=N.squaredLength;N.mag=N.magnitude;N.length=N.magnitude;N.len=N.magnitude;var me=!1;function _e(){if(me)return;let A=[\"xx\",\"xy\",\"yx\",\"yy\",\"xxx\",\"xxy\",\"xyx\",\"xyy\",\"yxx\",\"yxy\",\"yyx\",\"yyy\",\"xxxx\",\"xxxy\",\"xxyx\",\"xxyy\",\"xyxx\",\"xyxy\",\"xyyx\",\"xyyy\",\"yxxx\",\"yxxy\",\"yxyx\",\"yxyy\",\"yyxx\",\"yyxy\",\"yyyx\",\"yyyy\",\"rr\",\"rg\",\"gr\",\"gg\",\"rrr\",\"rrg\",\"rgr\",\"rgg\",\"grr\",\"grg\",\"ggr\",\"ggg\",\"rrrr\",\"rrrg\",\"rrgr\",\"rrgg\",\"rgrr\",\"rgrg\",\"rggr\",\"rggg\",\"grrr\",\"grrg\",\"grgr\",\"grgg\",\"ggrr\",\"ggrg\",\"gggr\",\"gggg\"],e=[\"xz\",\"yz\",\"zx\",\"zy\",\"zz\",\"xxz\",\"xyz\",\"xzx\",\"xzy\",\"xzz\",\"yxz\",\"yyz\",\"yzx\",\"yzy\",\"yzz\",\"zxx\",\"zxy\",\"zxz\",\"zyx\",\"zyy\",\"zyz\",\"zzx\",\"zzy\",\"zzz\",\"xxxz\",\"xxyz\",\"xxzx\",\"xxzy\",\"xxzz\",\"xyxz\",\"xyyz\",\"xyzx\",\"xyzy\",\"xyzz\",\"xzxx\",\"xzxy\",\"xzxz\",\"xzyx\",\"xzyy\",\"xzyz\",\"xzzx\",\"xzzy\",\"xzzz\",\"yxxz\",\"yxyz\",\"yxzx\",\"yxzy\",\"yxzz\",\"yyxz\",\"yyyz\",\"yyzx\",\"yyzy\",\"yyzz\",\"yzxx\",\"yzxy\",\"yzxz\",\"yzyx\",\"yzyy\",\"yzyz\",\"yzzx\",\"yzzy\",\"yzzz\",\"zxxx\",\"zxxy\",\"zxxz\",\"zxyx\",\"zxyy\",\"zxyz\",\"zxzx\",\"zxzy\",\"zxzz\",\"zyxx\",\"zyxy\",\"zyxz\",\"zyyx\",\"zyyy\",\"zyyz\",\"zyzx\",\"zyzy\",\"zyzz\",\"zzxx\",\"zzxy\",\"zzxz\",\"zzyx\",\"zzyy\",\"zzyz\",\"zzzx\",\"zzzy\",\"zzzz\",\"rb\",\"gb\",\"br\",\"bg\",\"bb\",\"rrb\",\"rgb\",\"rbr\",\"rbg\",\"rbb\",\"grb\",\"ggb\",\"gbr\",\"gbg\",\"gbb\",\"brr\",\"brg\",\"brb\",\"bgr\",\"bgg\",\"bgb\",\"bbr\",\"bbg\",\"bbb\",\"rrrb\",\"rrgb\",\"rrbr\",\"rrbg\",\"rrbb\",\"rgrb\",\"rggb\",\"rgbr\",\"rgbg\",\"rgbb\",\"rbrr\",\"rbrg\",\"rbrb\",\"rbgr\",\"rbgg\",\"rbgb\",\"rbbr\",\"rbbg\",\"rbbb\",\"grrb\",\"grgb\",\"grbr\",\"grbg\",\"grbb\",\"ggrb\",\"gggb\",\"ggbr\",\"ggbg\",\"ggbb\",\"gbrr\",\"gbrg\",\"gbrb\",\"gbgr\",\"gbgg\",\"gbgb\",\"gbbr\",\"gbbg\",\"gbbb\",\"brrr\",\"brrg\",\"brrb\",\"brgr\",\"brgg\",\"brgb\",\"brbr\",\"brbg\",\"brbb\",\"bgrr\",\"bgrg\",\"bgrb\",\"bggr\",\"bggg\",\"bggb\",\"bgbr\",\"bgbg\",\"bgbb\",\"bbrr\",\"bbrg\",\"bbrb\",\"bbgr\",\"bbgg\",\"bbgb\",\"bbbr\",\"bbbg\",\"bbbb\"],t=[\"xw\",\"yw\",\"zw\",\"wx\",\"wy\",\"wz\",\"ww\",\"xxw\",\"xyw\",\"xzw\",\"xwx\",\"xwy\",\"xwz\",\"xww\",\"yxw\",\"yyw\",\"yzw\",\"ywx\",\"ywy\",\"ywz\",\"yww\",\"zxw\",\"zyw\",\"zzw\",\"zwx\",\"zwy\",\"zwz\",\"zww\",\"wxx\",\"wxy\",\"wxz\",\"wxw\",\"wyx\",\"wyy\",\"wyz\",\"wyw\",\"wzx\",\"wzy\",\"wzz\",\"wzw\",\"wwx\",\"wwy\",\"wwz\",\"www\",\"xxxw\",\"xxyw\",\"xxzw\",\"xxwx\",\"xxwy\",\"xxwz\",\"xxww\",\"xyxw\",\"xyyw\",\"xyzw\",\"xywx\",\"xywy\",\"xywz\",\"xyww\",\"xzxw\",\"xzyw\",\"xzzw\",\"xzwx\",\"xzwy\",\"xzwz\",\"xzww\",\"xwxx\",\"xwxy\",\"xwxz\",\"xwxw\",\"xwyx\",\"xwyy\",\"xwyz\",\"xwyw\",\"xwzx\",\"xwzy\",\"xwzz\",\"xwzw\",\"xwwx\",\"xwwy\",\"xwwz\",\"xwww\",\"yxxw\",\"yxyw\",\"yxzw\",\"yxwx\",\"yxwy\",\"yxwz\",\"yxww\",\"yyxw\",\"yyyw\",\"yyzw\",\"yywx\",\"yywy\",\"yywz\",\"yyww\",\"yzxw\",\"yzyw\",\"yzzw\",\"yzwx\",\"yzwy\",\"yzwz\",\"yzww\",\"ywxx\",\"ywxy\",\"ywxz\",\"ywxw\",\"ywyx\",\"ywyy\",\"ywyz\",\"ywyw\",\"ywzx\",\"ywzy\",\"ywzz\",\"ywzw\",\"ywwx\",\"ywwy\",\"ywwz\",\"ywww\",\"zxxw\",\"zxyw\",\"zxzw\",\"zxwx\",\"zxwy\",\"zxwz\",\"zxww\",\"zyxw\",\"zyyw\",\"zyzw\",\"zywx\",\"zywy\",\"zywz\",\"zyww\",\"zzxw\",\"zzyw\",\"zzzw\",\"zzwx\",\"zzwy\",\"zzwz\",\"zzww\",\"zwxx\",\"zwxy\",\"zwxz\",\"zwxw\",\"zwyx\",\"zwyy\",\"zwyz\",\"zwyw\",\"zwzx\",\"zwzy\",\"zwzz\",\"zwzw\",\"zwwx\",\"zwwy\",\"zwwz\",\"zwww\",\"wxxx\",\"wxxy\",\"wxxz\",\"wxxw\",\"wxyx\",\"wxyy\",\"wxyz\",\"wxyw\",\"wxzx\",\"wxzy\",\"wxzz\",\"wxzw\",\"wxwx\",\"wxwy\",\"wxwz\",\"wxww\",\"wyxx\",\"wyxy\",\"wyxz\",\"wyxw\",\"wyyx\",\"wyyy\",\"wyyz\",\"wyyw\",\"wyzx\",\"wyzy\",\"wyzz\",\"wyzw\",\"wywx\",\"wywy\",\"wywz\",\"wyww\",\"wzxx\",\"wzxy\",\"wzxz\",\"wzxw\",\"wzyx\",\"wzyy\",\"wzyz\",\"wzyw\",\"wzzx\",\"wzzy\",\"wzzz\",\"wzzw\",\"wzwx\",\"wzwy\",\"wzwz\",\"wzww\",\"wwxx\",\"wwxy\",\"wwxz\",\"wwxw\",\"wwyx\",\"wwyy\",\"wwyz\",\"wwyw\",\"wwzx\",\"wwzy\",\"wwzz\",\"wwzw\",\"wwwx\",\"wwwy\",\"wwwz\",\"wwww\",\"ra\",\"ga\",\"ba\",\"ar\",\"ag\",\"ab\",\"aa\",\"rra\",\"rga\",\"rba\",\"rar\",\"rag\",\"rab\",\"raa\",\"gra\",\"gga\",\"gba\",\"gar\",\"gag\",\"gab\",\"gaa\",\"bra\",\"bga\",\"bba\",\"bar\",\"bag\",\"bab\",\"baa\",\"arr\",\"arg\",\"arb\",\"ara\",\"agr\",\"agg\",\"agb\",\"aga\",\"abr\",\"abg\",\"abb\",\"aba\",\"aar\",\"aag\",\"aab\",\"aaa\",\"rrra\",\"rrga\",\"rrba\",\"rrar\",\"rrag\",\"rrab\",\"rraa\",\"rgra\",\"rgga\",\"rgba\",\"rgar\",\"rgag\",\"rgab\",\"rgaa\",\"rbra\",\"rbga\",\"rbba\",\"rbar\",\"rbag\",\"rbab\",\"rbaa\",\"rarr\",\"rarg\",\"rarb\",\"rara\",\"ragr\",\"ragg\",\"ragb\",\"raga\",\"rabr\",\"rabg\",\"rabb\",\"raba\",\"raar\",\"raag\",\"raab\",\"raaa\",\"grra\",\"grga\",\"grba\",\"grar\",\"grag\",\"grab\",\"graa\",\"ggra\",\"ggga\",\"ggba\",\"ggar\",\"ggag\",\"ggab\",\"ggaa\",\"gbra\",\"gbga\",\"gbba\",\"gbar\",\"gbag\",\"gbab\",\"gbaa\",\"garr\",\"garg\",\"garb\",\"gara\",\"gagr\",\"gagg\",\"gagb\",\"gaga\",\"gabr\",\"gabg\",\"gabb\",\"gaba\",\"gaar\",\"gaag\",\"gaab\",\"gaaa\",\"brra\",\"brga\",\"brba\",\"brar\",\"brag\",\"brab\",\"braa\",\"bgra\",\"bgga\",\"bgba\",\"bgar\",\"bgag\",\"bgab\",\"bgaa\",\"bbra\",\"bbga\",\"bbba\",\"bbar\",\"bbag\",\"bbab\",\"bbaa\",\"barr\",\"barg\",\"barb\",\"bara\",\"bagr\",\"bagg\",\"bagb\",\"baga\",\"babr\",\"babg\",\"babb\",\"baba\",\"baar\",\"baag\",\"baab\",\"baaa\",\"arrr\",\"arrg\",\"arrb\",\"arra\",\"argr\",\"argg\",\"argb\",\"arga\",\"arbr\",\"arbg\",\"arbb\",\"arba\",\"arar\",\"arag\",\"arab\",\"araa\",\"agrr\",\"agrg\",\"agrb\",\"agra\",\"aggr\",\"aggg\",\"aggb\",\"agga\",\"agbr\",\"agbg\",\"agbb\",\"agba\",\"agar\",\"agag\",\"agab\",\"agaa\",\"abrr\",\"abrg\",\"abrb\",\"abra\",\"abgr\",\"abgg\",\"abgb\",\"abga\",\"abbr\",\"abbg\",\"abbb\",\"abba\",\"abar\",\"abag\",\"abab\",\"abaa\",\"aarr\",\"aarg\",\"aarb\",\"aara\",\"aagr\",\"aagg\",\"aagb\",\"aaga\",\"aabr\",\"aabg\",\"aabb\",\"aaba\",\"aaar\",\"aaag\",\"aaab\",\"aaaa\"],n={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};function s(r){switch(r.length){case 2:return function(){return new N(this[n[r[0]]],this[n[r[1]]])};case 3:return function(){return new T(this[n[r[0]]],this[n[r[1]]],this[n[r[2]]])};case 4:return function(){return new q(this[n[r[0]]],this[n[r[1]]],this[n[r[2]]],this[n[r[3]]])}}throw new Error(\"Illegal swizzle length\")}for(let r of A){let a=s(r);Object.defineProperty(N.prototype,r,{get:a}),Object.defineProperty(T.prototype,r,{get:a}),Object.defineProperty(q.prototype,r,{get:a})}for(let r of e){let a=s(r);Object.defineProperty(T.prototype,r,{get:a}),Object.defineProperty(q.prototype,r,{get:a})}for(let r of t){let a=s(r);Object.defineProperty(q.prototype,r,{get:a})}me=!0}var xe=Math.PI/180,Re=180/Math.PI;function tt(A){return A*Re}function nt(A){return A*xe}export{_e as EnableSwizzles,v as Mat2,_ as Mat2d,u as Mat3,G as Mat4,O as Quat,J as Quat2,N as Vec2,T as Vec3,q as Vec4,v as mat2,_ as mat2d,u as mat3,G as mat4,O as quat,J as quat2,tt as toDegree,nt as toRadian,N as vec2,T as vec3,q as vec4};\n//# sourceMappingURL=gl-matrix-f32.min.js.map\n"],"names":["ne","C","_Float32Array","_this","_classCallCheck","_len","arguments","length","e","Array","_key","_callSuper","t","E","_assertThisInitialized","_inherits","_createClass","key","get","str","value","copy","set","identity","multiply","mul","transpose","invert","scale","rotate","Float32Array","BYTES_PER_ELEMENT","create","clone","fromValues","_len2","_key2","_construct","undefined","n","s","r","a","i","adjoint","determinant","add","subtract","sub","c","y","L","k","Math","sin","cos","fromRotation","fromScaling","frob","sqrt","multiplyScalar","multiplyScalarAndAdd","LDU","exactEquals","equals","abs","max","concat","join","_wrapNativeSuper","WeakMap","Z","v","prototype"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;"} \ No newline at end of file diff --git a/dist-cdn/umd/gl-matrix-f64.js b/dist-cdn/umd/gl-matrix-f64.js new file mode 100644 index 00000000..aea4acf5 --- /dev/null +++ b/dist-cdn/umd/gl-matrix-f64.js @@ -0,0 +1,10784 @@ +// gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library. +// @author Brandon Jones +// @author Colin MacKenzie IV +// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md) +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.glMatrixF64 = {})); +})(this, (function (exports) { 'use strict'; + + function _assertThisInitialized(e) { + if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return e; + } + function _callSuper(t, o, e) { + return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); + } + function _classCallCheck(a, n) { + if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); + } + function _construct(t, e, r) { + if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); + var o = [null]; + o.push.apply(o, e); + var p = new (t.bind.apply(t, o))(); + return r && _setPrototypeOf(p, r.prototype), p; + } + function _defineProperties(e, r) { + for (var t = 0; t < r.length; t++) { + var o = r[t]; + o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); + } + } + function _createClass(e, r, t) { + return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { + writable: !1 + }), e; + } + function _get() { + return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { + var p = _superPropBase(e, t); + if (p) { + var n = Object.getOwnPropertyDescriptor(p, t); + return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; + } + }, _get.apply(null, arguments); + } + function _getPrototypeOf(t) { + return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { + return t.__proto__ || Object.getPrototypeOf(t); + }, _getPrototypeOf(t); + } + function _inherits(t, e) { + if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); + t.prototype = Object.create(e && e.prototype, { + constructor: { + value: t, + writable: !0, + configurable: !0 + } + }), Object.defineProperty(t, "prototype", { + writable: !1 + }), e && _setPrototypeOf(t, e); + } + function _isNativeFunction(t) { + try { + return -1 !== Function.toString.call(t).indexOf("[native code]"); + } catch (n) { + return "function" == typeof t; + } + } + function _isNativeReflectConstruct() { + try { + var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (t) {} + return (_isNativeReflectConstruct = function () { + return !!t; + })(); + } + function _possibleConstructorReturn(t, e) { + if (e && ("object" == typeof e || "function" == typeof e)) return e; + if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); + return _assertThisInitialized(t); + } + function _setPrototypeOf(t, e) { + return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { + return t.__proto__ = e, t; + }, _setPrototypeOf(t, e); + } + function _superPropBase(t, o) { + for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); + return t; + } + function _superPropGet(t, o, e, r) { + var p = _get(_getPrototypeOf(t.prototype ), o, e); + return "function" == typeof p ? function (t) { + return p.apply(e, t); + } : p; + } + function _toPrimitive(t, r) { + if ("object" != typeof t || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r); + if ("object" != typeof i) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return (String )(t); + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == typeof i ? i : i + ""; + } + function _wrapNativeSuper(t) { + var r = "function" == typeof Map ? new Map() : void 0; + return _wrapNativeSuper = function (t) { + if (null === t || !_isNativeFunction(t)) return t; + if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); + if (void 0 !== r) { + if (r.has(t)) return r.get(t); + r.set(t, Wrapper); + } + function Wrapper() { + return _construct(t, arguments, _getPrototypeOf(this).constructor); + } + return Wrapper.prototype = Object.create(t.prototype, { + constructor: { + value: Wrapper, + enumerable: !1, + writable: !0, + configurable: !0 + } + }), _setPrototypeOf(Wrapper, t); + }, _wrapNativeSuper(t); + } + + // gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library. + // @author Brandon Jones + // @author Colin MacKenzie IV + // @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md) + var __typeError = function __typeError(msg) { + throw TypeError(msg); + }; + var __accessCheck = function __accessCheck(obj, member, msg) { + return member.has(obj) || __typeError("Cannot " + msg); + }; + var __privateGet = function __privateGet(obj, member, getter) { + return __accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj); + }; + var __privateAdd = function __privateAdd(obj, member, value) { + return member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); + }; + + // src/common/index.ts + var GLM_EPSILON = 1e-6; + + // src/_lib/f64/Mat2.ts + var _IDENTITY_2X2; + var _Mat2 = /*#__PURE__*/function (_Float64Array) { + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + function _Mat2() { + var _this; + _classCallCheck(this, _Mat2); + for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) { + values[_key] = arguments[_key]; + } + switch (values.length) { + case 4: + _this = _callSuper(this, _Mat2, [values]); + break; + case 2: + _this = _callSuper(this, _Mat2, [values[0], values[1], 4]); + break; + case 1: + var v = values[0]; + if (typeof v === "number") { + _this = _callSuper(this, _Mat2, [[v, v, v, v]]); + } else { + _this = _callSuper(this, _Mat2, [v, 0, 4]); + } + break; + default: + _this = _callSuper(this, _Mat2, [__privateGet(_Mat2, _IDENTITY_2X2)]); + break; + } + return _assertThisInitialized(_this); + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat2.str(this);` + * + * @category Accessors + */ + _inherits(_Mat2, _Float64Array); + return _createClass(_Mat2, [{ + key: "str", + get: function get() { + return _Mat2.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat2} into `this`. + * + * @param a the source vector + * @returns `this` + * @category Methods + */ + }, { + key: "copy", + value: function copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat2.identity(this) + * + * @returns `this` + * @category Methods + */ + }, { + key: "identity", + value: function identity() { + this.set(__privateGet(_Mat2, _IDENTITY_2X2)); + return this; + } + /** + * Multiplies this {@link Mat2} against another one + * Equivalent to `Mat2.multiply(this, this, b);` + * + * @param b - The second operand + * @returns `this` + * @category Methods + */ + }, { + key: "multiply", + value: function multiply(b) { + return _Mat2.multiply(this, this, b); + } + /** + * Alias for {@link Mat2.multiply} + * @category Methods + */ + }, { + key: "mul", + value: function mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat2} + * Equivalent to `Mat2.transpose(this, this);` + * + * @returns `this` + * @category Methods + */ + }, { + key: "transpose", + value: function transpose() { + return _Mat2.transpose(this, this); + } + /** + * Inverts this {@link Mat2} + * Equivalent to `Mat4.invert(this, this);` + * + * @returns `this` + * @category Methods + */ + }, { + key: "invert", + value: function invert() { + return _Mat2.invert(this, this); + } + /** + * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2.scale(this, this, v);` + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + * @category Methods + */ + }, { + key: "scale", + value: function scale(v) { + return _Mat2.scale(this, this, v); + } + /** + * Rotates this {@link Mat2} by the given angle around the given axis + * Equivalent to `Mat2.rotate(this, this, rad);` + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + * @category Methods + */ + }, { + key: "rotate", + value: function rotate(rad) { + return _Mat2.rotate(this, this, rad); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2}. + */ + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 4 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat2} + * @category Static + * + * @returns A new {@link Mat2} + */ + }, { + key: "create", + value: function create() { + return new _Mat2(); + } + /** + * Creates a new {@link Mat2} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2} + */ + }, { + key: "clone", + value: function clone(a) { + return new _Mat2(a); + } + /** + * Copy the values from one {@link Mat2} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + }, { + key: "copy", + value: function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Create a new {@link Mat2} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2} + */ + }, { + key: "fromValues", + value: function fromValues() { + for (var _len2 = arguments.length, values = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + values[_key2] = arguments[_key2]; + } + return _construct(_Mat2, values); + } + /** + * Set the components of a {@link Mat2} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + }, { + key: "set", + value: function set(out) { + out[0] = arguments.length <= 1 ? undefined : arguments[1]; + out[1] = arguments.length <= 2 ? undefined : arguments[2]; + out[2] = arguments.length <= 3 ? undefined : arguments[3]; + out[3] = arguments.length <= 4 ? undefined : arguments[4]; + return out; + } + /** + * Set a {@link Mat2} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + }, { + key: "identity", + value: function identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + }, { + key: "transpose", + value: function transpose(out, a) { + if (out === a) { + var a1 = a[1]; + out[1] = a[2]; + out[2] = a1; + } else { + out[0] = a[0]; + out[1] = a[2]; + out[2] = a[1]; + out[3] = a[3]; + } + return out; + } + /** + * Inverts a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + }, { + key: "invert", + value: function invert(out, a) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var det = a0 * a3 - a2 * a1; + if (!det) { + return null; + } + det = 1 / det; + out[0] = a3 * det; + out[1] = -a1 * det; + out[2] = -a2 * det; + out[3] = a0 * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + }, { + key: "adjoint", + value: function adjoint(out, a) { + var a0 = a[0]; + out[0] = a[3]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a0; + return out; + } + /** + * Calculates the determinant of a {@link Mat2} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + }, { + key: "determinant", + value: function determinant(a) { + return a[0] * a[3] - a[2] * a[1]; + } + /** + * Adds two {@link Mat2}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "add", + value: function add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "subtract", + value: function subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + return out; + } + /** + * Alias for {@link Mat2.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sub", + value: function sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat2}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "multiply", + value: function multiply(out, a, b) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; + out[0] = a0 * b0 + a2 * b1; + out[1] = a1 * b0 + a3 * b1; + out[2] = a0 * b2 + a2 * b3; + out[3] = a1 * b2 + a3 * b3; + return out; + } + /** + * Alias for {@link Mat2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "mul", + value: function mul(out, a, b) { + return out; + } + /** + * Rotates a {@link Mat2} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "rotate", + value: function rotate(out, a, rad) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var s = Math.sin(rad); + var c = Math.cos(rad); + out[0] = a0 * c + a2 * s; + out[1] = a1 * c + a3 * s; + out[2] = a0 * -s + a2 * c; + out[3] = a1 * -s + a3 * c; + return out; + } + /** + * Scales the {@link Mat2} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + }, { + key: "scale", + value: function scale(out, a, v) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var v0 = v[0]; + var v1 = v[1]; + out[0] = a0 * v0; + out[1] = a1 * v0; + out[2] = a2 * v1; + out[3] = a3 * v1; + return out; + } + /** + * Creates a {@link Mat2} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "fromRotation", + value: function fromRotation(out, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = -s; + out[3] = c; + return out; + } + /** + * Creates a {@link Mat2} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + }, { + key: "fromScaling", + value: function fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = v[1]; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat2} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + }, { + key: "frob", + value: function frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]); + } + /** + * Multiply each element of a {@link Mat2} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + }, { + key: "multiplyScalar", + value: function multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + return out; + } + /** + * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + }, { + key: "multiplyScalarAndAdd", + value: function multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + return out; + } + /** + * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix + * @category Static + * + * @param L - the lower triangular matrix + * @param D - the diagonal matrix + * @param U - the upper triangular matrix + * @param a - the input matrix to factorize + */ + }, { + key: "LDU", + value: function LDU(L, D, U, a) { + L[2] = a[2] / a[0]; + U[0] = a[0]; + U[1] = a[1]; + U[3] = a[3] - L[2] * U[1]; + return [L, D, U]; + } + /** + * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + }, { + key: "exactEquals", + value: function exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + /** + * Returns whether two {@link Mat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + }, { + key: "equals", + value: function equals(a, b) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)); + } + /** + * Returns a string representation of a {@link Mat2} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + }, { + key: "str", + value: function str(a) { + return "Mat2(".concat(a.join(", "), ")"); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float64Array)); + _IDENTITY_2X2 = new WeakMap(); + __privateAdd(_Mat2, _IDENTITY_2X2, new Float64Array([1, 0, 0, 1])); + var Mat2 = _Mat2; + Mat2.prototype.mul = Mat2.prototype.multiply; + Mat2.mul = Mat2.multiply; + Mat2.sub = Mat2.subtract; + + // src/_lib/f64/Mat2d.ts + var _IDENTITY_2X3; + var _Mat2d = /*#__PURE__*/function (_Float64Array2) { + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + function _Mat2d() { + var _this2; + _classCallCheck(this, _Mat2d); + for (var _len3 = arguments.length, values = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + values[_key3] = arguments[_key3]; + } + switch (values.length) { + case 6: + _this2 = _callSuper(this, _Mat2d, [values]); + break; + case 2: + _this2 = _callSuper(this, _Mat2d, [values[0], values[1], 6]); + break; + case 1: + var v = values[0]; + if (typeof v === "number") { + _this2 = _callSuper(this, _Mat2d, [[v, v, v, v, v, v]]); + } else { + _this2 = _callSuper(this, _Mat2d, [v, 0, 6]); + } + break; + default: + _this2 = _callSuper(this, _Mat2d, [__privateGet(_Mat2d, _IDENTITY_2X3)]); + break; + } + return _assertThisInitialized(_this2); + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat2d.str(this);` + * + * @category Accessors + */ + _inherits(_Mat2d, _Float64Array2); + return _createClass(_Mat2d, [{ + key: "str", + get: function get() { + return _Mat2d.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Mat2d} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + }, { + key: "copy", + value: function copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat2d.identity(this) + * @category Methods + * + * @returns `this` + */ + }, { + key: "identity", + value: function identity() { + this.set(__privateGet(_Mat2d, _IDENTITY_2X3)); + return this; + } + /** + * Multiplies this {@link Mat2d} against another one + * Equivalent to `Mat2d.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + }, { + key: "multiply", + value: function multiply(b) { + return _Mat2d.multiply(this, this, b); + } + /** + * Alias for {@link Mat2d.multiply} + * @category Methods + */ + }, { + key: "mul", + value: function mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Translate this {@link Mat2d} by the given vector + * Equivalent to `Mat2d.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + }, { + key: "translate", + value: function translate(v) { + return _Mat2d.translate(this, this, v); + } + /** + * Rotates this {@link Mat2d} by the given angle around the given axis + * Equivalent to `Mat2d.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + }, { + key: "rotate", + value: function rotate(rad) { + return _Mat2d.rotate(this, this, rad); + } + /** + * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2d.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + }, { + key: "scale", + value: function scale(v) { + return _Mat2d.scale(this, this, v); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2d}. + */ + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 6 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat2d} + * @category Static + * + * @returns A new {@link Mat2d} + */ + }, { + key: "create", + value: function create() { + return new _Mat2d(); + } + /** + * Creates a new {@link Mat2d} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2d} + */ + }, { + key: "clone", + value: function clone(a) { + return new _Mat2d(a); + } + /** + * Copy the values from one {@link Mat2d} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + }, { + key: "copy", + value: function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + return out; + } + /** + * Create a new {@link Mat2d} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2d} + */ + }, { + key: "fromValues", + value: function fromValues() { + for (var _len4 = arguments.length, values = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + values[_key4] = arguments[_key4]; + } + return _construct(_Mat2d, values); + } + /** + * Set the components of a {@link Mat2d} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + }, { + key: "set", + value: function set(out) { + out[0] = arguments.length <= 1 ? undefined : arguments[1]; + out[1] = arguments.length <= 2 ? undefined : arguments[2]; + out[2] = arguments.length <= 3 ? undefined : arguments[3]; + out[3] = arguments.length <= 4 ? undefined : arguments[4]; + out[4] = arguments.length <= 5 ? undefined : arguments[5]; + out[5] = arguments.length <= 6 ? undefined : arguments[6]; + return out; + } + /** + * Set a {@link Mat2d} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + }, { + key: "identity", + value: function identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Inverts a {@link Mat2d} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + }, { + key: "invert", + value: function invert(out, a) { + var aa = a[0]; + var ab = a[1]; + var ac = a[2]; + var ad = a[3]; + var atx = a[4]; + var aty = a[5]; + var det = aa * ad - ab * ac; + if (!det) { + return null; + } + det = 1 / det; + out[0] = ad * det; + out[1] = -ab * det; + out[2] = -ac * det; + out[3] = aa * det; + out[4] = (ac * aty - ad * atx) * det; + out[5] = (ab * atx - aa * aty) * det; + return out; + } + /** + * Calculates the determinant of a {@link Mat2d} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + }, { + key: "determinant", + value: function determinant(a) { + return a[0] * a[3] - a[1] * a[2]; + } + /** + * Adds two {@link Mat2d}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "add", + value: function add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "subtract", + value: function subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + return out; + } + /** + * Alias for {@link Mat2d.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sub", + value: function sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat2d}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "multiply", + value: function multiply(out, a, b) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var a4 = a[4]; + var a5 = a[5]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; + var b4 = b[4]; + var b5 = b[5]; + out[0] = a0 * b0 + a2 * b1; + out[1] = a1 * b0 + a3 * b1; + out[2] = a0 * b2 + a2 * b3; + out[3] = a1 * b2 + a3 * b3; + out[4] = a0 * b4 + a2 * b5 + a4; + out[5] = a1 * b4 + a3 * b5 + a5; + return out; + } + /** + * Alias for {@link Mat2d.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "mul", + value: function mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat2d} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + }, { + key: "translate", + value: function translate(out, a, v) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var a4 = a[4]; + var a5 = a[5]; + var v0 = v[0]; + var v1 = v[1]; + out[0] = a0; + out[1] = a1; + out[2] = a2; + out[3] = a3; + out[4] = a0 * v0 + a2 * v1 + a4; + out[5] = a1 * v0 + a3 * v1 + a5; + return out; + } + /** + * Rotates a {@link Mat2d} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "rotate", + value: function rotate(out, a, rad) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var a4 = a[4]; + var a5 = a[5]; + var s = Math.sin(rad); + var c = Math.cos(rad); + out[0] = a0 * c + a2 * s; + out[1] = a1 * c + a3 * s; + out[2] = a0 * -s + a2 * c; + out[3] = a1 * -s + a3 * c; + out[4] = a4; + out[5] = a5; + return out; + } + /** + * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + }, { + key: "scale", + value: function scale(out, a, v) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var a4 = a[4]; + var a5 = a[5]; + var v0 = v[0]; + var v1 = v[1]; + out[0] = a0 * v0; + out[1] = a1 * v0; + out[2] = a2 * v1; + out[3] = a3 * v1; + out[4] = a4; + out[5] = a5; + return out; + } + // TODO: Got to fromRotation + /** + * Creates a {@link Mat2d} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + }, { + key: "fromTranslation", + value: function fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = v[0]; + out[5] = v[1]; + return out; + } + /** + * Creates a {@link Mat2d} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "fromRotation", + value: function fromRotation(out, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = -s; + out[3] = c; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Creates a {@link Mat2d} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + }, { + key: "fromScaling", + value: function fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = v[1]; + out[4] = 0; + out[5] = 0; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat2d} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + }, { + key: "frob", + value: function frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1); + } + /** + * Multiply each element of a {@link Mat2d} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + }, { + key: "multiplyScalar", + value: function multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + return out; + } + /** + * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + }, { + key: "multiplyScalarAndAdd", + value: function multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + return out; + } + /** + * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + }, { + key: "exactEquals", + value: function exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5]; + } + /** + * Returns whether two {@link Mat2d}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + }, { + key: "equals", + value: function equals(a, b) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var a4 = a[4]; + var a5 = a[5]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; + var b4 = b[4]; + var b5 = b[5]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)); + } + /** + * Returns a string representation of a {@link Mat2d} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + }, { + key: "str", + value: function str(a) { + return "Mat2d(".concat(a.join(", "), ")"); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float64Array)); + _IDENTITY_2X3 = new WeakMap(); + __privateAdd(_Mat2d, _IDENTITY_2X3, new Float64Array([1, 0, 0, 1, 0, 0])); + var Mat2d = _Mat2d; + Mat2d.mul = Mat2d.multiply; + Mat2d.sub = Mat2d.subtract; + + // src/_lib/f64/Mat3.ts + var _IDENTITY_3X3; + var _Mat3 = /*#__PURE__*/function (_Float64Array3) { + /** + * Create a {@link Mat3}. + * + * @category Constructor + */ + function _Mat3() { + var _this3; + _classCallCheck(this, _Mat3); + for (var _len5 = arguments.length, values = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { + values[_key5] = arguments[_key5]; + } + switch (values.length) { + case 9: + _this3 = _callSuper(this, _Mat3, [values]); + break; + case 2: + _this3 = _callSuper(this, _Mat3, [values[0], values[1], 9]); + break; + case 1: + var v = values[0]; + if (typeof v === "number") { + _this3 = _callSuper(this, _Mat3, [[v, v, v, v, v, v, v, v, v]]); + } else { + _this3 = _callSuper(this, _Mat3, [v, 0, 9]); + } + break; + default: + _this3 = _callSuper(this, _Mat3, [__privateGet(_Mat3, _IDENTITY_3X3)]); + break; + } + return _assertThisInitialized(_this3); + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat3.str(this);` + * + * @category Accessors + */ + _inherits(_Mat3, _Float64Array3); + return _createClass(_Mat3, [{ + key: "str", + get: function get() { + return _Mat3.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + }, { + key: "copy", + value: function copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat3.identity(this) + * @category Methods + * + * @returns `this` + */ + }, { + key: "identity", + value: function identity() { + this.set(__privateGet(_Mat3, _IDENTITY_3X3)); + return this; + } + /** + * Multiplies this {@link Mat3} against another one + * Equivalent to `Mat3.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + }, { + key: "multiply", + value: function multiply(b) { + return _Mat3.multiply(this, this, b); + } + /** + * Alias for {@link Mat3.multiply} + * @category Methods + */ + }, { + key: "mul", + value: function mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat3} + * Equivalent to `Mat3.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "transpose", + value: function transpose() { + return _Mat3.transpose(this, this); + } + /** + * Inverts this {@link Mat3} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "invert", + value: function invert() { + return _Mat3.invert(this, this); + } + /** + * Translate this {@link Mat3} by the given vector + * Equivalent to `Mat3.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + }, { + key: "translate", + value: function translate(v) { + return _Mat3.translate(this, this, v); + } + /** + * Rotates this {@link Mat3} by the given angle around the given axis + * Equivalent to `Mat3.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + }, { + key: "rotate", + value: function rotate(rad) { + return _Mat3.rotate(this, this, rad); + } + /** + * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat3.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + }, { + key: "scale", + value: function scale(v) { + return _Mat3.scale(this, this, v); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat3}. + */ + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 9 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat3} + * @category Static + * + * @returns A new {@link Mat3} + */ + }, { + key: "create", + value: function create() { + return new _Mat3(); + } + /** + * Creates a new {@link Mat3} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat3} + */ + }, { + key: "clone", + value: function clone(a) { + return new _Mat3(a); + } + /** + * Copy the values from one {@link Mat3} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + }, { + key: "copy", + value: function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + return out; + } + /** + * Create a new {@link Mat3} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat3} + */ + }, { + key: "fromValues", + value: function fromValues() { + for (var _len6 = arguments.length, values = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { + values[_key6] = arguments[_key6]; + } + return _construct(_Mat3, values); + } + /** + * Set the components of a {@link Mat3} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + }, { + key: "set", + value: function set(out) { + out[0] = arguments.length <= 1 ? undefined : arguments[1]; + out[1] = arguments.length <= 2 ? undefined : arguments[2]; + out[2] = arguments.length <= 3 ? undefined : arguments[3]; + out[3] = arguments.length <= 4 ? undefined : arguments[4]; + out[4] = arguments.length <= 5 ? undefined : arguments[5]; + out[5] = arguments.length <= 6 ? undefined : arguments[6]; + out[6] = arguments.length <= 7 ? undefined : arguments[7]; + out[7] = arguments.length <= 8 ? undefined : arguments[8]; + out[8] = arguments.length <= 9 ? undefined : arguments[9]; + return out; + } + /** + * Set a {@link Mat3} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + }, { + key: "identity", + value: function identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + }, { + key: "transpose", + value: function transpose(out, a) { + if (out === a) { + var a01 = a[1], + a02 = a[2], + a12 = a[5]; + out[1] = a[3]; + out[2] = a[6]; + out[3] = a01; + out[5] = a[7]; + out[6] = a02; + out[7] = a12; + } else { + out[0] = a[0]; + out[1] = a[3]; + out[2] = a[6]; + out[3] = a[1]; + out[4] = a[4]; + out[5] = a[7]; + out[6] = a[2]; + out[7] = a[5]; + out[8] = a[8]; + } + return out; + } + /** + * Inverts a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + }, { + key: "invert", + value: function invert(out, a) { + var a00 = a[0], + a01 = a[1], + a02 = a[2]; + var a10 = a[3], + a11 = a[4], + a12 = a[5]; + var a20 = a[6], + a21 = a[7], + a22 = a[8]; + var b01 = a22 * a11 - a12 * a21; + var b11 = -a22 * a10 + a12 * a20; + var b21 = a21 * a10 - a11 * a20; + var det = a00 * b01 + a01 * b11 + a02 * b21; + if (!det) { + return null; + } + det = 1 / det; + out[0] = b01 * det; + out[1] = (-a22 * a01 + a02 * a21) * det; + out[2] = (a12 * a01 - a02 * a11) * det; + out[3] = b11 * det; + out[4] = (a22 * a00 - a02 * a20) * det; + out[5] = (-a12 * a00 + a02 * a10) * det; + out[6] = b21 * det; + out[7] = (-a21 * a00 + a01 * a20) * det; + out[8] = (a11 * a00 - a01 * a10) * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + }, { + key: "adjoint", + value: function adjoint(out, a) { + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; + out[0] = a11 * a22 - a12 * a21; + out[1] = a02 * a21 - a01 * a22; + out[2] = a01 * a12 - a02 * a11; + out[3] = a12 * a20 - a10 * a22; + out[4] = a00 * a22 - a02 * a20; + out[5] = a02 * a10 - a00 * a12; + out[6] = a10 * a21 - a11 * a20; + out[7] = a01 * a20 - a00 * a21; + out[8] = a00 * a11 - a01 * a10; + return out; + } + /** + * Calculates the determinant of a {@link Mat3} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + }, { + key: "determinant", + value: function determinant(a) { + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; + return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20); + } + /** + * Adds two {@link Mat3}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "add", + value: function add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + out[8] = a[8] + b[8]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "subtract", + value: function subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + out[6] = a[6] - b[6]; + out[7] = a[7] - b[7]; + out[8] = a[8] - b[8]; + return out; + } + /** + * Alias for {@link Mat3.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sub", + value: function sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Mat3}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "multiply", + value: function multiply(out, a, b) { + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20; + out[1] = b0 * a01 + b1 * a11 + b2 * a21; + out[2] = b0 * a02 + b1 * a12 + b2 * a22; + b0 = b[3]; + b1 = b[4]; + b2 = b[5]; + out[3] = b0 * a00 + b1 * a10 + b2 * a20; + out[4] = b0 * a01 + b1 * a11 + b2 * a21; + out[5] = b0 * a02 + b1 * a12 + b2 * a22; + b0 = b[6]; + b1 = b[7]; + b2 = b[8]; + out[6] = b0 * a00 + b1 * a10 + b2 * a20; + out[7] = b0 * a01 + b1 * a11 + b2 * a21; + out[8] = b0 * a02 + b1 * a12 + b2 * a22; + return out; + } + /** + * Alias for {@link Mat3.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "mul", + value: function mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat3} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + }, { + key: "translate", + value: function translate(out, a, v) { + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; + var x = v[0]; + var y = v[1]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a10; + out[4] = a11; + out[5] = a12; + out[6] = x * a00 + y * a10 + a20; + out[7] = x * a01 + y * a11 + a21; + out[8] = x * a02 + y * a12 + a22; + return out; + } + /** + * Rotates a {@link Mat3} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "rotate", + value: function rotate(out, a, rad) { + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; + var s = Math.sin(rad); + var c = Math.cos(rad); + out[0] = c * a00 + s * a10; + out[1] = c * a01 + s * a11; + out[2] = c * a02 + s * a12; + out[3] = c * a10 - s * a00; + out[4] = c * a11 - s * a01; + out[5] = c * a12 - s * a02; + out[6] = a20; + out[7] = a21; + out[8] = a22; + return out; + } + /** + * Scales the {@link Mat3} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + }, { + key: "scale", + value: function scale(out, a, v) { + var x = v[0]; + var y = v[1]; + out[0] = x * a[0]; + out[1] = x * a[1]; + out[2] = x * a[2]; + out[3] = y * a[3]; + out[4] = y * a[4]; + out[5] = y * a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + return out; + } + /** + * Creates a {@link Mat3} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + }, { + key: "fromTranslation", + value: function fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = v[0]; + out[7] = v[1]; + out[8] = 1; + return out; + } + /** + * Creates a {@link Mat3} from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat3.identity(dest); + * mat3.rotate(dest, dest, rad); + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "fromRotation", + value: function fromRotation(out, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = 0; + out[3] = -s; + out[4] = c; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Creates a {@link Mat3} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + }, { + key: "fromScaling", + value: function fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = v[1]; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + /** + * Copies the upper-left 3x3 values of a {@link Mat2d} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 2x3 matrix + * @returns `out` + */ + }, { + key: "fromMat2d", + value: function fromMat2d(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = 0; + out[3] = a[2]; + out[4] = a[3]; + out[5] = 0; + out[6] = a[4]; + out[7] = a[5]; + out[8] = 1; + return out; + } + /** + * Calculates a {@link Mat3} from the given quaternion + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param q - {@link Quat} to create matrix from + * @returns `out` + */ + }, { + key: "fromQuat", + value: function fromQuat(out, q) { + var x = q[0]; + var y = q[1]; + var z = q[2]; + var w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var yx = y * x2; + var yy = y * y2; + var zx = z * x2; + var zy = z * y2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + out[0] = 1 - yy - zz; + out[3] = yx - wz; + out[6] = zx + wy; + out[1] = yx + wz; + out[4] = 1 - xx - zz; + out[7] = zy - wx; + out[2] = zx - wy; + out[5] = zy + wx; + out[8] = 1 - xx - yy; + return out; + } + /** + * Copies the upper-left 3x3 values of a {@link Mat4} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 4x4 matrix + * @returns `out` + */ + }, { + key: "fromMat4", + value: function fromMat4(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[4]; + out[4] = a[5]; + out[5] = a[6]; + out[6] = a[8]; + out[7] = a[9]; + out[8] = a[10]; + return out; + } + /** + * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix + * @category Static + * + * @param {mat3} out mat3 receiving operation result + * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + }, { + key: "normalFromMat4", + value: function normalFromMat4(out, a) { + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; + var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + return out; + } + /** + * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + }, { + key: "normalFromMat4Fast", + value: function normalFromMat4Fast(out, a) { + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + var bx = a[4]; + var by = a[5]; + var bz = a[6]; + var cx = a[8]; + var cy = a[9]; + var cz = a[10]; + out[0] = by * cz - cz * cy; + out[1] = bz * cx - cx * cz; + out[2] = bx * cy - cy * cx; + out[3] = cy * az - cz * ay; + out[4] = cz * ax - cx * az; + out[5] = cx * ay - cy * ax; + out[6] = ay * bz - az * by; + out[7] = az * bx - ax * bz; + out[8] = ax * by - ay * bx; + return out; + } + /** + * Generates a 2D projection matrix with the given bounds + * @category Static + * + * @param out mat3 frustum matrix will be written into + * @param width Width of your gl context + * @param height Height of gl context + * @returns `out` + */ + }, { + key: "projection", + value: function projection(out, width, height) { + out[0] = 2 / width; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = -2 / height; + out[5] = 0; + out[6] = -1; + out[7] = 1; + out[8] = 1; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat3} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + }, { + key: "frob", + value: function frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8]); + } + /** + * Multiply each element of a {@link Mat3} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + }, { + key: "multiplyScalar", + value: function multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + out[8] = a[8] * b; + return out; + } + /** + * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + }, { + key: "multiplyScalarAndAdd", + value: function multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + out[6] = a[6] + b[6] * scale; + out[7] = a[7] + b[7] * scale; + out[8] = a[8] + b[8] * scale; + return out; + } + /** + * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + }, { + key: "exactEquals", + value: function exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8]; + } + /** + * Returns whether two {@link Mat3}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + }, { + key: "equals", + value: function equals(a, b) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var a4 = a[4]; + var a5 = a[5]; + var a6 = a[6]; + var a7 = a[7]; + var a8 = a[8]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; + var b4 = b[4]; + var b5 = b[5]; + var b6 = b[6]; + var b7 = b[7]; + var b8 = b[8]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)); + } + /** + * Returns a string representation of a {@link Mat3} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + }, { + key: "str", + value: function str(a) { + return "Mat3(".concat(a.join(", "), ")"); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float64Array)); + _IDENTITY_3X3 = new WeakMap(); + __privateAdd(_Mat3, _IDENTITY_3X3, new Float64Array([1, 0, 0, 0, 1, 0, 0, 0, 1])); + var Mat3 = _Mat3; + Mat3.prototype.mul = Mat3.prototype.multiply; + Mat3.mul = Mat3.multiply; + Mat3.sub = Mat3.subtract; + + // src/_lib/f64/Mat4.ts + var _IDENTITY_4X4, _TMP_VEC3; + var _Mat4 = /*#__PURE__*/function (_Float64Array4) { + /** + * Create a {@link Mat4}. + * + * @category Constructor + */ + function _Mat4() { + var _this4; + _classCallCheck(this, _Mat4); + for (var _len7 = arguments.length, values = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { + values[_key7] = arguments[_key7]; + } + switch (values.length) { + case 16: + _this4 = _callSuper(this, _Mat4, [values]); + break; + case 2: + _this4 = _callSuper(this, _Mat4, [values[0], values[1], 16]); + break; + case 1: + var v = values[0]; + if (typeof v === "number") { + _this4 = _callSuper(this, _Mat4, [[v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v]]); + } else { + _this4 = _callSuper(this, _Mat4, [v, 0, 16]); + } + break; + default: + _this4 = _callSuper(this, _Mat4, [__privateGet(_Mat4, _IDENTITY_4X4)]); + break; + } + return _assertThisInitialized(_this4); + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Mat4.str(this);` + * + * @category Accessors + */ + _inherits(_Mat4, _Float64Array4); + return _createClass(_Mat4, [{ + key: "str", + get: function get() { + return _Mat4.str(this); + } + // =================== + // Instance methods + // =================== + /** + * Copy the values from another {@link Mat4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + }, { + key: "copy", + value: function copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat4.identity(this) + * @category Methods + * + * @returns `this` + */ + }, { + key: "identity", + value: function identity() { + this.set(__privateGet(_Mat4, _IDENTITY_4X4)); + return this; + } + /** + * Multiplies this {@link Mat4} against another one + * Equivalent to `Mat4.multiply(this, this, b);` + * @category Methods + * + * @param b - The second operand + * @returns `this` + */ + }, { + key: "multiply", + value: function multiply(b) { + return _Mat4.multiply(this, this, b); + } + /** + * Alias for {@link Mat4.multiply} + * @category Methods + */ + }, { + key: "mul", + value: function mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Transpose this {@link Mat4} + * Equivalent to `Mat4.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "transpose", + value: function transpose() { + return _Mat4.transpose(this, this); + } + /** + * Inverts this {@link Mat4} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "invert", + value: function invert() { + return _Mat4.invert(this, this); + } + /** + * Translate this {@link Mat4} by the given vector + * Equivalent to `Mat4.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to translate by + * @returns `this` + */ + }, { + key: "translate", + value: function translate(v) { + return _Mat4.translate(this, this, v); + } + /** + * Rotates this {@link Mat4} by the given angle around the given axis + * Equivalent to `Mat4.rotate(this, this, rad, axis);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `this` + */ + }, { + key: "rotate", + value: function rotate(rad, axis) { + return _Mat4.rotate(this, this, rad, axis); + } + /** + * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat4.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to scale the matrix by + * @returns `this` + */ + }, { + key: "scale", + value: function scale(v) { + return _Mat4.scale(this, this, v); + } + /** + * Rotates this {@link Mat4} by the given angle around the X axis + * Equivalent to `Mat4.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + }, { + key: "rotateX", + value: function rotateX(rad) { + return _Mat4.rotateX(this, this, rad); + } + /** + * Rotates this {@link Mat4} by the given angle around the Y axis + * Equivalent to `Mat4.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + }, { + key: "rotateY", + value: function rotateY(rad) { + return _Mat4.rotateY(this, this, rad); + } + /** + * Rotates this {@link Mat4} by the given angle around the Z axis + * Equivalent to `Mat4.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + }, { + key: "rotateZ", + value: function rotateZ(rad) { + return _Mat4.rotateZ(this, this, rad); + } + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + }, { + key: "perspectiveNO", + value: function perspectiveNO(fovy, aspect, near, far) { + return _Mat4.perspectiveNO(this, fovy, aspect, near, far); + } + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + }, { + key: "perspectiveZO", + value: function perspectiveZO(fovy, aspect, near, far) { + return _Mat4.perspectiveZO(this, fovy, aspect, near, far); + } + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + }, { + key: "orthoNO", + value: function orthoNO(left, right, bottom, top, near, far) { + return _Mat4.orthoNO(this, left, right, bottom, top, near, far); + } + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + }, { + key: "orthoZO", + value: function orthoZO(left, right, bottom, top, near, far) { + return _Mat4.orthoZO(this, left, right, bottom, top, near, far); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat4}. + */ + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 16 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, identity {@link Mat4} + * @category Static + * + * @returns A new {@link Mat4} + */ + }, { + key: "create", + value: function create() { + return new _Mat4(); + } + /** + * Creates a new {@link Mat4} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat4} + */ + }, { + key: "clone", + value: function clone(a) { + return new _Mat4(a); + } + /** + * Copy the values from one {@link Mat4} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + }, { + key: "copy", + value: function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + /** + * Create a new mat4 with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat4} + */ + }, { + key: "fromValues", + value: function fromValues() { + for (var _len8 = arguments.length, values = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) { + values[_key8] = arguments[_key8]; + } + return _construct(_Mat4, values); + } + /** + * Set the components of a mat4 to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + }, { + key: "set", + value: function set(out) { + out[0] = arguments.length <= 1 ? undefined : arguments[1]; + out[1] = arguments.length <= 2 ? undefined : arguments[2]; + out[2] = arguments.length <= 3 ? undefined : arguments[3]; + out[3] = arguments.length <= 4 ? undefined : arguments[4]; + out[4] = arguments.length <= 5 ? undefined : arguments[5]; + out[5] = arguments.length <= 6 ? undefined : arguments[6]; + out[6] = arguments.length <= 7 ? undefined : arguments[7]; + out[7] = arguments.length <= 8 ? undefined : arguments[8]; + out[8] = arguments.length <= 9 ? undefined : arguments[9]; + out[9] = arguments.length <= 10 ? undefined : arguments[10]; + out[10] = arguments.length <= 11 ? undefined : arguments[11]; + out[11] = arguments.length <= 12 ? undefined : arguments[12]; + out[12] = arguments.length <= 13 ? undefined : arguments[13]; + out[13] = arguments.length <= 14 ? undefined : arguments[14]; + out[14] = arguments.length <= 15 ? undefined : arguments[15]; + out[15] = arguments.length <= 16 ? undefined : arguments[16]; + return out; + } + /** + * Set a {@link Mat4} to the identity matrix + * @category Static + * + * @param out - The receiving Matrix + * @returns `out` + */ + }, { + key: "identity", + value: function identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + }, { + key: "transpose", + value: function transpose(out, a) { + if (out === a) { + var a01 = a[1], + a02 = a[2], + a03 = a[3]; + var a12 = a[6], + a13 = a[7]; + var a23 = a[11]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a01; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a02; + out[9] = a12; + out[11] = a[14]; + out[12] = a03; + out[13] = a13; + out[14] = a23; + } else { + out[0] = a[0]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a[1]; + out[5] = a[5]; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a[2]; + out[9] = a[6]; + out[10] = a[10]; + out[11] = a[14]; + out[12] = a[3]; + out[13] = a[7]; + out[14] = a[11]; + out[15] = a[15]; + } + return out; + } + /** + * Inverts a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + }, { + key: "invert", + value: function invert(out, a) { + var a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3]; + var a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7]; + var a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + var a30 = a[12], + a31 = a[13], + a32 = a[14], + a33 = a[15]; + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; + var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + }, { + key: "adjoint", + value: function adjoint(out, a) { + var a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3]; + var a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7]; + var a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + var a30 = a[12], + a31 = a[13], + a32 = a[14], + a33 = a[15]; + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; + out[0] = a11 * b11 - a12 * b10 + a13 * b09; + out[1] = a02 * b10 - a01 * b11 - a03 * b09; + out[2] = a31 * b05 - a32 * b04 + a33 * b03; + out[3] = a22 * b04 - a21 * b05 - a23 * b03; + out[4] = a12 * b08 - a10 * b11 - a13 * b07; + out[5] = a00 * b11 - a02 * b08 + a03 * b07; + out[6] = a32 * b02 - a30 * b05 - a33 * b01; + out[7] = a20 * b05 - a22 * b02 + a23 * b01; + out[8] = a10 * b10 - a11 * b08 + a13 * b06; + out[9] = a01 * b08 - a00 * b10 - a03 * b06; + out[10] = a30 * b04 - a31 * b02 + a33 * b00; + out[11] = a21 * b02 - a20 * b04 - a23 * b00; + out[12] = a11 * b07 - a10 * b09 - a12 * b06; + out[13] = a00 * b09 - a01 * b07 + a02 * b06; + out[14] = a31 * b01 - a30 * b03 - a32 * b00; + out[15] = a20 * b03 - a21 * b01 + a22 * b00; + return out; + } + /** + * Calculates the determinant of a {@link Mat4} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + }, { + key: "determinant", + value: function determinant(a) { + var a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3]; + var a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7]; + var a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + var a30 = a[12], + a31 = a[13], + a32 = a[14], + a33 = a[15]; + var b0 = a00 * a11 - a01 * a10; + var b1 = a00 * a12 - a02 * a10; + var b2 = a01 * a12 - a02 * a11; + var b3 = a20 * a31 - a21 * a30; + var b4 = a20 * a32 - a22 * a30; + var b5 = a21 * a32 - a22 * a31; + var b6 = a00 * b5 - a01 * b4 + a02 * b3; + var b7 = a10 * b5 - a11 * b4 + a12 * b3; + var b8 = a20 * b2 - a21 * b1 + a22 * b0; + var b9 = a30 * b2 - a31 * b1 + a32 * b0; + return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9; + } + /** + * Multiplies two {@link Mat4}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "multiply", + value: function multiply(out, a, b) { + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[4]; + b1 = b[5]; + b2 = b[6]; + b3 = b[7]; + out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[8]; + b1 = b[9]; + b2 = b[10]; + b3 = b[11]; + out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[12]; + b1 = b[13]; + b2 = b[14]; + b3 = b[15]; + out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + return out; + } + /** + * Alias for {@link Mat4.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "mul", + value: function mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat4} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + }, { + key: "translate", + value: function translate(out, a, v) { + var x = v[0]; + var y = v[1]; + var z = v[2]; + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a03; + out[4] = a10; + out[5] = a11; + out[6] = a12; + out[7] = a13; + out[8] = a20; + out[9] = a21; + out[10] = a22; + out[11] = a23; + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + return out; + } + /** + * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec3} to scale the matrix by + * @returns `out` + **/ + }, { + key: "scale", + value: function scale(out, a, v) { + var x = v[0]; + var y = v[1]; + var z = v[2]; + out[0] = a[0] * x; + out[1] = a[1] * x; + out[2] = a[2] * x; + out[3] = a[3] * x; + out[4] = a[4] * y; + out[5] = a[5] * y; + out[6] = a[6] * y; + out[7] = a[7] * y; + out[8] = a[8] * z; + out[9] = a[9] * z; + out[10] = a[10] * z; + out[11] = a[11] * z; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + /** + * Rotates a {@link Mat4} by the given angle around the given axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if axis has a length of 0 + */ + }, { + key: "rotate", + value: function rotate(out, a, rad, axis) { + var x = axis[0]; + var y = axis[1]; + var z = axis[2]; + var len = Math.sqrt(x * x + y * y + z * z); + if (len < GLM_EPSILON) { + return null; + } + len = 1 / len; + x *= len; + y *= len; + z *= len; + var s = Math.sin(rad); + var c = Math.cos(rad); + var t = 1 - c; + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + var b00 = x * x * t + c; + var b01 = y * x * t + z * s; + var b02 = z * x * t - y * s; + var b10 = x * y * t - z * s; + var b11 = y * y * t + c; + var b12 = z * y * t + x * s; + var b20 = x * z * t + y * s; + var b21 = y * z * t - x * s; + var b22 = z * z * t + c; + out[0] = a00 * b00 + a10 * b01 + a20 * b02; + out[1] = a01 * b00 + a11 * b01 + a21 * b02; + out[2] = a02 * b00 + a12 * b01 + a22 * b02; + out[3] = a03 * b00 + a13 * b01 + a23 * b02; + out[4] = a00 * b10 + a10 * b11 + a20 * b12; + out[5] = a01 * b10 + a11 * b11 + a21 * b12; + out[6] = a02 * b10 + a12 * b11 + a22 * b12; + out[7] = a03 * b10 + a13 * b11 + a23 * b12; + out[8] = a00 * b20 + a10 * b21 + a20 * b22; + out[9] = a01 * b20 + a11 * b21 + a21 * b22; + out[10] = a02 * b20 + a12 * b21 + a22 * b22; + out[11] = a03 * b20 + a13 * b21 + a23 * b22; + if (a !== out) { + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + return out; + } + /** + * Rotates a matrix by the given angle around the X axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "rotateX", + value: function rotateX(out, a, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + if (a !== out) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[4] = a10 * c + a20 * s; + out[5] = a11 * c + a21 * s; + out[6] = a12 * c + a22 * s; + out[7] = a13 * c + a23 * s; + out[8] = a20 * c - a10 * s; + out[9] = a21 * c - a11 * s; + out[10] = a22 * c - a12 * s; + out[11] = a23 * c - a13 * s; + return out; + } + /** + * Rotates a matrix by the given angle around the Y axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "rotateY", + value: function rotateY(out, a, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + if (a !== out) { + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[0] = a00 * c - a20 * s; + out[1] = a01 * c - a21 * s; + out[2] = a02 * c - a22 * s; + out[3] = a03 * c - a23 * s; + out[8] = a00 * s + a20 * c; + out[9] = a01 * s + a21 * c; + out[10] = a02 * s + a22 * c; + out[11] = a03 * s + a23 * c; + return out; + } + /** + * Rotates a matrix by the given angle around the Z axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "rotateZ", + value: function rotateZ(out, a, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + if (a !== out) { + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[0] = a00 * c + a10 * s; + out[1] = a01 * c + a11 * s; + out[2] = a02 * c + a12 * s; + out[3] = a03 * c + a13 * s; + out[4] = a10 * c - a00 * s; + out[5] = a11 * c - a01 * s; + out[6] = a12 * c - a02 * s; + out[7] = a13 * c - a03 * s; + return out; + } + /** + * Creates a {@link Mat4} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + }, { + key: "fromTranslation", + value: function fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Creates a {@link Mat4} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + }, { + key: "fromScaling", + value: function fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = v[1]; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = v[2]; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a {@link Mat4} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotate(dest, dest, rad, axis); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if `axis` has a length of 0 + */ + }, { + key: "fromRotation", + value: function fromRotation(out, rad, axis) { + var x = axis[0]; + var y = axis[1]; + var z = axis[2]; + var len = Math.sqrt(x * x + y * y + z * z); + if (len < GLM_EPSILON) { + return null; + } + len = 1 / len; + x *= len; + y *= len; + z *= len; + var s = Math.sin(rad); + var c = Math.cos(rad); + var t = 1 - c; + out[0] = x * x * t + c; + out[1] = y * x * t + z * s; + out[2] = z * x * t - y * s; + out[3] = 0; + out[4] = x * y * t - z * s; + out[5] = y * y * t + c; + out[6] = z * y * t + x * s; + out[7] = 0; + out[8] = x * z * t + y * s; + out[9] = y * z * t - x * s; + out[10] = z * z * t + c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateX(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "fromXRotation", + value: function fromXRotation(out, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = c; + out[6] = s; + out[7] = 0; + out[8] = 0; + out[9] = -s; + out[10] = c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateY(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "fromYRotation", + value: function fromYRotation(out, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + out[0] = c; + out[1] = 0; + out[2] = -s; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = s; + out[9] = 0; + out[10] = c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateZ(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + }, { + key: "fromZRotation", + value: function fromZRotation(out, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = 0; + out[3] = 0; + out[4] = -s; + out[5] = c; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @returns `out` + */ + }, { + key: "fromRotationTranslation", + value: function fromRotationTranslation(out, q, v) { + var x = q[0]; + var y = q[1]; + var z = q[2]; + var w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Sets a {@link Mat4} from a {@link Quat2}. + * @category Static + * + * @param out - Matrix + * @param a - Dual Quaternion + * @returns `out` + */ + }, { + key: "fromQuat2", + value: function fromQuat2(out, a) { + var bx = -a[0]; + var by = -a[1]; + var bz = -a[2]; + var bw = a[3]; + var ax = a[4]; + var ay = a[5]; + var az = a[6]; + var aw = a[7]; + var magnitude = bx * bx + by * by + bz * bz + bw * bw; + if (magnitude > 0) { + __privateGet(_Mat4, _TMP_VEC3)[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude; + __privateGet(_Mat4, _TMP_VEC3)[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude; + __privateGet(_Mat4, _TMP_VEC3)[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude; + } else { + __privateGet(_Mat4, _TMP_VEC3)[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; + __privateGet(_Mat4, _TMP_VEC3)[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; + __privateGet(_Mat4, _TMP_VEC3)[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + } + _Mat4.fromRotationTranslation(out, a, __privateGet(_Mat4, _TMP_VEC3)); + return out; + } + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + }, { + key: "normalFromMat4", + value: function normalFromMat4(out, a) { + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; + var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[3] = 0; + out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[7] = 0; + out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + }, { + key: "normalFromMat4Fast", + value: function normalFromMat4Fast(out, a) { + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + var bx = a[4]; + var by = a[5]; + var bz = a[6]; + var cx = a[8]; + var cy = a[9]; + var cz = a[10]; + out[0] = by * cz - cz * cy; + out[1] = bz * cx - cx * cz; + out[2] = bx * cy - cy * cx; + out[3] = 0; + out[4] = cy * az - cz * ay; + out[5] = cz * ax - cx * az; + out[6] = cx * ay - cy * ax; + out[7] = 0; + out[8] = ay * bz - az * by; + out[9] = az * bx - ax * bz; + out[10] = ax * by - ay * bx; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Returns the translation vector component of a transformation + * matrix. If a matrix is built with fromRotationTranslation, + * the returned vector will be the same as the translation vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive translation component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + }, { + key: "getTranslation", + value: function getTranslation(out, mat) { + out[0] = mat[12]; + out[1] = mat[13]; + out[2] = mat[14]; + return out; + } + /** + * Returns the scaling factor component of a transformation + * matrix. If a matrix is built with fromRotationTranslationScale + * with a normalized Quaternion parameter, the returned vector will be + * the same as the scaling vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive scaling factor component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + }, { + key: "getScaling", + value: function getScaling(out, mat) { + var m11 = mat[0]; + var m12 = mat[1]; + var m13 = mat[2]; + var m21 = mat[4]; + var m22 = mat[5]; + var m23 = mat[6]; + var m31 = mat[8]; + var m32 = mat[9]; + var m33 = mat[10]; + out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + return out; + } + /** + * Returns a quaternion representing the rotational component + * of a transformation matrix. If a matrix is built with + * fromRotationTranslation, the returned quaternion will be the + * same as the quaternion originally supplied. + * @category Static + * + * @param out - Quaternion to receive the rotation component + * @param mat - Matrix to be decomposed (input) + * @return `out` + */ + }, { + key: "getRotation", + value: function getRotation(out, mat) { + _Mat4.getScaling(__privateGet(_Mat4, _TMP_VEC3), mat); + var is1 = 1 / __privateGet(_Mat4, _TMP_VEC3)[0]; + var is2 = 1 / __privateGet(_Mat4, _TMP_VEC3)[1]; + var is3 = 1 / __privateGet(_Mat4, _TMP_VEC3)[2]; + var sm11 = mat[0] * is1; + var sm12 = mat[1] * is2; + var sm13 = mat[2] * is3; + var sm21 = mat[4] * is1; + var sm22 = mat[5] * is2; + var sm23 = mat[6] * is3; + var sm31 = mat[8] * is1; + var sm32 = mat[9] * is2; + var sm33 = mat[10] * is3; + var trace = sm11 + sm22 + sm33; + var S = 0; + if (trace > 0) { + S = Math.sqrt(trace + 1) * 2; + out[3] = 0.25 * S; + out[0] = (sm23 - sm32) / S; + out[1] = (sm31 - sm13) / S; + out[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2; + out[3] = (sm23 - sm32) / S; + out[0] = 0.25 * S; + out[1] = (sm12 + sm21) / S; + out[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2; + out[3] = (sm31 - sm13) / S; + out[0] = (sm12 + sm21) / S; + out[1] = 0.25 * S; + out[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2; + out[3] = (sm12 - sm21) / S; + out[0] = (sm31 + sm13) / S; + out[1] = (sm23 + sm32) / S; + out[2] = 0.25 * S; + } + return out; + } + /** + * Decomposes a transformation matrix into its rotation, translation + * and scale components. Returns only the rotation component + * @category Static + * + * @param out_r - Quaternion to receive the rotation component + * @param out_t - Vector to receive the translation vector + * @param out_s - Vector to receive the scaling factor + * @param mat - Matrix to be decomposed (input) + * @returns `out_r` + */ + }, { + key: "decompose", + value: function decompose(out_r, out_t, out_s, mat) { + out_t[0] = mat[12]; + out_t[1] = mat[13]; + out_t[2] = mat[14]; + var m11 = mat[0]; + var m12 = mat[1]; + var m13 = mat[2]; + var m21 = mat[4]; + var m22 = mat[5]; + var m23 = mat[6]; + var m31 = mat[8]; + var m32 = mat[9]; + var m33 = mat[10]; + out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + var is1 = 1 / out_s[0]; + var is2 = 1 / out_s[1]; + var is3 = 1 / out_s[2]; + var sm11 = m11 * is1; + var sm12 = m12 * is2; + var sm13 = m13 * is3; + var sm21 = m21 * is1; + var sm22 = m22 * is2; + var sm23 = m23 * is3; + var sm31 = m31 * is1; + var sm32 = m32 * is2; + var sm33 = m33 * is3; + var trace = sm11 + sm22 + sm33; + var S = 0; + if (trace > 0) { + S = Math.sqrt(trace + 1) * 2; + out_r[3] = 0.25 * S; + out_r[0] = (sm23 - sm32) / S; + out_r[1] = (sm31 - sm13) / S; + out_r[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2; + out_r[3] = (sm23 - sm32) / S; + out_r[0] = 0.25 * S; + out_r[1] = (sm12 + sm21) / S; + out_r[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2; + out_r[3] = (sm31 - sm13) / S; + out_r[0] = (sm12 + sm21) / S; + out_r[1] = 0.25 * S; + out_r[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2; + out_r[3] = (sm12 - sm21) / S; + out_r[0] = (sm31 + sm13) / S; + out_r[1] = (sm23 + sm32) / S; + out_r[2] = 0.25 * S; + } + return out_r; + } + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @returns `out` + */ + }, { + key: "fromRotationTranslationScale", + value: function fromRotationTranslationScale(out, q, v, s) { + var x = q[0]; + var y = q[1]; + var z = q[2]; + var w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + var sx = s[0]; + var sy = s[1]; + var sz = s[2]; + out[0] = (1 - (yy + zz)) * sx; + out[1] = (xy + wz) * sx; + out[2] = (xz - wy) * sx; + out[3] = 0; + out[4] = (xy - wz) * sy; + out[5] = (1 - (xx + zz)) * sy; + out[6] = (yz + wx) * sy; + out[7] = 0; + out[8] = (xz + wy) * sz; + out[9] = (yz - wx) * sz; + out[10] = (1 - (xx + yy)) * sz; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the + * given origin. This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * mat4.translate(dest, origin); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * mat4.translate(dest, negativeOrigin); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @param o - The origin vector around which to scale and rotate + * @returns `out` + */ + }, { + key: "fromRotationTranslationScaleOrigin", + value: function fromRotationTranslationScaleOrigin(out, q, v, s, o) { + var x = q[0]; + var y = q[1]; + var z = q[2]; + var w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + var sx = s[0]; + var sy = s[1]; + var sz = s[2]; + var ox = o[0]; + var oy = o[1]; + var oz = o[2]; + var out0 = (1 - (yy + zz)) * sx; + var out1 = (xy + wz) * sx; + var out2 = (xz - wy) * sx; + var out4 = (xy - wz) * sy; + var out5 = (1 - (xx + zz)) * sy; + var out6 = (yz + wx) * sy; + var out8 = (xz + wy) * sz; + var out9 = (yz - wx) * sz; + var out10 = (1 - (xx + yy)) * sz; + out[0] = out0; + out[1] = out1; + out[2] = out2; + out[3] = 0; + out[4] = out4; + out[5] = out5; + out[6] = out6; + out[7] = 0; + out[8] = out8; + out[9] = out9; + out[10] = out10; + out[11] = 0; + out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz); + out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz); + out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); + out[15] = 1; + return out; + } + /** + * Calculates a 4x4 matrix from the given quaternion + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Quaternion to create matrix from + * @returns `out` + */ + }, { + key: "fromQuat", + value: function fromQuat(out, q) { + var x = q[0]; + var y = q[1]; + var z = q[2]; + var w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var yx = y * x2; + var yy = y * y2; + var zx = z * x2; + var zy = z * y2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + out[0] = 1 - yy - zz; + out[1] = yx + wz; + out[2] = zx - wy; + out[3] = 0; + out[4] = yx - wz; + out[5] = 1 - xx - zz; + out[6] = zy + wx; + out[7] = 0; + out[8] = zx + wy; + out[9] = zy - wx; + out[10] = 1 - xx - yy; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + }, { + key: "frustumNO", + value: function frustumNO(out, left, right, bottom, top, near) { + var far = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : Infinity; + var rl = 1 / (right - left); + var tb = 1 / (top - bottom); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + var nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + /** + * Alias for {@link Mat4.frustumNO} + * @category Static + * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly + */ + }, { + key: "frustum", + value: function frustum(out, left, right, bottom, top, near) { + return out; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + }, { + key: "frustumZO", + value: function frustumZO(out, left, right, bottom, top, near) { + var far = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : Infinity; + var rl = 1 / (right - left); + var tb = 1 / (top - bottom); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + var nf = 1 / (near - far); + out[10] = far * nf; + out[14] = far * near * nf; + } else { + out[10] = -1; + out[14] = -near; + } + return out; + } + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + }, { + key: "perspectiveNO", + value: function perspectiveNO(out, fovy, aspect, near) { + var far = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : Infinity; + var f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + var nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + /** + * Alias for {@link Mat4.perspectiveNO} + * @category Static + * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "perspective", + value: function perspective(out, fovy, aspect, near) { + return out; + } + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + }, { + key: "perspectiveZO", + value: function perspectiveZO(out, fovy, aspect, near) { + var far = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : Infinity; + var f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + var nf = 1 / (near - far); + out[10] = far * nf; + out[14] = far * near * nf; + } else { + out[10] = -1; + out[14] = -near; + } + return out; + } + /** + * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating + * projection matrices to be used with the still experimental WebVR API. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + * @deprecated + */ + }, { + key: "perspectiveFromFieldOfView", + value: function perspectiveFromFieldOfView(out, fov, near, far) { + var upTan = Math.tan(fov.upDegrees * Math.PI / 180); + var downTan = Math.tan(fov.downDegrees * Math.PI / 180); + var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180); + var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180); + var xScale = 2 / (leftTan + rightTan); + var yScale = 2 / (upTan + downTan); + out[0] = xScale; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = yScale; + out[6] = 0; + out[7] = 0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = (upTan - downTan) * yScale * 0.5; + out[10] = far / (near - far); + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = far * near / (near - far); + out[15] = 0; + return out; + } + /** + * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + }, { + key: "orthoNO", + value: function orthoNO(out, left, right, bottom, top, near, far) { + var lr = 1 / (left - right); + var bt = 1 / (bottom - top); + var nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; + } + /** + * Alias for {@link Mat4.orthoNO} + * @category Static + * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "ortho", + value: function ortho(out, left, right, bottom, top, near, far) { + return out; + } + /** + * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + }, { + key: "orthoZO", + value: function orthoZO(out, left, right, bottom, top, near, far) { + var lr = 1 / (left - right); + var bt = 1 / (bottom - top); + var nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = near * nf; + out[15] = 1; + return out; + } + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that + * actually makes an object look at another object, you should use targetTo instead. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param center - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + }, { + key: "lookAt", + value: function lookAt(out, eye, center, up) { + var eyex = eye[0]; + var eyey = eye[1]; + var eyez = eye[2]; + var upx = up[0]; + var upy = up[1]; + var upz = up[2]; + var centerx = center[0]; + var centery = center[1]; + var centerz = center[2]; + if (Math.abs(eyex - centerx) < GLM_EPSILON && Math.abs(eyey - centery) < GLM_EPSILON && Math.abs(eyez - centerz) < GLM_EPSILON) { + return _Mat4.identity(out); + } + var z0 = eyex - centerx; + var z1 = eyey - centery; + var z2 = eyez - centerz; + var len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + z0 *= len; + z1 *= len; + z2 *= len; + var x0 = upy * z2 - upz * z1; + var x1 = upz * z0 - upx * z2; + var x2 = upx * z1 - upy * z0; + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + if (!len) { + x0 = 0; + x1 = 0; + x2 = 0; + } else { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + var y0 = z1 * x2 - z2 * x1; + var y1 = z2 * x0 - z0 * x2; + var y2 = z0 * x1 - z1 * x0; + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + if (!len) { + y0 = 0; + y1 = 0; + y2 = 0; + } else { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + out[0] = x0; + out[1] = y0; + out[2] = z0; + out[3] = 0; + out[4] = x1; + out[5] = y1; + out[6] = z1; + out[7] = 0; + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); + out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); + out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + return out; + } + /** + * Generates a matrix that makes something look at something else. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param target - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + }, { + key: "targetTo", + value: function targetTo(out, eye, target, up) { + var eyex = eye[0]; + var eyey = eye[1]; + var eyez = eye[2]; + var upx = up[0]; + var upy = up[1]; + var upz = up[2]; + var z0 = eyex - target[0]; + var z1 = eyey - target[1]; + var z2 = eyez - target[2]; + var len = z0 * z0 + z1 * z1 + z2 * z2; + if (len > 0) { + len = 1 / Math.sqrt(len); + z0 *= len; + z1 *= len; + z2 *= len; + } + var x0 = upy * z2 - upz * z1; + var x1 = upz * z0 - upx * z2; + var x2 = upx * z1 - upy * z0; + len = x0 * x0 + x1 * x1 + x2 * x2; + if (len > 0) { + len = 1 / Math.sqrt(len); + x0 *= len; + x1 *= len; + x2 *= len; + } + out[0] = x0; + out[1] = x1; + out[2] = x2; + out[3] = 0; + out[4] = z1 * x2 - z2 * x1; + out[5] = z2 * x0 - z0 * x2; + out[6] = z0 * x1 - z1 * x0; + out[7] = 0; + out[8] = z0; + out[9] = z1; + out[10] = z2; + out[11] = 0; + out[12] = eyex; + out[13] = eyey; + out[14] = eyez; + out[15] = 1; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat4} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + }, { + key: "frob", + value: function frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + a[9] * a[9] + a[10] * a[10] + a[11] * a[11] + a[12] * a[12] + a[13] * a[13] + a[14] * a[14] + a[15] * a[15]); + } + /** + * Adds two {@link Mat4}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "add", + value: function add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + out[8] = a[8] + b[8]; + out[9] = a[9] + b[9]; + out[10] = a[10] + b[10]; + out[11] = a[11] + b[11]; + out[12] = a[12] + b[12]; + out[13] = a[13] + b[13]; + out[14] = a[14] + b[14]; + out[15] = a[15] + b[15]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "subtract", + value: function subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + out[6] = a[6] - b[6]; + out[7] = a[7] - b[7]; + out[8] = a[8] - b[8]; + out[9] = a[9] - b[9]; + out[10] = a[10] - b[10]; + out[11] = a[11] - b[11]; + out[12] = a[12] - b[12]; + out[13] = a[13] - b[13]; + out[14] = a[14] - b[14]; + out[15] = a[15] - b[15]; + return out; + } + /** + * Alias for {@link Mat4.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sub", + value: function sub(out, a, b) { + return out; + } + /** + * Multiply each element of the matrix by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + }, { + key: "multiplyScalar", + value: function multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + out[8] = a[8] * b; + out[9] = a[9] * b; + out[10] = a[10] * b; + out[11] = a[11] * b; + out[12] = a[12] * b; + out[13] = a[13] * b; + out[14] = a[14] * b; + out[15] = a[15] * b; + return out; + } + /** + * Adds two mat4's after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + }, { + key: "multiplyScalarAndAdd", + value: function multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + out[6] = a[6] + b[6] * scale; + out[7] = a[7] + b[7] * scale; + out[8] = a[8] + b[8] * scale; + out[9] = a[9] + b[9] * scale; + out[10] = a[10] + b[10] * scale; + out[11] = a[11] + b[11] * scale; + out[12] = a[12] + b[12] * scale; + out[13] = a[13] + b[13] * scale; + out[14] = a[14] + b[14] * scale; + out[15] = a[15] + b[15] * scale; + return out; + } + /** + * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + }, { + key: "exactEquals", + value: function exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15]; + } + /** + * Returns whether two {@link Mat4}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + }, { + key: "equals", + value: function equals(a, b) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var a4 = a[4]; + var a5 = a[5]; + var a6 = a[6]; + var a7 = a[7]; + var a8 = a[8]; + var a9 = a[9]; + var a10 = a[10]; + var a11 = a[11]; + var a12 = a[12]; + var a13 = a[13]; + var a14 = a[14]; + var a15 = a[15]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; + var b4 = b[4]; + var b5 = b[5]; + var b6 = b[6]; + var b7 = b[7]; + var b8 = b[8]; + var b9 = b[9]; + var b10 = b[10]; + var b11 = b[11]; + var b12 = b[12]; + var b13 = b[13]; + var b14 = b[14]; + var b15 = b[15]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15)); + } + /** + * Returns a string representation of a {@link Mat4} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + }, { + key: "str", + value: function str(a) { + return "Mat4(".concat(a.join(", "), ")"); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float64Array)); + _IDENTITY_4X4 = new WeakMap(); + _TMP_VEC3 = new WeakMap(); + __privateAdd(_Mat4, _IDENTITY_4X4, new Float64Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])); + /** + * Temporary variable to prevent repeated allocations in the algorithms within Mat4. + * These are declared as TypedArrays to aid in tree-shaking. + */ + __privateAdd(_Mat4, _TMP_VEC3, new Float64Array(3)); + var Mat4 = _Mat4; + Mat4.prototype.mul = Mat4.prototype.multiply; + Mat4.sub = Mat4.subtract; + Mat4.mul = Mat4.multiply; + Mat4.frustum = Mat4.frustumNO; + Mat4.perspective = Mat4.perspectiveNO; + Mat4.ortho = Mat4.orthoNO; + + // src/_lib/f64/Vec3.ts + var Vec3 = /*#__PURE__*/function (_Float64Array5) { + /** + * Create a {@link Vec3}. + * + * @category Constructor + */ + function _Vec3() { + var _this5; + _classCallCheck(this, _Vec3); + for (var _len9 = arguments.length, values = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) { + values[_key9] = arguments[_key9]; + } + switch (values.length) { + case 3: + _this5 = _callSuper(this, _Vec3, [values]); + break; + case 2: + _this5 = _callSuper(this, _Vec3, [values[0], values[1], 3]); + break; + case 1: + { + var v = values[0]; + if (typeof v === "number") { + _this5 = _callSuper(this, _Vec3, [[v, v, v]]); + } else { + _this5 = _callSuper(this, _Vec3, [v, 0, 3]); + } + break; + } + default: + _this5 = _callSuper(this, _Vec3, [3]); + break; + } + return _assertThisInitialized(_this5); + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + _inherits(_Vec3, _Float64Array5); + return _createClass(_Vec3, [{ + key: "x", + get: function get() { + return this[0]; + }, + set: function set(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + }, { + key: "y", + get: function get() { + return this[1]; + }, + set: function set(value) { + this[1] = value; + } + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + }, { + key: "z", + get: function get() { + return this[2]; + }, + set: function set(value) { + this[2] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + }, { + key: "r", + get: function get() { + return this[0]; + }, + set: function set(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + }, { + key: "g", + get: function get() { + return this[1]; + }, + set: function set(value) { + this[1] = value; + } + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + }, { + key: "b", + get: function get() { + return this[2]; + }, + set: function set(value) { + this[2] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec3.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + }, { + key: "magnitude", + get: function get() { + var x = this[0]; + var y = this[1]; + var z = this[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.magnitude} + * + * @category Accessors + */ + }, { + key: "mag", + get: function get() { + return this.magnitude; + } + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec3.squaredMagnitude(this);` + * + * @category Accessors + */ + }, { + key: "squaredMagnitude", + get: function get() { + var x = this[0]; + var y = this[1]; + var z = this[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredMagnitude} + * + * @category Accessors + */ + }, { + key: "sqrMag", + get: function get() { + return this.squaredMagnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec3.str(this);` + * + * @category Accessors + */ + }, { + key: "str", + get: function get() { + return _Vec3.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + }, { + key: "copy", + value: function copy(a) { + this.set(a); + return this; + } + /** + * Adds a {@link Vec3} to `this`. + * Equivalent to `Vec3.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + }, { + key: "add", + value: function add(b) { + this[0] += b[0]; + this[1] += b[1]; + this[2] += b[2]; + return this; + } + /** + * Subtracts a {@link Vec3} from `this`. + * Equivalent to `Vec3.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + }, { + key: "subtract", + value: function subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + this[2] -= b[2]; + return this; + } + /** + * Alias for {@link Vec3.subtract} + * @category Methods + */ + }, { + key: "sub", + value: function sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec3}. + * Equivalent to `Vec3.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + }, { + key: "multiply", + value: function multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + this[2] *= b[2]; + return this; + } + /** + * Alias for {@link Vec3.multiply} + * @category Methods + */ + }, { + key: "mul", + value: function mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec3}. + * Equivalent to `Vec3.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + }, { + key: "divide", + value: function divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + this[2] /= b[2]; + return this; + } + /** + * Alias for {@link Vec3.divide} + * @category Methods + */ + }, { + key: "div", + value: function div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec3.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + }, { + key: "scale", + value: function scale(b) { + this[0] *= b; + this[1] *= b; + this[2] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + this[2] += b[2] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + }, { + key: "distance", + value: function distance(b) { + return _Vec3.distance(this, b); + } + /** + * Alias for {@link Vec3.distance} + * @category Methods + */ + }, { + key: "dist", + value: function dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + }, { + key: "squaredDistance", + value: function squaredDistance(b) { + return _Vec3.squaredDistance(this, b); + } + /** + * Alias for {@link Vec3.squaredDistance} + * @category Methods + */ + }, { + key: "sqrDist", + value: function sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec3.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "negate", + value: function negate() { + this[0] *= -1; + this[1] *= -1; + this[2] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec3.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "invert", + value: function invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + this[2] = 1 / this[2]; + return this; + } + /** + * Sets each component of `this` to its absolute value. + * Equivalent to `Vec3.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "abs", + value: function abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + this[2] = Math.abs(this[2]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec3}. + * Equivalent to `Vec3.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + }, { + key: "dot", + value: function dot(b) { + return this[0] * b[0] + this[1] * b[1] + this[2] * b[2]; + } + /** + * Normalize `this`. + * Equivalent to `Vec3.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "normalize", + value: function normalize() { + return _Vec3.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec3}. + */ + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 3 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty vec3 + * @category Static + * + * @returns a new 3D vector + */ + }, { + key: "create", + value: function create() { + return new _Vec3(); + } + /** + * Creates a new vec3 initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 3D vector + */ + }, { + key: "clone", + value: function clone(a) { + return new _Vec3(a); + } + /** + * Calculates the magnitude (length) of a {@link Vec3} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + }, { + key: "magnitude", + value: function magnitude(a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.magnitude} + * @category Static + */ + }, { + key: "mag", + value: function mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + // Length conflicts with Function.length + }, { + key: "length", + value: function length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.mag} + */ + }, { + key: "len", + value: function len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Creates a new vec3 initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns a new 3D vector + */ + }, { + key: "fromValues", + value: function fromValues(x, y, z) { + return new _Vec3(x, y, z); + } + /** + * Copy the values from one vec3 to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + }, { + key: "copy", + value: function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + return out; + } + /** + * Set the components of a vec3 to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns `out` + */ + }, { + key: "set", + value: function set(out, x, y, z) { + out[0] = x; + out[1] = y; + out[2] = z; + return out; + } + /** + * Adds two {@link Vec3}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "add", + value: function add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "subtract", + value: function subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + return out; + } + /** + * Alias for {@link Vec3.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sub", + value: function sub(out, a, b) { + return [0, 0, 0]; + } + /** + * Multiplies two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "multiply", + value: function multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + return out; + } + /** + * Alias for {@link Vec3.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "mul", + value: function mul(out, a, b) { + return [0, 0, 0]; + } + /** + * Divides two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "divide", + value: function divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + out[2] = a[2] / b[2]; + return out; + } + /** + * Alias for {@link Vec3.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "div", + value: function div(out, a, b) { + return [0, 0, 0]; + } + /** + * Math.ceil the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + }, { + key: "ceil", + value: function ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + out[2] = Math.ceil(a[2]); + return out; + } + /** + * Math.floor the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + }, { + key: "floor", + value: function floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + out[2] = Math.floor(a[2]); + return out; + } + /** + * Returns the minimum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "min", + value: function min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + return out; + } + /** + * Returns the maximum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "max", + value: function max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + return out; + } + /** + * symmetric round the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + /* + static round(out: Vec3Like, a: Readonly): Vec3Like { + out[0] = glMatrix.round(a[0]); + out[1] = glMatrix.round(a[1]); + out[2] = glMatrix.round(a[2]); + return out; + }*/ + /** + * Scales a vec3 by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + }, { + key: "scale", + value: function scale(out, a, _scale) { + out[0] = a[0] * _scale; + out[1] = a[1] * _scale; + out[2] = a[2] * _scale; + return out; + } + /** + * Adds two vec3's after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + }, { + key: "distance", + value: function distance(a, b) { + var x = b[0] - a[0]; + var y = b[1] - a[1]; + var z = b[2] - a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "dist", + value: function dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + }, { + key: "squaredDistance", + value: function squaredDistance(a, b) { + var x = b[0] - a[0]; + var y = b[1] - a[1]; + var z = b[2] - a[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredDistance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sqrDist", + value: function sqrDist(a, b) { + return 0; + } + /** + * Calculates the squared length of a vec3 + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + }, { + key: "squaredLength", + value: function squaredLength(a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredLength} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sqrLen", + value: function sqrLen(a, b) { + return 0; + } + /** + * Negates the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + }, { + key: "negate", + value: function negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + return out; + } + /** + * Returns the inverse of the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + }, { + key: "inverse", + value: function inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + out[2] = 1 / a[2]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec3} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + }, { + key: "abs", + value: function abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + out[2] = Math.abs(a[2]); + return out; + } + /** + * Normalize a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + }, { + key: "normalize", + value: function normalize(out, a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + var len = x * x + y * y + z * z; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + out[2] = a[2] * len; + return out; + } + /** + * Calculates the dot product of two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + }, { + key: "dot", + value: function dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; + } + /** + * Computes the cross product of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "cross", + value: function cross(out, a, b) { + var ax = a[0], + ay = a[1], + az = a[2]; + var bx = b[0], + by = b[1], + bz = b[2]; + out[0] = ay * bz - az * by; + out[1] = az * bx - ax * bz; + out[2] = ax * by - ay * bx; + return out; + } + /** + * Performs a linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + }, { + key: "lerp", + value: function lerp(out, a, b, t) { + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + return out; + } + /** + * Performs a spherical linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + }, { + key: "slerp", + value: function slerp(out, a, b, t) { + var angle = Math.acos(Math.min(Math.max(_Vec3.dot(a, b), -1), 1)); + var sinTotal = Math.sin(angle); + var ratioA = Math.sin((1 - t) * angle) / sinTotal; + var ratioB = Math.sin(t * angle) / sinTotal; + out[0] = ratioA * a[0] + ratioB * b[0]; + out[1] = ratioA * a[1] + ratioB * b[1]; + out[2] = ratioA * a[2] + ratioB * b[2]; + return out; + } + /** + * Performs a hermite interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + }, { + key: "hermite", + value: function hermite(out, a, b, c, d, t) { + var factorTimes2 = t * t; + var factor1 = factorTimes2 * (2 * t - 3) + 1; + var factor2 = factorTimes2 * (t - 2) + t; + var factor3 = factorTimes2 * (t - 1); + var factor4 = factorTimes2 * (3 - 2 * t); + out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; + out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; + out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; + return out; + } + /** + * Performs a bezier interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + }, { + key: "bezier", + value: function bezier(out, a, b, c, d, t) { + var inverseFactor = 1 - t; + var inverseFactorTimesTwo = inverseFactor * inverseFactor; + var factorTimes2 = t * t; + var factor1 = inverseFactorTimesTwo * inverseFactor; + var factor2 = 3 * t * inverseFactorTimesTwo; + var factor3 = 3 * factorTimes2 * inverseFactor; + var factor4 = factorTimes2 * t; + out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; + out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; + out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; + return out; + } + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned + * @returns `out` + */ + /* + static random(out: Vec3Like, scale) { + scale = scale === undefined ? 1.0 : scale; + + let r = glMatrix.RANDOM() * 2.0 * Math.PI; + let z = glMatrix.RANDOM() * 2.0 - 1.0; + let zScale = Math.sqrt(1.0 - z * z) * scale; + + out[0] = Math.cos(r) * zScale; + out[1] = Math.sin(r) * zScale; + out[2] = z * scale; + return out; + }*/ + /** + * Transforms the vec3 with a mat4. + * 4th vector component is implicitly '1' + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + }, { + key: "transformMat4", + value: function transformMat4(out, a, m) { + var x = a[0], + y = a[1], + z = a[2]; + var w = m[3] * x + m[7] * y + m[11] * z + m[15] || 1; + out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; + out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; + out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; + return out; + } + /** + * Transforms the vec3 with a mat3. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - the 3x3 matrix to transform with + * @returns `out` + */ + }, { + key: "transformMat3", + value: function transformMat3(out, a, m) { + var x = a[0], + y = a[1], + z = a[2]; + out[0] = x * m[0] + y * m[3] + z * m[6]; + out[1] = x * m[1] + y * m[4] + z * m[7]; + out[2] = x * m[2] + y * m[5] + z * m[8]; + return out; + } + /** + * Transforms the vec3 with a quat + * Can also be used for dual quaternions. (Multiply it with the real part) + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + }, { + key: "transformQuat", + value: function transformQuat(out, a, q) { + var qx = q[0]; + var qy = q[1]; + var qz = q[2]; + var w2 = q[3] * 2; + var x = a[0]; + var y = a[1]; + var z = a[2]; + var uvx = qy * z - qz * y; + var uvy = qz * x - qx * z; + var uvz = qx * y - qy * x; + var uuvx = (qy * uvz - qz * uvy) * 2; + var uuvy = (qz * uvx - qx * uvz) * 2; + var uuvz = (qx * uvy - qy * uvx) * 2; + out[0] = x + uvx * w2 + uuvx; + out[1] = y + uvy * w2 + uuvy; + out[2] = z + uvz * w2 + uuvz; + return out; + } + /** + * Rotate a 3D vector around the x-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + }, { + key: "rotateX", + value: function rotateX(out, a, b, rad) { + var by = b[1]; + var bz = b[2]; + var py = a[1] - by; + var pz = a[2] - bz; + out[0] = a[0]; + out[1] = py * Math.cos(rad) - pz * Math.sin(rad) + by; + out[2] = py * Math.sin(rad) + pz * Math.cos(rad) + bz; + return out; + } + /** + * Rotate a 3D vector around the y-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + }, { + key: "rotateY", + value: function rotateY(out, a, b, rad) { + var bx = b[0]; + var bz = b[2]; + var px = a[0] - bx; + var pz = a[2] - bz; + out[0] = pz * Math.sin(rad) + px * Math.cos(rad) + bx; + out[1] = a[1]; + out[2] = pz * Math.cos(rad) - px * Math.sin(rad) + bz; + return out; + } + /** + * Rotate a 3D vector around the z-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + }, { + key: "rotateZ", + value: function rotateZ(out, a, b, rad) { + var bx = b[0]; + var by = b[1]; + var px = a[0] - bx; + var py = a[1] - by; + out[0] = px * Math.cos(rad) - py * Math.sin(rad) + bx; + out[1] = px * Math.sin(rad) + py * Math.cos(rad) + by; + out[2] = b[2]; + return out; + } + /** + * Get the angle between two 3D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + }, { + key: "angle", + value: function angle(a, b) { + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + var bx = b[0]; + var by = b[1]; + var bz = b[2]; + var mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz)); + var cosine = mag && _Vec3.dot(a, b) / mag; + return Math.acos(Math.min(Math.max(cosine, -1), 1)); + } + /** + * Set the components of a vec3 to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + }, { + key: "zero", + value: function zero(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + return out; + } + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + }, { + key: "str", + value: function str(a) { + return "Vec3(".concat(a.join(", "), ")"); + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + }, { + key: "exactEquals", + value: function exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + }, { + key: "equals", + value: function equals(a, b) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float64Array)); + Vec3.prototype.sub = Vec3.prototype.subtract; + Vec3.prototype.mul = Vec3.prototype.multiply; + Vec3.prototype.div = Vec3.prototype.divide; + Vec3.prototype.dist = Vec3.prototype.distance; + Vec3.prototype.sqrDist = Vec3.prototype.squaredDistance; + Vec3.sub = Vec3.subtract; + Vec3.mul = Vec3.multiply; + Vec3.div = Vec3.divide; + Vec3.dist = Vec3.distance; + Vec3.sqrDist = Vec3.squaredDistance; + Vec3.sqrLen = Vec3.squaredLength; + Vec3.mag = Vec3.magnitude; + Vec3.length = Vec3.magnitude; + Vec3.len = Vec3.magnitude; + + // src/_lib/f64/Vec4.ts + var Vec4 = /*#__PURE__*/function (_Float64Array6) { + /** + * Create a {@link Vec4}. + * + * @category Constructor + */ + function _Vec4() { + var _this6; + _classCallCheck(this, _Vec4); + for (var _len10 = arguments.length, values = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) { + values[_key10] = arguments[_key10]; + } + switch (values.length) { + case 4: + _this6 = _callSuper(this, _Vec4, [values]); + break; + case 2: + _this6 = _callSuper(this, _Vec4, [values[0], values[1], 4]); + break; + case 1: + { + var v = values[0]; + if (typeof v === "number") { + _this6 = _callSuper(this, _Vec4, [[v, v, v, v]]); + } else { + _this6 = _callSuper(this, _Vec4, [v, 0, 4]); + } + break; + } + default: + _this6 = _callSuper(this, _Vec4, [4]); + break; + } + return _assertThisInitialized(_this6); + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + _inherits(_Vec4, _Float64Array6); + return _createClass(_Vec4, [{ + key: "x", + get: function get() { + return this[0]; + }, + set: function set(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + }, { + key: "y", + get: function get() { + return this[1]; + }, + set: function set(value) { + this[1] = value; + } + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + }, { + key: "z", + get: function get() { + return this[2]; + }, + set: function set(value) { + this[2] = value; + } + /** + * The w component of the vector. Equivalent to `this[3];` + * @category Vector Components + */ + }, { + key: "w", + get: function get() { + return this[3]; + }, + set: function set(value) { + this[3] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + }, { + key: "r", + get: function get() { + return this[0]; + }, + set: function set(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + }, { + key: "g", + get: function get() { + return this[1]; + }, + set: function set(value) { + this[1] = value; + } + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + }, { + key: "b", + get: function get() { + return this[2]; + }, + set: function set(value) { + this[2] = value; + } + /** + * The a component of the vector. Equivalent to `this[3];` + * @category Color Components + */ + }, { + key: "a", + get: function get() { + return this[3]; + }, + set: function set(value) { + this[3] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec4.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + }, { + key: "magnitude", + get: function get() { + var x = this[0]; + var y = this[1]; + var z = this[2]; + var w = this[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Vec4.magnitude} + * + * @category Accessors + */ + }, { + key: "mag", + get: function get() { + return this.magnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec4.str(this);` + * + * @category Accessors + */ + }, { + key: "str", + get: function get() { + return _Vec4.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + }, { + key: "copy", + value: function copy(a) { + _superPropGet(_Vec4, "set", this)([a]); + return this; + } + /** + * Adds a {@link Vec4} to `this`. + * Equivalent to `Vec4.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + }, { + key: "add", + value: function add(b) { + this[0] += b[0]; + this[1] += b[1]; + this[2] += b[2]; + this[3] += b[3]; + return this; + } + /** + * Subtracts a {@link Vec4} from `this`. + * Equivalent to `Vec4.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + }, { + key: "subtract", + value: function subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + this[2] -= b[2]; + this[3] -= b[3]; + return this; + } + /** + * Alias for {@link Vec4.subtract} + * @category Methods + */ + }, { + key: "sub", + value: function sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec4}. + * Equivalent to `Vec4.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + }, { + key: "multiply", + value: function multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + this[2] *= b[2]; + this[3] *= b[3]; + return this; + } + /** + * Alias for {@link Vec4.multiply} + * @category Methods + */ + }, { + key: "mul", + value: function mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec4}. + * Equivalent to `Vec4.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + }, { + key: "divide", + value: function divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + this[2] /= b[2]; + this[3] /= b[3]; + return this; + } + /** + * Alias for {@link Vec4.divide} + * @category Methods + */ + }, { + key: "div", + value: function div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec4.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + }, { + key: "scale", + value: function scale(b) { + this[0] *= b; + this[1] *= b; + this[2] *= b; + this[3] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + this[2] += b[2] * scale; + this[3] += b[3] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + }, { + key: "distance", + value: function distance(b) { + return _Vec4.distance(this, b); + } + /** + * Alias for {@link Vec4.distance} + * @category Methods + */ + }, { + key: "dist", + value: function dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + }, { + key: "squaredDistance", + value: function squaredDistance(b) { + return _Vec4.squaredDistance(this, b); + } + /** + * Alias for {@link Vec4.squaredDistance} + * @category Methods + */ + }, { + key: "sqrDist", + value: function sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec4.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "negate", + value: function negate() { + this[0] *= -1; + this[1] *= -1; + this[2] *= -1; + this[3] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec4.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "invert", + value: function invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + this[2] = 1 / this[2]; + this[3] = 1 / this[3]; + return this; + } + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec4.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "abs", + value: function abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + this[2] = Math.abs(this[2]); + this[3] = Math.abs(this[3]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec4}. + * Equivalent to `Vec4.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + }, { + key: "dot", + value: function dot(b) { + return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3]; + } + /** + * Normalize `this`. + * Equivalent to `Vec4.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "normalize", + value: function normalize() { + return _Vec4.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec4}. + */ + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 4 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty {@link Vec4} + * @category Static + * + * @returns a new 4D vector + */ + }, { + key: "create", + value: function create() { + return new _Vec4(); + } + /** + * Creates a new {@link Vec4} initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 4D vector + */ + }, { + key: "clone", + value: function clone(a) { + return new _Vec4(a); + } + /** + * Creates a new {@link Vec4} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new 4D vector + */ + }, { + key: "fromValues", + value: function fromValues(x, y, z, w) { + return new _Vec4(x, y, z, w); + } + /** + * Copy the values from one {@link Vec4} to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + }, { + key: "copy", + value: function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Vec4} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + }, { + key: "set", + value: function set(out, x, y, z, w) { + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = w; + return out; + } + /** + * Adds two {@link Vec4}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "add", + value: function add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "subtract", + value: function subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + return out; + } + /** + * Alias for {@link Vec4.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sub", + value: function sub(out, a, b) { + return out; + } + /** + * Multiplies two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "multiply", + value: function multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + out[3] = a[3] * b[3]; + return out; + } + /** + * Alias for {@link Vec4.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "mul", + value: function mul(out, a, b) { + return out; + } + /** + * Divides two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "divide", + value: function divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + out[2] = a[2] / b[2]; + out[3] = a[3] / b[3]; + return out; + } + /** + * Alias for {@link Vec4.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "div", + value: function div(out, a, b) { + return out; + } + /** + * Math.ceil the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + }, { + key: "ceil", + value: function ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + out[2] = Math.ceil(a[2]); + out[3] = Math.ceil(a[3]); + return out; + } + /** + * Math.floor the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + }, { + key: "floor", + value: function floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + out[2] = Math.floor(a[2]); + out[3] = Math.floor(a[3]); + return out; + } + /** + * Returns the minimum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "min", + value: function min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + out[3] = Math.min(a[3], b[3]); + return out; + } + /** + * Returns the maximum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "max", + value: function max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + out[3] = Math.max(a[3], b[3]); + return out; + } + /** + * Math.round the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + }, { + key: "round", + value: function round(out, a) { + out[0] = Math.round(a[0]); + out[1] = Math.round(a[1]); + out[2] = Math.round(a[2]); + out[3] = Math.round(a[3]); + return out; + } + /** + * Scales a {@link Vec4} by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + }, { + key: "scale", + value: function scale(out, a, _scale2) { + out[0] = a[0] * _scale2; + out[1] = a[1] * _scale2; + out[2] = a[2] * _scale2; + out[3] = a[3] * _scale2; + return out; + } + /** + * Adds two {@link Vec4}'s after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + }, { + key: "distance", + value: function distance(a, b) { + var x = b[0] - a[0]; + var y = b[1] - a[1]; + var z = b[2] - a[2]; + var w = b[3] - a[3]; + return Math.hypot(x, y, z, w); + } + /** + * Alias for {@link Vec4.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "dist", + value: function dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + }, { + key: "squaredDistance", + value: function squaredDistance(a, b) { + var x = b[0] - a[0]; + var y = b[1] - a[1]; + var z = b[2] - a[2]; + var w = b[3] - a[3]; + return x * x + y * y + z * z + w * w; + } + /** + * Alias for {@link Vec4.squaredDistance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sqrDist", + value: function sqrDist(a, b) { + return 0; + } + /** + * Calculates the magnitude (length) of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate length of + * @returns length of `a` + */ + }, { + key: "magnitude", + value: function magnitude(a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + var w = a[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Vec4.magnitude} + * @category Static + */ + }, { + key: "mag", + value: function mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + }, { + key: "length", + value: function length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.mag} + */ + }, { + key: "len", + value: function len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + }, { + key: "squaredLength", + value: function squaredLength(a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + var w = a[3]; + return x * x + y * y + z * z + w * w; + } + /** + * Alias for {@link Vec4.squaredLength} + * @category Static + */ + }, { + key: "sqrLen", + value: function sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + }, { + key: "negate", + value: function negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = -a[3]; + return out; + } + /** + * Returns the inverse of the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + }, { + key: "inverse", + value: function inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + out[2] = 1 / a[2]; + out[3] = 1 / a[3]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec4} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + }, { + key: "abs", + value: function abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + out[2] = Math.abs(a[2]); + out[3] = Math.abs(a[3]); + return out; + } + /** + * Normalize a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + }, { + key: "normalize", + value: function normalize(out, a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + var w = a[3]; + var len = x * x + y * y + z * z + w * w; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = x * len; + out[1] = y * len; + out[2] = z * len; + out[3] = w * len; + return out; + } + /** + * Calculates the dot product of two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + }, { + key: "dot", + value: function dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + /** + * Returns the cross-product of three vectors in a 4-dimensional space + * @category Static + * + * @param out the receiving vector + * @param u - the first vector + * @param v - the second vector + * @param w - the third vector + * @returns result + */ + }, { + key: "cross", + value: function cross(out, u, v, w) { + var a = v[0] * w[1] - v[1] * w[0]; + var b = v[0] * w[2] - v[2] * w[0]; + var c = v[0] * w[3] - v[3] * w[0]; + var d = v[1] * w[2] - v[2] * w[1]; + var e = v[1] * w[3] - v[3] * w[1]; + var f = v[2] * w[3] - v[3] * w[2]; + var g = u[0]; + var h = u[1]; + var i = u[2]; + var j = u[3]; + out[0] = h * f - i * e + j * d; + out[1] = -(g * f) + i * c - j * b; + out[2] = g * e - h * c + j * a; + out[3] = -(g * d) + h * b - i * a; + return out; + } + /** + * Performs a linear interpolation between two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + }, { + key: "lerp", + value: function lerp(out, a, b, t) { + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + var aw = a[3]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + out[3] = aw + t * (b[3] - aw); + return out; + } + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns `out` + */ + /* + static random(out: Vec4Like, scale): Vec4Like { + scale = scale || 1.0; + + // Marsaglia, George. Choosing a Point from the Surface of a + // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646. + // http://projecteuclid.org/euclid.aoms/1177692644; + var v1, v2, v3, v4; + var s1, s2; + do { + v1 = glMatrix.RANDOM() * 2 - 1; + v2 = glMatrix.RANDOM() * 2 - 1; + s1 = v1 * v1 + v2 * v2; + } while (s1 >= 1); + do { + v3 = glMatrix.RANDOM() * 2 - 1; + v4 = glMatrix.RANDOM() * 2 - 1; + s2 = v3 * v3 + v4 * v4; + } while (s2 >= 1); + + var d = Math.sqrt((1 - s1) / s2); + out[0] = scale * v1; + out[1] = scale * v2; + out[2] = scale * v3 * d; + out[3] = scale * v4 * d; + return out; + }*/ + /** + * Transforms the {@link Vec4} with a {@link Mat4}. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + }, { + key: "transformMat4", + value: function transformMat4(out, a, m) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + var w = a[3]; + out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; + out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; + out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; + out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; + return out; + } + /** + * Transforms the {@link Vec4} with a {@link Quat} + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + }, { + key: "transformQuat", + value: function transformQuat(out, a, q) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + var qx = q[0]; + var qy = q[1]; + var qz = q[2]; + var qw = q[3]; + var ix = qw * x + qy * z - qz * y; + var iy = qw * y + qz * x - qx * z; + var iz = qw * z + qx * y - qy * x; + var iw = -qx * x - qy * y - qz * z; + out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy; + out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz; + out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Vec4} to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + }, { + key: "zero", + value: function zero(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 0; + return out; + } + /** + * Returns a string representation of a {@link Vec4} + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + }, { + key: "str", + value: function str(a) { + return "Vec4(".concat(a.join(", "), ")"); + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + }, { + key: "exactEquals", + value: function exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + }, { + key: "equals", + value: function equals(a, b) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float64Array)); + Vec4.prototype.sub = Vec4.prototype.subtract; + Vec4.prototype.mul = Vec4.prototype.multiply; + Vec4.prototype.div = Vec4.prototype.divide; + Vec4.prototype.dist = Vec4.prototype.distance; + Vec4.prototype.sqrDist = Vec4.prototype.squaredDistance; + Vec4.sub = Vec4.subtract; + Vec4.mul = Vec4.multiply; + Vec4.div = Vec4.divide; + Vec4.dist = Vec4.distance; + Vec4.sqrDist = Vec4.squaredDistance; + Vec4.sqrLen = Vec4.squaredLength; + Vec4.mag = Vec4.magnitude; + Vec4.length = Vec4.magnitude; + Vec4.len = Vec4.magnitude; + + // src/_lib/f64/Quat.ts + var _DEFAULT_ANGLE_ORDER, _TMP_QUAT1, _TMP_QUAT2, _TMP_MAT3, _TMP_VEC32, _X_UNIT_VEC3, _Y_UNIT_VEC3; + var _Quat = /*#__PURE__*/function (_Float64Array7) { + /** + * Create a {@link Quat}. + * + * @category Constructor + */ + function _Quat() { + var _this7; + _classCallCheck(this, _Quat); + for (var _len11 = arguments.length, values = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) { + values[_key11] = arguments[_key11]; + } + switch (values.length) { + case 4: + _this7 = _callSuper(this, _Quat, [values]); + break; + case 2: + _this7 = _callSuper(this, _Quat, [values[0], values[1], 4]); + break; + case 1: + { + var v = values[0]; + if (typeof v === "number") { + _this7 = _callSuper(this, _Quat, [[v, v, v, v]]); + } else { + _this7 = _callSuper(this, _Quat, [v, 0, 4]); + } + break; + } + default: + _this7 = _callSuper(this, _Quat, [4]); + _this7[3] = 1; + break; + } + return _assertThisInitialized(_this7); + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the quaternion. Equivalent to `this[0];` + * @category Quaternion Components + */ + _inherits(_Quat, _Float64Array7); + return _createClass(_Quat, [{ + key: "x", + get: function get() { + return this[0]; + }, + set: function set(value) { + this[0] = value; + } + /** + * The y component of the quaternion. Equivalent to `this[1];` + * @category Quaternion Components + */ + }, { + key: "y", + get: function get() { + return this[1]; + }, + set: function set(value) { + this[1] = value; + } + /** + * The z component of the quaternion. Equivalent to `this[2];` + * @category Quaternion Components + */ + }, { + key: "z", + get: function get() { + return this[2]; + }, + set: function set(value) { + this[2] = value; + } + /** + * The w component of the quaternion. Equivalent to `this[3];` + * @category Quaternion Components + */ + }, { + key: "w", + get: function get() { + return this[3]; + }, + set: function set(value) { + this[3] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Quat.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + }, { + key: "magnitude", + get: function get() { + var x = this[0]; + var y = this[1]; + var z = this[2]; + var w = this[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Quat.magnitude} + * + * @category Accessors + */ + }, { + key: "mag", + get: function get() { + return this.magnitude; + } + /** + * A string representation of `this` + * Equivalent to `Quat.str(this);` + * + * @category Accessors + */ + }, { + key: "str", + get: function get() { + return _Quat.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Quat} into `this`. + * @category Methods + * + * @param a the source quaternion + * @returns `this` + */ + }, { + key: "copy", + value: function copy(a) { + _superPropGet(_Quat, "set", this)([a]); + return this; + } + /** + * Set `this` to the identity quaternion + * Equivalent to Quat.identity(this) + * @category Methods + * + * @returns `this` + */ + }, { + key: "identity", + value: function identity() { + this[0] = 0; + this[1] = 0; + this[2] = 0; + this[3] = 1; + return this; + } + /** + * Multiplies `this` by a {@link Quat}. + * Equivalent to `Quat.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + }, { + key: "multiply", + value: function multiply(b) { + return _Quat.multiply(this, this, b); + } + /** + * Alias for {@link Quat.multiply} + * @category Methods + */ + }, { + key: "mul", + value: function mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Rotates `this` by the given angle about the X axis + * Equivalent to `Quat.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + }, { + key: "rotateX", + value: function rotateX(rad) { + return _Quat.rotateX(this, this, rad); + } + /** + * Rotates `this` by the given angle about the Y axis + * Equivalent to `Quat.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + }, { + key: "rotateY", + value: function rotateY(rad) { + return _Quat.rotateY(this, this, rad); + } + /** + * Rotates `this` by the given angle about the Z axis + * Equivalent to `Quat.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + }, { + key: "rotateZ", + value: function rotateZ(rad) { + return _Quat.rotateZ(this, this, rad); + } + /** + * Inverts `this` + * Equivalent to `Quat.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "invert", + value: function invert() { + return _Quat.invert(this, this); + } + /** + * Scales `this` by a scalar number + * Equivalent to `Quat.scale(this, this, scale);` + * @category Methods + * + * @param scale - amount to scale the vector by + * @returns `this` + */ + }, { + key: "scale", + value: function scale(_scale3) { + this[0] *= _scale3; + this[1] *= _scale3; + this[2] *= _scale3; + this[3] *= _scale3; + return this; + } + /** + * Calculates the dot product of `this` and another {@link Quat} + * Equivalent to `Quat.dot(this, b);` + * @category Methods + * + * @param b - the second operand + * @returns dot product of `this` and b + */ + }, { + key: "dot", + value: function dot(b) { + return _Quat.dot(this, b); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat}. + */ + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 4 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new identity quat + * @category Static + * + * @returns a new quaternion + */ + }, { + key: "create", + value: function create() { + return new _Quat(); + } + /** + * Set a quat to the identity quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + }, { + key: "identity", + value: function identity(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * @category Static + * + * @param out - the receiving quaternion + * @param axis - the axis around which to rotate + * @param rad - the angle in radians + * @returns `out` + **/ + }, { + key: "setAxisAngle", + value: function setAxisAngle(out, axis, rad) { + rad *= 0.5; + var s = Math.sin(rad); + out[0] = s * axis[0]; + out[1] = s * axis[1]; + out[2] = s * axis[2]; + out[3] = Math.cos(rad); + return out; + } + /** + * Gets the rotation axis and angle for a given + * quaternion. If a quaternion is created with + * setAxisAngle, this method will return the same + * values as provided in the original parameter list + * OR functionally equivalent values. + * Example: The quaternion formed by axis [0, 0, 1] and + * angle -90 is the same as the quaternion formed by + * [0, 0, 1] and 270. This method favors the latter. + * @category Static + * + * @param out_axis - Vector receiving the axis of rotation + * @param q - Quaternion to be decomposed + * @return Angle, in radians, of the rotation + */ + }, { + key: "getAxisAngle", + value: function getAxisAngle(out_axis, q) { + var rad = Math.acos(q[3]) * 2; + var s = Math.sin(rad / 2); + if (s > GLM_EPSILON) { + out_axis[0] = q[0] / s; + out_axis[1] = q[1] / s; + out_axis[2] = q[2] / s; + } else { + out_axis[0] = 1; + out_axis[1] = 0; + out_axis[2] = 0; + } + return rad; + } + /** + * Gets the angular distance between two unit quaternions + * @category Static + * + * @param {ReadonlyQuat} a Origin unit quaternion + * @param {ReadonlyQuat} b Destination unit quaternion + * @return {Number} Angle, in radians, between the two quaternions + */ + }, { + key: "getAngle", + value: function getAngle(a, b) { + var dotproduct = _Quat.dot(a, b); + return Math.acos(2 * dotproduct * dotproduct - 1); + } + /** + * Multiplies two quaternions. + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "multiply", + value: function multiply(out, a, b) { + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + var aw = a[3]; + var bx = b[0]; + var by = b[1]; + var bz = b[2]; + var bw = b[3]; + out[0] = ax * bw + aw * bx + ay * bz - az * by; + out[1] = ay * bw + aw * by + az * bx - ax * bz; + out[2] = az * bw + aw * bz + ax * by - ay * bx; + out[3] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + /** + * Rotates a quaternion by the given angle about the X axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + }, { + key: "rotateX", + value: function rotateX(out, a, rad) { + rad *= 0.5; + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + var aw = a[3]; + var bx = Math.sin(rad); + var bw = Math.cos(rad); + out[0] = ax * bw + aw * bx; + out[1] = ay * bw + az * bx; + out[2] = az * bw - ay * bx; + out[3] = aw * bw - ax * bx; + return out; + } + /** + * Rotates a quaternion by the given angle about the Y axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + }, { + key: "rotateY", + value: function rotateY(out, a, rad) { + rad *= 0.5; + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + var aw = a[3]; + var by = Math.sin(rad); + var bw = Math.cos(rad); + out[0] = ax * bw - az * by; + out[1] = ay * bw + aw * by; + out[2] = az * bw + ax * by; + out[3] = aw * bw - ay * by; + return out; + } + /** + * Rotates a quaternion by the given angle about the Z axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + }, { + key: "rotateZ", + value: function rotateZ(out, a, rad) { + rad *= 0.5; + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + var aw = a[3]; + var bz = Math.sin(rad); + var bw = Math.cos(rad); + out[0] = ax * bw + ay * bz; + out[1] = ay * bw - ax * bz; + out[2] = az * bw + aw * bz; + out[3] = aw * bw - az * bz; + return out; + } + /** + * Calculates the W component of a quat from the X, Y, and Z components. + * Assumes that quaternion is 1 unit in length. + * Any existing W component will be ignored. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate W component of + * @returns `out` + */ + }, { + key: "calculateW", + value: function calculateW(out, a) { + var x = a[0], + y = a[1], + z = a[2]; + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = Math.sqrt(Math.abs(1 - x * x - y * y - z * z)); + return out; + } + /** + * Calculate the exponential of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + }, { + key: "exp", + value: function exp(out, a) { + var x = a[0], + y = a[1], + z = a[2], + w = a[3]; + var r = Math.sqrt(x * x + y * y + z * z); + var et = Math.exp(w); + var s = r > 0 ? et * Math.sin(r) / r : 0; + out[0] = x * s; + out[1] = y * s; + out[2] = z * s; + out[3] = et * Math.cos(r); + return out; + } + /** + * Calculate the natural logarithm of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + }, { + key: "ln", + value: function ln(out, a) { + var x = a[0], + y = a[1], + z = a[2], + w = a[3]; + var r = Math.sqrt(x * x + y * y + z * z); + var t = r > 0 ? Math.atan2(r, w) / r : 0; + out[0] = x * t; + out[1] = y * t; + out[2] = z * t; + out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w); + return out; + } + /** + * Calculate the scalar power of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @param b - amount to scale the quaternion by + * @returns `out` + */ + }, { + key: "pow", + value: function pow(out, a, b) { + _Quat.ln(out, a); + _Quat.scale(out, out, b); + _Quat.exp(out, out); + return out; + } + /** + * Performs a spherical linear interpolation between two quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + }, { + key: "slerp", + value: function slerp(out, a, b, t) { + var ax = a[0], + ay = a[1], + az = a[2], + aw = a[3]; + var bx = b[0], + by = b[1], + bz = b[2], + bw = b[3]; + var scale0; + var scale1; + var cosom = ax * bx + ay * by + az * bz + aw * bw; + if (cosom < 0) { + cosom = -cosom; + bx = -bx; + by = -by; + bz = -bz; + bw = -bw; + } + if (1 - cosom > GLM_EPSILON) { + var omega = Math.acos(cosom); + var sinom = Math.sin(omega); + scale0 = Math.sin((1 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; + } else { + scale0 = 1 - t; + scale1 = t; + } + out[0] = scale0 * ax + scale1 * bx; + out[1] = scale0 * ay + scale1 * by; + out[2] = scale0 * az + scale1 * bz; + out[3] = scale0 * aw + scale1 * bw; + return out; + } + /** + * Generates a random unit quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + /* static random(out: QuatLike): QuatLike { + // Implementation of http://planning.cs.uiuc.edu/node198.html + // TODO: Calling random 3 times is probably not the fastest solution + let u1 = glMatrix.RANDOM(); + let u2 = glMatrix.RANDOM(); + let u3 = glMatrix.RANDOM(); + + let sqrt1MinusU1 = Math.sqrt(1 - u1); + let sqrtU1 = Math.sqrt(u1); + + out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2); + out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2); + out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3); + out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3); + return out; + }*/ + /** + * Calculates the inverse of a quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate inverse of + * @returns `out` + */ + }, { + key: "invert", + value: function invert(out, a) { + var a0 = a[0], + a1 = a[1], + a2 = a[2], + a3 = a[3]; + var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; + var invDot = dot ? 1 / dot : 0; + out[0] = -a0 * invDot; + out[1] = -a1 * invDot; + out[2] = -a2 * invDot; + out[3] = a3 * invDot; + return out; + } + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate conjugate of + * @returns `out` + */ + }, { + key: "conjugate", + value: function conjugate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + return out; + } + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to re-normalize the quaternion yourself where necessary. + * @category Static + * + * @param out - the receiving quaternion + * @param m - rotation matrix + * @returns `out` + */ + }, { + key: "fromMat3", + value: function fromMat3(out, m) { + var fTrace = m[0] + m[4] + m[8]; + var fRoot; + if (fTrace > 0) { + fRoot = Math.sqrt(fTrace + 1); + out[3] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[0] = (m[5] - m[7]) * fRoot; + out[1] = (m[6] - m[2]) * fRoot; + out[2] = (m[1] - m[3]) * fRoot; + } else { + var i = 0; + if (m[4] > m[0]) { + i = 1; + } + if (m[8] > m[i * 3 + i]) { + i = 2; + } + var j = (i + 1) % 3; + var k = (i + 2) % 3; + fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1); + out[i] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot; + out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; + out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + } + return out; + } + /** + * Creates a quaternion from the given euler angle x, y, z. + * @category Static + * + * @param out - the receiving quaternion + * @param x - Angle to rotate around X axis in degrees. + * @param y - Angle to rotate around Y axis in degrees. + * @param z - Angle to rotate around Z axis in degrees. + * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx. + * @returns `out` + */ + }, { + key: "fromEuler", + value: function fromEuler(out, x, y, z) { + var order = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : __privateGet(_Quat, _DEFAULT_ANGLE_ORDER); + var halfToRad = 0.5 * Math.PI / 180; + x *= halfToRad; + y *= halfToRad; + z *= halfToRad; + var sx = Math.sin(x); + var cx = Math.cos(x); + var sy = Math.sin(y); + var cy = Math.cos(y); + var sz = Math.sin(z); + var cz = Math.cos(z); + switch (order) { + case "xyz": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "xzy": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + case "yxz": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + case "yzx": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "zxy": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "zyx": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + default: + throw new Error("Unknown angle order ".concat(order)); + } + return out; + } + /** + * Returns a string representation of a quatenion + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + }, { + key: "str", + value: function str(a) { + return "Quat(".concat(a.join(", "), ")"); + } + /** + * Creates a new quat initialized with values from an existing quaternion + * @category Static + * + * @param a - quaternion to clone + * @returns a new quaternion + */ + }, { + key: "clone", + value: function clone(a) { + return new _Quat(a); + } + /** + * Creates a new quat initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new quaternion + */ + }, { + key: "fromValues", + value: function fromValues(x, y, z, w) { + return new _Quat(x, y, z, w); + } + /** + * Copy the values from one quat to another + * @category Static + * + * @param out - the receiving quaternion + * @param a - the source quaternion + * @returns `out` + */ + }, { + key: "copy", + value: function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the components of a {@link Quat} to the given values + * @category Static + * + * @param out - the receiving quaternion + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "set", + value: function set(out, x, y, z, w) { + return out; + } + /** + * Adds two {@link Quat}'s + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "add", + value: function add(out, a, b) { + return out; + } + /** + * Alias for {@link Quat.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "mul", + value: function mul(out, a, b) { + return out; + } + /** + * Scales a quat by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param b - amount to scale the vector by + * @returns `out` + */ + }, { + key: "scale", + value: function scale(out, a, _scale4) { + out[0] = a[0] * _scale4; + out[1] = a[1] * _scale4; + out[2] = a[2] * _scale4; + out[3] = a[3] * _scale4; + return out; + } + /** + * Calculates the dot product of two quat's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + }, { + key: "dot", + value: function dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + /** + * Performs a linear interpolation between two quat's + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "lerp", + value: function lerp(out, a, b, t) { + return out; + } + /** + * Calculates the magnitude (length) of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate length of + * @returns length of `a` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "magnitude", + value: function magnitude(a) { + return 0; + } + /** + * Alias for {@link Quat.magnitude} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "mag", + value: function mag(a) { + return 0; + } + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + }, { + key: "length", + value: function length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.mag} + */ + }, { + key: "len", + value: function len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate squared length of + * @returns squared length of a + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "squaredLength", + value: function squaredLength(a) { + return 0; + } + /** + * Alias for {@link Quat.squaredLength} + * @category Static + */ + }, { + key: "sqrLen", + value: function sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Normalize a {@link Quat} + * @category Static + * + * @param out - the receiving quaternion + * @param a - quaternion to normalize + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "normalize", + value: function normalize(out, a) { + return out; + } + /** + * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first quaternion. + * @param b - The second quaternion. + * @returns True if the vectors are equal, false otherwise. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "exactEquals", + value: function exactEquals(a, b) { + return false; + } + /** + * Returns whether the quaternions have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "equals", + value: function equals(a, b) { + return false; + } + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * @category Static + * + * @param out - the receiving quaternion. + * @param a - the initial vector + * @param b - the destination vector + * @returns `out` + */ + }, { + key: "rotationTo", + value: function rotationTo(out, a, b) { + var dot = Vec3.dot(a, b); + if (dot < -0.999999) { + Vec3.cross(__privateGet(_Quat, _TMP_VEC32), __privateGet(_Quat, _X_UNIT_VEC3), a); + if (Vec3.mag(__privateGet(_Quat, _TMP_VEC32)) < 1e-6) { + Vec3.cross(__privateGet(_Quat, _TMP_VEC32), __privateGet(_Quat, _Y_UNIT_VEC3), a); + } + Vec3.normalize(__privateGet(_Quat, _TMP_VEC32), __privateGet(_Quat, _TMP_VEC32)); + _Quat.setAxisAngle(out, __privateGet(_Quat, _TMP_VEC32), Math.PI); + return out; + } else if (dot > 0.999999) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } else { + Vec3.cross(__privateGet(_Quat, _TMP_VEC32), a, b); + out[0] = __privateGet(_Quat, _TMP_VEC32)[0]; + out[1] = __privateGet(_Quat, _TMP_VEC32)[1]; + out[2] = __privateGet(_Quat, _TMP_VEC32)[2]; + out[3] = 1 + dot; + return _Quat.normalize(out, out); + } + } + /** + * Performs a spherical linear interpolation with two control points + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + }, { + key: "sqlerp", + value: function sqlerp(out, a, b, c, d, t) { + _Quat.slerp(__privateGet(_Quat, _TMP_QUAT1), a, d, t); + _Quat.slerp(__privateGet(_Quat, _TMP_QUAT2), b, c, t); + _Quat.slerp(out, __privateGet(_Quat, _TMP_QUAT1), __privateGet(_Quat, _TMP_QUAT2), 2 * t * (1 - t)); + return out; + } + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * @category Static + * + * @param out - The receiving quaternion + * @param view - the vector representing the viewing direction + * @param right - the vector representing the local `right` direction + * @param up - the vector representing the local `up` direction + * @returns `out` + */ + }, { + key: "setAxes", + value: function setAxes(out, view, right, up) { + __privateGet(_Quat, _TMP_MAT3)[0] = right[0]; + __privateGet(_Quat, _TMP_MAT3)[3] = right[1]; + __privateGet(_Quat, _TMP_MAT3)[6] = right[2]; + __privateGet(_Quat, _TMP_MAT3)[1] = up[0]; + __privateGet(_Quat, _TMP_MAT3)[4] = up[1]; + __privateGet(_Quat, _TMP_MAT3)[7] = up[2]; + __privateGet(_Quat, _TMP_MAT3)[2] = -view[0]; + __privateGet(_Quat, _TMP_MAT3)[5] = -view[1]; + __privateGet(_Quat, _TMP_MAT3)[8] = -view[2]; + return _Quat.normalize(out, _Quat.fromMat3(out, __privateGet(_Quat, _TMP_MAT3))); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float64Array)); + _DEFAULT_ANGLE_ORDER = new WeakMap(); + _TMP_QUAT1 = new WeakMap(); + _TMP_QUAT2 = new WeakMap(); + _TMP_MAT3 = new WeakMap(); + _TMP_VEC32 = new WeakMap(); + _X_UNIT_VEC3 = new WeakMap(); + _Y_UNIT_VEC3 = new WeakMap(); + __privateAdd(_Quat, _DEFAULT_ANGLE_ORDER, "zyx"); + // Temporary variables to prevent repeated allocations in the algorithms within Quat. + // These are declared as TypedArrays to aid in tree-shaking. + __privateAdd(_Quat, _TMP_QUAT1, new Float64Array(4)); + __privateAdd(_Quat, _TMP_QUAT2, new Float64Array(4)); + __privateAdd(_Quat, _TMP_MAT3, new Float64Array(9)); + __privateAdd(_Quat, _TMP_VEC32, new Float64Array(3)); + __privateAdd(_Quat, _X_UNIT_VEC3, new Float64Array([1, 0, 0])); + __privateAdd(_Quat, _Y_UNIT_VEC3, new Float64Array([0, 1, 0])); + var Quat = _Quat; + Quat.set = Vec4.set; + Quat.add = Vec4.add; + Quat.lerp = Vec4.lerp; + Quat.normalize = Vec4.normalize; + Quat.squaredLength = Vec4.squaredLength; + Quat.sqrLen = Vec4.squaredLength; + Quat.exactEquals = Vec4.exactEquals; + Quat.equals = Vec4.equals; + Quat.magnitude = Vec4.magnitude; + Quat.prototype.mul = Quat.prototype.multiply; + Quat.mul = Quat.multiply; + Quat.mag = Quat.magnitude; + Quat.length = Quat.magnitude; + Quat.len = Quat.magnitude; + + // src/_lib/f64/Quat2.ts + var _TMP_QUAT, _TMP_VEC33; + var _Quat2 = /*#__PURE__*/function (_Float64Array8) { + /** + * Create a {@link Quat2}. + * + * @category Constructor + */ + function _Quat2() { + var _this8; + _classCallCheck(this, _Quat2); + for (var _len12 = arguments.length, values = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) { + values[_key12] = arguments[_key12]; + } + switch (values.length) { + case 8: + _this8 = _callSuper(this, _Quat2, [values]); + break; + case 2: + _this8 = _callSuper(this, _Quat2, [values[0], values[1], 8]); + break; + case 1: + { + var v = values[0]; + if (typeof v === "number") { + _this8 = _callSuper(this, _Quat2, [[v, v, v, v, v, v, v, v]]); + } else { + _this8 = _callSuper(this, _Quat2, [v, 0, 8]); + } + break; + } + default: + _this8 = _callSuper(this, _Quat2, [8]); + _this8[3] = 1; + break; + } + return _assertThisInitialized(_this8); + } + // ============ + // Accessors + // ============ + /** + * A string representation of `this` + * Equivalent to `Quat2.str(this);` + * + * @category Accessors + */ + _inherits(_Quat2, _Float64Array8); + return _createClass(_Quat2, [{ + key: "str", + get: function get() { + return _Quat2.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Quat2} into `this`. + * @category Methods + * + * @param a the source dual quaternion + * @returns `this` + */ + }, { + key: "copy", + value: function copy(a) { + _superPropGet(_Quat2, "set", this)([a]); + return this; + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat2}. + */ + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 8 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new identity {@link Quat2} + * @category Static + * + * @returns a new dual quaternion [real -> rotation, dual -> translation] + */ + }, { + key: "create", + value: function create() { + return new _Quat2(); + } + /** + * Creates a {@link Quat2} quat initialized with values from an existing quaternion + * @category Static + * + * @param a - dual quaternion to clone + * @returns a new dual quaternion + */ + }, { + key: "clone", + value: function clone(a) { + return new _Quat2(a); + } + /** + * Creates a new {@link Quat2} initialized with the given values + * @category Static + * + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns a new dual quaternion + */ + }, { + key: "fromValues", + value: function fromValues(x1, y1, z1, w1, x2, y2, z2, w2) { + return new _Quat2(x1, y1, z1, w1, x2, y2, z2, w2); + } + /** + * Creates a new {@link Quat2} from the given values (quat and translation) + * @category Static + * + * @param x1 - X component (rotation) + * @param y1 - Y component (rotation) + * @param z1 - Z component (rotation) + * @param w1 - W component (rotation) + * @param x2 - X component (translation) + * @param y2 - Y component (translation) + * @param z2 - Z component (translation) + * @returns a new dual quaternion + */ + }, { + key: "fromRotationTranslationValues", + value: function fromRotationTranslationValues(x1, y1, z1, w1, x2, y2, z2) { + var ax = x2 * 0.5; + var ay = y2 * 0.5; + var az = z2 * 0.5; + return new _Quat2(x1, y1, z1, w1, ax * w1 + ay * z1 - az * y1, ay * w1 + az * x1 - ax * z1, az * w1 + ax * y1 - ay * x1, -ax * x1 - ay * y1 - az * z1); + } + /** + * Sets a {@link Quat2} from a quaternion and a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @param t - translation vector + * @returns `out` + */ + }, { + key: "fromRotationTranslation", + value: function fromRotationTranslation(out, q, t) { + var ax = t[0] * 0.5; + var ay = t[1] * 0.5; + var az = t[2] * 0.5; + var bx = q[0]; + var by = q[1]; + var bz = q[2]; + var bw = q[3]; + out[0] = bx; + out[1] = by; + out[2] = bz; + out[3] = bw; + out[4] = ax * bw + ay * bz - az * by; + out[5] = ay * bw + az * bx - ax * bz; + out[6] = az * bw + ax * by - ay * bx; + out[7] = -ax * bx - ay * by - az * bz; + return out; + } + /** + * Sets a {@link Quat2} from a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param t - translation vector + * @returns `out` + */ + }, { + key: "fromTranslation", + value: function fromTranslation(out, t) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = t[0] * 0.5; + out[5] = t[1] * 0.5; + out[6] = t[2] * 0.5; + out[7] = 0; + return out; + } + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @returns `out` + */ + }, { + key: "fromRotation", + value: function fromRotation(out, q) { + out[0] = q[0]; + out[1] = q[1]; + out[2] = q[2]; + out[3] = q[3]; + out[4] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + return out; + } + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param a - the matrix + * @returns `out` + */ + }, { + key: "fromMat4", + value: function fromMat4(out, a) { + Mat4.getRotation(__privateGet(_Quat2, _TMP_QUAT), a); + Mat4.getTranslation(__privateGet(_Quat2, _TMP_VEC33), a); + return _Quat2.fromRotationTranslation(out, __privateGet(_Quat2, _TMP_QUAT), __privateGet(_Quat2, _TMP_VEC33)); + } + /** + * Copy the values from one {@link Quat2} to another + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the source dual quaternion + * @returns `out` + */ + }, { + key: "copy", + value: function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + return out; + } + /** + * Set a {@link Quat2} to the identity dual quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @returns `out` + */ + }, { + key: "identity", + value: function identity(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + return out; + } + /** + * Set the components of a {@link Quat2} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns `out` + */ + }, { + key: "set", + value: function set(out, x1, y1, z1, w1, x2, y2, z2, w2) { + out[0] = x1; + out[1] = y1; + out[2] = z1; + out[3] = w1; + out[4] = x2; + out[5] = y2; + out[6] = z2; + out[7] = w2; + return out; + } + /** + * Gets the real part of a dual quat + * @category Static + * + * @param out - real part + * @param a - Dual Quaternion + * @return `out` + */ + }, { + key: "getReal", + value: function getReal(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Gets the dual part of a dual quat + * @category Static + * + * @param out - dual part + * @param a - Dual Quaternion + * @return `out` + */ + }, { + key: "getDual", + value: function getDual(out, a) { + out[0] = a[4]; + out[1] = a[5]; + out[2] = a[6]; + out[3] = a[7]; + return out; + } + /** + * Set the real component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the real part + * @return `out` + */ + }, { + key: "setReal", + value: function setReal(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Set the dual component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the dual part + * @return `out` + */ + }, { + key: "setDual", + value: function setDual(out, a) { + out[4] = a[0]; + out[5] = a[1]; + out[6] = a[2]; + out[7] = a[3]; + return out; + } + /** + * Gets the translation of a normalized {@link Quat2} + * @category Static + * + * @param out - the receiving translation vector + * @param a - Dual Quaternion to be decomposed + * @return `out` + */ + }, { + key: "getTranslation", + value: function getTranslation(out, a) { + var ax = a[4]; + var ay = a[5]; + var az = a[6]; + var aw = a[7]; + var bx = -a[0]; + var by = -a[1]; + var bz = -a[2]; + var bw = a[3]; + out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; + out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; + out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + return out; + } + /** + * Translates a {@link Quat2} by the given vector + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to translate + * @param v - vector to translate by + * @returns `out` + */ + }, { + key: "translate", + value: function translate(out, a, v) { + var ax1 = a[0]; + var ay1 = a[1]; + var az1 = a[2]; + var aw1 = a[3]; + var bx1 = v[0] * 0.5; + var by1 = v[1] * 0.5; + var bz1 = v[2] * 0.5; + var ax2 = a[4]; + var ay2 = a[5]; + var az2 = a[6]; + var aw2 = a[7]; + out[0] = ax1; + out[1] = ay1; + out[2] = az1; + out[3] = aw1; + out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2; + out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2; + out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2; + out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2; + return out; + } + /** + * Rotates a {@link Quat2} around the X axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + }, { + key: "rotateX", + value: function rotateX(out, a, rad) { + var bx = -a[0]; + var by = -a[1]; + var bz = -a[2]; + var bw = a[3]; + var ax = a[4]; + var ay = a[5]; + var az = a[6]; + var aw = a[7]; + var ax1 = ax * bw + aw * bx + ay * bz - az * by; + var ay1 = ay * bw + aw * by + az * bx - ax * bz; + var az1 = az * bw + aw * bz + ax * by - ay * bx; + var aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateX(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} around the Y axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + }, { + key: "rotateY", + value: function rotateY(out, a, rad) { + var bx = -a[0]; + var by = -a[1]; + var bz = -a[2]; + var bw = a[3]; + var ax = a[4]; + var ay = a[5]; + var az = a[6]; + var aw = a[7]; + var ax1 = ax * bw + aw * bx + ay * bz - az * by; + var ay1 = ay * bw + aw * by + az * bx - ax * bz; + var az1 = az * bw + aw * bz + ax * by - ay * bx; + var aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateY(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} around the Z axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + }, { + key: "rotateZ", + value: function rotateZ(out, a, rad) { + var bx = -a[0]; + var by = -a[1]; + var bz = -a[2]; + var bw = a[3]; + var ax = a[4]; + var ay = a[5]; + var az = a[6]; + var aw = a[7]; + var ax1 = ax * bw + aw * bx + ay * bz - az * by; + var ay1 = ay * bw + aw * by + az * bx - ax * bz; + var az1 = az * bw + aw * bz + ax * by - ay * bx; + var aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateZ(out, a, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + /** + * Rotates a {@link Quat2} by a given quaternion (a * q) + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param q - quaternion to rotate by + * @returns `out` + */ + }, { + key: "rotateByQuatAppend", + value: function rotateByQuatAppend(out, a, q) { + var qx = q[0]; + var qy = q[1]; + var qz = q[2]; + var qw = q[3]; + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + var aw = a[3]; + out[0] = ax * qw + aw * qx + ay * qz - az * qy; + out[1] = ay * qw + aw * qy + az * qx - ax * qz; + out[2] = az * qw + aw * qz + ax * qy - ay * qx; + out[3] = aw * qw - ax * qx - ay * qy - az * qz; + ax = a[4]; + ay = a[5]; + az = a[6]; + aw = a[7]; + out[4] = ax * qw + aw * qx + ay * qz - az * qy; + out[5] = ay * qw + aw * qy + az * qx - ax * qz; + out[6] = az * qw + aw * qz + ax * qy - ay * qx; + out[7] = aw * qw - ax * qx - ay * qy - az * qz; + return out; + } + /** + * Rotates a {@link Quat2} by a given quaternion (q * a) + * @category Static + * + * @param out - the receiving dual quaternion + * @param q - quaternion to rotate by + * @param a - the dual quaternion to rotate + * @returns `out` + */ + }, { + key: "rotateByQuatPrepend", + value: function rotateByQuatPrepend(out, q, a) { + var qx = q[0]; + var qy = q[1]; + var qz = q[2]; + var qw = q[3]; + var bx = a[0]; + var by = a[1]; + var bz = a[2]; + var bw = a[3]; + out[0] = qx * bw + qw * bx + qy * bz - qz * by; + out[1] = qy * bw + qw * by + qz * bx - qx * bz; + out[2] = qz * bw + qw * bz + qx * by - qy * bx; + out[3] = qw * bw - qx * bx - qy * by - qz * bz; + bx = a[4]; + by = a[5]; + bz = a[6]; + bw = a[7]; + out[4] = qx * bw + qw * bx + qy * bz - qz * by; + out[5] = qy * bw + qw * by + qz * bx - qx * bz; + out[6] = qz * bw + qw * bz + qx * by - qy * bx; + out[7] = qw * bw - qx * bx - qy * by - qz * bz; + return out; + } + /** + * Rotates a {@link Quat2} around a given axis. Does the normalization automatically + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param axis - the axis to rotate around + * @param rad - how far the rotation should be + * @returns `out` + */ + }, { + key: "rotateAroundAxis", + value: function rotateAroundAxis(out, a, axis, rad) { + if (Math.abs(rad) < GLM_EPSILON) { + return _Quat2.copy(out, a); + } + var axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]); + rad *= 0.5; + var s = Math.sin(rad); + var bx = s * axis[0] / axisLength; + var by = s * axis[1] / axisLength; + var bz = s * axis[2] / axisLength; + var bw = Math.cos(rad); + var ax1 = a[0]; + var ay1 = a[1]; + var az1 = a[2]; + var aw1 = a[3]; + out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + var ax = a[4]; + var ay = a[5]; + var az = a[6]; + var aw = a[7]; + out[4] = ax * bw + aw * bx + ay * bz - az * by; + out[5] = ay * bw + aw * by + az * bx - ax * bz; + out[6] = az * bw + aw * bz + ax * by - ay * bx; + out[7] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + /** + * Adds two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + }, { + key: "add", + value: function add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + return out; + } + /** + * Multiplies two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns {quat2} out + */ + }, { + key: "multiply", + value: function multiply(out, a, b) { + var ax0 = a[0]; + var ay0 = a[1]; + var az0 = a[2]; + var aw0 = a[3]; + var bx1 = b[4]; + var by1 = b[5]; + var bz1 = b[6]; + var bw1 = b[7]; + var ax1 = a[4]; + var ay1 = a[5]; + var az1 = a[6]; + var aw1 = a[7]; + var bx0 = b[0]; + var by0 = b[1]; + var bz0 = b[2]; + var bw0 = b[3]; + out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0; + out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0; + out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0; + out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0; + out[4] = ax0 * bw1 + aw0 * bx1 + ay0 * bz1 - az0 * by1 + ax1 * bw0 + aw1 * bx0 + ay1 * bz0 - az1 * by0; + out[5] = ay0 * bw1 + aw0 * by1 + az0 * bx1 - ax0 * bz1 + ay1 * bw0 + aw1 * by0 + az1 * bx0 - ax1 * bz0; + out[6] = az0 * bw1 + aw0 * bz1 + ax0 * by1 - ay0 * bx1 + az1 * bw0 + aw1 * bz0 + ax1 * by0 - ay1 * bx0; + out[7] = aw0 * bw1 - ax0 * bx1 - ay0 * by1 - az0 * bz1 + aw1 * bw0 - ax1 * bx0 - ay1 * by0 - az1 * bz0; + return out; + } + /** + * Alias for {@link Quat2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "mul", + value: function mul(out, a, b) { + return out; + } + /** + * Scales a {@link Quat2} by a scalar value + * @category Static + * + * @param out - the receiving dual quaterion + * @param a - the dual quaternion to scale + * @param b - scalar value to scale the dual quaterion by + * @returns `out` + */ + }, { + key: "scale", + value: function scale(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + return out; + } + /** + * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts) + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "dot", + value: function dot(a, b) { + return 0; + } + /** + * Performs a linear interpolation between two {@link Quat2}s + * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`) + * @category Static + * + * @param out - the receiving dual quat + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + }, { + key: "lerp", + value: function lerp(out, a, b, t) { + var mt = 1 - t; + if (_Quat2.dot(a, b) < 0) { + t = -t; + } + out[0] = a[0] * mt + b[0] * t; + out[1] = a[1] * mt + b[1] * t; + out[2] = a[2] * mt + b[2] * t; + out[3] = a[3] * mt + b[3] * t; + out[4] = a[4] * mt + b[4] * t; + out[5] = a[5] * mt + b[5] * t; + out[6] = a[6] * mt + b[6] * t; + out[7] = a[7] * mt + b[7] * t; + return out; + } + /** + * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quat to calculate inverse of + * @returns `out` + */ + }, { + key: "invert", + value: function invert(out, a) { + var sqlen = _Quat2.squaredLength(a); + out[0] = -a[0] / sqlen; + out[1] = -a[1] / sqlen; + out[2] = -a[2] / sqlen; + out[3] = a[3] / sqlen; + out[4] = -a[4] / sqlen; + out[5] = -a[5] / sqlen; + out[6] = -a[6] / sqlen; + out[7] = a[7] / sqlen; + return out; + } + /** + * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than + * {@link Quat2.invert} and produces the same result. + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to calculate conjugate of + * @returns `out` + */ + }, { + key: "conjugate", + value: function conjugate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + out[4] = -a[4]; + out[5] = -a[5]; + out[6] = -a[6]; + out[7] = a[7]; + return out; + } + /** + * Calculates the magnitude (length) of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate length of + * @returns length of `a` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "magnitude", + value: function magnitude(a) { + return 0; + } + /** + * Alias for {@link Quat2.magnitude} + * @category Static + */ + }, { + key: "mag", + value: function mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + }, { + key: "length", + value: function length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.mag} + */ + }, { + key: "len", + value: function len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate squared length of + * @returns squared length of a + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "squaredLength", + value: function squaredLength(a) { + return 0; + } + /** + * Alias for {@link Quat2.squaredLength} + * @category Static + */ + }, { + key: "sqrLen", + value: function sqrLen(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Normalize a {@link Quat2} + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to normalize + * @returns `out` + */ + }, { + key: "normalize", + value: function normalize(out, a) { + var magnitude = _Quat2.squaredLength(a); + if (magnitude > 0) { + magnitude = Math.sqrt(magnitude); + var a0 = a[0] / magnitude; + var a1 = a[1] / magnitude; + var a2 = a[2] / magnitude; + var a3 = a[3] / magnitude; + var b0 = a[4]; + var b1 = a[5]; + var b2 = a[6]; + var b3 = a[7]; + var a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3; + out[0] = a0; + out[1] = a1; + out[2] = a2; + out[3] = a3; + out[4] = (b0 - a0 * a_dot_b) / magnitude; + out[5] = (b1 - a1 * a_dot_b) / magnitude; + out[6] = (b2 - a2 * a_dot_b) / magnitude; + out[7] = (b3 - a3 * a_dot_b) / magnitude; + } + return out; + } + /** + * Returns a string representation of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to represent as a string + * @returns string representation of the vector + */ + }, { + key: "str", + value: function str(a) { + return "Quat2(".concat(a.join(", "), ")"); + } + /** + * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + }, { + key: "exactEquals", + value: function exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7]; + } + /** + * Returns whether the {@link Quat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + }, { + key: "equals", + value: function equals(a, b) { + var a0 = a[0]; + var a1 = a[1]; + var a2 = a[2]; + var a3 = a[3]; + var a4 = a[4]; + var a5 = a[5]; + var a6 = a[6]; + var a7 = a[7]; + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; + var b4 = b[4]; + var b5 = b[5]; + var b6 = b[6]; + var b7 = b[7]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float64Array)); + _TMP_QUAT = new WeakMap(); + _TMP_VEC33 = new WeakMap(); + // Temporary variables to prevent repeated allocations in the algorithms within Quat2. + // These are declared as TypedArrays to aid in tree-shaking. + __privateAdd(_Quat2, _TMP_QUAT, new Float64Array(4)); + __privateAdd(_Quat2, _TMP_VEC33, new Float64Array(3)); + var Quat2 = _Quat2; + Quat2.dot = Quat.dot; + Quat2.squaredLength = Quat.squaredLength; + Quat2.sqrLen = Quat.squaredLength; + Quat2.mag = Quat.magnitude; + Quat2.length = Quat.magnitude; + Quat2.len = Quat.magnitude; + Quat2.mul = Quat2.multiply; + + // src/_lib/f64/Vec2.ts + var Vec2 = /*#__PURE__*/function (_Float64Array9) { + /** + * Create a {@link Vec2}. + * + * @category Constructor + */ + function _Vec2() { + var _this9; + _classCallCheck(this, _Vec2); + switch (arguments.length) { + case 2: + { + var v = arguments.length <= 0 ? undefined : arguments[0]; + if (typeof v === "number") { + _this9 = _callSuper(this, _Vec2, [[v, arguments.length <= 1 ? undefined : arguments[1]]]); + } else { + _this9 = _callSuper(this, _Vec2, [v, arguments.length <= 1 ? undefined : arguments[1], 2]); + } + break; + } + case 1: + { + var _v = arguments.length <= 0 ? undefined : arguments[0]; + if (typeof _v === "number") { + _this9 = _callSuper(this, _Vec2, [[_v, _v]]); + } else { + _this9 = _callSuper(this, _Vec2, [_v, 0, 2]); + } + break; + } + default: + _this9 = _callSuper(this, _Vec2, [2]); + break; + } + return _assertThisInitialized(_this9); + } + // ============ + // Accessors + // ============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + _inherits(_Vec2, _Float64Array9); + return _createClass(_Vec2, [{ + key: "x", + get: function get() { + return this[0]; + }, + set: function set(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + }, { + key: "y", + get: function get() { + return this[1]; + }, + set: function set(value) { + this[1] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + }, { + key: "r", + get: function get() { + return this[0]; + }, + set: function set(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + }, { + key: "g", + get: function get() { + return this[1]; + }, + set: function set(value) { + this[1] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec2.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + }, { + key: "magnitude", + get: function get() { + return Math.hypot(this[0], this[1]); + } + /** + * Alias for {@link Vec2.magnitude} + * + * @category Accessors + */ + }, { + key: "mag", + get: function get() { + return this.magnitude; + } + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec2.squaredMagnitude(this);` + * + * @category Accessors + */ + }, { + key: "squaredMagnitude", + get: function get() { + var x = this[0]; + var y = this[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.squaredMagnitude} + * + * @category Accessors + */ + }, { + key: "sqrMag", + get: function get() { + return this.squaredMagnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec2.str(this);` + * + * @category Accessors + */ + }, { + key: "str", + get: function get() { + return _Vec2.str(this); + } + // =================== + // Instances methods + // =================== + /** + * Copy the values from another {@link Vec2} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + }, { + key: "copy", + value: function copy(a) { + this.set(a); + return this; + } + // Instead of zero(), use a.fill(0) for instances; + /** + * Adds a {@link Vec2} to `this`. + * Equivalent to `Vec2.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + }, { + key: "add", + value: function add(b) { + this[0] += b[0]; + this[1] += b[1]; + return this; + } + /** + * Subtracts a {@link Vec2} from `this`. + * Equivalent to `Vec2.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + }, { + key: "subtract", + value: function subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + return this; + } + /** + * Alias for {@link Vec2.subtract} + * @category Methods + */ + }, { + key: "sub", + value: function sub(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Multiplies `this` by a {@link Vec2}. + * Equivalent to `Vec2.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + }, { + key: "multiply", + value: function multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + return this; + } + /** + * Alias for {@link Vec2.multiply} + * @category Methods + */ + }, { + key: "mul", + value: function mul(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Divides `this` by a {@link Vec2}. + * Equivalent to `Vec2.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + }, { + key: "divide", + value: function divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + return this; + } + /** + * Alias for {@link Vec2.divide} + * @category Methods + */ + }, { + key: "div", + value: function div(b) { + return this; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec2.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + }, { + key: "scale", + value: function scale(b) { + this[0] *= b; + this[1] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + return this; + } + /** + * Calculates the Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + }, { + key: "distance", + value: function distance(b) { + return _Vec2.distance(this, b); + } + /** + * Alias for {@link Vec2.distance} + * @category Methods + */ + }, { + key: "dist", + value: function dist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + }, { + key: "squaredDistance", + value: function squaredDistance(b) { + return _Vec2.squaredDistance(this, b); + } + /** + * Alias for {@link Vec2.squaredDistance} + * @category Methods + */ + }, { + key: "sqrDist", + value: function sqrDist(b) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Negates the components of `this`. + * Equivalent to `Vec2.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "negate", + value: function negate() { + this[0] *= -1; + this[1] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec2.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "invert", + value: function invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + return this; + } + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec2.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "abs", + value: function abs() { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + return this; + } + /** + * Calculates the dot product of this and another {@link Vec2}. + * Equivalent to `Vec2.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + }, { + key: "dot", + value: function dot(b) { + return this[0] * b[0] + this[1] * b[1]; + } + /** + * Normalize `this`. + * Equivalent to `Vec2.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + }, { + key: "normalize", + value: function normalize() { + return _Vec2.normalize(this, this); + } + // =================== + // Static accessors + // =================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec2}. + */ + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 2 * Float64Array.BYTES_PER_ELEMENT; + } + // =================== + // Static methods + // =================== + /** + * Creates a new, empty {@link Vec2} + * @category Static + * + * @returns A new 2D vector + */ + }, { + key: "create", + value: function create() { + return new _Vec2(); + } + /** + * Creates a new {@link Vec2} initialized with values from an existing vector + * @category Static + * + * @param a - Vector to clone + * @returns A new 2D vector + */ + }, { + key: "clone", + value: function clone(a) { + return new _Vec2(a); + } + /** + * Creates a new {@link Vec2} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @returns A new 2D vector + */ + }, { + key: "fromValues", + value: function fromValues(x, y) { + return new _Vec2(x, y); + } + /** + * Copy the values from one {@link Vec2} to another + * @category Static + * + * @param out - the receiving vector + * @param a - The source vector + * @returns `out` + */ + }, { + key: "copy", + value: function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + return out; + } + /** + * Set the components of a {@link Vec2} to the given values + * @category Static + * + * @param out - The receiving vector + * @param x - X component + * @param y - Y component + * @returns `out` + */ + }, { + key: "set", + value: function set(out, x, y) { + out[0] = x; + out[1] = y; + return out; + } + /** + * Adds two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "add", + value: function add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "subtract", + value: function subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + return out; + } + /** + * Alias for {@link Vec2.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sub", + value: function sub(out, a, b) { + return [0, 0]; + } + /** + * Multiplies two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "multiply", + value: function multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + return out; + } + /** + * Alias for {@link Vec2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "mul", + value: function mul(out, a, b) { + return [0, 0]; + } + /** + * Divides two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "divide", + value: function divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + return out; + } + /** + * Alias for {@link Vec2.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "div", + value: function div(out, a, b) { + return [0, 0]; + } + /** + * Math.ceil the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to ceil + * @returns `out` + */ + }, { + key: "ceil", + value: function ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + return out; + } + /** + * Math.floor the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to floor + * @returns `out` + */ + }, { + key: "floor", + value: function floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + return out; + } + /** + * Returns the minimum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "min", + value: function min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + return out; + } + /** + * Returns the maximum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "max", + value: function max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + return out; + } + /** + * Math.round the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to round + * @returns `out` + */ + }, { + key: "round", + value: function round(out, a) { + out[0] = Math.round(a[0]); + out[1] = Math.round(a[1]); + return out; + } + /** + * Scales a {@link Vec2} by a scalar number + * @category Static + * + * @param out - The receiving vector + * @param a - The vector to scale + * @param b - Amount to scale the vector by + * @returns `out` + */ + }, { + key: "scale", + value: function scale(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + return out; + } + /** + * Adds two Vec2's after scaling the second operand by a scalar value + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param scale - The amount to scale b by before adding + * @returns `out` + */ + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + return out; + } + /** + * Calculates the Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns distance between `a` and `b` + */ + }, { + key: "distance", + value: function distance(a, b) { + return Math.hypot(b[0] - a[0], b[1] - a[1]); + } + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "dist", + value: function dist(a, b) { + return 0; + } + /** + * Calculates the squared Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Squared distance between `a` and `b` + */ + }, { + key: "squaredDistance", + value: function squaredDistance(a, b) { + var x = b[0] - a[0]; + var y = b[1] - a[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sqrDist", + value: function sqrDist(a, b) { + return 0; + } + /** + * Calculates the magnitude (length) of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + }, { + key: "magnitude", + value: function magnitude(a) { + var x = a[0]; + var y = a[1]; + return Math.sqrt(x * x + y * y); + } + /** + * Alias for {@link Vec2.magnitude} + * @category Static + */ + }, { + key: "mag", + value: function mag(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + // Length conflicts with Function.length + }, { + key: "length", + value: function length(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.mag} + */ + }, { + key: "len", + value: function len(a) { + return 0; + } + // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Calculates the squared length of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate squared length of + * @returns Squared length of a + */ + }, { + key: "squaredLength", + value: function squaredLength(a) { + var x = a[0]; + var y = a[1]; + return x * x + y * y; + } + /** + * Alias for {@link Vec2.squaredLength} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + }, { + key: "sqrLen", + value: function sqrLen(a, b) { + return 0; + } + /** + * Negates the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to negate + * @returns `out` + */ + }, { + key: "negate", + value: function negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + return out; + } + /** + * Returns the inverse of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to invert + * @returns `out` + */ + }, { + key: "inverse", + value: function inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + return out; + } + /** + * Returns the absolute value of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + }, { + key: "abs", + value: function abs(out, a) { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + return out; + } + /** + * Normalize a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to normalize + * @returns `out` + */ + }, { + key: "normalize", + value: function normalize(out, a) { + var x = a[0]; + var y = a[1]; + var len = x * x + y * y; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + return out; + } + /** + * Calculates the dot product of two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Dot product of `a` and `b` + */ + }, { + key: "dot", + value: function dot(a, b) { + return a[0] * b[0] + a[1] * b[1]; + } + /** + * Computes the cross product of two {@link Vec2}s + * Note that the cross product must by definition produce a 3D vector. + * For this reason there is also not instance equivalent for this function. + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + }, { + key: "cross", + value: function cross(out, a, b) { + var z = a[0] * b[1] - a[1] * b[0]; + out[0] = out[1] = 0; + out[2] = z; + return out; + } + /** + * Performs a linear interpolation between two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param t - Interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + }, { + key: "lerp", + value: function lerp(out, a, b, t) { + var ax = a[0]; + var ay = a[1]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat2} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + }, { + key: "transformMat2", + value: function transformMat2(out, a, m) { + var x = a[0]; + var y = a[1]; + out[0] = m[0] * x + m[2] * y; + out[1] = m[1] * x + m[3] * y; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat2d} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + }, { + key: "transformMat2d", + value: function transformMat2d(out, a, m) { + var x = a[0]; + var y = a[1]; + out[0] = m[0] * x + m[2] * y + m[4]; + out[1] = m[1] * x + m[3] * y + m[5]; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat3} + * 3rd vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + }, { + key: "transformMat3", + value: function transformMat3(out, a, m) { + var x = a[0]; + var y = a[1]; + out[0] = m[0] * x + m[3] * y + m[6]; + out[1] = m[1] * x + m[4] * y + m[7]; + return out; + } + /** + * Transforms the {@link Vec2} with a {@link Mat4} + * 3rd vector component is implicitly '0' + * 4th vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + }, { + key: "transformMat4", + value: function transformMat4(out, a, m) { + var x = a[0]; + var y = a[1]; + out[0] = m[0] * x + m[4] * y + m[12]; + out[1] = m[1] * x + m[5] * y + m[13]; + return out; + } + /** + * Rotate a 2D vector + * @category Static + * + * @param out - The receiving {@link Vec2} + * @param a - The {@link Vec2} point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + }, { + key: "rotate", + value: function rotate(out, a, b, rad) { + var p0 = a[0] - b[0]; + var p1 = a[1] - b[1]; + var sinC = Math.sin(rad); + var cosC = Math.cos(rad); + out[0] = p0 * cosC - p1 * sinC + b[0]; + out[1] = p0 * sinC + p1 * cosC + b[1]; + return out; + } + /** + * Get the angle between two 2D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + }, { + key: "angle", + value: function angle(a, b) { + var x1 = a[0]; + var y1 = a[1]; + var x2 = b[0]; + var y2 = b[1]; + var mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2); + var cosine = mag && (x1 * x2 + y1 * y2) / mag; + return Math.acos(Math.min(Math.max(cosine, -1), 1)); + } + /** + * Set the components of a {@link Vec2} to zero + * @category Static + * + * @param out - The receiving vector + * @returns `out` + */ + }, { + key: "zero", + value: function zero(out) { + out[0] = 0; + out[1] = 0; + return out; + } + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors components are ===, `false` otherwise. + */ + }, { + key: "exactEquals", + value: function exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1]; + } + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors are approximately equal, `false` otherwise. + */ + }, { + key: "equals", + value: function equals(a, b) { + var a0 = a[0]; + var a1 = a[1]; + var b0 = b[0]; + var b1 = b[1]; + return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)); + } + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - Vector to represent as a string + * @returns String representation of the vector + */ + }, { + key: "str", + value: function str(a) { + return "Vec2(".concat(a.join(", "), ")"); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float64Array)); + Vec2.prototype.sub = Vec2.prototype.subtract; + Vec2.prototype.mul = Vec2.prototype.multiply; + Vec2.prototype.div = Vec2.prototype.divide; + Vec2.prototype.dist = Vec2.prototype.distance; + Vec2.prototype.sqrDist = Vec2.prototype.squaredDistance; + Vec2.sub = Vec2.subtract; + Vec2.mul = Vec2.multiply; + Vec2.div = Vec2.divide; + Vec2.dist = Vec2.distance; + Vec2.sqrDist = Vec2.squaredDistance; + Vec2.sqrLen = Vec2.squaredLength; + Vec2.mag = Vec2.magnitude; + Vec2.length = Vec2.magnitude; + Vec2.len = Vec2.magnitude; + + // src/swizzle/f64/index.ts + var GLM_SWIZZLES_ENABLED_F64 = false; + function EnableSwizzlesF64() { + if (GLM_SWIZZLES_ENABLED_F64) { + return; + } + var VEC2_SWIZZLES = ["xx", "xy", "yx", "yy", "xxx", "xxy", "xyx", "xyy", "yxx", "yxy", "yyx", "yyy", "xxxx", "xxxy", "xxyx", "xxyy", "xyxx", "xyxy", "xyyx", "xyyy", "yxxx", "yxxy", "yxyx", "yxyy", "yyxx", "yyxy", "yyyx", "yyyy", "rr", "rg", "gr", "gg", "rrr", "rrg", "rgr", "rgg", "grr", "grg", "ggr", "ggg", "rrrr", "rrrg", "rrgr", "rrgg", "rgrr", "rgrg", "rggr", "rggg", "grrr", "grrg", "grgr", "grgg", "ggrr", "ggrg", "gggr", "gggg"]; + var VEC3_SWIZZLES = ["xz", "yz", "zx", "zy", "zz", "xxz", "xyz", "xzx", "xzy", "xzz", "yxz", "yyz", "yzx", "yzy", "yzz", "zxx", "zxy", "zxz", "zyx", "zyy", "zyz", "zzx", "zzy", "zzz", "xxxz", "xxyz", "xxzx", "xxzy", "xxzz", "xyxz", "xyyz", "xyzx", "xyzy", "xyzz", "xzxx", "xzxy", "xzxz", "xzyx", "xzyy", "xzyz", "xzzx", "xzzy", "xzzz", "yxxz", "yxyz", "yxzx", "yxzy", "yxzz", "yyxz", "yyyz", "yyzx", "yyzy", "yyzz", "yzxx", "yzxy", "yzxz", "yzyx", "yzyy", "yzyz", "yzzx", "yzzy", "yzzz", "zxxx", "zxxy", "zxxz", "zxyx", "zxyy", "zxyz", "zxzx", "zxzy", "zxzz", "zyxx", "zyxy", "zyxz", "zyyx", "zyyy", "zyyz", "zyzx", "zyzy", "zyzz", "zzxx", "zzxy", "zzxz", "zzyx", "zzyy", "zzyz", "zzzx", "zzzy", "zzzz", "rb", "gb", "br", "bg", "bb", "rrb", "rgb", "rbr", "rbg", "rbb", "grb", "ggb", "gbr", "gbg", "gbb", "brr", "brg", "brb", "bgr", "bgg", "bgb", "bbr", "bbg", "bbb", "rrrb", "rrgb", "rrbr", "rrbg", "rrbb", "rgrb", "rggb", "rgbr", "rgbg", "rgbb", "rbrr", "rbrg", "rbrb", "rbgr", "rbgg", "rbgb", "rbbr", "rbbg", "rbbb", "grrb", "grgb", "grbr", "grbg", "grbb", "ggrb", "gggb", "ggbr", "ggbg", "ggbb", "gbrr", "gbrg", "gbrb", "gbgr", "gbgg", "gbgb", "gbbr", "gbbg", "gbbb", "brrr", "brrg", "brrb", "brgr", "brgg", "brgb", "brbr", "brbg", "brbb", "bgrr", "bgrg", "bgrb", "bggr", "bggg", "bggb", "bgbr", "bgbg", "bgbb", "bbrr", "bbrg", "bbrb", "bbgr", "bbgg", "bbgb", "bbbr", "bbbg", "bbbb"]; + var VEC4_SWIZZLES = ["xw", "yw", "zw", "wx", "wy", "wz", "ww", "xxw", "xyw", "xzw", "xwx", "xwy", "xwz", "xww", "yxw", "yyw", "yzw", "ywx", "ywy", "ywz", "yww", "zxw", "zyw", "zzw", "zwx", "zwy", "zwz", "zww", "wxx", "wxy", "wxz", "wxw", "wyx", "wyy", "wyz", "wyw", "wzx", "wzy", "wzz", "wzw", "wwx", "wwy", "wwz", "www", "xxxw", "xxyw", "xxzw", "xxwx", "xxwy", "xxwz", "xxww", "xyxw", "xyyw", "xyzw", "xywx", "xywy", "xywz", "xyww", "xzxw", "xzyw", "xzzw", "xzwx", "xzwy", "xzwz", "xzww", "xwxx", "xwxy", "xwxz", "xwxw", "xwyx", "xwyy", "xwyz", "xwyw", "xwzx", "xwzy", "xwzz", "xwzw", "xwwx", "xwwy", "xwwz", "xwww", "yxxw", "yxyw", "yxzw", "yxwx", "yxwy", "yxwz", "yxww", "yyxw", "yyyw", "yyzw", "yywx", "yywy", "yywz", "yyww", "yzxw", "yzyw", "yzzw", "yzwx", "yzwy", "yzwz", "yzww", "ywxx", "ywxy", "ywxz", "ywxw", "ywyx", "ywyy", "ywyz", "ywyw", "ywzx", "ywzy", "ywzz", "ywzw", "ywwx", "ywwy", "ywwz", "ywww", "zxxw", "zxyw", "zxzw", "zxwx", "zxwy", "zxwz", "zxww", "zyxw", "zyyw", "zyzw", "zywx", "zywy", "zywz", "zyww", "zzxw", "zzyw", "zzzw", "zzwx", "zzwy", "zzwz", "zzww", "zwxx", "zwxy", "zwxz", "zwxw", "zwyx", "zwyy", "zwyz", "zwyw", "zwzx", "zwzy", "zwzz", "zwzw", "zwwx", "zwwy", "zwwz", "zwww", "wxxx", "wxxy", "wxxz", "wxxw", "wxyx", "wxyy", "wxyz", "wxyw", "wxzx", "wxzy", "wxzz", "wxzw", "wxwx", "wxwy", "wxwz", "wxww", "wyxx", "wyxy", "wyxz", "wyxw", "wyyx", "wyyy", "wyyz", "wyyw", "wyzx", "wyzy", "wyzz", "wyzw", "wywx", "wywy", "wywz", "wyww", "wzxx", "wzxy", "wzxz", "wzxw", "wzyx", "wzyy", "wzyz", "wzyw", "wzzx", "wzzy", "wzzz", "wzzw", "wzwx", "wzwy", "wzwz", "wzww", "wwxx", "wwxy", "wwxz", "wwxw", "wwyx", "wwyy", "wwyz", "wwyw", "wwzx", "wwzy", "wwzz", "wwzw", "wwwx", "wwwy", "wwwz", "wwww", "ra", "ga", "ba", "ar", "ag", "ab", "aa", "rra", "rga", "rba", "rar", "rag", "rab", "raa", "gra", "gga", "gba", "gar", "gag", "gab", "gaa", "bra", "bga", "bba", "bar", "bag", "bab", "baa", "arr", "arg", "arb", "ara", "agr", "agg", "agb", "aga", "abr", "abg", "abb", "aba", "aar", "aag", "aab", "aaa", "rrra", "rrga", "rrba", "rrar", "rrag", "rrab", "rraa", "rgra", "rgga", "rgba", "rgar", "rgag", "rgab", "rgaa", "rbra", "rbga", "rbba", "rbar", "rbag", "rbab", "rbaa", "rarr", "rarg", "rarb", "rara", "ragr", "ragg", "ragb", "raga", "rabr", "rabg", "rabb", "raba", "raar", "raag", "raab", "raaa", "grra", "grga", "grba", "grar", "grag", "grab", "graa", "ggra", "ggga", "ggba", "ggar", "ggag", "ggab", "ggaa", "gbra", "gbga", "gbba", "gbar", "gbag", "gbab", "gbaa", "garr", "garg", "garb", "gara", "gagr", "gagg", "gagb", "gaga", "gabr", "gabg", "gabb", "gaba", "gaar", "gaag", "gaab", "gaaa", "brra", "brga", "brba", "brar", "brag", "brab", "braa", "bgra", "bgga", "bgba", "bgar", "bgag", "bgab", "bgaa", "bbra", "bbga", "bbba", "bbar", "bbag", "bbab", "bbaa", "barr", "barg", "barb", "bara", "bagr", "bagg", "bagb", "baga", "babr", "babg", "babb", "baba", "baar", "baag", "baab", "baaa", "arrr", "arrg", "arrb", "arra", "argr", "argg", "argb", "arga", "arbr", "arbg", "arbb", "arba", "arar", "arag", "arab", "araa", "agrr", "agrg", "agrb", "agra", "aggr", "aggg", "aggb", "agga", "agbr", "agbg", "agbb", "agba", "agar", "agag", "agab", "agaa", "abrr", "abrg", "abrb", "abra", "abgr", "abgg", "abgb", "abga", "abbr", "abbg", "abbb", "abba", "abar", "abag", "abab", "abaa", "aarr", "aarg", "aarb", "aara", "aagr", "aagg", "aagb", "aaga", "aabr", "aabg", "aabb", "aaba", "aaar", "aaag", "aaab", "aaaa"]; + var SWIZZLE_INDEX = { + x: 0, + r: 0, + y: 1, + g: 1, + z: 2, + b: 2, + w: 3, + a: 3 + }; + function getSwizzleImpl(swizzle) { + switch (swizzle.length) { + case 2: + return function () { + return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]); + }; + case 3: + return function () { + return new Vec3(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]], this[SWIZZLE_INDEX[swizzle[2]]]); + }; + case 4: + return function () { + return new Vec4(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]], this[SWIZZLE_INDEX[swizzle[2]]], this[SWIZZLE_INDEX[swizzle[3]]]); + }; + } + throw new Error("Illegal swizzle length"); + } + for (var _i = 0, _VEC2_SWIZZLES = VEC2_SWIZZLES; _i < _VEC2_SWIZZLES.length; _i++) { + var swizzle = _VEC2_SWIZZLES[_i]; + var impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec2.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec3.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + for (var _i2 = 0, _VEC3_SWIZZLES = VEC3_SWIZZLES; _i2 < _VEC3_SWIZZLES.length; _i2++) { + var _swizzle = _VEC3_SWIZZLES[_i2]; + var _impl = getSwizzleImpl(_swizzle); + Object.defineProperty(Vec3.prototype, _swizzle, { + get: _impl + }); + Object.defineProperty(Vec4.prototype, _swizzle, { + get: _impl + }); + } + for (var _i3 = 0, _VEC4_SWIZZLES = VEC4_SWIZZLES; _i3 < _VEC4_SWIZZLES.length; _i3++) { + var _swizzle2 = _VEC4_SWIZZLES[_i3]; + var _impl2 = getSwizzleImpl(_swizzle2); + Object.defineProperty(Vec4.prototype, _swizzle2, { + get: _impl2 + }); + } + GLM_SWIZZLES_ENABLED_F64 = true; + } + + // src/util/angleConversion.ts + var GLM_DEG_TO_RAD = Math.PI / 180; + var GLM_RAD_TO_DEG = 180 / Math.PI; + function toDegree(value) { + return value * GLM_RAD_TO_DEG; + } + function toRadian(value) { + return value * GLM_DEG_TO_RAD; + } + + exports.EnableSwizzlesF64 = EnableSwizzlesF64; + exports.Mat2 = Mat2; + exports.Mat2d = Mat2d; + exports.Mat3 = Mat3; + exports.Mat4 = Mat4; + exports.Quat = Quat; + exports.Quat2 = Quat2; + exports.Vec2 = Vec2; + exports.Vec3 = Vec3; + exports.Vec4 = Vec4; + exports.toDegree = toDegree; + exports.toRadian = toRadian; + +})); +//# sourceMappingURL=gl-matrix-f64.js.map diff --git a/dist-cdn/umd/gl-matrix-f64.js.map b/dist-cdn/umd/gl-matrix-f64.js.map new file mode 100644 index 00000000..3ca88ac3 --- /dev/null +++ b/dist-cdn/umd/gl-matrix-f64.js.map @@ -0,0 +1 @@ +{"version":3,"file":"gl-matrix-f64.js","sources":["../esm/2016/gl-matrix-f64.js"],"sourcesContent":["// gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library.\n// @author Brandon Jones\n// @author Colin MacKenzie IV\n// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md)\nvar __typeError = (msg) => {\n throw TypeError(msg);\n};\nvar __accessCheck = (obj, member, msg) => member.has(obj) || __typeError(\"Cannot \" + msg);\nvar __privateGet = (obj, member, getter) => (__accessCheck(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj));\nvar __privateAdd = (obj, member, value) => member.has(obj) ? __typeError(\"Cannot add the same private member more than once\") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n\n// src/common/index.ts\nvar GLM_EPSILON = 1e-6;\n\n// src/_lib/f64/Mat2.ts\nvar _IDENTITY_2X2;\nvar _Mat2 = class _Mat2 extends Float64Array {\n /**\n * Create a {@link Mat2}.\n *\n * @category Constructor\n */\n constructor(...values) {\n switch (values.length) {\n case 4:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 4);\n break;\n case 1:\n const v = values[0];\n if (typeof v === \"number\") {\n super([\n v,\n v,\n v,\n v\n ]);\n } else {\n super(v, 0, 4);\n }\n break;\n default:\n super(__privateGet(_Mat2, _IDENTITY_2X2));\n break;\n }\n }\n // ============\n // Accessors\n // ============\n /**\n * A string representation of `this`\n * Equivalent to `Mat2.str(this);`\n *\n * @category Accessors\n */\n get str() {\n return _Mat2.str(this);\n }\n // ===================\n // Instance methods\n // ===================\n /**\n * Copy the values from another {@link Mat2} into `this`.\n *\n * @param a the source vector\n * @returns `this`\n * @category Methods\n */\n copy(a) {\n this.set(a);\n return this;\n }\n /**\n * Set `this` to the identity matrix\n * Equivalent to Mat2.identity(this)\n *\n * @returns `this`\n * @category Methods\n */\n identity() {\n this.set(__privateGet(_Mat2, _IDENTITY_2X2));\n return this;\n }\n /**\n * Multiplies this {@link Mat2} against another one\n * Equivalent to `Mat2.multiply(this, this, b);`\n *\n * @param b - The second operand\n * @returns `this`\n * @category Methods\n */\n multiply(b) {\n return _Mat2.multiply(this, this, b);\n }\n /**\n * Alias for {@link Mat2.multiply}\n * @category Methods\n */\n mul(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Transpose this {@link Mat2}\n * Equivalent to `Mat2.transpose(this, this);`\n *\n * @returns `this`\n * @category Methods\n */\n transpose() {\n return _Mat2.transpose(this, this);\n }\n /**\n * Inverts this {@link Mat2}\n * Equivalent to `Mat4.invert(this, this);`\n *\n * @returns `this`\n * @category Methods\n */\n invert() {\n return _Mat2.invert(this, this);\n }\n /**\n * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization\n * Equivalent to `Mat2.scale(this, this, v);`\n *\n * @param v - The {@link Vec2} to scale the matrix by\n * @returns `this`\n * @category Methods\n */\n scale(v) {\n return _Mat2.scale(this, this, v);\n }\n /**\n * Rotates this {@link Mat2} by the given angle around the given axis\n * Equivalent to `Mat2.rotate(this, this, rad);`\n *\n * @param rad - the angle to rotate the matrix by\n * @returns `this`\n * @category Methods\n */\n rotate(rad) {\n return _Mat2.rotate(this, this, rad);\n }\n // ===================\n // Static accessors\n // ===================\n /**\n * @category Static\n *\n * @returns The number of bytes in a {@link Mat2}.\n */\n static get BYTE_LENGTH() {\n return 4 * Float64Array.BYTES_PER_ELEMENT;\n }\n // ===================\n // Static methods\n // ===================\n /**\n * Creates a new, identity {@link Mat2}\n * @category Static\n *\n * @returns A new {@link Mat2}\n */\n static create() {\n return new _Mat2();\n }\n /**\n * Creates a new {@link Mat2} initialized with values from an existing matrix\n * @category Static\n *\n * @param a - Matrix to clone\n * @returns A new {@link Mat2}\n */\n static clone(a) {\n return new _Mat2(a);\n }\n /**\n * Copy the values from one {@link Mat2} to another\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - Matrix to copy\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n }\n /**\n * Create a new {@link Mat2} with the given values\n * @category Static\n *\n * @param values - Matrix components\n * @returns A new {@link Mat2}\n */\n static fromValues(...values) {\n return new _Mat2(...values);\n }\n /**\n * Set the components of a {@link Mat2} to the given values\n * @category Static\n *\n * @param out - The receiving matrix\n * @param values - Matrix components\n * @returns `out`\n */\n static set(out, ...values) {\n out[0] = values[0];\n out[1] = values[1];\n out[2] = values[2];\n out[3] = values[3];\n return out;\n }\n /**\n * Set a {@link Mat2} to the identity matrix\n * @category Static\n *\n * @param out - The receiving matrix\n * @returns `out`\n */\n static identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n }\n /**\n * Transpose the values of a {@link Mat2}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static transpose(out, a) {\n if (out === a) {\n const a1 = a[1];\n out[1] = a[2];\n out[2] = a1;\n } else {\n out[0] = a[0];\n out[1] = a[2];\n out[2] = a[1];\n out[3] = a[3];\n }\n return out;\n }\n /**\n * Inverts a {@link Mat2}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out` or `null` if the matrix is not invertible\n */\n static invert(out, a) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n let det = a0 * a3 - a2 * a1;\n if (!det) {\n return null;\n }\n det = 1 / det;\n out[0] = a3 * det;\n out[1] = -a1 * det;\n out[2] = -a2 * det;\n out[3] = a0 * det;\n return out;\n }\n /**\n * Calculates the adjugate of a {@link Mat2}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static adjoint(out, a) {\n const a0 = a[0];\n out[0] = a[3];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a0;\n return out;\n }\n /**\n * Calculates the determinant of a {@link Mat2}\n * @category Static\n *\n * @param a - the source matrix\n * @returns determinant of a\n */\n static determinant(a) {\n return a[0] * a[3] - a[2] * a[1];\n }\n /**\n * Adds two {@link Mat2}'s\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n }\n /**\n * Subtracts matrix b from matrix a\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n }\n /**\n * Alias for {@link Mat2.subtract}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sub(out, a, b) {\n return out;\n }\n /**\n * Multiplies two {@link Mat2}s\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n return out;\n }\n /**\n * Alias for {@link Mat2.multiply}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static mul(out, a, b) {\n return out;\n }\n /**\n * Rotates a {@link Mat2} by the given angle\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static rotate(out, a, rad) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n return out;\n }\n /**\n * Scales the {@link Mat2} by the dimensions in the given {@link Vec2}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param v - the {@link Vec2} to scale the matrix by\n * @returns `out`\n **/\n static scale(out, a, v) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const v0 = v[0];\n const v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n return out;\n }\n /**\n * Creates a {@link Mat2} from a given angle around a given axis\n * This is equivalent to (but much faster than):\n * ```js\n * mat2.identity(dest);\n * mat2.rotate(dest, dest, rad);\n * ```\n * @category Static\n *\n * @param out - {@link Mat2} receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static fromRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = -s;\n out[3] = c;\n return out;\n }\n /**\n * Creates a {@link Mat2} from a vector scaling\n * This is equivalent to (but much faster than):\n * ```js\n * mat2.identity(dest);\n * mat2.scale(dest, dest, vec);\n * ```\n * @category Static\n *\n * @param out - {@link Mat2} receiving operation result\n * @param v - Scaling vector\n * @returns `out`\n */\n static fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = v[1];\n return out;\n }\n /**\n * Returns Frobenius norm of a {@link Mat2}\n * @category Static\n *\n * @param a - the matrix to calculate Frobenius norm of\n * @returns Frobenius norm\n */\n static frob(a) {\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]);\n }\n /**\n * Multiply each element of a {@link Mat2} by a scalar.\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param b - amount to scale the matrix's elements by\n * @returns `out`\n */\n static multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n }\n /**\n * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value.\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param scale - the amount to scale b's elements by before adding\n * @returns `out`\n */\n static multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n }\n /**\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\n * @category Static\n *\n * @param L - the lower triangular matrix\n * @param D - the diagonal matrix\n * @param U - the upper triangular matrix\n * @param a - the input matrix to factorize\n */\n static LDU(L, D, U, a) {\n L[2] = a[2] / a[0];\n U[0] = a[0];\n U[1] = a[1];\n U[3] = a[3] - L[2] * U[1];\n return [L, D, U];\n }\n /**\n * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n }\n /**\n * Returns whether two {@link Mat2}s have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3));\n }\n /**\n * Returns a string representation of a {@link Mat2}\n * @category Static\n *\n * @param a - matrix to represent as a string\n * @returns string representation of the matrix\n */\n static str(a) {\n return `Mat2(${a.join(\", \")})`;\n }\n};\n_IDENTITY_2X2 = new WeakMap();\n__privateAdd(_Mat2, _IDENTITY_2X2, new Float64Array([\n 1,\n 0,\n 0,\n 1\n]));\nvar Mat2 = _Mat2;\nMat2.prototype.mul = Mat2.prototype.multiply;\nMat2.mul = Mat2.multiply;\nMat2.sub = Mat2.subtract;\n\n// src/_lib/f64/Mat2d.ts\nvar _IDENTITY_2X3;\nvar _Mat2d = class _Mat2d extends Float64Array {\n /**\n * Create a {@link Mat2}.\n *\n * @category Constructor\n */\n constructor(...values) {\n switch (values.length) {\n case 6:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 6);\n break;\n case 1:\n const v = values[0];\n if (typeof v === \"number\") {\n super([\n v,\n v,\n v,\n v,\n v,\n v\n ]);\n } else {\n super(v, 0, 6);\n }\n break;\n default:\n super(__privateGet(_Mat2d, _IDENTITY_2X3));\n break;\n }\n }\n // ============\n // Accessors\n // ============\n /**\n * A string representation of `this`\n * Equivalent to `Mat2d.str(this);`\n *\n * @category Accessors\n */\n get str() {\n return _Mat2d.str(this);\n }\n // ===================\n // Instances methods\n // ===================\n /**\n * Copy the values from another {@link Mat2d} into `this`.\n * @category Methods\n *\n * @param a the source vector\n * @returns `this`\n */\n copy(a) {\n this.set(a);\n return this;\n }\n /**\n * Set `this` to the identity matrix\n * Equivalent to Mat2d.identity(this)\n * @category Methods\n *\n * @returns `this`\n */\n identity() {\n this.set(__privateGet(_Mat2d, _IDENTITY_2X3));\n return this;\n }\n /**\n * Multiplies this {@link Mat2d} against another one\n * Equivalent to `Mat2d.multiply(this, this, b);`\n * @category Methods\n *\n * @param out - The receiving Matrix\n * @param a - The first operand\n * @param b - The second operand\n * @returns `this`\n */\n multiply(b) {\n return _Mat2d.multiply(this, this, b);\n }\n /**\n * Alias for {@link Mat2d.multiply}\n * @category Methods\n */\n mul(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Translate this {@link Mat2d} by the given vector\n * Equivalent to `Mat2d.translate(this, this, v);`\n * @category Methods\n *\n * @param v - The {@link Vec2} to translate by\n * @returns `this`\n */\n translate(v) {\n return _Mat2d.translate(this, this, v);\n }\n /**\n * Rotates this {@link Mat2d} by the given angle around the given axis\n * Equivalent to `Mat2d.rotate(this, this, rad);`\n * @category Methods\n *\n * @param rad - the angle to rotate the matrix by\n * @returns `this`\n */\n rotate(rad) {\n return _Mat2d.rotate(this, this, rad);\n }\n /**\n * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization\n * Equivalent to `Mat2d.scale(this, this, v);`\n * @category Methods\n *\n * @param v - The {@link Vec2} to scale the matrix by\n * @returns `this`\n */\n scale(v) {\n return _Mat2d.scale(this, this, v);\n }\n // ===================\n // Static accessors\n // ===================\n /**\n * @category Static\n *\n * @returns The number of bytes in a {@link Mat2d}.\n */\n static get BYTE_LENGTH() {\n return 6 * Float64Array.BYTES_PER_ELEMENT;\n }\n // ===================\n // Static methods\n // ===================\n /**\n * Creates a new, identity {@link Mat2d}\n * @category Static\n *\n * @returns A new {@link Mat2d}\n */\n static create() {\n return new _Mat2d();\n }\n /**\n * Creates a new {@link Mat2d} initialized with values from an existing matrix\n * @category Static\n *\n * @param a - Matrix to clone\n * @returns A new {@link Mat2d}\n */\n static clone(a) {\n return new _Mat2d(a);\n }\n /**\n * Copy the values from one {@link Mat2d} to another\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - Matrix to copy\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n return out;\n }\n /**\n * Create a new {@link Mat2d} with the given values\n * @category Static\n *\n * @param values - Matrix components\n * @returns A new {@link Mat2d}\n */\n static fromValues(...values) {\n return new _Mat2d(...values);\n }\n /**\n * Set the components of a {@link Mat2d} to the given values\n * @category Static\n *\n * @param out - The receiving matrix\n * @param values - Matrix components\n * @returns `out`\n */\n static set(out, ...values) {\n out[0] = values[0];\n out[1] = values[1];\n out[2] = values[2];\n out[3] = values[3];\n out[4] = values[4];\n out[5] = values[5];\n return out;\n }\n /**\n * Set a {@link Mat2d} to the identity matrix\n * @category Static\n *\n * @param out - The receiving matrix\n * @returns `out`\n */\n static identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n return out;\n }\n /**\n * Inverts a {@link Mat2d}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out` or `null` if the matrix is not invertible\n */\n static invert(out, a) {\n const aa = a[0];\n const ab = a[1];\n const ac = a[2];\n const ad = a[3];\n const atx = a[4];\n const aty = a[5];\n let det = aa * ad - ab * ac;\n if (!det) {\n return null;\n }\n det = 1 / det;\n out[0] = ad * det;\n out[1] = -ab * det;\n out[2] = -ac * det;\n out[3] = aa * det;\n out[4] = (ac * aty - ad * atx) * det;\n out[5] = (ab * atx - aa * aty) * det;\n return out;\n }\n /**\n * Calculates the determinant of a {@link Mat2d}\n * @category Static\n *\n * @param a - the source matrix\n * @returns determinant of a\n */\n static determinant(a) {\n return a[0] * a[3] - a[1] * a[2];\n }\n /**\n * Adds two {@link Mat2d}'s\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n return out;\n }\n /**\n * Subtracts matrix b from matrix a\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n return out;\n }\n /**\n * Alias for {@link Mat2d.subtract}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sub(out, a, b) {\n return out;\n }\n /**\n * Multiplies two {@link Mat2d}s\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n out[4] = a0 * b4 + a2 * b5 + a4;\n out[5] = a1 * b4 + a3 * b5 + a5;\n return out;\n }\n /**\n * Alias for {@link Mat2d.multiply}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static mul(out, a, b) {\n return out;\n }\n /**\n * Translate a {@link Mat2d} by the given vector\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to translate\n * @param v - vector to translate by\n * @returns `out`\n */\n static translate(out, a, v) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const v0 = v[0];\n const v1 = v[1];\n out[0] = a0;\n out[1] = a1;\n out[2] = a2;\n out[3] = a3;\n out[4] = a0 * v0 + a2 * v1 + a4;\n out[5] = a1 * v0 + a3 * v1 + a5;\n return out;\n }\n /**\n * Rotates a {@link Mat2d} by the given angle\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static rotate(out, a, rad) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n out[4] = a4;\n out[5] = a5;\n return out;\n }\n /**\n * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param v - the {@link Vec2} to scale the matrix by\n * @returns `out`\n **/\n static scale(out, a, v) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const v0 = v[0];\n const v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n out[4] = a4;\n out[5] = a5;\n return out;\n }\n // TODO: Got to fromRotation\n /**\n * Creates a {@link Mat2d} from a vector translation\n * This is equivalent to (but much faster than):\n * ```js\n * Mat2d.identity(dest);\n * Mat2d.translate(dest, dest, vec);\n * ```\n * @category Static\n *\n * @param out - {@link Mat2d} receiving operation result\n * @param v - Translation vector\n * @returns `out`\n */\n static fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = v[0];\n out[5] = v[1];\n return out;\n }\n /**\n * Creates a {@link Mat2d} from a given angle around a given axis\n * This is equivalent to (but much faster than):\n * ```js\n * Mat2d.identity(dest);\n * Mat2d.rotate(dest, dest, rad);\n * ```\n * @category Static\n *\n * @param out - {@link Mat2d} receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static fromRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = -s;\n out[3] = c;\n out[4] = 0;\n out[5] = 0;\n return out;\n }\n /**\n * Creates a {@link Mat2d} from a vector scaling\n * This is equivalent to (but much faster than):\n * ```js\n * Mat2d.identity(dest);\n * Mat2d.scale(dest, dest, vec);\n * ```\n * @category Static\n *\n * @param out - {@link Mat2d} receiving operation result\n * @param v - Scaling vector\n * @returns `out`\n */\n static fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = v[1];\n out[4] = 0;\n out[5] = 0;\n return out;\n }\n /**\n * Returns Frobenius norm of a {@link Mat2d}\n * @category Static\n *\n * @param a - the matrix to calculate Frobenius norm of\n * @returns Frobenius norm\n */\n static frob(a) {\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1);\n }\n /**\n * Multiply each element of a {@link Mat2d} by a scalar.\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param b - amount to scale the matrix's elements by\n * @returns `out`\n */\n static multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n return out;\n }\n /**\n * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value.\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param scale - the amount to scale b's elements by before adding\n * @returns `out`\n */\n static multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n return out;\n }\n /**\n * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===).\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5];\n }\n /**\n * Returns whether two {@link Mat2d}s have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\n return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5));\n }\n /**\n * Returns a string representation of a {@link Mat2d}\n * @category Static\n *\n * @param a - matrix to represent as a string\n * @returns string representation of the matrix\n */\n static str(a) {\n return `Mat2d(${a.join(\", \")})`;\n }\n};\n_IDENTITY_2X3 = new WeakMap();\n__privateAdd(_Mat2d, _IDENTITY_2X3, new Float64Array([\n 1,\n 0,\n 0,\n 1,\n 0,\n 0\n]));\nvar Mat2d = _Mat2d;\nMat2d.mul = Mat2d.multiply;\nMat2d.sub = Mat2d.subtract;\n\n// src/_lib/f64/Mat3.ts\nvar _IDENTITY_3X3;\nvar _Mat3 = class _Mat3 extends Float64Array {\n /**\n * Create a {@link Mat3}.\n *\n * @category Constructor\n */\n constructor(...values) {\n switch (values.length) {\n case 9:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 9);\n break;\n case 1:\n const v = values[0];\n if (typeof v === \"number\") {\n super([\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v\n ]);\n } else {\n super(v, 0, 9);\n }\n break;\n default:\n super(__privateGet(_Mat3, _IDENTITY_3X3));\n break;\n }\n }\n // ============\n // Accessors\n // ============\n /**\n * A string representation of `this`\n * Equivalent to `Mat3.str(this);`\n *\n * @category Accessors\n */\n get str() {\n return _Mat3.str(this);\n }\n // ===================\n // Instance methods\n // ===================\n /**\n * Copy the values from another {@link Mat3} into `this`.\n * @category Methods\n *\n * @param a the source vector\n * @returns `this`\n */\n copy(a) {\n this.set(a);\n return this;\n }\n /**\n * Set `this` to the identity matrix\n * Equivalent to Mat3.identity(this)\n * @category Methods\n *\n * @returns `this`\n */\n identity() {\n this.set(__privateGet(_Mat3, _IDENTITY_3X3));\n return this;\n }\n /**\n * Multiplies this {@link Mat3} against another one\n * Equivalent to `Mat3.multiply(this, this, b);`\n * @category Methods\n *\n * @param out - The receiving Matrix\n * @param a - The first operand\n * @param b - The second operand\n * @returns `this`\n */\n multiply(b) {\n return _Mat3.multiply(this, this, b);\n }\n /**\n * Alias for {@link Mat3.multiply}\n * @category Methods\n */\n mul(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Transpose this {@link Mat3}\n * Equivalent to `Mat3.transpose(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n transpose() {\n return _Mat3.transpose(this, this);\n }\n /**\n * Inverts this {@link Mat3}\n * Equivalent to `Mat4.invert(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n invert() {\n return _Mat3.invert(this, this);\n }\n /**\n * Translate this {@link Mat3} by the given vector\n * Equivalent to `Mat3.translate(this, this, v);`\n * @category Methods\n *\n * @param v - The {@link Vec2} to translate by\n * @returns `this`\n */\n translate(v) {\n return _Mat3.translate(this, this, v);\n }\n /**\n * Rotates this {@link Mat3} by the given angle around the given axis\n * Equivalent to `Mat3.rotate(this, this, rad);`\n * @category Methods\n *\n * @param rad - the angle to rotate the matrix by\n * @returns `this`\n */\n rotate(rad) {\n return _Mat3.rotate(this, this, rad);\n }\n /**\n * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization\n * Equivalent to `Mat3.scale(this, this, v);`\n * @category Methods\n *\n * @param v - The {@link Vec2} to scale the matrix by\n * @returns `this`\n */\n scale(v) {\n return _Mat3.scale(this, this, v);\n }\n // ===================\n // Static accessors\n // ===================\n /**\n * @category Static\n *\n * @returns The number of bytes in a {@link Mat3}.\n */\n static get BYTE_LENGTH() {\n return 9 * Float64Array.BYTES_PER_ELEMENT;\n }\n // ===================\n // Static methods\n // ===================\n /**\n * Creates a new, identity {@link Mat3}\n * @category Static\n *\n * @returns A new {@link Mat3}\n */\n static create() {\n return new _Mat3();\n }\n /**\n * Creates a new {@link Mat3} initialized with values from an existing matrix\n * @category Static\n *\n * @param a - Matrix to clone\n * @returns A new {@link Mat3}\n */\n static clone(a) {\n return new _Mat3(a);\n }\n /**\n * Copy the values from one {@link Mat3} to another\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - Matrix to copy\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n }\n /**\n * Create a new {@link Mat3} with the given values\n * @category Static\n *\n * @param values - Matrix components\n * @returns A new {@link Mat3}\n */\n static fromValues(...values) {\n return new _Mat3(...values);\n }\n /**\n * Set the components of a {@link Mat3} to the given values\n * @category Static\n *\n * @param out - The receiving matrix\n * @param values - Matrix components\n * @returns `out`\n */\n static set(out, ...values) {\n out[0] = values[0];\n out[1] = values[1];\n out[2] = values[2];\n out[3] = values[3];\n out[4] = values[4];\n out[5] = values[5];\n out[6] = values[6];\n out[7] = values[7];\n out[8] = values[8];\n return out;\n }\n /**\n * Set a {@link Mat3} to the identity matrix\n * @category Static\n *\n * @param out - The receiving matrix\n * @returns `out`\n */\n static identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n }\n /**\n * Transpose the values of a {@link Mat3}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static transpose(out, a) {\n if (out === a) {\n const a01 = a[1], a02 = a[2], a12 = a[5];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a01;\n out[5] = a[7];\n out[6] = a02;\n out[7] = a12;\n } else {\n out[0] = a[0];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a[1];\n out[4] = a[4];\n out[5] = a[7];\n out[6] = a[2];\n out[7] = a[5];\n out[8] = a[8];\n }\n return out;\n }\n /**\n * Inverts a {@link Mat3}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out` or `null` if the matrix is not invertible\n */\n static invert(out, a) {\n const a00 = a[0], a01 = a[1], a02 = a[2];\n const a10 = a[3], a11 = a[4], a12 = a[5];\n const a20 = a[6], a21 = a[7], a22 = a[8];\n const b01 = a22 * a11 - a12 * a21;\n const b11 = -a22 * a10 + a12 * a20;\n const b21 = a21 * a10 - a11 * a20;\n let det = a00 * b01 + a01 * b11 + a02 * b21;\n if (!det) {\n return null;\n }\n det = 1 / det;\n out[0] = b01 * det;\n out[1] = (-a22 * a01 + a02 * a21) * det;\n out[2] = (a12 * a01 - a02 * a11) * det;\n out[3] = b11 * det;\n out[4] = (a22 * a00 - a02 * a20) * det;\n out[5] = (-a12 * a00 + a02 * a10) * det;\n out[6] = b21 * det;\n out[7] = (-a21 * a00 + a01 * a20) * det;\n out[8] = (a11 * a00 - a01 * a10) * det;\n return out;\n }\n /**\n * Calculates the adjugate of a {@link Mat3}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static adjoint(out, a) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n out[0] = a11 * a22 - a12 * a21;\n out[1] = a02 * a21 - a01 * a22;\n out[2] = a01 * a12 - a02 * a11;\n out[3] = a12 * a20 - a10 * a22;\n out[4] = a00 * a22 - a02 * a20;\n out[5] = a02 * a10 - a00 * a12;\n out[6] = a10 * a21 - a11 * a20;\n out[7] = a01 * a20 - a00 * a21;\n out[8] = a00 * a11 - a01 * a10;\n return out;\n }\n /**\n * Calculates the determinant of a {@link Mat3}\n * @category Static\n *\n * @param a - the source matrix\n * @returns determinant of a\n */\n static determinant(a) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);\n }\n /**\n * Adds two {@link Mat3}'s\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n return out;\n }\n /**\n * Subtracts matrix b from matrix a\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n return out;\n }\n /**\n * Alias for {@link Mat3.subtract}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sub(out, a, b) {\n return out;\n }\n /**\n * Multiplies two {@link Mat3}s\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n let b0 = b[0];\n let b1 = b[1];\n let b2 = b[2];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22;\n b0 = b[3];\n b1 = b[4];\n b2 = b[5];\n out[3] = b0 * a00 + b1 * a10 + b2 * a20;\n out[4] = b0 * a01 + b1 * a11 + b2 * a21;\n out[5] = b0 * a02 + b1 * a12 + b2 * a22;\n b0 = b[6];\n b1 = b[7];\n b2 = b[8];\n out[6] = b0 * a00 + b1 * a10 + b2 * a20;\n out[7] = b0 * a01 + b1 * a11 + b2 * a21;\n out[8] = b0 * a02 + b1 * a12 + b2 * a22;\n return out;\n }\n /**\n * Alias for {@link Mat3.multiply}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static mul(out, a, b) {\n return out;\n }\n /**\n * Translate a {@link Mat3} by the given vector\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to translate\n * @param v - vector to translate by\n * @returns `out`\n */\n static translate(out, a, v) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n const x = v[0];\n const y = v[1];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a10;\n out[4] = a11;\n out[5] = a12;\n out[6] = x * a00 + y * a10 + a20;\n out[7] = x * a01 + y * a11 + a21;\n out[8] = x * a02 + y * a12 + a22;\n return out;\n }\n /**\n * Rotates a {@link Mat3} by the given angle\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static rotate(out, a, rad) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c * a00 + s * a10;\n out[1] = c * a01 + s * a11;\n out[2] = c * a02 + s * a12;\n out[3] = c * a10 - s * a00;\n out[4] = c * a11 - s * a01;\n out[5] = c * a12 - s * a02;\n out[6] = a20;\n out[7] = a21;\n out[8] = a22;\n return out;\n }\n /**\n * Scales the {@link Mat3} by the dimensions in the given {@link Vec2}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param v - the {@link Vec2} to scale the matrix by\n * @returns `out`\n **/\n static scale(out, a, v) {\n const x = v[0];\n const y = v[1];\n out[0] = x * a[0];\n out[1] = x * a[1];\n out[2] = x * a[2];\n out[3] = y * a[3];\n out[4] = y * a[4];\n out[5] = y * a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n }\n /**\n * Creates a {@link Mat3} from a vector translation\n * This is equivalent to (but much faster than):\n * ```js\n * mat3.identity(dest);\n * mat3.translate(dest, dest, vec);\n * ```\n * @category Static\n *\n * @param out - {@link Mat3} receiving operation result\n * @param v - Translation vector\n * @returns `out`\n */\n static fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = v[0];\n out[7] = v[1];\n out[8] = 1;\n return out;\n }\n /**\n * Creates a {@link Mat3} from a given angle around a given axis\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.rotate(dest, dest, rad);\n * @category Static\n *\n * @param out - {@link Mat3} receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static fromRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = -s;\n out[4] = c;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n }\n /**\n * Creates a {@link Mat3} from a vector scaling\n * This is equivalent to (but much faster than):\n * ```js\n * mat3.identity(dest);\n * mat3.scale(dest, dest, vec);\n * ```\n * @category Static\n *\n * @param out - {@link Mat3} receiving operation result\n * @param v - Scaling vector\n * @returns `out`\n */\n static fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = v[1];\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n }\n /**\n * Copies the upper-left 3x3 values of a {@link Mat2d} into the given\n * {@link Mat3}.\n * @category Static\n *\n * @param out - the receiving 3x3 matrix\n * @param a - the source 2x3 matrix\n * @returns `out`\n */\n static fromMat2d(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = 0;\n out[3] = a[2];\n out[4] = a[3];\n out[5] = 0;\n out[6] = a[4];\n out[7] = a[5];\n out[8] = 1;\n return out;\n }\n /**\n * Calculates a {@link Mat3} from the given quaternion\n * @category Static\n *\n * @param out - {@link Mat3} receiving operation result\n * @param q - {@link Quat} to create matrix from\n * @returns `out`\n */\n static fromQuat(out, q) {\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\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 out[0] = 1 - yy - zz;\n out[3] = yx - wz;\n out[6] = zx + wy;\n out[1] = yx + wz;\n out[4] = 1 - xx - zz;\n out[7] = zy - wx;\n out[2] = zx - wy;\n out[5] = zy + wx;\n out[8] = 1 - xx - yy;\n return out;\n }\n /**\n * Copies the upper-left 3x3 values of a {@link Mat4} into the given\n * {@link Mat3}.\n * @category Static\n *\n * @param out - the receiving 3x3 matrix\n * @param a - the source 4x4 matrix\n * @returns `out`\n */\n static fromMat4(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[4];\n out[4] = a[5];\n out[5] = a[6];\n out[6] = a[8];\n out[7] = a[9];\n out[8] = a[10];\n return out;\n }\n /**\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\n * @category Static\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from\n * @returns `out` or `null` if the matrix is not invertible\n */\n static normalFromMat4(out, a) {\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];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n const a30 = a[12];\n const a31 = a[13];\n const a32 = a[14];\n const a33 = a[15];\n const b00 = a00 * a11 - a01 * a10;\n const b01 = a00 * a12 - a02 * a10;\n const b02 = a00 * a13 - a03 * a10;\n const b03 = a01 * a12 - a02 * a11;\n const b04 = a01 * a13 - a03 * a11;\n const b05 = a02 * a13 - a03 * a12;\n const b06 = a20 * a31 - a21 * a30;\n const b07 = a20 * a32 - a22 * a30;\n const b08 = a20 * a33 - a23 * a30;\n const b09 = a21 * a32 - a22 * a31;\n const b10 = a21 * a33 - a23 * a31;\n const b11 = a22 * a33 - a23 * a32;\n let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n if (!det) {\n return null;\n }\n det = 1 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n return out;\n }\n /**\n * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4}\n * This version omits the calculation of the constant factor (1/determinant), so\n * any normals transformed with it will need to be renormalized.\n * From https://stackoverflow.com/a/27616419/25968\n * @category Static\n *\n * @param out - Matrix receiving operation result\n * @param a - Mat4 to derive the normal matrix from\n * @returns `out`\n */\n static normalFromMat4Fast(out, a) {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = a[4];\n const by = a[5];\n const bz = a[6];\n const cx = a[8];\n const cy = a[9];\n const cz = a[10];\n out[0] = by * cz - cz * cy;\n out[1] = bz * cx - cx * cz;\n out[2] = bx * cy - cy * cx;\n out[3] = cy * az - cz * ay;\n out[4] = cz * ax - cx * az;\n out[5] = cx * ay - cy * ax;\n out[6] = ay * bz - az * by;\n out[7] = az * bx - ax * bz;\n out[8] = ax * by - ay * bx;\n return out;\n }\n /**\n * Generates a 2D projection matrix with the given bounds\n * @category Static\n *\n * @param out mat3 frustum matrix will be written into\n * @param width Width of your gl context\n * @param height Height of gl context\n * @returns `out`\n */\n static projection(out, width, height) {\n out[0] = 2 / width;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = -2 / height;\n out[5] = 0;\n out[6] = -1;\n out[7] = 1;\n out[8] = 1;\n return out;\n }\n /**\n * Returns Frobenius norm of a {@link Mat3}\n * @category Static\n *\n * @param a - the matrix to calculate Frobenius norm of\n * @returns Frobenius norm\n */\n static frob(a) {\n return Math.sqrt(\n a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8]\n );\n }\n /**\n * Multiply each element of a {@link Mat3} by a scalar.\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param b - amount to scale the matrix's elements by\n * @returns `out`\n */\n static multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n return out;\n }\n /**\n * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value.\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param scale - the amount to scale b's elements by before adding\n * @returns `out`\n */\n static multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n return out;\n }\n /**\n * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===).\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8];\n }\n /**\n * Returns whether two {@link Mat3}s have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const a6 = a[6];\n const a7 = a[7];\n const a8 = a[8];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\n const b6 = b[6];\n const b7 = b[7];\n const b8 = b[8];\n return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8));\n }\n /**\n * Returns a string representation of a {@link Mat3}\n * @category Static\n *\n * @param a - matrix to represent as a string\n * @returns string representation of the matrix\n */\n static str(a) {\n return `Mat3(${a.join(\", \")})`;\n }\n};\n_IDENTITY_3X3 = new WeakMap();\n__privateAdd(_Mat3, _IDENTITY_3X3, new Float64Array([\n 1,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 1\n]));\nvar Mat3 = _Mat3;\nMat3.prototype.mul = Mat3.prototype.multiply;\nMat3.mul = Mat3.multiply;\nMat3.sub = Mat3.subtract;\n\n// src/_lib/f64/Mat4.ts\nvar _IDENTITY_4X4, _TMP_VEC3;\nvar _Mat4 = class _Mat4 extends Float64Array {\n /**\n * Create a {@link Mat4}.\n *\n * @category Constructor\n */\n constructor(...values) {\n switch (values.length) {\n case 16:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 16);\n break;\n case 1:\n const v = values[0];\n if (typeof v === \"number\") {\n super([\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v,\n v\n ]);\n } else {\n super(v, 0, 16);\n }\n break;\n default:\n super(__privateGet(_Mat4, _IDENTITY_4X4));\n break;\n }\n }\n // ============\n // Accessors\n // ============\n /**\n * A string representation of `this`\n * Equivalent to `Mat4.str(this);`\n *\n * @category Accessors\n */\n get str() {\n return _Mat4.str(this);\n }\n // ===================\n // Instance methods\n // ===================\n /**\n * Copy the values from another {@link Mat4} into `this`.\n * @category Methods\n *\n * @param a the source vector\n * @returns `this`\n */\n copy(a) {\n this.set(a);\n return this;\n }\n /**\n * Set `this` to the identity matrix\n * Equivalent to Mat4.identity(this)\n * @category Methods\n *\n * @returns `this`\n */\n identity() {\n this.set(__privateGet(_Mat4, _IDENTITY_4X4));\n return this;\n }\n /**\n * Multiplies this {@link Mat4} against another one\n * Equivalent to `Mat4.multiply(this, this, b);`\n * @category Methods\n *\n * @param b - The second operand\n * @returns `this`\n */\n multiply(b) {\n return _Mat4.multiply(this, this, b);\n }\n /**\n * Alias for {@link Mat4.multiply}\n * @category Methods\n */\n mul(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Transpose this {@link Mat4}\n * Equivalent to `Mat4.transpose(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n transpose() {\n return _Mat4.transpose(this, this);\n }\n /**\n * Inverts this {@link Mat4}\n * Equivalent to `Mat4.invert(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n invert() {\n return _Mat4.invert(this, this);\n }\n /**\n * Translate this {@link Mat4} by the given vector\n * Equivalent to `Mat4.translate(this, this, v);`\n * @category Methods\n *\n * @param v - The {@link Vec3} to translate by\n * @returns `this`\n */\n translate(v) {\n return _Mat4.translate(this, this, v);\n }\n /**\n * Rotates this {@link Mat4} by the given angle around the given axis\n * Equivalent to `Mat4.rotate(this, this, rad, axis);`\n * @category Methods\n *\n * @param rad - the angle to rotate the matrix by\n * @param axis - the axis to rotate around\n * @returns `this`\n */\n rotate(rad, axis) {\n return _Mat4.rotate(this, this, rad, axis);\n }\n /**\n * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization\n * Equivalent to `Mat4.scale(this, this, v);`\n * @category Methods\n *\n * @param v - The {@link Vec3} to scale the matrix by\n * @returns `this`\n */\n scale(v) {\n return _Mat4.scale(this, this, v);\n }\n /**\n * Rotates this {@link Mat4} by the given angle around the X axis\n * Equivalent to `Mat4.rotateX(this, this, rad);`\n * @category Methods\n *\n * @param rad - the angle to rotate the matrix by\n * @returns `this`\n */\n rotateX(rad) {\n return _Mat4.rotateX(this, this, rad);\n }\n /**\n * Rotates this {@link Mat4} by the given angle around the Y axis\n * Equivalent to `Mat4.rotateY(this, this, rad);`\n * @category Methods\n *\n * @param rad - the angle to rotate the matrix by\n * @returns `this`\n */\n rotateY(rad) {\n return _Mat4.rotateY(this, this, rad);\n }\n /**\n * Rotates this {@link Mat4} by the given angle around the Z axis\n * Equivalent to `Mat4.rotateZ(this, this, rad);`\n * @category Methods\n *\n * @param rad - the angle to rotate the matrix by\n * @returns `this`\n */\n rotateZ(rad) {\n return _Mat4.rotateZ(this, this, rad);\n }\n /**\n * Generates a perspective projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);`\n * @category Methods\n *\n * @param fovy - Vertical field of view in radians\n * @param aspect - Aspect ratio. typically viewport width/height\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum, can be null or Infinity\n * @returns `this`\n */\n perspectiveNO(fovy, aspect, near, far) {\n return _Mat4.perspectiveNO(this, fovy, aspect, near, far);\n }\n /**\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);`\n * @category Methods\n *\n * @param fovy - Vertical field of view in radians\n * @param aspect - Aspect ratio. typically viewport width/height\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum, can be null or Infinity\n * @returns `this`\n */\n perspectiveZO(fovy, aspect, near, far) {\n return _Mat4.perspectiveZO(this, fovy, aspect, near, far);\n }\n /**\n * Generates a orthogonal projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);`\n * @category Methods\n *\n * @param left - Left bound of the frustum\n * @param right - Right bound of the frustum\n * @param bottom - Bottom bound of the frustum\n * @param top - Top bound of the frustum\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum\n * @returns `this`\n */\n orthoNO(left, right, bottom, top, near, far) {\n return _Mat4.orthoNO(this, left, right, bottom, top, near, far);\n }\n /**\n * Generates a orthogonal projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);`\n * @category Methods\n *\n * @param left - Left bound of the frustum\n * @param right - Right bound of the frustum\n * @param bottom - Bottom bound of the frustum\n * @param top - Top bound of the frustum\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum\n * @returns `this`\n */\n orthoZO(left, right, bottom, top, near, far) {\n return _Mat4.orthoZO(this, left, right, bottom, top, near, far);\n }\n // ===================\n // Static accessors\n // ===================\n /**\n * @category Static\n *\n * @returns The number of bytes in a {@link Mat4}.\n */\n static get BYTE_LENGTH() {\n return 16 * Float64Array.BYTES_PER_ELEMENT;\n }\n // ===================\n // Static methods\n // ===================\n /**\n * Creates a new, identity {@link Mat4}\n * @category Static\n *\n * @returns A new {@link Mat4}\n */\n static create() {\n return new _Mat4();\n }\n /**\n * Creates a new {@link Mat4} initialized with values from an existing matrix\n * @category Static\n *\n * @param a - Matrix to clone\n * @returns A new {@link Mat4}\n */\n static clone(a) {\n return new _Mat4(a);\n }\n /**\n * Copy the values from one {@link Mat4} to another\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - Matrix to copy\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n }\n /**\n * Create a new mat4 with the given values\n * @category Static\n *\n * @param values - Matrix components\n * @returns A new {@link Mat4}\n */\n static fromValues(...values) {\n return new _Mat4(...values);\n }\n /**\n * Set the components of a mat4 to the given values\n * @category Static\n *\n * @param out - The receiving matrix\n * @param values - Matrix components\n * @returns `out`\n */\n static set(out, ...values) {\n out[0] = values[0];\n out[1] = values[1];\n out[2] = values[2];\n out[3] = values[3];\n out[4] = values[4];\n out[5] = values[5];\n out[6] = values[6];\n out[7] = values[7];\n out[8] = values[8];\n out[9] = values[9];\n out[10] = values[10];\n out[11] = values[11];\n out[12] = values[12];\n out[13] = values[13];\n out[14] = values[14];\n out[15] = values[15];\n return out;\n }\n /**\n * Set a {@link Mat4} to the identity matrix\n * @category Static\n *\n * @param out - The receiving Matrix\n * @returns `out`\n */\n static identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Transpose the values of a {@link Mat4}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static transpose(out, a) {\n if (out === a) {\n const a01 = a[1], a02 = a[2], a03 = a[3];\n const a12 = a[6], a13 = a[7];\n const a23 = a[11];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n } else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n return out;\n }\n /**\n * Inverts a {@link Mat4}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out` or `null` if the matrix is not invertible\n */\n static invert(out, a) {\n const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3];\n const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7];\n const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];\n const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n const b00 = a00 * a11 - a01 * a10;\n const b01 = a00 * a12 - a02 * a10;\n const b02 = a00 * a13 - a03 * a10;\n const b03 = a01 * a12 - a02 * a11;\n const b04 = a01 * a13 - a03 * a11;\n const b05 = a02 * a13 - a03 * a12;\n const b06 = a20 * a31 - a21 * a30;\n const b07 = a20 * a32 - a22 * a30;\n const b08 = a20 * a33 - a23 * a30;\n const b09 = a21 * a32 - a22 * a31;\n const b10 = a21 * a33 - a23 * a31;\n const b11 = a22 * a33 - a23 * a32;\n let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n if (!det) {\n return null;\n }\n det = 1 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n return out;\n }\n /**\n * Calculates the adjugate of a {@link Mat4}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static adjoint(out, a) {\n const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3];\n const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7];\n const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];\n const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n const b00 = a00 * a11 - a01 * a10;\n const b01 = a00 * a12 - a02 * a10;\n const b02 = a00 * a13 - a03 * a10;\n const b03 = a01 * a12 - a02 * a11;\n const b04 = a01 * a13 - a03 * a11;\n const b05 = a02 * a13 - a03 * a12;\n const b06 = a20 * a31 - a21 * a30;\n const b07 = a20 * a32 - a22 * a30;\n const b08 = a20 * a33 - a23 * a30;\n const b09 = a21 * a32 - a22 * a31;\n const b10 = a21 * a33 - a23 * a31;\n const b11 = a22 * a33 - a23 * a32;\n out[0] = a11 * b11 - a12 * b10 + a13 * b09;\n out[1] = a02 * b10 - a01 * b11 - a03 * b09;\n out[2] = a31 * b05 - a32 * b04 + a33 * b03;\n out[3] = a22 * b04 - a21 * b05 - a23 * b03;\n out[4] = a12 * b08 - a10 * b11 - a13 * b07;\n out[5] = a00 * b11 - a02 * b08 + a03 * b07;\n out[6] = a32 * b02 - a30 * b05 - a33 * b01;\n out[7] = a20 * b05 - a22 * b02 + a23 * b01;\n out[8] = a10 * b10 - a11 * b08 + a13 * b06;\n out[9] = a01 * b08 - a00 * b10 - a03 * b06;\n out[10] = a30 * b04 - a31 * b02 + a33 * b00;\n out[11] = a21 * b02 - a20 * b04 - a23 * b00;\n out[12] = a11 * b07 - a10 * b09 - a12 * b06;\n out[13] = a00 * b09 - a01 * b07 + a02 * b06;\n out[14] = a31 * b01 - a30 * b03 - a32 * b00;\n out[15] = a20 * b03 - a21 * b01 + a22 * b00;\n return out;\n }\n /**\n * Calculates the determinant of a {@link Mat4}\n * @category Static\n *\n * @param a - the source matrix\n * @returns determinant of a\n */\n static determinant(a) {\n const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3];\n const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7];\n const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];\n const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n const b0 = a00 * a11 - a01 * a10;\n const b1 = a00 * a12 - a02 * a10;\n const b2 = a01 * a12 - a02 * a11;\n const b3 = a20 * a31 - a21 * a30;\n const b4 = a20 * a32 - a22 * a30;\n const b5 = a21 * a32 - a22 * a31;\n const b6 = a00 * b5 - a01 * b4 + a02 * b3;\n const b7 = a10 * b5 - a11 * b4 + a12 * b3;\n const b8 = a20 * b2 - a21 * b1 + a22 * b0;\n const b9 = a30 * b2 - a31 * b1 + a32 * b0;\n return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9;\n }\n /**\n * Multiplies two {@link Mat4}s\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\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];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n const a30 = a[12];\n const a31 = a[13];\n const a32 = a[14];\n const a33 = a[15];\n let b0 = b[0];\n let b1 = b[1];\n let b2 = b[2];\n let b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4];\n b1 = b[5];\n b2 = b[6];\n b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8];\n b1 = b[9];\n b2 = b[10];\n b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12];\n b1 = b[13];\n b2 = b[14];\n b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n }\n /**\n * Alias for {@link Mat4.multiply}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static mul(out, a, b) {\n return out;\n }\n /**\n * Translate a {@link Mat4} by the given vector\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to translate\n * @param v - vector to translate by\n * @returns `out`\n */\n static translate(out, a, v) {\n const x = v[0];\n const y = v[1];\n const z = v[2];\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\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];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a03;\n out[4] = a10;\n out[5] = a11;\n out[6] = a12;\n out[7] = a13;\n out[8] = a20;\n out[9] = a21;\n out[10] = a22;\n out[11] = a23;\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n return out;\n }\n /**\n * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param v - the {@link Vec3} to scale the matrix by\n * @returns `out`\n **/\n static scale(out, a, v) {\n const x = v[0];\n const y = v[1];\n const z = v[2];\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n }\n /**\n * Rotates a {@link Mat4} by the given angle around the given axis\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @param axis - the axis to rotate around\n * @returns `out` or `null` if axis has a length of 0\n */\n static rotate(out, a, rad, axis) {\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n let len = Math.sqrt(x * x + y * y + z * z);\n if (len < GLM_EPSILON) {\n return null;\n }\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n const t = 1 - c;\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];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n const b00 = x * x * t + c;\n const b01 = y * x * t + z * s;\n const b02 = z * x * t - y * s;\n const b10 = x * y * t - z * s;\n const b11 = y * y * t + c;\n const b12 = z * y * t + x * s;\n const b20 = x * z * t + y * s;\n const b21 = y * z * t - x * s;\n const b22 = z * z * t + c;\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n if (a !== out) {\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n return out;\n }\n /**\n * Rotates a matrix by the given angle around the X axis\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static rotateX(out, a, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n const a10 = a[4];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n if (a !== out) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n }\n /**\n * Rotates a matrix by the given angle around the Y axis\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static rotateY(out, a, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n if (a !== out) {\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n }\n /**\n * Rotates a matrix by the given angle around the Z axis\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static rotateZ(out, a, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\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];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n if (a !== out) {\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n }\n /**\n * Creates a {@link Mat4} from a vector translation\n * This is equivalent to (but much faster than):\n * ```js\n * mat4.identity(dest);\n * mat4.translate(dest, dest, vec);\n * ```\n * @category Static\n *\n * @param out - {@link Mat4} receiving operation result\n * @param v - Translation vector\n * @returns `out`\n */\n static fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n }\n /**\n * Creates a {@link Mat4} from a vector scaling\n * This is equivalent to (but much faster than):\n * ```js\n * mat4.identity(dest);\n * mat4.scale(dest, dest, vec);\n * ```\n * @category Static\n *\n * @param out - {@link Mat4} receiving operation result\n * @param v - Scaling vector\n * @returns `out`\n */\n static fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = v[1];\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = v[2];\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Creates a {@link Mat4} from a given angle around a given axis\n * This is equivalent to (but much faster than):\n * ```js\n * mat4.identity(dest);\n * mat4.rotate(dest, dest, rad, axis);\n * ```\n * @category Static\n *\n * @param out - {@link Mat4} receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @param axis - the axis to rotate around\n * @returns `out` or `null` if `axis` has a length of 0\n */\n static fromRotation(out, rad, axis) {\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n let len = Math.sqrt(x * x + y * y + z * z);\n if (len < GLM_EPSILON) {\n return null;\n }\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n const t = 1 - c;\n out[0] = x * x * t + c;\n out[1] = y * x * t + z * s;\n out[2] = z * x * t - y * s;\n out[3] = 0;\n out[4] = x * y * t - z * s;\n out[5] = y * y * t + c;\n out[6] = z * y * t + x * s;\n out[7] = 0;\n out[8] = x * z * t + y * s;\n out[9] = y * z * t - x * s;\n out[10] = z * z * t + c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Creates a matrix from the given angle around the X axis\n * This is equivalent to (but much faster than):\n * ```js\n * mat4.identity(dest);\n * mat4.rotateX(dest, dest, rad);\n * ```\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static fromXRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = c;\n out[6] = s;\n out[7] = 0;\n out[8] = 0;\n out[9] = -s;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Creates a matrix from the given angle around the Y axis\n * This is equivalent to (but much faster than):\n * ```js\n * mat4.identity(dest);\n * mat4.rotateY(dest, dest, rad);\n * ```\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static fromYRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c;\n out[1] = 0;\n out[2] = -s;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = s;\n out[9] = 0;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Creates a matrix from the given angle around the Z axis\n * This is equivalent to (but much faster than):\n * ```js\n * mat4.identity(dest);\n * mat4.rotateZ(dest, dest, rad);\n * ```\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static fromZRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = 0;\n out[4] = -s;\n out[5] = c;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Creates a matrix from a quaternion rotation and vector translation\n * This is equivalent to (but much faster than):\n * ```js\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * ```\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param q - Rotation quaternion\n * @param v - Translation vector\n * @returns `out`\n */\n static fromRotationTranslation(out, q, v) {\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const xy = x * y2;\n const xz = x * z2;\n const yy = y * y2;\n const yz = y * z2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n }\n /**\n * Sets a {@link Mat4} from a {@link Quat2}.\n * @category Static\n *\n * @param out - Matrix\n * @param a - Dual Quaternion\n * @returns `out`\n */\n static fromQuat2(out, a) {\n const bx = -a[0];\n const by = -a[1];\n const bz = -a[2];\n const bw = a[3];\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n const magnitude = bx * bx + by * by + bz * bz + bw * bw;\n if (magnitude > 0) {\n __privateGet(_Mat4, _TMP_VEC3)[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude;\n __privateGet(_Mat4, _TMP_VEC3)[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude;\n __privateGet(_Mat4, _TMP_VEC3)[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude;\n } else {\n __privateGet(_Mat4, _TMP_VEC3)[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n __privateGet(_Mat4, _TMP_VEC3)[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n __privateGet(_Mat4, _TMP_VEC3)[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n }\n _Mat4.fromRotationTranslation(out, a, __privateGet(_Mat4, _TMP_VEC3));\n return out;\n }\n /**\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\n * @category Static\n *\n * @param out - Matrix receiving operation result\n * @param a - Mat4 to derive the normal matrix from\n * @returns `out` or `null` if the matrix is not invertible\n */\n static normalFromMat4(out, a) {\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];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n const a30 = a[12];\n const a31 = a[13];\n const a32 = a[14];\n const a33 = a[15];\n const b00 = a00 * a11 - a01 * a10;\n const b01 = a00 * a12 - a02 * a10;\n const b02 = a00 * a13 - a03 * a10;\n const b03 = a01 * a12 - a02 * a11;\n const b04 = a01 * a13 - a03 * a11;\n const b05 = a02 * a13 - a03 * a12;\n const b06 = a20 * a31 - a21 * a30;\n const b07 = a20 * a32 - a22 * a30;\n const b08 = a20 * a33 - a23 * a30;\n const b09 = a21 * a32 - a22 * a31;\n const b10 = a21 * a33 - a23 * a31;\n const b11 = a22 * a33 - a23 * a32;\n let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n if (!det) {\n return null;\n }\n det = 1 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[3] = 0;\n out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[7] = 0;\n out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4}\n * This version omits the calculation of the constant factor (1/determinant), so\n * any normals transformed with it will need to be renormalized.\n * From https://stackoverflow.com/a/27616419/25968\n * @category Static\n *\n * @param out - Matrix receiving operation result\n * @param a - Mat4 to derive the normal matrix from\n * @returns `out`\n */\n static normalFromMat4Fast(out, a) {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = a[4];\n const by = a[5];\n const bz = a[6];\n const cx = a[8];\n const cy = a[9];\n const cz = a[10];\n out[0] = by * cz - cz * cy;\n out[1] = bz * cx - cx * cz;\n out[2] = bx * cy - cy * cx;\n out[3] = 0;\n out[4] = cy * az - cz * ay;\n out[5] = cz * ax - cx * az;\n out[6] = cx * ay - cy * ax;\n out[7] = 0;\n out[8] = ay * bz - az * by;\n out[9] = az * bx - ax * bz;\n out[10] = ax * by - ay * bx;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Returns the translation vector component of a transformation\n * matrix. If a matrix is built with fromRotationTranslation,\n * the returned vector will be the same as the translation vector\n * originally supplied.\n * @category Static\n *\n * @param {vec3} out Vector to receive translation component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {vec3} out\n */\n static getTranslation(out, mat) {\n out[0] = mat[12];\n out[1] = mat[13];\n out[2] = mat[14];\n return out;\n }\n /**\n * Returns the scaling factor component of a transformation\n * matrix. If a matrix is built with fromRotationTranslationScale\n * with a normalized Quaternion parameter, the returned vector will be\n * the same as the scaling vector\n * originally supplied.\n * @category Static\n *\n * @param {vec3} out Vector to receive scaling factor component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {vec3} out\n */\n static getScaling(out, mat) {\n const m11 = mat[0];\n const m12 = mat[1];\n const m13 = mat[2];\n const m21 = mat[4];\n const m22 = mat[5];\n const m23 = mat[6];\n const m31 = mat[8];\n const m32 = mat[9];\n const m33 = mat[10];\n out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\n out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\n out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\n return out;\n }\n /**\n * Returns a quaternion representing the rotational component\n * of a transformation matrix. If a matrix is built with\n * fromRotationTranslation, the returned quaternion will be the\n * same as the quaternion originally supplied.\n * @category Static\n *\n * @param out - Quaternion to receive the rotation component\n * @param mat - Matrix to be decomposed (input)\n * @return `out`\n */\n static getRotation(out, mat) {\n _Mat4.getScaling(__privateGet(_Mat4, _TMP_VEC3), mat);\n const is1 = 1 / __privateGet(_Mat4, _TMP_VEC3)[0];\n const is2 = 1 / __privateGet(_Mat4, _TMP_VEC3)[1];\n const is3 = 1 / __privateGet(_Mat4, _TMP_VEC3)[2];\n const sm11 = mat[0] * is1;\n const sm12 = mat[1] * is2;\n const sm13 = mat[2] * is3;\n const sm21 = mat[4] * is1;\n const sm22 = mat[5] * is2;\n const sm23 = mat[6] * is3;\n const sm31 = mat[8] * is1;\n const sm32 = mat[9] * is2;\n const sm33 = mat[10] * is3;\n const trace = sm11 + sm22 + sm33;\n let S = 0;\n if (trace > 0) {\n S = Math.sqrt(trace + 1) * 2;\n out[3] = 0.25 * S;\n out[0] = (sm23 - sm32) / S;\n out[1] = (sm31 - sm13) / S;\n out[2] = (sm12 - sm21) / S;\n } else if (sm11 > sm22 && sm11 > sm33) {\n S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2;\n out[3] = (sm23 - sm32) / S;\n out[0] = 0.25 * S;\n out[1] = (sm12 + sm21) / S;\n out[2] = (sm31 + sm13) / S;\n } else if (sm22 > sm33) {\n S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2;\n out[3] = (sm31 - sm13) / S;\n out[0] = (sm12 + sm21) / S;\n out[1] = 0.25 * S;\n out[2] = (sm23 + sm32) / S;\n } else {\n S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2;\n out[3] = (sm12 - sm21) / S;\n out[0] = (sm31 + sm13) / S;\n out[1] = (sm23 + sm32) / S;\n out[2] = 0.25 * S;\n }\n return out;\n }\n /**\n * Decomposes a transformation matrix into its rotation, translation\n * and scale components. Returns only the rotation component\n * @category Static\n *\n * @param out_r - Quaternion to receive the rotation component\n * @param out_t - Vector to receive the translation vector\n * @param out_s - Vector to receive the scaling factor\n * @param mat - Matrix to be decomposed (input)\n * @returns `out_r`\n */\n static decompose(out_r, out_t, out_s, mat) {\n out_t[0] = mat[12];\n out_t[1] = mat[13];\n out_t[2] = mat[14];\n const m11 = mat[0];\n const m12 = mat[1];\n const m13 = mat[2];\n const m21 = mat[4];\n const m22 = mat[5];\n const m23 = mat[6];\n const m31 = mat[8];\n const m32 = mat[9];\n const m33 = mat[10];\n out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\n out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\n out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\n const is1 = 1 / out_s[0];\n const is2 = 1 / out_s[1];\n const is3 = 1 / out_s[2];\n const sm11 = m11 * is1;\n const sm12 = m12 * is2;\n const sm13 = m13 * is3;\n const sm21 = m21 * is1;\n const sm22 = m22 * is2;\n const sm23 = m23 * is3;\n const sm31 = m31 * is1;\n const sm32 = m32 * is2;\n const sm33 = m33 * is3;\n const trace = sm11 + sm22 + sm33;\n let S = 0;\n if (trace > 0) {\n S = Math.sqrt(trace + 1) * 2;\n out_r[3] = 0.25 * S;\n out_r[0] = (sm23 - sm32) / S;\n out_r[1] = (sm31 - sm13) / S;\n out_r[2] = (sm12 - sm21) / S;\n } else if (sm11 > sm22 && sm11 > sm33) {\n S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2;\n out_r[3] = (sm23 - sm32) / S;\n out_r[0] = 0.25 * S;\n out_r[1] = (sm12 + sm21) / S;\n out_r[2] = (sm31 + sm13) / S;\n } else if (sm22 > sm33) {\n S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2;\n out_r[3] = (sm31 - sm13) / S;\n out_r[0] = (sm12 + sm21) / S;\n out_r[1] = 0.25 * S;\n out_r[2] = (sm23 + sm32) / S;\n } else {\n S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2;\n out_r[3] = (sm12 - sm21) / S;\n out_r[0] = (sm31 + sm13) / S;\n out_r[1] = (sm23 + sm32) / S;\n out_r[2] = 0.25 * S;\n }\n return out_r;\n }\n /**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\n * This is equivalent to (but much faster than):\n * ```js\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale);\n * ```\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param q - Rotation quaternion\n * @param v - Translation vector\n * @param s - Scaling vector\n * @returns `out`\n */\n static fromRotationTranslationScale(out, q, v, s) {\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const xy = x * y2;\n const xz = x * z2;\n const yy = y * y2;\n const yz = y * z2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n const sx = s[0];\n const sy = s[1];\n const sz = s[2];\n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n }\n /**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the\n * given origin. This is equivalent to (but much faster than):\n * ```js\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * mat4.translate(dest, origin);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale)\n * mat4.translate(dest, negativeOrigin);\n * ```\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param q - Rotation quaternion\n * @param v - Translation vector\n * @param s - Scaling vector\n * @param o - The origin vector around which to scale and rotate\n * @returns `out`\n */\n static fromRotationTranslationScaleOrigin(out, q, v, s, o) {\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const xy = x * y2;\n const xz = x * z2;\n const yy = y * y2;\n const yz = y * z2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n const sx = s[0];\n const sy = s[1];\n const sz = s[2];\n const ox = o[0];\n const oy = o[1];\n const oz = o[2];\n const out0 = (1 - (yy + zz)) * sx;\n const out1 = (xy + wz) * sx;\n const out2 = (xz - wy) * sx;\n const out4 = (xy - wz) * sy;\n const out5 = (1 - (xx + zz)) * sy;\n const out6 = (yz + wx) * sy;\n const out8 = (xz + wy) * sz;\n const out9 = (yz - wx) * sz;\n const out10 = (1 - (xx + yy)) * sz;\n out[0] = out0;\n out[1] = out1;\n out[2] = out2;\n out[3] = 0;\n out[4] = out4;\n out[5] = out5;\n out[6] = out6;\n out[7] = 0;\n out[8] = out8;\n out[9] = out9;\n out[10] = out10;\n out[11] = 0;\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\n out[15] = 1;\n return out;\n }\n /**\n * Calculates a 4x4 matrix from the given quaternion\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param q - Quaternion to create matrix from\n * @returns `out`\n */\n static fromQuat(out, q) {\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\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 out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Generates a frustum matrix with the given bounds\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param left - Left bound of the frustum\n * @param right - Right bound of the frustum\n * @param bottom - Bottom bound of the frustum\n * @param top - Top bound of the frustum\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum, can be null or Infinity\n * @returns `out`\n */\n static frustumNO(out, left, right, bottom, top, near, far = Infinity) {\n const rl = 1 / (right - left);\n const tb = 1 / (top - bottom);\n out[0] = near * 2 * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = near * 2 * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n if (far != null && far !== Infinity) {\n const nf = 1 / (near - far);\n out[10] = (far + near) * nf;\n out[14] = 2 * far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -2 * near;\n }\n return out;\n }\n /**\n * Alias for {@link Mat4.frustumNO}\n * @category Static\n * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly\n */\n static frustum(out, left, right, bottom, top, near, far = Infinity) {\n return out;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Generates a frustum matrix with the given bounds\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param left - Left bound of the frustum\n * @param right - Right bound of the frustum\n * @param bottom - Bottom bound of the frustum\n * @param top - Top bound of the frustum\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum, can be null or Infinity\n * @returns `out`\n */\n static frustumZO(out, left, right, bottom, top, near, far = Infinity) {\n const rl = 1 / (right - left);\n const tb = 1 / (top - bottom);\n out[0] = near * 2 * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = near * 2 * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n if (far != null && far !== Infinity) {\n const nf = 1 / (near - far);\n out[10] = far * nf;\n out[14] = far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -near;\n }\n return out;\n }\n /**\n * Generates a perspective projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param fovy - Vertical field of view in radians\n * @param aspect - Aspect ratio. typically viewport width/height\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum, can be null or Infinity\n * @returns `out`\n */\n static perspectiveNO(out, fovy, aspect, near, far = Infinity) {\n const f = 1 / Math.tan(fovy / 2);\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n if (far != null && far !== Infinity) {\n const nf = 1 / (near - far);\n out[10] = (far + near) * nf;\n out[14] = 2 * far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -2 * near;\n }\n return out;\n }\n /**\n * Alias for {@link Mat4.perspectiveNO}\n * @category Static\n * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static perspective(out, fovy, aspect, near, far = Infinity) {\n return out;\n }\n /**\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param fovy - Vertical field of view in radians\n * @param aspect - Aspect ratio. typically viewport width/height\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum, can be null or Infinity\n * @returns `out`\n */\n static perspectiveZO(out, fovy, aspect, near, far = Infinity) {\n const f = 1 / Math.tan(fovy / 2);\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n if (far != null && far !== Infinity) {\n const nf = 1 / (near - far);\n out[10] = far * nf;\n out[14] = far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -near;\n }\n return out;\n }\n /**\n * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating\n * projection matrices to be used with the still experimental WebVR API.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum\n * @returns `out`\n * @deprecated\n */\n static perspectiveFromFieldOfView(out, fov, near, far) {\n const upTan = Math.tan(fov.upDegrees * Math.PI / 180);\n const downTan = Math.tan(fov.downDegrees * Math.PI / 180);\n const leftTan = Math.tan(fov.leftDegrees * Math.PI / 180);\n const rightTan = Math.tan(fov.rightDegrees * Math.PI / 180);\n const xScale = 2 / (leftTan + rightTan);\n const yScale = 2 / (upTan + downTan);\n out[0] = xScale;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = yScale;\n out[6] = 0;\n out[7] = 0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = (upTan - downTan) * yScale * 0.5;\n out[10] = far / (near - far);\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = far * near / (near - far);\n out[15] = 0;\n return out;\n }\n /**\n * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\n * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param left - Left bound of the frustum\n * @param right - Right bound of the frustum\n * @param bottom - Bottom bound of the frustum\n * @param top - Top bound of the frustum\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum\n * @returns `out`\n */\n static orthoNO(out, left, right, bottom, top, near, far) {\n const lr = 1 / (left - right);\n const bt = 1 / (bottom - top);\n const nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n }\n /**\n * Alias for {@link Mat4.orthoNO}\n * @category Static\n * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static ortho(out, left, right, bottom, top, near, far) {\n return out;\n }\n /**\n * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a\n * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param left - Left bound of the frustum\n * @param right - Right bound of the frustum\n * @param bottom - Bottom bound of the frustum\n * @param top - Top bound of the frustum\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum\n * @returns `out`\n */\n static orthoZO(out, left, right, bottom, top, near, far) {\n const lr = 1 / (left - right);\n const bt = 1 / (bottom - top);\n const nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = near * nf;\n out[15] = 1;\n return out;\n }\n /**\n * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that\n * actually makes an object look at another object, you should use targetTo instead.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param eye - Position of the viewer\n * @param center - Point the viewer is looking at\n * @param up - vec3 pointing up\n * @returns `out`\n */\n static lookAt(out, eye, center, up) {\n const eyex = eye[0];\n const eyey = eye[1];\n const eyez = eye[2];\n const upx = up[0];\n const upy = up[1];\n const upz = up[2];\n const centerx = center[0];\n const centery = center[1];\n const centerz = center[2];\n if (Math.abs(eyex - centerx) < GLM_EPSILON && Math.abs(eyey - centery) < GLM_EPSILON && Math.abs(eyez - centerz) < GLM_EPSILON) {\n return _Mat4.identity(out);\n }\n let z0 = eyex - centerx;\n let z1 = eyey - centery;\n let z2 = eyez - centerz;\n let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n let x0 = upy * z2 - upz * z1;\n let x1 = upz * z0 - upx * z2;\n let x2 = upx * z1 - upy * z0;\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n let y0 = z1 * x2 - z2 * x1;\n let y1 = z2 * x0 - z0 * x2;\n let y2 = z0 * x1 - z1 * x0;\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n return out;\n }\n /**\n * Generates a matrix that makes something look at something else.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param eye - Position of the viewer\n * @param target - Point the viewer is looking at\n * @param up - vec3 pointing up\n * @returns `out`\n */\n static targetTo(out, eye, target, up) {\n const eyex = eye[0];\n const eyey = eye[1];\n const eyez = eye[2];\n const upx = up[0];\n const upy = up[1];\n const upz = up[2];\n let z0 = eyex - target[0];\n let z1 = eyey - target[1];\n let z2 = eyez - target[2];\n let len = z0 * z0 + z1 * z1 + z2 * z2;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n }\n let x0 = upy * z2 - upz * z1;\n let x1 = upz * z0 - upx * z2;\n let x2 = upx * z1 - upy * z0;\n len = x0 * x0 + x1 * x1 + x2 * x2;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n out[0] = x0;\n out[1] = x1;\n out[2] = x2;\n out[3] = 0;\n out[4] = z1 * x2 - z2 * x1;\n out[5] = z2 * x0 - z0 * x2;\n out[6] = z0 * x1 - z1 * x0;\n out[7] = 0;\n out[8] = z0;\n out[9] = z1;\n out[10] = z2;\n out[11] = 0;\n out[12] = eyex;\n out[13] = eyey;\n out[14] = eyez;\n out[15] = 1;\n return out;\n }\n /**\n * Returns Frobenius norm of a {@link Mat4}\n * @category Static\n *\n * @param a - the matrix to calculate Frobenius norm of\n * @returns Frobenius norm\n */\n static frob(a) {\n return Math.sqrt(\n a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + a[9] * a[9] + a[10] * a[10] + a[11] * a[11] + a[12] * a[12] + a[13] * a[13] + a[14] * a[14] + a[15] * a[15]\n );\n }\n /**\n * Adds two {@link Mat4}'s\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n out[9] = a[9] + b[9];\n out[10] = a[10] + b[10];\n out[11] = a[11] + b[11];\n out[12] = a[12] + b[12];\n out[13] = a[13] + b[13];\n out[14] = a[14] + b[14];\n out[15] = a[15] + b[15];\n return out;\n }\n /**\n * Subtracts matrix b from matrix a\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n out[9] = a[9] - b[9];\n out[10] = a[10] - b[10];\n out[11] = a[11] - b[11];\n out[12] = a[12] - b[12];\n out[13] = a[13] - b[13];\n out[14] = a[14] - b[14];\n out[15] = a[15] - b[15];\n return out;\n }\n /**\n * Alias for {@link Mat4.subtract}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sub(out, a, b) {\n return out;\n }\n /**\n * Multiply each element of the matrix by a scalar.\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param b - amount to scale the matrix's elements by\n * @returns `out`\n */\n static multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n out[9] = a[9] * b;\n out[10] = a[10] * b;\n out[11] = a[11] * b;\n out[12] = a[12] * b;\n out[13] = a[13] * b;\n out[14] = a[14] * b;\n out[15] = a[15] * b;\n return out;\n }\n /**\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param scale - the amount to scale b's elements by before adding\n * @returns `out`\n */\n static multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n out[9] = a[9] + b[9] * scale;\n out[10] = a[10] + b[10] * scale;\n out[11] = a[11] + b[11] * scale;\n out[12] = a[12] + b[12] * scale;\n out[13] = a[13] + b[13] * scale;\n out[14] = a[14] + b[14] * scale;\n out[15] = a[15] + b[15] * scale;\n return out;\n }\n /**\n * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===).\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15];\n }\n /**\n * Returns whether two {@link Mat4}s have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const a6 = a[6];\n const a7 = a[7];\n const a8 = a[8];\n const a9 = a[9];\n const a10 = a[10];\n const a11 = a[11];\n const a12 = a[12];\n const a13 = a[13];\n const a14 = a[14];\n const a15 = a[15];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\n const b6 = b[6];\n const b7 = b[7];\n const b8 = b[8];\n const b9 = b[9];\n const b10 = b[10];\n const b11 = b[11];\n const b12 = b[12];\n const b13 = b[13];\n const b14 = b[14];\n const b15 = b[15];\n return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15));\n }\n /**\n * Returns a string representation of a {@link Mat4}\n * @category Static\n *\n * @param a - matrix to represent as a string\n * @returns string representation of the matrix\n */\n static str(a) {\n return `Mat4(${a.join(\", \")})`;\n }\n};\n_IDENTITY_4X4 = new WeakMap();\n_TMP_VEC3 = new WeakMap();\n__privateAdd(_Mat4, _IDENTITY_4X4, new Float64Array([\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1\n]));\n/**\n * Temporary variable to prevent repeated allocations in the algorithms within Mat4.\n * These are declared as TypedArrays to aid in tree-shaking.\n */\n__privateAdd(_Mat4, _TMP_VEC3, new Float64Array(3));\nvar Mat4 = _Mat4;\nMat4.prototype.mul = Mat4.prototype.multiply;\nMat4.sub = Mat4.subtract;\nMat4.mul = Mat4.multiply;\nMat4.frustum = Mat4.frustumNO;\nMat4.perspective = Mat4.perspectiveNO;\nMat4.ortho = Mat4.orthoNO;\n\n// src/_lib/f64/Vec3.ts\nvar Vec3 = class _Vec3 extends Float64Array {\n /**\n * Create a {@link Vec3}.\n *\n * @category Constructor\n */\n constructor(...values) {\n switch (values.length) {\n case 3:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 3);\n break;\n case 1: {\n const v = values[0];\n if (typeof v === \"number\") {\n super([v, v, v]);\n } else {\n super(v, 0, 3);\n }\n break;\n }\n default:\n super(3);\n break;\n }\n }\n // ============\n // Accessors\n // ============\n // Getters and setters to make component access read better.\n // These are likely to be a little bit slower than direct array access.\n /**\n * The x component of the vector. Equivalent to `this[0];`\n * @category Vector Components\n */\n get x() {\n return this[0];\n }\n set x(value) {\n this[0] = value;\n }\n /**\n * The y component of the vector. Equivalent to `this[1];`\n * @category Vector Components\n */\n get y() {\n return this[1];\n }\n set y(value) {\n this[1] = value;\n }\n /**\n * The z component of the vector. Equivalent to `this[2];`\n * @category Vector Components\n */\n get z() {\n return this[2];\n }\n set z(value) {\n this[2] = value;\n }\n // Alternate set of getters and setters in case this is being used to define\n // a color.\n /**\n * The r component of the vector. Equivalent to `this[0];`\n * @category Color Components\n */\n get r() {\n return this[0];\n }\n set r(value) {\n this[0] = value;\n }\n /**\n * The g component of the vector. Equivalent to `this[1];`\n * @category Color Components\n */\n get g() {\n return this[1];\n }\n set g(value) {\n this[1] = value;\n }\n /**\n * The b component of the vector. Equivalent to `this[2];`\n * @category Color Components\n */\n get b() {\n return this[2];\n }\n set b(value) {\n this[2] = value;\n }\n /**\n * The magnitude (length) of this.\n * Equivalent to `Vec3.magnitude(this);`\n *\n * Magnitude is used because the `length` attribute is already defined by\n * TypedArrays to mean the number of elements in the array.\n *\n * @category Accessors\n */\n get magnitude() {\n const x = this[0];\n const y = this[1];\n const z = this[2];\n return Math.sqrt(x * x + y * y + z * z);\n }\n /**\n * Alias for {@link Vec3.magnitude}\n *\n * @category Accessors\n */\n get mag() {\n return this.magnitude;\n }\n /**\n * The squared magnitude (length) of `this`.\n * Equivalent to `Vec3.squaredMagnitude(this);`\n *\n * @category Accessors\n */\n get squaredMagnitude() {\n const x = this[0];\n const y = this[1];\n const z = this[2];\n return x * x + y * y + z * z;\n }\n /**\n * Alias for {@link Vec3.squaredMagnitude}\n *\n * @category Accessors\n */\n get sqrMag() {\n return this.squaredMagnitude;\n }\n /**\n * A string representation of `this`\n * Equivalent to `Vec3.str(this);`\n *\n * @category Accessors\n */\n get str() {\n return _Vec3.str(this);\n }\n // ===================\n // Instances methods\n // ===================\n /**\n * Copy the values from another {@link Vec3} into `this`.\n * @category Methods\n *\n * @param a the source vector\n * @returns `this`\n */\n copy(a) {\n this.set(a);\n return this;\n }\n /**\n * Adds a {@link Vec3} to `this`.\n * Equivalent to `Vec3.add(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to add to `this`\n * @returns `this`\n */\n add(b) {\n this[0] += b[0];\n this[1] += b[1];\n this[2] += b[2];\n return this;\n }\n /**\n * Subtracts a {@link Vec3} from `this`.\n * Equivalent to `Vec3.subtract(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to subtract from `this`\n * @returns `this`\n */\n subtract(b) {\n this[0] -= b[0];\n this[1] -= b[1];\n this[2] -= b[2];\n return this;\n }\n /**\n * Alias for {@link Vec3.subtract}\n * @category Methods\n */\n sub(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Multiplies `this` by a {@link Vec3}.\n * Equivalent to `Vec3.multiply(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to multiply `this` by\n * @returns `this`\n */\n multiply(b) {\n this[0] *= b[0];\n this[1] *= b[1];\n this[2] *= b[2];\n return this;\n }\n /**\n * Alias for {@link Vec3.multiply}\n * @category Methods\n */\n mul(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Divides `this` by a {@link Vec3}.\n * Equivalent to `Vec3.divide(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to divide `this` by\n * @returns `this`\n */\n divide(b) {\n this[0] /= b[0];\n this[1] /= b[1];\n this[2] /= b[2];\n return this;\n }\n /**\n * Alias for {@link Vec3.divide}\n * @category Methods\n */\n div(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Scales `this` by a scalar number.\n * Equivalent to `Vec3.scale(this, this, b);`\n * @category Methods\n *\n * @param b - Amount to scale `this` by\n * @returns `this`\n */\n scale(b) {\n this[0] *= b;\n this[1] *= b;\n this[2] *= b;\n return this;\n }\n /**\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\n * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);`\n * @category Methods\n *\n * @param b - The vector to add to `this`\n * @param scale - The amount to scale `b` by before adding\n * @returns `this`\n */\n scaleAndAdd(b, scale) {\n this[0] += b[0] * scale;\n this[1] += b[1] * scale;\n this[2] += b[2] * scale;\n return this;\n }\n /**\n * Calculates the Euclidean distance between another {@link Vec3} and `this`.\n * Equivalent to `Vec3.distance(this, b);`\n * @category Methods\n *\n * @param b - The vector to calculate the distance to\n * @returns Distance between `this` and `b`\n */\n distance(b) {\n return _Vec3.distance(this, b);\n }\n /**\n * Alias for {@link Vec3.distance}\n * @category Methods\n */\n dist(b) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Calculates the squared Euclidean distance between another {@link Vec3} and `this`.\n * Equivalent to `Vec3.squaredDistance(this, b);`\n * @category Methods\n *\n * @param b The vector to calculate the squared distance to\n * @returns Squared distance between `this` and `b`\n */\n squaredDistance(b) {\n return _Vec3.squaredDistance(this, b);\n }\n /**\n * Alias for {@link Vec3.squaredDistance}\n * @category Methods\n */\n sqrDist(b) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Negates the components of `this`.\n * Equivalent to `Vec3.negate(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n negate() {\n this[0] *= -1;\n this[1] *= -1;\n this[2] *= -1;\n return this;\n }\n /**\n * Inverts the components of `this`.\n * Equivalent to `Vec3.inverse(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n invert() {\n this[0] = 1 / this[0];\n this[1] = 1 / this[1];\n this[2] = 1 / this[2];\n return this;\n }\n /**\n * Sets each component of `this` to its absolute value.\n * Equivalent to `Vec3.abs(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n abs() {\n this[0] = Math.abs(this[0]);\n this[1] = Math.abs(this[1]);\n this[2] = Math.abs(this[2]);\n return this;\n }\n /**\n * Calculates the dot product of this and another {@link Vec3}.\n * Equivalent to `Vec3.dot(this, b);`\n * @category Methods\n *\n * @param b - The second operand\n * @returns Dot product of `this` and `b`\n */\n dot(b) {\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2];\n }\n /**\n * Normalize `this`.\n * Equivalent to `Vec3.normalize(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n normalize() {\n return _Vec3.normalize(this, this);\n }\n // ===================\n // Static accessors\n // ===================\n /**\n * @category Static\n *\n * @returns The number of bytes in a {@link Vec3}.\n */\n static get BYTE_LENGTH() {\n return 3 * Float64Array.BYTES_PER_ELEMENT;\n }\n // ===================\n // Static methods\n // ===================\n /**\n * Creates a new, empty vec3\n * @category Static\n *\n * @returns a new 3D vector\n */\n static create() {\n return new _Vec3();\n }\n /**\n * Creates a new vec3 initialized with values from an existing vector\n * @category Static\n *\n * @param a - vector to clone\n * @returns a new 3D vector\n */\n static clone(a) {\n return new _Vec3(a);\n }\n /**\n * Calculates the magnitude (length) of a {@link Vec3}\n * @category Static\n *\n * @param a - Vector to calculate magnitude of\n * @returns Magnitude of a\n */\n static magnitude(a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n return Math.sqrt(x * x + y * y + z * z);\n }\n /**\n * Alias for {@link Vec3.magnitude}\n * @category Static\n */\n static mag(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Alias for {@link Vec3.magnitude}\n * @category Static\n * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs\n *\n * @param a - vector to calculate length of\n * @returns length of a\n */\n // Length conflicts with Function.length\n static length(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Alias for {@link Vec3.magnitude}\n * @category Static\n * @deprecated Use {@link Vec3.mag}\n */\n static len(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Creates a new vec3 initialized with the given values\n * @category Static\n *\n * @param x - X component\n * @param y - Y component\n * @param z - Z component\n * @returns a new 3D vector\n */\n static fromValues(x, y, z) {\n return new _Vec3(x, y, z);\n }\n /**\n * Copy the values from one vec3 to another\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the source vector\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n }\n /**\n * Set the components of a vec3 to the given values\n * @category Static\n *\n * @param out - the receiving vector\n * @param x - X component\n * @param y - Y component\n * @param z - Z component\n * @returns `out`\n */\n static set(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n }\n /**\n * Adds two {@link Vec3}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n }\n /**\n * Subtracts vector b from vector a\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n }\n /**\n * Alias for {@link Vec3.subtract}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sub(out, a, b) {\n return [0, 0, 0];\n }\n /**\n * Multiplies two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n }\n /**\n * Alias for {@link Vec3.multiply}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static mul(out, a, b) {\n return [0, 0, 0];\n }\n /**\n * Divides two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n }\n /**\n * Alias for {@link Vec3.divide}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static div(out, a, b) {\n return [0, 0, 0];\n }\n /**\n * Math.ceil the components of a vec3\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to ceil\n * @returns `out`\n */\n static ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n return out;\n }\n /**\n * Math.floor the components of a vec3\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to floor\n * @returns `out`\n */\n static floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n return out;\n }\n /**\n * Returns the minimum of two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n }\n /**\n * Returns the maximum of two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n }\n /**\n * symmetric round the components of a vec3\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to round\n * @returns `out`\n */\n /*\n static round(out: Vec3Like, a: Readonly): Vec3Like {\n out[0] = glMatrix.round(a[0]);\n out[1] = glMatrix.round(a[1]);\n out[2] = glMatrix.round(a[2]);\n return out;\n }*/\n /**\n * Scales a vec3 by a scalar number\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to scale\n * @param scale - amount to scale the vector by\n * @returns `out`\n */\n static scale(out, a, scale) {\n out[0] = a[0] * scale;\n out[1] = a[1] * scale;\n out[2] = a[2] * scale;\n return out;\n }\n /**\n * Adds two vec3's after scaling the second operand by a scalar value\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param scale - the amount to scale b by before adding\n * @returns `out`\n */\n static scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n return out;\n }\n /**\n * Calculates the Euclidean distance between two vec3's\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns distance between a and b\n */\n static distance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n const z = b[2] - a[2];\n return Math.sqrt(x * x + y * y + z * z);\n }\n /**\n * Alias for {@link Vec3.distance}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static dist(a, b) {\n return 0;\n }\n /**\n * Calculates the squared Euclidean distance between two vec3's\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns squared distance between a and b\n */\n static squaredDistance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n const z = b[2] - a[2];\n return x * x + y * y + z * z;\n }\n /**\n * Alias for {@link Vec3.squaredDistance}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sqrDist(a, b) {\n return 0;\n }\n /**\n * Calculates the squared length of a vec3\n * @category Static\n *\n * @param a - vector to calculate squared length of\n * @returns squared length of a\n */\n static squaredLength(a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n return x * x + y * y + z * z;\n }\n /**\n * Alias for {@link Vec3.squaredLength}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sqrLen(a, b) {\n return 0;\n }\n /**\n * Negates the components of a vec3\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to negate\n * @returns `out`\n */\n static negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n }\n /**\n * Returns the inverse of the components of a vec3\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to invert\n * @returns `out`\n */\n static inverse(out, a) {\n out[0] = 1 / a[0];\n out[1] = 1 / a[1];\n out[2] = 1 / a[2];\n return out;\n }\n /**\n * Returns the absolute value of the components of a {@link Vec3}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to compute the absolute values of\n * @returns `out`\n */\n static abs(out, a) {\n out[0] = Math.abs(a[0]);\n out[1] = Math.abs(a[1]);\n out[2] = Math.abs(a[2]);\n return out;\n }\n /**\n * Normalize a vec3\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to normalize\n * @returns `out`\n */\n static normalize(out, a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n let len = x * x + y * y + z * z;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n return out;\n }\n /**\n * Calculates the dot product of two vec3's\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns dot product of a and b\n */\n static dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n }\n /**\n * Computes the cross product of two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static cross(out, a, b) {\n const ax = a[0], ay = a[1], az = a[2];\n const bx = b[0], by = b[1], bz = b[2];\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n }\n /**\n * Performs a linear interpolation between two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static lerp(out, a, b, t) {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n }\n /**\n * Performs a spherical linear interpolation between two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static slerp(out, a, b, t) {\n const angle = Math.acos(Math.min(Math.max(_Vec3.dot(a, b), -1), 1));\n const sinTotal = Math.sin(angle);\n const ratioA = Math.sin((1 - t) * angle) / sinTotal;\n const ratioB = Math.sin(t * angle) / sinTotal;\n out[0] = ratioA * a[0] + ratioB * b[0];\n out[1] = ratioA * a[1] + ratioB * b[1];\n out[2] = ratioA * a[2] + ratioB * b[2];\n return out;\n }\n /**\n * Performs a hermite interpolation with two control points\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param c - the third operand\n * @param d - the fourth operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static hermite(out, a, b, c, d, t) {\n const factorTimes2 = t * t;\n const factor1 = factorTimes2 * (2 * t - 3) + 1;\n const factor2 = factorTimes2 * (t - 2) + t;\n const factor3 = factorTimes2 * (t - 1);\n const factor4 = factorTimes2 * (3 - 2 * t);\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n }\n /**\n * Performs a bezier interpolation with two control points\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param c - the third operand\n * @param d - the fourth operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static bezier(out, a, b, c, d, t) {\n const inverseFactor = 1 - t;\n const inverseFactorTimesTwo = inverseFactor * inverseFactor;\n const factorTimes2 = t * t;\n const factor1 = inverseFactorTimesTwo * inverseFactor;\n const factor2 = 3 * t * inverseFactorTimesTwo;\n const factor3 = 3 * factorTimes2 * inverseFactor;\n const factor4 = factorTimes2 * t;\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n }\n /**\n * Generates a random vector with the given scale\n * @category Static\n *\n * @param out - the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned\n * @returns `out`\n */\n /*\n static random(out: Vec3Like, scale) {\n scale = scale === undefined ? 1.0 : scale;\n \n let r = glMatrix.RANDOM() * 2.0 * Math.PI;\n let z = glMatrix.RANDOM() * 2.0 - 1.0;\n let zScale = Math.sqrt(1.0 - z * z) * scale;\n \n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n }*/\n /**\n * Transforms the vec3 with a mat4.\n * 4th vector component is implicitly '1'\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to transform\n * @param m - matrix to transform with\n * @returns `out`\n */\n static transformMat4(out, a, m) {\n const x = a[0], y = a[1], z = a[2];\n const w = m[3] * x + m[7] * y + m[11] * z + m[15] || 1;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n }\n /**\n * Transforms the vec3 with a mat3.\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to transform\n * @param m - the 3x3 matrix to transform with\n * @returns `out`\n */\n static transformMat3(out, a, m) {\n const x = a[0], y = a[1], z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n }\n /**\n * Transforms the vec3 with a quat\n * Can also be used for dual quaternions. (Multiply it with the real part)\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to transform\n * @param q - quaternion to transform with\n * @returns `out`\n */\n static transformQuat(out, a, q) {\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const w2 = q[3] * 2;\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const uvx = qy * z - qz * y;\n const uvy = qz * x - qx * z;\n const uvz = qx * y - qy * x;\n const uuvx = (qy * uvz - qz * uvy) * 2;\n const uuvy = (qz * uvx - qx * uvz) * 2;\n const uuvz = (qx * uvy - qy * uvx) * 2;\n out[0] = x + uvx * w2 + uuvx;\n out[1] = y + uvy * w2 + uuvy;\n out[2] = z + uvz * w2 + uuvz;\n return out;\n }\n /**\n * Rotate a 3D vector around the x-axis\n * @category Static\n *\n * @param out - The receiving vec3\n * @param a - The vec3 point to rotate\n * @param b - The origin of the rotation\n * @param rad - The angle of rotation in radians\n * @returns `out`\n */\n static rotateX(out, a, b, rad) {\n const by = b[1];\n const bz = b[2];\n const py = a[1] - by;\n const pz = a[2] - bz;\n out[0] = a[0];\n out[1] = py * Math.cos(rad) - pz * Math.sin(rad) + by;\n out[2] = py * Math.sin(rad) + pz * Math.cos(rad) + bz;\n return out;\n }\n /**\n * Rotate a 3D vector around the y-axis\n * @category Static\n *\n * @param out - The receiving vec3\n * @param a - The vec3 point to rotate\n * @param b - The origin of the rotation\n * @param rad - The angle of rotation in radians\n * @returns `out`\n */\n static rotateY(out, a, b, rad) {\n const bx = b[0];\n const bz = b[2];\n const px = a[0] - bx;\n const pz = a[2] - bz;\n out[0] = pz * Math.sin(rad) + px * Math.cos(rad) + bx;\n out[1] = a[1];\n out[2] = pz * Math.cos(rad) - px * Math.sin(rad) + bz;\n return out;\n }\n /**\n * Rotate a 3D vector around the z-axis\n * @category Static\n *\n * @param out - The receiving vec3\n * @param a - The vec3 point to rotate\n * @param b - The origin of the rotation\n * @param rad - The angle of rotation in radians\n * @returns `out`\n */\n static rotateZ(out, a, b, rad) {\n const bx = b[0];\n const by = b[1];\n const px = a[0] - bx;\n const py = a[1] - by;\n out[0] = px * Math.cos(rad) - py * Math.sin(rad) + bx;\n out[1] = px * Math.sin(rad) + py * Math.cos(rad) + by;\n out[2] = b[2];\n return out;\n }\n /**\n * Get the angle between two 3D vectors\n * @category Static\n *\n * @param a - The first operand\n * @param b - The second operand\n * @returns The angle in radians\n */\n static angle(a, b) {\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 mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz));\n const cosine = mag && _Vec3.dot(a, b) / mag;\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n }\n /**\n * Set the components of a vec3 to zero\n * @category Static\n *\n * @param out - the receiving vector\n * @returns `out`\n */\n static zero(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n return out;\n }\n /**\n * Returns a string representation of a vector\n * @category Static\n *\n * @param a - vector to represent as a string\n * @returns string representation of the vector\n */\n static str(a) {\n return `Vec3(${a.join(\", \")})`;\n }\n /**\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n }\n /**\n * Returns whether the vectors have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2));\n }\n};\nVec3.prototype.sub = Vec3.prototype.subtract;\nVec3.prototype.mul = Vec3.prototype.multiply;\nVec3.prototype.div = Vec3.prototype.divide;\nVec3.prototype.dist = Vec3.prototype.distance;\nVec3.prototype.sqrDist = Vec3.prototype.squaredDistance;\nVec3.sub = Vec3.subtract;\nVec3.mul = Vec3.multiply;\nVec3.div = Vec3.divide;\nVec3.dist = Vec3.distance;\nVec3.sqrDist = Vec3.squaredDistance;\nVec3.sqrLen = Vec3.squaredLength;\nVec3.mag = Vec3.magnitude;\nVec3.length = Vec3.magnitude;\nVec3.len = Vec3.magnitude;\n\n// src/_lib/f64/Vec4.ts\nvar Vec4 = class _Vec4 extends Float64Array {\n /**\n * Create a {@link Vec4}.\n *\n * @category Constructor\n */\n constructor(...values) {\n switch (values.length) {\n case 4:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 4);\n break;\n case 1: {\n const v = values[0];\n if (typeof v === \"number\") {\n super([v, v, v, v]);\n } else {\n super(v, 0, 4);\n }\n break;\n }\n default:\n super(4);\n break;\n }\n }\n // ============\n // Accessors\n // ============\n // Getters and setters to make component access read better.\n // These are likely to be a little bit slower than direct array access.\n /**\n * The x component of the vector. Equivalent to `this[0];`\n * @category Vector Components\n */\n get x() {\n return this[0];\n }\n set x(value) {\n this[0] = value;\n }\n /**\n * The y component of the vector. Equivalent to `this[1];`\n * @category Vector Components\n */\n get y() {\n return this[1];\n }\n set y(value) {\n this[1] = value;\n }\n /**\n * The z component of the vector. Equivalent to `this[2];`\n * @category Vector Components\n */\n get z() {\n return this[2];\n }\n set z(value) {\n this[2] = value;\n }\n /**\n * The w component of the vector. Equivalent to `this[3];`\n * @category Vector Components\n */\n get w() {\n return this[3];\n }\n set w(value) {\n this[3] = value;\n }\n // Alternate set of getters and setters in case this is being used to define\n // a color.\n /**\n * The r component of the vector. Equivalent to `this[0];`\n * @category Color Components\n */\n get r() {\n return this[0];\n }\n set r(value) {\n this[0] = value;\n }\n /**\n * The g component of the vector. Equivalent to `this[1];`\n * @category Color Components\n */\n get g() {\n return this[1];\n }\n set g(value) {\n this[1] = value;\n }\n /**\n * The b component of the vector. Equivalent to `this[2];`\n * @category Color Components\n */\n get b() {\n return this[2];\n }\n set b(value) {\n this[2] = value;\n }\n /**\n * The a component of the vector. Equivalent to `this[3];`\n * @category Color Components\n */\n get a() {\n return this[3];\n }\n set a(value) {\n this[3] = value;\n }\n /**\n * The magnitude (length) of this.\n * Equivalent to `Vec4.magnitude(this);`\n *\n * Magnitude is used because the `length` attribute is already defined by\n * TypedArrays to mean the number of elements in the array.\n *\n * @category Accessors\n */\n get magnitude() {\n const x = this[0];\n const y = this[1];\n const z = this[2];\n const w = this[3];\n return Math.sqrt(x * x + y * y + z * z + w * w);\n }\n /**\n * Alias for {@link Vec4.magnitude}\n *\n * @category Accessors\n */\n get mag() {\n return this.magnitude;\n }\n /**\n * A string representation of `this`\n * Equivalent to `Vec4.str(this);`\n *\n * @category Accessors\n */\n get str() {\n return _Vec4.str(this);\n }\n // ===================\n // Instances methods\n // ===================\n /**\n * Copy the values from another {@link Vec4} into `this`.\n * @category Methods\n *\n * @param a the source vector\n * @returns `this`\n */\n copy(a) {\n super.set(a);\n return this;\n }\n /**\n * Adds a {@link Vec4} to `this`.\n * Equivalent to `Vec4.add(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to add to `this`\n * @returns `this`\n */\n add(b) {\n this[0] += b[0];\n this[1] += b[1];\n this[2] += b[2];\n this[3] += b[3];\n return this;\n }\n /**\n * Subtracts a {@link Vec4} from `this`.\n * Equivalent to `Vec4.subtract(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to subtract from `this`\n * @returns `this`\n */\n subtract(b) {\n this[0] -= b[0];\n this[1] -= b[1];\n this[2] -= b[2];\n this[3] -= b[3];\n return this;\n }\n /**\n * Alias for {@link Vec4.subtract}\n * @category Methods\n */\n sub(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Multiplies `this` by a {@link Vec4}.\n * Equivalent to `Vec4.multiply(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to multiply `this` by\n * @returns `this`\n */\n multiply(b) {\n this[0] *= b[0];\n this[1] *= b[1];\n this[2] *= b[2];\n this[3] *= b[3];\n return this;\n }\n /**\n * Alias for {@link Vec4.multiply}\n * @category Methods\n */\n mul(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Divides `this` by a {@link Vec4}.\n * Equivalent to `Vec4.divide(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to divide `this` by\n * @returns `this`\n */\n divide(b) {\n this[0] /= b[0];\n this[1] /= b[1];\n this[2] /= b[2];\n this[3] /= b[3];\n return this;\n }\n /**\n * Alias for {@link Vec4.divide}\n * @category Methods\n */\n div(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Scales `this` by a scalar number.\n * Equivalent to `Vec4.scale(this, this, b);`\n * @category Methods\n *\n * @param b - Amount to scale `this` by\n * @returns `this`\n */\n scale(b) {\n this[0] *= b;\n this[1] *= b;\n this[2] *= b;\n this[3] *= b;\n return this;\n }\n /**\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\n * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);`\n * @category Methods\n *\n * @param b - The vector to add to `this`\n * @param scale - The amount to scale `b` by before adding\n * @returns `this`\n */\n scaleAndAdd(b, scale) {\n this[0] += b[0] * scale;\n this[1] += b[1] * scale;\n this[2] += b[2] * scale;\n this[3] += b[3] * scale;\n return this;\n }\n /**\n * Calculates the Euclidean distance between another {@link Vec4} and `this`.\n * Equivalent to `Vec4.distance(this, b);`\n * @category Methods\n *\n * @param b - The vector to calculate the distance to\n * @returns Distance between `this` and `b`\n */\n distance(b) {\n return _Vec4.distance(this, b);\n }\n /**\n * Alias for {@link Vec4.distance}\n * @category Methods\n */\n dist(b) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Calculates the squared Euclidean distance between another {@link Vec4} and `this`.\n * Equivalent to `Vec4.squaredDistance(this, b);`\n * @category Methods\n *\n * @param b The vector to calculate the squared distance to\n * @returns Squared distance between `this` and `b`\n */\n squaredDistance(b) {\n return _Vec4.squaredDistance(this, b);\n }\n /**\n * Alias for {@link Vec4.squaredDistance}\n * @category Methods\n */\n sqrDist(b) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Negates the components of `this`.\n * Equivalent to `Vec4.negate(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n negate() {\n this[0] *= -1;\n this[1] *= -1;\n this[2] *= -1;\n this[3] *= -1;\n return this;\n }\n /**\n * Inverts the components of `this`.\n * Equivalent to `Vec4.inverse(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n invert() {\n this[0] = 1 / this[0];\n this[1] = 1 / this[1];\n this[2] = 1 / this[2];\n this[3] = 1 / this[3];\n return this;\n }\n /**\n * Sets each component of `this` to it's absolute value.\n * Equivalent to `Vec4.abs(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n abs() {\n this[0] = Math.abs(this[0]);\n this[1] = Math.abs(this[1]);\n this[2] = Math.abs(this[2]);\n this[3] = Math.abs(this[3]);\n return this;\n }\n /**\n * Calculates the dot product of this and another {@link Vec4}.\n * Equivalent to `Vec4.dot(this, b);`\n * @category Methods\n *\n * @param b - The second operand\n * @returns Dot product of `this` and `b`\n */\n dot(b) {\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3];\n }\n /**\n * Normalize `this`.\n * Equivalent to `Vec4.normalize(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n normalize() {\n return _Vec4.normalize(this, this);\n }\n // ===================\n // Static accessors\n // ===================\n /**\n * @category Static\n *\n * @returns The number of bytes in a {@link Vec4}.\n */\n static get BYTE_LENGTH() {\n return 4 * Float64Array.BYTES_PER_ELEMENT;\n }\n // ===================\n // Static methods\n // ===================\n /**\n * Creates a new, empty {@link Vec4}\n * @category Static\n *\n * @returns a new 4D vector\n */\n static create() {\n return new _Vec4();\n }\n /**\n * Creates a new {@link Vec4} initialized with values from an existing vector\n * @category Static\n *\n * @param a - vector to clone\n * @returns a new 4D vector\n */\n static clone(a) {\n return new _Vec4(a);\n }\n /**\n * Creates a new {@link Vec4} initialized with the given values\n * @category Static\n *\n * @param x - X component\n * @param y - Y component\n * @param z - Z component\n * @param w - W component\n * @returns a new 4D vector\n */\n static fromValues(x, y, z, w) {\n return new _Vec4(x, y, z, w);\n }\n /**\n * Copy the values from one {@link Vec4} to another\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the source vector\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n }\n /**\n * Set the components of a {@link Vec4} to the given values\n * @category Static\n *\n * @param out - the receiving vector\n * @param x - X component\n * @param y - Y component\n * @param z - Z component\n * @param w - W component\n * @returns `out`\n */\n static set(out, x, y, z, w) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n }\n /**\n * Adds two {@link Vec4}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n }\n /**\n * Subtracts vector b from vector a\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n }\n /**\n * Alias for {@link Vec4.subtract}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sub(out, a, b) {\n return out;\n }\n /**\n * Multiplies two {@link Vec4}'s\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n out[3] = a[3] * b[3];\n return out;\n }\n /**\n * Alias for {@link Vec4.multiply}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static mul(out, a, b) {\n return out;\n }\n /**\n * Divides two {@link Vec4}'s\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n out[3] = a[3] / b[3];\n return out;\n }\n /**\n * Alias for {@link Vec4.divide}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static div(out, a, b) {\n return out;\n }\n /**\n * Math.ceil the components of a {@link Vec4}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to ceil\n * @returns `out`\n */\n static ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n out[3] = Math.ceil(a[3]);\n return out;\n }\n /**\n * Math.floor the components of a {@link Vec4}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to floor\n * @returns `out`\n */\n static floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n out[3] = Math.floor(a[3]);\n return out;\n }\n /**\n * Returns the minimum of two {@link Vec4}'s\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n out[3] = Math.min(a[3], b[3]);\n return out;\n }\n /**\n * Returns the maximum of two {@link Vec4}'s\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n out[3] = Math.max(a[3], b[3]);\n return out;\n }\n /**\n * Math.round the components of a {@link Vec4}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to round\n * @returns `out`\n */\n static round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n out[3] = Math.round(a[3]);\n return out;\n }\n /**\n * Scales a {@link Vec4} by a scalar number\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to scale\n * @param scale - amount to scale the vector by\n * @returns `out`\n */\n static scale(out, a, scale) {\n out[0] = a[0] * scale;\n out[1] = a[1] * scale;\n out[2] = a[2] * scale;\n out[3] = a[3] * scale;\n return out;\n }\n /**\n * Adds two {@link Vec4}'s after scaling the second operand by a scalar value\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param scale - the amount to scale b by before adding\n * @returns `out`\n */\n static scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n }\n /**\n * Calculates the Euclidean distance between two {@link Vec4}'s\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns distance between a and b\n */\n static distance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n const z = b[2] - a[2];\n const w = b[3] - a[3];\n return Math.hypot(x, y, z, w);\n }\n /**\n * Alias for {@link Vec4.distance}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static dist(a, b) {\n return 0;\n }\n /**\n * Calculates the squared Euclidean distance between two {@link Vec4}'s\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns squared distance between a and b\n */\n static squaredDistance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n const z = b[2] - a[2];\n const w = b[3] - a[3];\n return x * x + y * y + z * z + w * w;\n }\n /**\n * Alias for {@link Vec4.squaredDistance}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sqrDist(a, b) {\n return 0;\n }\n /**\n * Calculates the magnitude (length) of a {@link Vec4}\n * @category Static\n *\n * @param a - vector to calculate length of\n * @returns length of `a`\n */\n static magnitude(a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n return Math.sqrt(x * x + y * y + z * z + w * w);\n }\n /**\n * Alias for {@link Vec4.magnitude}\n * @category Static\n */\n static mag(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Alias for {@link Vec4.magnitude}\n * @category Static\n * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs\n */\n // Length conflicts with Function.length\n static length(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Alias for {@link Vec4.magnitude}\n * @category Static\n * @deprecated Use {@link Vec4.mag}\n */\n static len(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Calculates the squared length of a {@link Vec4}\n * @category Static\n *\n * @param a - vector to calculate squared length of\n * @returns squared length of a\n */\n static squaredLength(a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n return x * x + y * y + z * z + w * w;\n }\n /**\n * Alias for {@link Vec4.squaredLength}\n * @category Static\n */\n static sqrLen(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Negates the components of a {@link Vec4}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to negate\n * @returns `out`\n */\n static negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = -a[3];\n return out;\n }\n /**\n * Returns the inverse of the components of a {@link Vec4}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to invert\n * @returns `out`\n */\n static inverse(out, a) {\n out[0] = 1 / a[0];\n out[1] = 1 / a[1];\n out[2] = 1 / a[2];\n out[3] = 1 / a[3];\n return out;\n }\n /**\n * Returns the absolute value of the components of a {@link Vec4}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to compute the absolute values of\n * @returns `out`\n */\n static abs(out, a) {\n out[0] = Math.abs(a[0]);\n out[1] = Math.abs(a[1]);\n out[2] = Math.abs(a[2]);\n out[3] = Math.abs(a[3]);\n return out;\n }\n /**\n * Normalize a {@link Vec4}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to normalize\n * @returns `out`\n */\n static normalize(out, a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n let len = x * x + y * y + z * z + w * w;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n out[0] = x * len;\n out[1] = y * len;\n out[2] = z * len;\n out[3] = w * len;\n return out;\n }\n /**\n * Calculates the dot product of two {@link Vec4}'s\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns dot product of a and b\n */\n static dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n }\n /**\n * Returns the cross-product of three vectors in a 4-dimensional space\n * @category Static\n *\n * @param out the receiving vector\n * @param u - the first vector\n * @param v - the second vector\n * @param w - the third vector\n * @returns result\n */\n static cross(out, u, v, w) {\n const a = v[0] * w[1] - v[1] * w[0];\n const b = v[0] * w[2] - v[2] * w[0];\n const c = v[0] * w[3] - v[3] * w[0];\n const d = v[1] * w[2] - v[2] * w[1];\n const e = v[1] * w[3] - v[3] * w[1];\n const f = v[2] * w[3] - v[3] * w[2];\n const g = u[0];\n const h = u[1];\n const i = u[2];\n const j = u[3];\n out[0] = h * f - i * e + j * d;\n out[1] = -(g * f) + i * c - j * b;\n out[2] = g * e - h * c + j * a;\n out[3] = -(g * d) + h * b - i * a;\n return out;\n }\n /**\n * Performs a linear interpolation between two {@link Vec4}'s\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static lerp(out, a, b, t) {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n out[3] = aw + t * (b[3] - aw);\n return out;\n }\n /**\n * Generates a random vector with the given scale\n * @category Static\n *\n * @param out - the receiving vector\n * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns `out`\n */\n /*\n static random(out: Vec4Like, scale): Vec4Like {\n scale = scale || 1.0;\n \n // Marsaglia, George. Choosing a Point from the Surface of a\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\n // http://projecteuclid.org/euclid.aoms/1177692644;\n var v1, v2, v3, v4;\n var s1, s2;\n do {\n v1 = glMatrix.RANDOM() * 2 - 1;\n v2 = glMatrix.RANDOM() * 2 - 1;\n s1 = v1 * v1 + v2 * v2;\n } while (s1 >= 1);\n do {\n v3 = glMatrix.RANDOM() * 2 - 1;\n v4 = glMatrix.RANDOM() * 2 - 1;\n s2 = v3 * v3 + v4 * v4;\n } while (s2 >= 1);\n \n var d = Math.sqrt((1 - s1) / s2);\n out[0] = scale * v1;\n out[1] = scale * v2;\n out[2] = scale * v3 * d;\n out[3] = scale * v4 * d;\n return out;\n }*/\n /**\n * Transforms the {@link Vec4} with a {@link Mat4}.\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to transform\n * @param m - matrix to transform with\n * @returns `out`\n */\n static transformMat4(out, a, m) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n }\n /**\n * Transforms the {@link Vec4} with a {@link Quat}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to transform\n * @param q - quaternion to transform with\n * @returns `out`\n */\n static transformQuat(out, a, q) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n const ix = qw * x + qy * z - qz * y;\n const iy = qw * y + qz * x - qx * z;\n const iz = qw * z + qx * y - qy * x;\n const iw = -qx * x - qy * y - qz * z;\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n out[3] = a[3];\n return out;\n }\n /**\n * Set the components of a {@link Vec4} to zero\n * @category Static\n *\n * @param out - the receiving vector\n * @returns `out`\n */\n static zero(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n return out;\n }\n /**\n * Returns a string representation of a {@link Vec4}\n * @category Static\n *\n * @param a - vector to represent as a string\n * @returns string representation of the vector\n */\n static str(a) {\n return `Vec4(${a.join(\", \")})`;\n }\n /**\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n }\n /**\n * Returns whether the vectors have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3));\n }\n};\nVec4.prototype.sub = Vec4.prototype.subtract;\nVec4.prototype.mul = Vec4.prototype.multiply;\nVec4.prototype.div = Vec4.prototype.divide;\nVec4.prototype.dist = Vec4.prototype.distance;\nVec4.prototype.sqrDist = Vec4.prototype.squaredDistance;\nVec4.sub = Vec4.subtract;\nVec4.mul = Vec4.multiply;\nVec4.div = Vec4.divide;\nVec4.dist = Vec4.distance;\nVec4.sqrDist = Vec4.squaredDistance;\nVec4.sqrLen = Vec4.squaredLength;\nVec4.mag = Vec4.magnitude;\nVec4.length = Vec4.magnitude;\nVec4.len = Vec4.magnitude;\n\n// src/_lib/f64/Quat.ts\nvar _DEFAULT_ANGLE_ORDER, _TMP_QUAT1, _TMP_QUAT2, _TMP_MAT3, _TMP_VEC32, _X_UNIT_VEC3, _Y_UNIT_VEC3;\nvar _Quat = class _Quat extends Float64Array {\n /**\n * Create a {@link Quat}.\n *\n * @category Constructor\n */\n constructor(...values) {\n switch (values.length) {\n case 4:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 4);\n break;\n case 1: {\n const v = values[0];\n if (typeof v === \"number\") {\n super([v, v, v, v]);\n } else {\n super(v, 0, 4);\n }\n break;\n }\n default:\n super(4);\n this[3] = 1;\n break;\n }\n }\n // ============\n // Accessors\n // ============\n // Getters and setters to make component access read better.\n // These are likely to be a little bit slower than direct array access.\n /**\n * The x component of the quaternion. Equivalent to `this[0];`\n * @category Quaternion Components\n */\n get x() {\n return this[0];\n }\n set x(value) {\n this[0] = value;\n }\n /**\n * The y component of the quaternion. Equivalent to `this[1];`\n * @category Quaternion Components\n */\n get y() {\n return this[1];\n }\n set y(value) {\n this[1] = value;\n }\n /**\n * The z component of the quaternion. Equivalent to `this[2];`\n * @category Quaternion Components\n */\n get z() {\n return this[2];\n }\n set z(value) {\n this[2] = value;\n }\n /**\n * The w component of the quaternion. Equivalent to `this[3];`\n * @category Quaternion Components\n */\n get w() {\n return this[3];\n }\n set w(value) {\n this[3] = value;\n }\n /**\n * The magnitude (length) of this.\n * Equivalent to `Quat.magnitude(this);`\n *\n * Magnitude is used because the `length` attribute is already defined by\n * TypedArrays to mean the number of elements in the array.\n *\n * @category Accessors\n */\n get magnitude() {\n const x = this[0];\n const y = this[1];\n const z = this[2];\n const w = this[3];\n return Math.sqrt(x * x + y * y + z * z + w * w);\n }\n /**\n * Alias for {@link Quat.magnitude}\n *\n * @category Accessors\n */\n get mag() {\n return this.magnitude;\n }\n /**\n * A string representation of `this`\n * Equivalent to `Quat.str(this);`\n *\n * @category Accessors\n */\n get str() {\n return _Quat.str(this);\n }\n // ===================\n // Instances methods\n // ===================\n /**\n * Copy the values from another {@link Quat} into `this`.\n * @category Methods\n *\n * @param a the source quaternion\n * @returns `this`\n */\n copy(a) {\n super.set(a);\n return this;\n }\n /**\n * Set `this` to the identity quaternion\n * Equivalent to Quat.identity(this)\n * @category Methods\n *\n * @returns `this`\n */\n identity() {\n this[0] = 0;\n this[1] = 0;\n this[2] = 0;\n this[3] = 1;\n return this;\n }\n /**\n * Multiplies `this` by a {@link Quat}.\n * Equivalent to `Quat.multiply(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to multiply `this` by\n * @returns `this`\n */\n multiply(b) {\n return _Quat.multiply(this, this, b);\n }\n /**\n * Alias for {@link Quat.multiply}\n * @category Methods\n */\n mul(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Rotates `this` by the given angle about the X axis\n * Equivalent to `Quat.rotateX(this, this, rad);`\n * @category Methods\n *\n * @param rad - angle (in radians) to rotate\n * @returns `this`\n */\n rotateX(rad) {\n return _Quat.rotateX(this, this, rad);\n }\n /**\n * Rotates `this` by the given angle about the Y axis\n * Equivalent to `Quat.rotateY(this, this, rad);`\n * @category Methods\n *\n * @param rad - angle (in radians) to rotate\n * @returns `this`\n */\n rotateY(rad) {\n return _Quat.rotateY(this, this, rad);\n }\n /**\n * Rotates `this` by the given angle about the Z axis\n * Equivalent to `Quat.rotateZ(this, this, rad);`\n * @category Methods\n *\n * @param rad - angle (in radians) to rotate\n * @returns `this`\n */\n rotateZ(rad) {\n return _Quat.rotateZ(this, this, rad);\n }\n /**\n * Inverts `this`\n * Equivalent to `Quat.invert(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n invert() {\n return _Quat.invert(this, this);\n }\n /**\n * Scales `this` by a scalar number\n * Equivalent to `Quat.scale(this, this, scale);`\n * @category Methods\n *\n * @param scale - amount to scale the vector by\n * @returns `this`\n */\n scale(scale) {\n this[0] *= scale;\n this[1] *= scale;\n this[2] *= scale;\n this[3] *= scale;\n return this;\n }\n /**\n * Calculates the dot product of `this` and another {@link Quat}\n * Equivalent to `Quat.dot(this, b);`\n * @category Methods\n *\n * @param b - the second operand\n * @returns dot product of `this` and b\n */\n dot(b) {\n return _Quat.dot(this, b);\n }\n // ===================\n // Static accessors\n // ===================\n /**\n * @category Static\n *\n * @returns The number of bytes in a {@link Quat}.\n */\n static get BYTE_LENGTH() {\n return 4 * Float64Array.BYTES_PER_ELEMENT;\n }\n // ===================\n // Static methods\n // ===================\n /**\n * Creates a new identity quat\n * @category Static\n *\n * @returns a new quaternion\n */\n static create() {\n return new _Quat();\n }\n /**\n * Set a quat to the identity quaternion\n * @category Static\n *\n * @param out - the receiving quaternion\n * @returns `out`\n */\n static identity(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n }\n /**\n * Sets a quat from the given angle and rotation axis,\n * then returns it.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param axis - the axis around which to rotate\n * @param rad - the angle in radians\n * @returns `out`\n **/\n static setAxisAngle(out, axis, rad) {\n rad *= 0.5;\n const s = Math.sin(rad);\n out[0] = s * axis[0];\n out[1] = s * axis[1];\n out[2] = s * axis[2];\n out[3] = Math.cos(rad);\n return out;\n }\n /**\n * Gets the rotation axis and angle for a given\n * quaternion. If a quaternion is created with\n * setAxisAngle, this method will return the same\n * values as provided in the original parameter list\n * OR functionally equivalent values.\n * Example: The quaternion formed by axis [0, 0, 1] and\n * angle -90 is the same as the quaternion formed by\n * [0, 0, 1] and 270. This method favors the latter.\n * @category Static\n *\n * @param out_axis - Vector receiving the axis of rotation\n * @param q - Quaternion to be decomposed\n * @return Angle, in radians, of the rotation\n */\n static getAxisAngle(out_axis, q) {\n const rad = Math.acos(q[3]) * 2;\n const s = Math.sin(rad / 2);\n if (s > GLM_EPSILON) {\n out_axis[0] = q[0] / s;\n out_axis[1] = q[1] / s;\n out_axis[2] = q[2] / s;\n } else {\n out_axis[0] = 1;\n out_axis[1] = 0;\n out_axis[2] = 0;\n }\n return rad;\n }\n /**\n * Gets the angular distance between two unit quaternions\n * @category Static\n *\n * @param {ReadonlyQuat} a Origin unit quaternion\n * @param {ReadonlyQuat} b Destination unit quaternion\n * @return {Number} Angle, in radians, between the two quaternions\n */\n static getAngle(a, b) {\n const dotproduct = _Quat.dot(a, b);\n return Math.acos(2 * dotproduct * dotproduct - 1);\n }\n /**\n * Multiplies two quaternions.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n }\n /**\n * Rotates a quaternion by the given angle about the X axis\n * @category Static\n *\n * @param out - quat receiving operation result\n * @param a - quat to rotate\n * @param rad - angle (in radians) to rotate\n * @returns `out`\n */\n static rotateX(out, a, rad) {\n rad *= 0.5;\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n const bx = Math.sin(rad);\n const bw = Math.cos(rad);\n out[0] = ax * bw + aw * bx;\n out[1] = ay * bw + az * bx;\n out[2] = az * bw - ay * bx;\n out[3] = aw * bw - ax * bx;\n return out;\n }\n /**\n * Rotates a quaternion by the given angle about the Y axis\n * @category Static\n *\n * @param out - quat receiving operation result\n * @param a - quat to rotate\n * @param rad - angle (in radians) to rotate\n * @returns `out`\n */\n static rotateY(out, a, rad) {\n rad *= 0.5;\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n const by = Math.sin(rad);\n const bw = Math.cos(rad);\n out[0] = ax * bw - az * by;\n out[1] = ay * bw + aw * by;\n out[2] = az * bw + ax * by;\n out[3] = aw * bw - ay * by;\n return out;\n }\n /**\n * Rotates a quaternion by the given angle about the Z axis\n * @category Static\n *\n * @param out - quat receiving operation result\n * @param a - quat to rotate\n * @param rad - angle (in radians) to rotate\n * @returns `out`\n */\n static rotateZ(out, a, rad) {\n rad *= 0.5;\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n const bz = Math.sin(rad);\n const bw = Math.cos(rad);\n out[0] = ax * bw + ay * bz;\n out[1] = ay * bw - ax * bz;\n out[2] = az * bw + aw * bz;\n out[3] = aw * bw - az * bz;\n return out;\n }\n /**\n * Calculates the W component of a quat from the X, Y, and Z components.\n * Assumes that quaternion is 1 unit in length.\n * Any existing W component will be ignored.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quat to calculate W component of\n * @returns `out`\n */\n static calculateW(out, a) {\n const x = a[0], y = a[1], z = a[2];\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = Math.sqrt(Math.abs(1 - x * x - y * y - z * z));\n return out;\n }\n /**\n * Calculate the exponential of a unit quaternion.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quat to calculate the exponential of\n * @returns `out`\n */\n static exp(out, a) {\n const x = a[0], y = a[1], z = a[2], w = a[3];\n const r = Math.sqrt(x * x + y * y + z * z);\n const et = Math.exp(w);\n const s = r > 0 ? et * Math.sin(r) / r : 0;\n out[0] = x * s;\n out[1] = y * s;\n out[2] = z * s;\n out[3] = et * Math.cos(r);\n return out;\n }\n /**\n * Calculate the natural logarithm of a unit quaternion.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quat to calculate the exponential of\n * @returns `out`\n */\n static ln(out, a) {\n const x = a[0], y = a[1], z = a[2], w = a[3];\n const r = Math.sqrt(x * x + y * y + z * z);\n const t = r > 0 ? Math.atan2(r, w) / r : 0;\n out[0] = x * t;\n out[1] = y * t;\n out[2] = z * t;\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\n return out;\n }\n /**\n * Calculate the scalar power of a unit quaternion.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quat to calculate the exponential of\n * @param b - amount to scale the quaternion by\n * @returns `out`\n */\n static pow(out, a, b) {\n _Quat.ln(out, a);\n _Quat.scale(out, out, b);\n _Quat.exp(out, out);\n return out;\n }\n /**\n * Performs a spherical linear interpolation between two quat\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static slerp(out, a, b, t) {\n const ax = a[0], ay = a[1], az = a[2], aw = a[3];\n let bx = b[0], by = b[1], bz = b[2], bw = b[3];\n let scale0;\n let scale1;\n let cosom = ax * bx + ay * by + az * bz + aw * bw;\n if (cosom < 0) {\n cosom = -cosom;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n if (1 - cosom > GLM_EPSILON) {\n const omega = Math.acos(cosom);\n const sinom = Math.sin(omega);\n scale0 = Math.sin((1 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n } else {\n scale0 = 1 - t;\n scale1 = t;\n }\n out[0] = scale0 * ax + scale1 * bx;\n out[1] = scale0 * ay + scale1 * by;\n out[2] = scale0 * az + scale1 * bz;\n out[3] = scale0 * aw + scale1 * bw;\n return out;\n }\n /**\n * Generates a random unit quaternion\n * @category Static\n *\n * @param out - the receiving quaternion\n * @returns `out`\n */\n /* static random(out: QuatLike): QuatLike {\n // Implementation of http://planning.cs.uiuc.edu/node198.html\n // TODO: Calling random 3 times is probably not the fastest solution\n let u1 = glMatrix.RANDOM();\n let u2 = glMatrix.RANDOM();\n let u3 = glMatrix.RANDOM();\n \n let sqrt1MinusU1 = Math.sqrt(1 - u1);\n let sqrtU1 = Math.sqrt(u1);\n \n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\n return out;\n }*/\n /**\n * Calculates the inverse of a quat\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quat to calculate inverse of\n * @returns `out`\n */\n static invert(out, a) {\n const a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3];\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1 / dot : 0;\n out[0] = -a0 * invDot;\n out[1] = -a1 * invDot;\n out[2] = -a2 * invDot;\n out[3] = a3 * invDot;\n return out;\n }\n /**\n * Calculates the conjugate of a quat\n * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quat to calculate conjugate of\n * @returns `out`\n */\n static conjugate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n return out;\n }\n /**\n * Creates a quaternion from the given 3x3 rotation matrix.\n *\n * NOTE: The resultant quaternion is not normalized, so you should be sure\n * to re-normalize the quaternion yourself where necessary.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param m - rotation matrix\n * @returns `out`\n */\n static fromMat3(out, m) {\n const fTrace = m[0] + m[4] + m[8];\n let fRoot;\n if (fTrace > 0) {\n fRoot = Math.sqrt(fTrace + 1);\n out[3] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot;\n out[0] = (m[5] - m[7]) * fRoot;\n out[1] = (m[6] - m[2]) * fRoot;\n out[2] = (m[1] - m[3]) * fRoot;\n } else {\n let i = 0;\n if (m[4] > m[0]) {\n i = 1;\n }\n if (m[8] > m[i * 3 + i]) {\n i = 2;\n }\n const j = (i + 1) % 3;\n const k = (i + 2) % 3;\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1);\n out[i] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot;\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\n }\n return out;\n }\n /**\n * Creates a quaternion from the given euler angle x, y, z.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param x - Angle to rotate around X axis in degrees.\n * @param y - Angle to rotate around Y axis in degrees.\n * @param z - Angle to rotate around Z axis in degrees.\n * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx.\n * @returns `out`\n */\n static fromEuler(out, x, y, z, order = __privateGet(_Quat, _DEFAULT_ANGLE_ORDER)) {\n const halfToRad = 0.5 * Math.PI / 180;\n x *= halfToRad;\n y *= halfToRad;\n z *= halfToRad;\n const sx = Math.sin(x);\n const cx = Math.cos(x);\n const sy = Math.sin(y);\n const cy = Math.cos(y);\n const sz = Math.sin(z);\n const cz = Math.cos(z);\n switch (order) {\n case \"xyz\":\n out[0] = sx * cy * cz + cx * sy * sz;\n out[1] = cx * sy * cz - sx * cy * sz;\n out[2] = cx * cy * sz + sx * sy * cz;\n out[3] = cx * cy * cz - sx * sy * sz;\n break;\n case \"xzy\":\n out[0] = sx * cy * cz - cx * sy * sz;\n out[1] = cx * sy * cz - sx * cy * sz;\n out[2] = cx * cy * sz + sx * sy * cz;\n out[3] = cx * cy * cz + sx * sy * sz;\n break;\n case \"yxz\":\n out[0] = sx * cy * cz + cx * sy * sz;\n out[1] = cx * sy * cz - sx * cy * sz;\n out[2] = cx * cy * sz - sx * sy * cz;\n out[3] = cx * cy * cz + sx * sy * sz;\n break;\n case \"yzx\":\n out[0] = sx * cy * cz + cx * sy * sz;\n out[1] = cx * sy * cz + sx * cy * sz;\n out[2] = cx * cy * sz - sx * sy * cz;\n out[3] = cx * cy * cz - sx * sy * sz;\n break;\n case \"zxy\":\n out[0] = sx * cy * cz - cx * sy * sz;\n out[1] = cx * sy * cz + sx * cy * sz;\n out[2] = cx * cy * sz + sx * sy * cz;\n out[3] = cx * cy * cz - sx * sy * sz;\n break;\n case \"zyx\":\n out[0] = sx * cy * cz - cx * sy * sz;\n out[1] = cx * sy * cz + sx * cy * sz;\n out[2] = cx * cy * sz - sx * sy * cz;\n out[3] = cx * cy * cz + sx * sy * sz;\n break;\n default:\n throw new Error(`Unknown angle order ${order}`);\n }\n return out;\n }\n /**\n * Returns a string representation of a quatenion\n * @category Static\n *\n * @param a - vector to represent as a string\n * @returns string representation of the vector\n */\n static str(a) {\n return `Quat(${a.join(\", \")})`;\n }\n /**\n * Creates a new quat initialized with values from an existing quaternion\n * @category Static\n *\n * @param a - quaternion to clone\n * @returns a new quaternion\n */\n static clone(a) {\n return new _Quat(a);\n }\n /**\n * Creates a new quat initialized with the given values\n * @category Static\n *\n * @param x - X component\n * @param y - Y component\n * @param z - Z component\n * @param w - W component\n * @returns a new quaternion\n */\n static fromValues(x, y, z, w) {\n return new _Quat(x, y, z, w);\n }\n /**\n * Copy the values from one quat to another\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - the source quaternion\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n }\n /**\n * Set the components of a {@link Quat} to the given values\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param x - X component\n * @param y - Y component\n * @param z - Z component\n * @param w - W component\n * @returns `out`\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static set(out, x, y, z, w) {\n return out;\n }\n /**\n * Adds two {@link Quat}'s\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static add(out, a, b) {\n return out;\n }\n /**\n * Alias for {@link Quat.multiply}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static mul(out, a, b) {\n return out;\n }\n /**\n * Scales a quat by a scalar number\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to scale\n * @param b - amount to scale the vector by\n * @returns `out`\n */\n static scale(out, a, scale) {\n out[0] = a[0] * scale;\n out[1] = a[1] * scale;\n out[2] = a[2] * scale;\n out[3] = a[3] * scale;\n return out;\n }\n /**\n * Calculates the dot product of two quat's\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns dot product of a and b\n */\n static dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n }\n /**\n * Performs a linear interpolation between two quat's\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static lerp(out, a, b, t) {\n return out;\n }\n /**\n * Calculates the magnitude (length) of a {@link Quat}\n * @category Static\n *\n * @param a - quaternion to calculate length of\n * @returns length of `a`\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static magnitude(a) {\n return 0;\n }\n /**\n * Alias for {@link Quat.magnitude}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static mag(a) {\n return 0;\n }\n /**\n * Alias for {@link Quat.magnitude}\n * @category Static\n * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs\n */\n // Length conflicts with Function.length\n static length(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Alias for {@link Quat.magnitude}\n * @category Static\n * @deprecated Use {@link Quat.mag}\n */\n static len(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Calculates the squared length of a {@link Quat}\n * @category Static\n *\n * @param a - quaternion to calculate squared length of\n * @returns squared length of a\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static squaredLength(a) {\n return 0;\n }\n /**\n * Alias for {@link Quat.squaredLength}\n * @category Static\n */\n static sqrLen(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Normalize a {@link Quat}\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quaternion to normalize\n * @returns `out`\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static normalize(out, a) {\n return out;\n }\n /**\n * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first quaternion.\n * @param b - The second quaternion.\n * @returns True if the vectors are equal, false otherwise.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static exactEquals(a, b) {\n return false;\n }\n /**\n * Returns whether the quaternions have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static equals(a, b) {\n return false;\n }\n /**\n * Sets a quaternion to represent the shortest rotation from one\n * vector to another.\n *\n * Both vectors are assumed to be unit length.\n * @category Static\n *\n * @param out - the receiving quaternion.\n * @param a - the initial vector\n * @param b - the destination vector\n * @returns `out`\n */\n static rotationTo(out, a, b) {\n const dot = Vec3.dot(a, b);\n if (dot < -0.999999) {\n Vec3.cross(__privateGet(_Quat, _TMP_VEC32), __privateGet(_Quat, _X_UNIT_VEC3), a);\n if (Vec3.mag(__privateGet(_Quat, _TMP_VEC32)) < 1e-6) {\n Vec3.cross(__privateGet(_Quat, _TMP_VEC32), __privateGet(_Quat, _Y_UNIT_VEC3), a);\n }\n Vec3.normalize(__privateGet(_Quat, _TMP_VEC32), __privateGet(_Quat, _TMP_VEC32));\n _Quat.setAxisAngle(out, __privateGet(_Quat, _TMP_VEC32), Math.PI);\n return out;\n } else if (dot > 0.999999) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n } else {\n Vec3.cross(__privateGet(_Quat, _TMP_VEC32), a, b);\n out[0] = __privateGet(_Quat, _TMP_VEC32)[0];\n out[1] = __privateGet(_Quat, _TMP_VEC32)[1];\n out[2] = __privateGet(_Quat, _TMP_VEC32)[2];\n out[3] = 1 + dot;\n return _Quat.normalize(out, out);\n }\n }\n /**\n * Performs a spherical linear interpolation with two control points\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @param c - the third operand\n * @param d - the fourth operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static sqlerp(out, a, b, c, d, t) {\n _Quat.slerp(__privateGet(_Quat, _TMP_QUAT1), a, d, t);\n _Quat.slerp(__privateGet(_Quat, _TMP_QUAT2), b, c, t);\n _Quat.slerp(out, __privateGet(_Quat, _TMP_QUAT1), __privateGet(_Quat, _TMP_QUAT2), 2 * t * (1 - t));\n return out;\n }\n /**\n * Sets the specified quaternion with values corresponding to the given\n * axes. Each axis is a vec3 and is expected to be unit length and\n * perpendicular to all other specified axes.\n * @category Static\n *\n * @param out - The receiving quaternion\n * @param view - the vector representing the viewing direction\n * @param right - the vector representing the local `right` direction\n * @param up - the vector representing the local `up` direction\n * @returns `out`\n */\n static setAxes(out, view, right, up) {\n __privateGet(_Quat, _TMP_MAT3)[0] = right[0];\n __privateGet(_Quat, _TMP_MAT3)[3] = right[1];\n __privateGet(_Quat, _TMP_MAT3)[6] = right[2];\n __privateGet(_Quat, _TMP_MAT3)[1] = up[0];\n __privateGet(_Quat, _TMP_MAT3)[4] = up[1];\n __privateGet(_Quat, _TMP_MAT3)[7] = up[2];\n __privateGet(_Quat, _TMP_MAT3)[2] = -view[0];\n __privateGet(_Quat, _TMP_MAT3)[5] = -view[1];\n __privateGet(_Quat, _TMP_MAT3)[8] = -view[2];\n return _Quat.normalize(out, _Quat.fromMat3(out, __privateGet(_Quat, _TMP_MAT3)));\n }\n};\n_DEFAULT_ANGLE_ORDER = new WeakMap();\n_TMP_QUAT1 = new WeakMap();\n_TMP_QUAT2 = new WeakMap();\n_TMP_MAT3 = new WeakMap();\n_TMP_VEC32 = new WeakMap();\n_X_UNIT_VEC3 = new WeakMap();\n_Y_UNIT_VEC3 = new WeakMap();\n__privateAdd(_Quat, _DEFAULT_ANGLE_ORDER, \"zyx\");\n// Temporary variables to prevent repeated allocations in the algorithms within Quat.\n// These are declared as TypedArrays to aid in tree-shaking.\n__privateAdd(_Quat, _TMP_QUAT1, new Float64Array(4));\n__privateAdd(_Quat, _TMP_QUAT2, new Float64Array(4));\n__privateAdd(_Quat, _TMP_MAT3, new Float64Array(9));\n__privateAdd(_Quat, _TMP_VEC32, new Float64Array(3));\n__privateAdd(_Quat, _X_UNIT_VEC3, new Float64Array([1, 0, 0]));\n__privateAdd(_Quat, _Y_UNIT_VEC3, new Float64Array([0, 1, 0]));\nvar Quat = _Quat;\nQuat.set = Vec4.set;\nQuat.add = Vec4.add;\nQuat.lerp = Vec4.lerp;\nQuat.normalize = Vec4.normalize;\nQuat.squaredLength = Vec4.squaredLength;\nQuat.sqrLen = Vec4.squaredLength;\nQuat.exactEquals = Vec4.exactEquals;\nQuat.equals = Vec4.equals;\nQuat.magnitude = Vec4.magnitude;\nQuat.prototype.mul = Quat.prototype.multiply;\nQuat.mul = Quat.multiply;\nQuat.mag = Quat.magnitude;\nQuat.length = Quat.magnitude;\nQuat.len = Quat.magnitude;\n\n// src/_lib/f64/Quat2.ts\nvar _TMP_QUAT, _TMP_VEC33;\nvar _Quat2 = class _Quat2 extends Float64Array {\n /**\n * Create a {@link Quat2}.\n *\n * @category Constructor\n */\n constructor(...values) {\n switch (values.length) {\n case 8:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 8);\n break;\n case 1: {\n const v = values[0];\n if (typeof v === \"number\") {\n super([v, v, v, v, v, v, v, v]);\n } else {\n super(v, 0, 8);\n }\n break;\n }\n default:\n super(8);\n this[3] = 1;\n break;\n }\n }\n // ============\n // Accessors\n // ============\n /**\n * A string representation of `this`\n * Equivalent to `Quat2.str(this);`\n *\n * @category Accessors\n */\n get str() {\n return _Quat2.str(this);\n }\n // ===================\n // Instances methods\n // ===================\n /**\n * Copy the values from another {@link Quat2} into `this`.\n * @category Methods\n *\n * @param a the source dual quaternion\n * @returns `this`\n */\n copy(a) {\n super.set(a);\n return this;\n }\n // ===================\n // Static accessors\n // ===================\n /**\n * @category Static\n *\n * @returns The number of bytes in a {@link Quat2}.\n */\n static get BYTE_LENGTH() {\n return 8 * Float64Array.BYTES_PER_ELEMENT;\n }\n // ===================\n // Static methods\n // ===================\n /**\n * Creates a new identity {@link Quat2}\n * @category Static\n *\n * @returns a new dual quaternion [real -> rotation, dual -> translation]\n */\n static create() {\n return new _Quat2();\n }\n /**\n * Creates a {@link Quat2} quat initialized with values from an existing quaternion\n * @category Static\n *\n * @param a - dual quaternion to clone\n * @returns a new dual quaternion\n */\n static clone(a) {\n return new _Quat2(a);\n }\n /**\n * Creates a new {@link Quat2} initialized with the given values\n * @category Static\n *\n * @param x1 - 1st X component\n * @param y1 - 1st Y component\n * @param z1 - 1st Z component\n * @param w1 - 1st W component\n * @param x2 - 2nd X component\n * @param y2 - 2nd Y component\n * @param z2 - 2nd Z component\n * @param w2 - 2nd W component\n * @returns a new dual quaternion\n */\n static fromValues(x1, y1, z1, w1, x2, y2, z2, w2) {\n return new _Quat2(x1, y1, z1, w1, x2, y2, z2, w2);\n }\n /**\n * Creates a new {@link Quat2} from the given values (quat and translation)\n * @category Static\n *\n * @param x1 - X component (rotation)\n * @param y1 - Y component (rotation)\n * @param z1 - Z component (rotation)\n * @param w1 - W component (rotation)\n * @param x2 - X component (translation)\n * @param y2 - Y component (translation)\n * @param z2 - Z component (translation)\n * @returns a new dual quaternion\n */\n static fromRotationTranslationValues(x1, y1, z1, w1, x2, y2, z2) {\n const ax = x2 * 0.5;\n const ay = y2 * 0.5;\n const az = z2 * 0.5;\n return new _Quat2(\n x1,\n y1,\n z1,\n w1,\n ax * w1 + ay * z1 - az * y1,\n ay * w1 + az * x1 - ax * z1,\n az * w1 + ax * y1 - ay * x1,\n -ax * x1 - ay * y1 - az * z1\n );\n }\n /**\n * Sets a {@link Quat2} from a quaternion and a translation\n * @category Static\n *\n * @param out - dual quaternion receiving operation result\n * @param q - a normalized quaternion\n * @param t - translation vector\n * @returns `out`\n */\n static fromRotationTranslation(out, q, t) {\n const ax = t[0] * 0.5;\n const ay = t[1] * 0.5;\n const az = t[2] * 0.5;\n const bx = q[0];\n const by = q[1];\n const bz = q[2];\n const bw = q[3];\n out[0] = bx;\n out[1] = by;\n out[2] = bz;\n out[3] = bw;\n out[4] = ax * bw + ay * bz - az * by;\n out[5] = ay * bw + az * bx - ax * bz;\n out[6] = az * bw + ax * by - ay * bx;\n out[7] = -ax * bx - ay * by - az * bz;\n return out;\n }\n /**\n * Sets a {@link Quat2} from a translation\n * @category Static\n *\n * @param out - dual quaternion receiving operation result\n * @param t - translation vector\n * @returns `out`\n */\n static fromTranslation(out, t) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = t[0] * 0.5;\n out[5] = t[1] * 0.5;\n out[6] = t[2] * 0.5;\n out[7] = 0;\n return out;\n }\n /**\n * Sets a {@link Quat2} from a quaternion\n * @category Static\n *\n * @param out - dual quaternion receiving operation result\n * @param q - a normalized quaternion\n * @returns `out`\n */\n static fromRotation(out, q) {\n out[0] = q[0];\n out[1] = q[1];\n out[2] = q[2];\n out[3] = q[3];\n out[4] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n return out;\n }\n /**\n * Sets a {@link Quat2} from a quaternion\n * @category Static\n *\n * @param out - dual quaternion receiving operation result\n * @param a - the matrix\n * @returns `out`\n */\n static fromMat4(out, a) {\n Mat4.getRotation(__privateGet(_Quat2, _TMP_QUAT), a);\n Mat4.getTranslation(__privateGet(_Quat2, _TMP_VEC33), a);\n return _Quat2.fromRotationTranslation(out, __privateGet(_Quat2, _TMP_QUAT), __privateGet(_Quat2, _TMP_VEC33));\n }\n /**\n * Copy the values from one {@link Quat2} to another\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the source dual quaternion\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n return out;\n }\n /**\n * Set a {@link Quat2} to the identity dual quaternion\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @returns `out`\n */\n static identity(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n return out;\n }\n /**\n * Set the components of a {@link Quat2} to the given values\n * @category Static\n *\n * @param out - the receiving vector\n * @param x1 - 1st X component\n * @param y1 - 1st Y component\n * @param z1 - 1st Z component\n * @param w1 - 1st W component\n * @param x2 - 2nd X component\n * @param y2 - 2nd Y component\n * @param z2 - 2nd Z component\n * @param w2 - 2nd W component\n * @returns `out`\n */\n static set(out, x1, y1, z1, w1, x2, y2, z2, w2) {\n out[0] = x1;\n out[1] = y1;\n out[2] = z1;\n out[3] = w1;\n out[4] = x2;\n out[5] = y2;\n out[6] = z2;\n out[7] = w2;\n return out;\n }\n /**\n * Gets the real part of a dual quat\n * @category Static\n *\n * @param out - real part\n * @param a - Dual Quaternion\n * @return `out`\n */\n static getReal(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n }\n /**\n * Gets the dual part of a dual quat\n * @category Static\n *\n * @param out - dual part\n * @param a - Dual Quaternion\n * @return `out`\n */\n static getDual(out, a) {\n out[0] = a[4];\n out[1] = a[5];\n out[2] = a[6];\n out[3] = a[7];\n return out;\n }\n /**\n * Set the real component of a {@link Quat2} to the given quaternion\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - a quaternion representing the real part\n * @return `out`\n */\n static setReal(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n }\n /**\n * Set the dual component of a {@link Quat2} to the given quaternion\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - a quaternion representing the dual part\n * @return `out`\n */\n static setDual(out, a) {\n out[4] = a[0];\n out[5] = a[1];\n out[6] = a[2];\n out[7] = a[3];\n return out;\n }\n /**\n * Gets the translation of a normalized {@link Quat2}\n * @category Static\n *\n * @param out - the receiving translation vector\n * @param a - Dual Quaternion to be decomposed\n * @return `out`\n */\n static getTranslation(out, a) {\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n const bx = -a[0];\n const by = -a[1];\n const bz = -a[2];\n const bw = a[3];\n out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n return out;\n }\n /**\n * Translates a {@link Quat2} by the given vector\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the dual quaternion to translate\n * @param v - vector to translate by\n * @returns `out`\n */\n static translate(out, a, v) {\n const ax1 = a[0];\n const ay1 = a[1];\n const az1 = a[2];\n const aw1 = a[3];\n const bx1 = v[0] * 0.5;\n const by1 = v[1] * 0.5;\n const bz1 = v[2] * 0.5;\n const ax2 = a[4];\n const ay2 = a[5];\n const az2 = a[6];\n const aw2 = a[7];\n out[0] = ax1;\n out[1] = ay1;\n out[2] = az1;\n out[3] = aw1;\n out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2;\n out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2;\n out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2;\n out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2;\n return out;\n }\n /**\n * Rotates a {@link Quat2} around the X axis\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the dual quaternion to rotate\n * @param rad - angle (in radians) to rotate\n * @returns `out`\n */\n static rotateX(out, a, rad) {\n let bx = -a[0];\n let by = -a[1];\n let bz = -a[2];\n let bw = a[3];\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\n Quat.rotateX(out, a, rad);\n bx = out[0];\n by = out[1];\n bz = out[2];\n bw = out[3];\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n return out;\n }\n /**\n * Rotates a {@link Quat2} around the Y axis\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the dual quaternion to rotate\n * @param rad - angle (in radians) to rotate\n * @returns `out`\n */\n static rotateY(out, a, rad) {\n let bx = -a[0];\n let by = -a[1];\n let bz = -a[2];\n let bw = a[3];\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\n Quat.rotateY(out, a, rad);\n bx = out[0];\n by = out[1];\n bz = out[2];\n bw = out[3];\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n return out;\n }\n /**\n * Rotates a {@link Quat2} around the Z axis\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the dual quaternion to rotate\n * @param rad - angle (in radians) to rotate\n * @returns `out`\n */\n static rotateZ(out, a, rad) {\n let bx = -a[0];\n let by = -a[1];\n let bz = -a[2];\n let bw = a[3];\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\n Quat.rotateZ(out, a, rad);\n bx = out[0];\n by = out[1];\n bz = out[2];\n bw = out[3];\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n return out;\n }\n /**\n * Rotates a {@link Quat2} by a given quaternion (a * q)\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the dual quaternion to rotate\n * @param q - quaternion to rotate by\n * @returns `out`\n */\n static rotateByQuatAppend(out, a, q) {\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n let ax = a[0];\n let ay = a[1];\n let az = a[2];\n let aw = a[3];\n out[0] = ax * qw + aw * qx + ay * qz - az * qy;\n out[1] = ay * qw + aw * qy + az * qx - ax * qz;\n out[2] = az * qw + aw * qz + ax * qy - ay * qx;\n out[3] = aw * qw - ax * qx - ay * qy - az * qz;\n ax = a[4];\n ay = a[5];\n az = a[6];\n aw = a[7];\n out[4] = ax * qw + aw * qx + ay * qz - az * qy;\n out[5] = ay * qw + aw * qy + az * qx - ax * qz;\n out[6] = az * qw + aw * qz + ax * qy - ay * qx;\n out[7] = aw * qw - ax * qx - ay * qy - az * qz;\n return out;\n }\n /**\n * Rotates a {@link Quat2} by a given quaternion (q * a)\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param q - quaternion to rotate by\n * @param a - the dual quaternion to rotate\n * @returns `out`\n */\n static rotateByQuatPrepend(out, q, a) {\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n let bx = a[0];\n let by = a[1];\n let bz = a[2];\n let bw = a[3];\n out[0] = qx * bw + qw * bx + qy * bz - qz * by;\n out[1] = qy * bw + qw * by + qz * bx - qx * bz;\n out[2] = qz * bw + qw * bz + qx * by - qy * bx;\n out[3] = qw * bw - qx * bx - qy * by - qz * bz;\n bx = a[4];\n by = a[5];\n bz = a[6];\n bw = a[7];\n out[4] = qx * bw + qw * bx + qy * bz - qz * by;\n out[5] = qy * bw + qw * by + qz * bx - qx * bz;\n out[6] = qz * bw + qw * bz + qx * by - qy * bx;\n out[7] = qw * bw - qx * bx - qy * by - qz * bz;\n return out;\n }\n /**\n * Rotates a {@link Quat2} around a given axis. Does the normalization automatically\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the dual quaternion to rotate\n * @param axis - the axis to rotate around\n * @param rad - how far the rotation should be\n * @returns `out`\n */\n static rotateAroundAxis(out, a, axis, rad) {\n if (Math.abs(rad) < GLM_EPSILON) {\n return _Quat2.copy(out, a);\n }\n const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);\n rad *= 0.5;\n const s = Math.sin(rad);\n const bx = s * axis[0] / axisLength;\n const by = s * axis[1] / axisLength;\n const bz = s * axis[2] / axisLength;\n const bw = Math.cos(rad);\n const ax1 = a[0];\n const ay1 = a[1];\n const az1 = a[2];\n const aw1 = a[3];\n out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n out[4] = ax * bw + aw * bx + ay * bz - az * by;\n out[5] = ay * bw + aw * by + az * bx - ax * bz;\n out[6] = az * bw + aw * bz + ax * by - ay * bx;\n out[7] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n }\n /**\n * Adds two {@link Quat2}s\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n return out;\n }\n /**\n * Multiplies two {@link Quat2}s\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @returns {quat2} out\n */\n static multiply(out, a, b) {\n const ax0 = a[0];\n const ay0 = a[1];\n const az0 = a[2];\n const aw0 = a[3];\n const bx1 = b[4];\n const by1 = b[5];\n const bz1 = b[6];\n const bw1 = b[7];\n const ax1 = a[4];\n const ay1 = a[5];\n const az1 = a[6];\n const aw1 = a[7];\n const bx0 = b[0];\n const by0 = b[1];\n const bz0 = b[2];\n const bw0 = b[3];\n out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0;\n out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0;\n out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0;\n out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0;\n out[4] = ax0 * bw1 + aw0 * bx1 + ay0 * bz1 - az0 * by1 + ax1 * bw0 + aw1 * bx0 + ay1 * bz0 - az1 * by0;\n out[5] = ay0 * bw1 + aw0 * by1 + az0 * bx1 - ax0 * bz1 + ay1 * bw0 + aw1 * by0 + az1 * bx0 - ax1 * bz0;\n out[6] = az0 * bw1 + aw0 * bz1 + ax0 * by1 - ay0 * bx1 + az1 * bw0 + aw1 * bz0 + ax1 * by0 - ay1 * bx0;\n out[7] = aw0 * bw1 - ax0 * bx1 - ay0 * by1 - az0 * bz1 + aw1 * bw0 - ax1 * bx0 - ay1 * by0 - az1 * bz0;\n return out;\n }\n /**\n * Alias for {@link Quat2.multiply}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static mul(out, a, b) {\n return out;\n }\n /**\n * Scales a {@link Quat2} by a scalar value\n * @category Static\n *\n * @param out - the receiving dual quaterion\n * @param a - the dual quaternion to scale\n * @param b - scalar value to scale the dual quaterion by\n * @returns `out`\n */\n static scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n return out;\n }\n /**\n * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts)\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns dot product of a and b\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static dot(a, b) {\n return 0;\n }\n /**\n * Performs a linear interpolation between two {@link Quat2}s\n * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`)\n * @category Static\n *\n * @param out - the receiving dual quat\n * @param a - the first operand\n * @param b - the second operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static lerp(out, a, b, t) {\n const mt = 1 - t;\n if (_Quat2.dot(a, b) < 0) {\n t = -t;\n }\n out[0] = a[0] * mt + b[0] * t;\n out[1] = a[1] * mt + b[1] * t;\n out[2] = a[2] * mt + b[2] * t;\n out[3] = a[3] * mt + b[3] * t;\n out[4] = a[4] * mt + b[4] * t;\n out[5] = a[5] * mt + b[5] * t;\n out[6] = a[6] * mt + b[6] * t;\n out[7] = a[7] * mt + b[7] * t;\n return out;\n }\n /**\n * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - dual quat to calculate inverse of\n * @returns `out`\n */\n static invert(out, a) {\n const sqlen = _Quat2.squaredLength(a);\n out[0] = -a[0] / sqlen;\n out[1] = -a[1] / sqlen;\n out[2] = -a[2] / sqlen;\n out[3] = a[3] / sqlen;\n out[4] = -a[4] / sqlen;\n out[5] = -a[5] / sqlen;\n out[6] = -a[6] / sqlen;\n out[7] = a[7] / sqlen;\n return out;\n }\n /**\n * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than\n * {@link Quat2.invert} and produces the same result.\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - dual quaternion to calculate conjugate of\n * @returns `out`\n */\n static conjugate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n out[4] = -a[4];\n out[5] = -a[5];\n out[6] = -a[6];\n out[7] = a[7];\n return out;\n }\n /**\n * Calculates the magnitude (length) of a {@link Quat2}\n * @category Static\n *\n * @param a - dual quaternion to calculate length of\n * @returns length of `a`\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static magnitude(a) {\n return 0;\n }\n /**\n * Alias for {@link Quat2.magnitude}\n * @category Static\n */\n static mag(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Alias for {@link Quat2.magnitude}\n * @category Static\n * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs\n */\n // Length conflicts with Function.length\n static length(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Alias for {@link Quat2.magnitude}\n * @category Static\n * @deprecated Use {@link Quat2.mag}\n */\n static len(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Calculates the squared length of a {@link Quat2}\n * @category Static\n *\n * @param a - dual quaternion to calculate squared length of\n * @returns squared length of a\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static squaredLength(a) {\n return 0;\n }\n /**\n * Alias for {@link Quat2.squaredLength}\n * @category Static\n */\n static sqrLen(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Normalize a {@link Quat2}\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - dual quaternion to normalize\n * @returns `out`\n */\n static normalize(out, a) {\n let magnitude = _Quat2.squaredLength(a);\n if (magnitude > 0) {\n magnitude = Math.sqrt(magnitude);\n const a0 = a[0] / magnitude;\n const a1 = a[1] / magnitude;\n const a2 = a[2] / magnitude;\n const a3 = a[3] / magnitude;\n const b0 = a[4];\n const b1 = a[5];\n const b2 = a[6];\n const b3 = a[7];\n const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3;\n out[0] = a0;\n out[1] = a1;\n out[2] = a2;\n out[3] = a3;\n out[4] = (b0 - a0 * a_dot_b) / magnitude;\n out[5] = (b1 - a1 * a_dot_b) / magnitude;\n out[6] = (b2 - a2 * a_dot_b) / magnitude;\n out[7] = (b3 - a3 * a_dot_b) / magnitude;\n }\n return out;\n }\n /**\n * Returns a string representation of a {@link Quat2}\n * @category Static\n *\n * @param a - dual quaternion to represent as a string\n * @returns string representation of the vector\n */\n static str(a) {\n return `Quat2(${a.join(\", \")})`;\n }\n /**\n * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first dual quaternion.\n * @param b - The second dual quaternion.\n * @returns True if the dual quaternions are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7];\n }\n /**\n * Returns whether the {@link Quat2}s have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first dual quaternion.\n * @param b - The second dual quaternion.\n * @returns True if the dual quaternions are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const a6 = a[6];\n const a7 = a[7];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\n const b6 = b[6];\n const b7 = b[7];\n return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7));\n }\n};\n_TMP_QUAT = new WeakMap();\n_TMP_VEC33 = new WeakMap();\n// Temporary variables to prevent repeated allocations in the algorithms within Quat2.\n// These are declared as TypedArrays to aid in tree-shaking.\n__privateAdd(_Quat2, _TMP_QUAT, new Float64Array(4));\n__privateAdd(_Quat2, _TMP_VEC33, new Float64Array(3));\nvar Quat2 = _Quat2;\nQuat2.dot = Quat.dot;\nQuat2.squaredLength = Quat.squaredLength;\nQuat2.sqrLen = Quat.squaredLength;\nQuat2.mag = Quat.magnitude;\nQuat2.length = Quat.magnitude;\nQuat2.len = Quat.magnitude;\nQuat2.mul = Quat2.multiply;\n\n// src/_lib/f64/Vec2.ts\nvar Vec2 = class _Vec2 extends Float64Array {\n /**\n * Create a {@link Vec2}.\n *\n * @category Constructor\n */\n constructor(...values) {\n switch (values.length) {\n case 2: {\n const v = values[0];\n if (typeof v === \"number\") {\n super([v, values[1]]);\n } else {\n super(v, values[1], 2);\n }\n break;\n }\n case 1: {\n const v = values[0];\n if (typeof v === \"number\") {\n super([v, v]);\n } else {\n super(v, 0, 2);\n }\n break;\n }\n default:\n super(2);\n break;\n }\n }\n // ============\n // Accessors\n // ============\n // Getters and setters to make component access read better.\n // These are likely to be a little bit slower than direct array access.\n /**\n * The x component of the vector. Equivalent to `this[0];`\n * @category Vector Components\n */\n get x() {\n return this[0];\n }\n set x(value) {\n this[0] = value;\n }\n /**\n * The y component of the vector. Equivalent to `this[1];`\n * @category Vector Components\n */\n get y() {\n return this[1];\n }\n set y(value) {\n this[1] = value;\n }\n // Alternate set of getters and setters in case this is being used to define\n // a color.\n /**\n * The r component of the vector. Equivalent to `this[0];`\n * @category Color Components\n */\n get r() {\n return this[0];\n }\n set r(value) {\n this[0] = value;\n }\n /**\n * The g component of the vector. Equivalent to `this[1];`\n * @category Color Components\n */\n get g() {\n return this[1];\n }\n set g(value) {\n this[1] = value;\n }\n /**\n * The magnitude (length) of this.\n * Equivalent to `Vec2.magnitude(this);`\n *\n * Magnitude is used because the `length` attribute is already defined by\n * TypedArrays to mean the number of elements in the array.\n *\n * @category Accessors\n */\n get magnitude() {\n return Math.hypot(this[0], this[1]);\n }\n /**\n * Alias for {@link Vec2.magnitude}\n *\n * @category Accessors\n */\n get mag() {\n return this.magnitude;\n }\n /**\n * The squared magnitude (length) of `this`.\n * Equivalent to `Vec2.squaredMagnitude(this);`\n *\n * @category Accessors\n */\n get squaredMagnitude() {\n const x = this[0];\n const y = this[1];\n return x * x + y * y;\n }\n /**\n * Alias for {@link Vec2.squaredMagnitude}\n *\n * @category Accessors\n */\n get sqrMag() {\n return this.squaredMagnitude;\n }\n /**\n * A string representation of `this`\n * Equivalent to `Vec2.str(this);`\n *\n * @category Accessors\n */\n get str() {\n return _Vec2.str(this);\n }\n // ===================\n // Instances methods\n // ===================\n /**\n * Copy the values from another {@link Vec2} into `this`.\n * @category Methods\n *\n * @param a the source vector\n * @returns `this`\n */\n copy(a) {\n this.set(a);\n return this;\n }\n // Instead of zero(), use a.fill(0) for instances;\n /**\n * Adds a {@link Vec2} to `this`.\n * Equivalent to `Vec2.add(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to add to `this`\n * @returns `this`\n */\n add(b) {\n this[0] += b[0];\n this[1] += b[1];\n return this;\n }\n /**\n * Subtracts a {@link Vec2} from `this`.\n * Equivalent to `Vec2.subtract(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to subtract from `this`\n * @returns `this`\n */\n subtract(b) {\n this[0] -= b[0];\n this[1] -= b[1];\n return this;\n }\n /**\n * Alias for {@link Vec2.subtract}\n * @category Methods\n */\n sub(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Multiplies `this` by a {@link Vec2}.\n * Equivalent to `Vec2.multiply(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to multiply `this` by\n * @returns `this`\n */\n multiply(b) {\n this[0] *= b[0];\n this[1] *= b[1];\n return this;\n }\n /**\n * Alias for {@link Vec2.multiply}\n * @category Methods\n */\n mul(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Divides `this` by a {@link Vec2}.\n * Equivalent to `Vec2.divide(this, this, b);`\n * @category Methods\n *\n * @param b - The vector to divide `this` by\n * @returns `this`\n */\n divide(b) {\n this[0] /= b[0];\n this[1] /= b[1];\n return this;\n }\n /**\n * Alias for {@link Vec2.divide}\n * @category Methods\n */\n div(b) {\n return this;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Scales `this` by a scalar number.\n * Equivalent to `Vec2.scale(this, this, b);`\n * @category Methods\n *\n * @param b - Amount to scale `this` by\n * @returns `this`\n */\n scale(b) {\n this[0] *= b;\n this[1] *= b;\n return this;\n }\n /**\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\n * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);`\n * @category Methods\n *\n * @param b - The vector to add to `this`\n * @param scale - The amount to scale `b` by before adding\n * @returns `this`\n */\n scaleAndAdd(b, scale) {\n this[0] += b[0] * scale;\n this[1] += b[1] * scale;\n return this;\n }\n /**\n * Calculates the Euclidean distance between another {@link Vec2} and `this`.\n * Equivalent to `Vec2.distance(this, b);`\n * @category Methods\n *\n * @param b - The vector to calculate the distance to\n * @returns Distance between `this` and `b`\n */\n distance(b) {\n return _Vec2.distance(this, b);\n }\n /**\n * Alias for {@link Vec2.distance}\n * @category Methods\n */\n dist(b) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Calculates the squared Euclidean distance between another {@link Vec2} and `this`.\n * Equivalent to `Vec2.squaredDistance(this, b);`\n * @category Methods\n *\n * @param b The vector to calculate the squared distance to\n * @returns Squared distance between `this` and `b`\n */\n squaredDistance(b) {\n return _Vec2.squaredDistance(this, b);\n }\n /**\n * Alias for {@link Vec2.squaredDistance}\n * @category Methods\n */\n sqrDist(b) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Negates the components of `this`.\n * Equivalent to `Vec2.negate(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n negate() {\n this[0] *= -1;\n this[1] *= -1;\n return this;\n }\n /**\n * Inverts the components of `this`.\n * Equivalent to `Vec2.inverse(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n invert() {\n this[0] = 1 / this[0];\n this[1] = 1 / this[1];\n return this;\n }\n /**\n * Sets each component of `this` to it's absolute value.\n * Equivalent to `Vec2.abs(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n abs() {\n this[0] = Math.abs(this[0]);\n this[1] = Math.abs(this[1]);\n return this;\n }\n /**\n * Calculates the dot product of this and another {@link Vec2}.\n * Equivalent to `Vec2.dot(this, b);`\n * @category Methods\n *\n * @param b - The second operand\n * @returns Dot product of `this` and `b`\n */\n dot(b) {\n return this[0] * b[0] + this[1] * b[1];\n }\n /**\n * Normalize `this`.\n * Equivalent to `Vec2.normalize(this, this);`\n * @category Methods\n *\n * @returns `this`\n */\n normalize() {\n return _Vec2.normalize(this, this);\n }\n // ===================\n // Static accessors\n // ===================\n /**\n * @category Static\n *\n * @returns The number of bytes in a {@link Vec2}.\n */\n static get BYTE_LENGTH() {\n return 2 * Float64Array.BYTES_PER_ELEMENT;\n }\n // ===================\n // Static methods\n // ===================\n /**\n * Creates a new, empty {@link Vec2}\n * @category Static\n *\n * @returns A new 2D vector\n */\n static create() {\n return new _Vec2();\n }\n /**\n * Creates a new {@link Vec2} initialized with values from an existing vector\n * @category Static\n *\n * @param a - Vector to clone\n * @returns A new 2D vector\n */\n static clone(a) {\n return new _Vec2(a);\n }\n /**\n * Creates a new {@link Vec2} initialized with the given values\n * @category Static\n *\n * @param x - X component\n * @param y - Y component\n * @returns A new 2D vector\n */\n static fromValues(x, y) {\n return new _Vec2(x, y);\n }\n /**\n * Copy the values from one {@link Vec2} to another\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - The source vector\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n return out;\n }\n /**\n * Set the components of a {@link Vec2} to the given values\n * @category Static\n *\n * @param out - The receiving vector\n * @param x - X component\n * @param y - Y component\n * @returns `out`\n */\n static set(out, x, y) {\n out[0] = x;\n out[1] = y;\n return out;\n }\n /**\n * Adds two {@link Vec2}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n return out;\n }\n /**\n * Subtracts vector b from vector a\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n return out;\n }\n /**\n * Alias for {@link Vec2.subtract}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sub(out, a, b) {\n return [0, 0];\n }\n /**\n * Multiplies two {@link Vec2}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n return out;\n }\n /**\n * Alias for {@link Vec2.multiply}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static mul(out, a, b) {\n return [0, 0];\n }\n /**\n * Divides two {@link Vec2}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n return out;\n }\n /**\n * Alias for {@link Vec2.divide}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static div(out, a, b) {\n return [0, 0];\n }\n /**\n * Math.ceil the components of a {@link Vec2}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to ceil\n * @returns `out`\n */\n static ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n return out;\n }\n /**\n * Math.floor the components of a {@link Vec2}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to floor\n * @returns `out`\n */\n static floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n return out;\n }\n /**\n * Returns the minimum of two {@link Vec2}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n return out;\n }\n /**\n * Returns the maximum of two {@link Vec2}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n return out;\n }\n /**\n * Math.round the components of a {@link Vec2}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to round\n * @returns `out`\n */\n static round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n return out;\n }\n /**\n * Scales a {@link Vec2} by a scalar number\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The vector to scale\n * @param b - Amount to scale the vector by\n * @returns `out`\n */\n static scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n return out;\n }\n /**\n * Adds two Vec2's after scaling the second operand by a scalar value\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @param scale - The amount to scale b by before adding\n * @returns `out`\n */\n static scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n return out;\n }\n /**\n * Calculates the Euclidean distance between two {@link Vec2}s\n * @category Static\n *\n * @param a - The first operand\n * @param b - The second operand\n * @returns distance between `a` and `b`\n */\n static distance(a, b) {\n return Math.hypot(b[0] - a[0], b[1] - a[1]);\n }\n /**\n * Alias for {@link Vec2.distance}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static dist(a, b) {\n return 0;\n }\n /**\n * Calculates the squared Euclidean distance between two {@link Vec2}s\n * @category Static\n *\n * @param a - The first operand\n * @param b - The second operand\n * @returns Squared distance between `a` and `b`\n */\n static squaredDistance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n return x * x + y * y;\n }\n /**\n * Alias for {@link Vec2.distance}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sqrDist(a, b) {\n return 0;\n }\n /**\n * Calculates the magnitude (length) of a {@link Vec2}\n * @category Static\n *\n * @param a - Vector to calculate magnitude of\n * @returns Magnitude of a\n */\n static magnitude(a) {\n const x = a[0];\n const y = a[1];\n return Math.sqrt(x * x + y * y);\n }\n /**\n * Alias for {@link Vec2.magnitude}\n * @category Static\n */\n static mag(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Alias for {@link Vec2.magnitude}\n * @category Static\n * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs\n *\n * @param a - vector to calculate length of\n * @returns length of a\n */\n // Length conflicts with Function.length\n static length(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Alias for {@link Vec2.magnitude}\n * @category Static\n * @deprecated Use {@link Vec2.mag}\n */\n static len(a) {\n return 0;\n }\n // eslint-disable-line @typescript-eslint/no-unused-vars\n /**\n * Calculates the squared length of a {@link Vec2}\n * @category Static\n *\n * @param a - Vector to calculate squared length of\n * @returns Squared length of a\n */\n static squaredLength(a) {\n const x = a[0];\n const y = a[1];\n return x * x + y * y;\n }\n /**\n * Alias for {@link Vec2.squaredLength}\n * @category Static\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static sqrLen(a, b) {\n return 0;\n }\n /**\n * Negates the components of a {@link Vec2}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to negate\n * @returns `out`\n */\n static negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n return out;\n }\n /**\n * Returns the inverse of the components of a {@link Vec2}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to invert\n * @returns `out`\n */\n static inverse(out, a) {\n out[0] = 1 / a[0];\n out[1] = 1 / a[1];\n return out;\n }\n /**\n * Returns the absolute value of the components of a {@link Vec2}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to compute the absolute values of\n * @returns `out`\n */\n static abs(out, a) {\n out[0] = Math.abs(a[0]);\n out[1] = Math.abs(a[1]);\n return out;\n }\n /**\n * Normalize a {@link Vec2}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to normalize\n * @returns `out`\n */\n static normalize(out, a) {\n const x = a[0];\n const y = a[1];\n let len = x * x + y * y;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n return out;\n }\n /**\n * Calculates the dot product of two {@link Vec2}s\n * @category Static\n *\n * @param a - The first operand\n * @param b - The second operand\n * @returns Dot product of `a` and `b`\n */\n static dot(a, b) {\n return a[0] * b[0] + a[1] * b[1];\n }\n /**\n * Computes the cross product of two {@link Vec2}s\n * Note that the cross product must by definition produce a 3D vector.\n * For this reason there is also not instance equivalent for this function.\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static cross(out, a, b) {\n const z = a[0] * b[1] - a[1] * b[0];\n out[0] = out[1] = 0;\n out[2] = z;\n return out;\n }\n /**\n * Performs a linear interpolation between two {@link Vec2}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @param t - Interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static lerp(out, a, b, t) {\n const ax = a[0];\n const ay = a[1];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n return out;\n }\n /**\n * Transforms the {@link Vec2} with a {@link Mat2}\n *\n * @param out - The receiving vector\n * @param a - The vector to transform\n * @param m - Matrix to transform with\n * @returns `out`\n * @category Static\n */\n static transformMat2(out, a, m) {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n return out;\n }\n /**\n * Transforms the {@link Vec2} with a {@link Mat2d}\n *\n * @param out - The receiving vector\n * @param a - The vector to transform\n * @param m - Matrix to transform with\n * @returns `out`\n * @category Static\n */\n static transformMat2d(out, a, m) {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[2] * y + m[4];\n out[1] = m[1] * x + m[3] * y + m[5];\n return out;\n }\n /**\n * Transforms the {@link Vec2} with a {@link Mat3}\n * 3rd vector component is implicitly '1'\n *\n * @param out - The receiving vector\n * @param a - The vector to transform\n * @param m - Matrix to transform with\n * @returns `out`\n * @category Static\n */\n static transformMat3(out, a, m) {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[3] * y + m[6];\n out[1] = m[1] * x + m[4] * y + m[7];\n return out;\n }\n /**\n * Transforms the {@link Vec2} with a {@link Mat4}\n * 3rd vector component is implicitly '0'\n * 4th vector component is implicitly '1'\n *\n * @param out - The receiving vector\n * @param a - The vector to transform\n * @param m - Matrix to transform with\n * @returns `out`\n * @category Static\n */\n static transformMat4(out, a, m) {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[4] * y + m[12];\n out[1] = m[1] * x + m[5] * y + m[13];\n return out;\n }\n /**\n * Rotate a 2D vector\n * @category Static\n *\n * @param out - The receiving {@link Vec2}\n * @param a - The {@link Vec2} point to rotate\n * @param b - The origin of the rotation\n * @param rad - The angle of rotation in radians\n * @returns `out`\n */\n static rotate(out, a, b, rad) {\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 out[0] = p0 * cosC - p1 * sinC + b[0];\n out[1] = p0 * sinC + p1 * cosC + b[1];\n return out;\n }\n /**\n * Get the angle between two 2D vectors\n * @category Static\n *\n * @param a - The first operand\n * @param b - The second operand\n * @returns The angle in radians\n */\n static angle(a, b) {\n const x1 = a[0];\n const y1 = a[1];\n const x2 = b[0];\n const y2 = b[1];\n const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2);\n const cosine = mag && (x1 * x2 + y1 * y2) / mag;\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n }\n /**\n * Set the components of a {@link Vec2} to zero\n * @category Static\n *\n * @param out - The receiving vector\n * @returns `out`\n */\n static zero(out) {\n out[0] = 0;\n out[1] = 0;\n return out;\n }\n /**\n * Returns whether the vectors have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns `true` if the vectors components are ===, `false` otherwise.\n */\n static exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1];\n }\n /**\n * Returns whether the vectors have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns `true` if the vectors are approximately equal, `false` otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const b0 = b[0];\n const b1 = b[1];\n return Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1));\n }\n /**\n * Returns a string representation of a vector\n * @category Static\n *\n * @param a - Vector to represent as a string\n * @returns String representation of the vector\n */\n static str(a) {\n return `Vec2(${a.join(\", \")})`;\n }\n};\nVec2.prototype.sub = Vec2.prototype.subtract;\nVec2.prototype.mul = Vec2.prototype.multiply;\nVec2.prototype.div = Vec2.prototype.divide;\nVec2.prototype.dist = Vec2.prototype.distance;\nVec2.prototype.sqrDist = Vec2.prototype.squaredDistance;\nVec2.sub = Vec2.subtract;\nVec2.mul = Vec2.multiply;\nVec2.div = Vec2.divide;\nVec2.dist = Vec2.distance;\nVec2.sqrDist = Vec2.squaredDistance;\nVec2.sqrLen = Vec2.squaredLength;\nVec2.mag = Vec2.magnitude;\nVec2.length = Vec2.magnitude;\nVec2.len = Vec2.magnitude;\n\n// src/swizzle/f64/index.ts\nvar GLM_SWIZZLES_ENABLED_F64 = false;\nfunction EnableSwizzlesF64() {\n if (GLM_SWIZZLES_ENABLED_F64) {\n return;\n }\n const VEC2_SWIZZLES = [\"xx\", \"xy\", \"yx\", \"yy\", \"xxx\", \"xxy\", \"xyx\", \"xyy\", \"yxx\", \"yxy\", \"yyx\", \"yyy\", \"xxxx\", \"xxxy\", \"xxyx\", \"xxyy\", \"xyxx\", \"xyxy\", \"xyyx\", \"xyyy\", \"yxxx\", \"yxxy\", \"yxyx\", \"yxyy\", \"yyxx\", \"yyxy\", \"yyyx\", \"yyyy\", \"rr\", \"rg\", \"gr\", \"gg\", \"rrr\", \"rrg\", \"rgr\", \"rgg\", \"grr\", \"grg\", \"ggr\", \"ggg\", \"rrrr\", \"rrrg\", \"rrgr\", \"rrgg\", \"rgrr\", \"rgrg\", \"rggr\", \"rggg\", \"grrr\", \"grrg\", \"grgr\", \"grgg\", \"ggrr\", \"ggrg\", \"gggr\", \"gggg\"];\n const VEC3_SWIZZLES = [\"xz\", \"yz\", \"zx\", \"zy\", \"zz\", \"xxz\", \"xyz\", \"xzx\", \"xzy\", \"xzz\", \"yxz\", \"yyz\", \"yzx\", \"yzy\", \"yzz\", \"zxx\", \"zxy\", \"zxz\", \"zyx\", \"zyy\", \"zyz\", \"zzx\", \"zzy\", \"zzz\", \"xxxz\", \"xxyz\", \"xxzx\", \"xxzy\", \"xxzz\", \"xyxz\", \"xyyz\", \"xyzx\", \"xyzy\", \"xyzz\", \"xzxx\", \"xzxy\", \"xzxz\", \"xzyx\", \"xzyy\", \"xzyz\", \"xzzx\", \"xzzy\", \"xzzz\", \"yxxz\", \"yxyz\", \"yxzx\", \"yxzy\", \"yxzz\", \"yyxz\", \"yyyz\", \"yyzx\", \"yyzy\", \"yyzz\", \"yzxx\", \"yzxy\", \"yzxz\", \"yzyx\", \"yzyy\", \"yzyz\", \"yzzx\", \"yzzy\", \"yzzz\", \"zxxx\", \"zxxy\", \"zxxz\", \"zxyx\", \"zxyy\", \"zxyz\", \"zxzx\", \"zxzy\", \"zxzz\", \"zyxx\", \"zyxy\", \"zyxz\", \"zyyx\", \"zyyy\", \"zyyz\", \"zyzx\", \"zyzy\", \"zyzz\", \"zzxx\", \"zzxy\", \"zzxz\", \"zzyx\", \"zzyy\", \"zzyz\", \"zzzx\", \"zzzy\", \"zzzz\", \"rb\", \"gb\", \"br\", \"bg\", \"bb\", \"rrb\", \"rgb\", \"rbr\", \"rbg\", \"rbb\", \"grb\", \"ggb\", \"gbr\", \"gbg\", \"gbb\", \"brr\", \"brg\", \"brb\", \"bgr\", \"bgg\", \"bgb\", \"bbr\", \"bbg\", \"bbb\", \"rrrb\", \"rrgb\", \"rrbr\", \"rrbg\", \"rrbb\", \"rgrb\", \"rggb\", \"rgbr\", \"rgbg\", \"rgbb\", \"rbrr\", \"rbrg\", \"rbrb\", \"rbgr\", \"rbgg\", \"rbgb\", \"rbbr\", \"rbbg\", \"rbbb\", \"grrb\", \"grgb\", \"grbr\", \"grbg\", \"grbb\", \"ggrb\", \"gggb\", \"ggbr\", \"ggbg\", \"ggbb\", \"gbrr\", \"gbrg\", \"gbrb\", \"gbgr\", \"gbgg\", \"gbgb\", \"gbbr\", \"gbbg\", \"gbbb\", \"brrr\", \"brrg\", \"brrb\", \"brgr\", \"brgg\", \"brgb\", \"brbr\", \"brbg\", \"brbb\", \"bgrr\", \"bgrg\", \"bgrb\", \"bggr\", \"bggg\", \"bggb\", \"bgbr\", \"bgbg\", \"bgbb\", \"bbrr\", \"bbrg\", \"bbrb\", \"bbgr\", \"bbgg\", \"bbgb\", \"bbbr\", \"bbbg\", \"bbbb\"];\n const VEC4_SWIZZLES = [\"xw\", \"yw\", \"zw\", \"wx\", \"wy\", \"wz\", \"ww\", \"xxw\", \"xyw\", \"xzw\", \"xwx\", \"xwy\", \"xwz\", \"xww\", \"yxw\", \"yyw\", \"yzw\", \"ywx\", \"ywy\", \"ywz\", \"yww\", \"zxw\", \"zyw\", \"zzw\", \"zwx\", \"zwy\", \"zwz\", \"zww\", \"wxx\", \"wxy\", \"wxz\", \"wxw\", \"wyx\", \"wyy\", \"wyz\", \"wyw\", \"wzx\", \"wzy\", \"wzz\", \"wzw\", \"wwx\", \"wwy\", \"wwz\", \"www\", \"xxxw\", \"xxyw\", \"xxzw\", \"xxwx\", \"xxwy\", \"xxwz\", \"xxww\", \"xyxw\", \"xyyw\", \"xyzw\", \"xywx\", \"xywy\", \"xywz\", \"xyww\", \"xzxw\", \"xzyw\", \"xzzw\", \"xzwx\", \"xzwy\", \"xzwz\", \"xzww\", \"xwxx\", \"xwxy\", \"xwxz\", \"xwxw\", \"xwyx\", \"xwyy\", \"xwyz\", \"xwyw\", \"xwzx\", \"xwzy\", \"xwzz\", \"xwzw\", \"xwwx\", \"xwwy\", \"xwwz\", \"xwww\", \"yxxw\", \"yxyw\", \"yxzw\", \"yxwx\", \"yxwy\", \"yxwz\", \"yxww\", \"yyxw\", \"yyyw\", \"yyzw\", \"yywx\", \"yywy\", \"yywz\", \"yyww\", \"yzxw\", \"yzyw\", \"yzzw\", \"yzwx\", \"yzwy\", \"yzwz\", \"yzww\", \"ywxx\", \"ywxy\", \"ywxz\", \"ywxw\", \"ywyx\", \"ywyy\", \"ywyz\", \"ywyw\", \"ywzx\", \"ywzy\", \"ywzz\", \"ywzw\", \"ywwx\", \"ywwy\", \"ywwz\", \"ywww\", \"zxxw\", \"zxyw\", \"zxzw\", \"zxwx\", \"zxwy\", \"zxwz\", \"zxww\", \"zyxw\", \"zyyw\", \"zyzw\", \"zywx\", \"zywy\", \"zywz\", \"zyww\", \"zzxw\", \"zzyw\", \"zzzw\", \"zzwx\", \"zzwy\", \"zzwz\", \"zzww\", \"zwxx\", \"zwxy\", \"zwxz\", \"zwxw\", \"zwyx\", \"zwyy\", \"zwyz\", \"zwyw\", \"zwzx\", \"zwzy\", \"zwzz\", \"zwzw\", \"zwwx\", \"zwwy\", \"zwwz\", \"zwww\", \"wxxx\", \"wxxy\", \"wxxz\", \"wxxw\", \"wxyx\", \"wxyy\", \"wxyz\", \"wxyw\", \"wxzx\", \"wxzy\", \"wxzz\", \"wxzw\", \"wxwx\", \"wxwy\", \"wxwz\", \"wxww\", \"wyxx\", \"wyxy\", \"wyxz\", \"wyxw\", \"wyyx\", \"wyyy\", \"wyyz\", \"wyyw\", \"wyzx\", \"wyzy\", \"wyzz\", \"wyzw\", \"wywx\", \"wywy\", \"wywz\", \"wyww\", \"wzxx\", \"wzxy\", \"wzxz\", \"wzxw\", \"wzyx\", \"wzyy\", \"wzyz\", \"wzyw\", \"wzzx\", \"wzzy\", \"wzzz\", \"wzzw\", \"wzwx\", \"wzwy\", \"wzwz\", \"wzww\", \"wwxx\", \"wwxy\", \"wwxz\", \"wwxw\", \"wwyx\", \"wwyy\", \"wwyz\", \"wwyw\", \"wwzx\", \"wwzy\", \"wwzz\", \"wwzw\", \"wwwx\", \"wwwy\", \"wwwz\", \"wwww\", \"ra\", \"ga\", \"ba\", \"ar\", \"ag\", \"ab\", \"aa\", \"rra\", \"rga\", \"rba\", \"rar\", \"rag\", \"rab\", \"raa\", \"gra\", \"gga\", \"gba\", \"gar\", \"gag\", \"gab\", \"gaa\", \"bra\", \"bga\", \"bba\", \"bar\", \"bag\", \"bab\", \"baa\", \"arr\", \"arg\", \"arb\", \"ara\", \"agr\", \"agg\", \"agb\", \"aga\", \"abr\", \"abg\", \"abb\", \"aba\", \"aar\", \"aag\", \"aab\", \"aaa\", \"rrra\", \"rrga\", \"rrba\", \"rrar\", \"rrag\", \"rrab\", \"rraa\", \"rgra\", \"rgga\", \"rgba\", \"rgar\", \"rgag\", \"rgab\", \"rgaa\", \"rbra\", \"rbga\", \"rbba\", \"rbar\", \"rbag\", \"rbab\", \"rbaa\", \"rarr\", \"rarg\", \"rarb\", \"rara\", \"ragr\", \"ragg\", \"ragb\", \"raga\", \"rabr\", \"rabg\", \"rabb\", \"raba\", \"raar\", \"raag\", \"raab\", \"raaa\", \"grra\", \"grga\", \"grba\", \"grar\", \"grag\", \"grab\", \"graa\", \"ggra\", \"ggga\", \"ggba\", \"ggar\", \"ggag\", \"ggab\", \"ggaa\", \"gbra\", \"gbga\", \"gbba\", \"gbar\", \"gbag\", \"gbab\", \"gbaa\", \"garr\", \"garg\", \"garb\", \"gara\", \"gagr\", \"gagg\", \"gagb\", \"gaga\", \"gabr\", \"gabg\", \"gabb\", \"gaba\", \"gaar\", \"gaag\", \"gaab\", \"gaaa\", \"brra\", \"brga\", \"brba\", \"brar\", \"brag\", \"brab\", \"braa\", \"bgra\", \"bgga\", \"bgba\", \"bgar\", \"bgag\", \"bgab\", \"bgaa\", \"bbra\", \"bbga\", \"bbba\", \"bbar\", \"bbag\", \"bbab\", \"bbaa\", \"barr\", \"barg\", \"barb\", \"bara\", \"bagr\", \"bagg\", \"bagb\", \"baga\", \"babr\", \"babg\", \"babb\", \"baba\", \"baar\", \"baag\", \"baab\", \"baaa\", \"arrr\", \"arrg\", \"arrb\", \"arra\", \"argr\", \"argg\", \"argb\", \"arga\", \"arbr\", \"arbg\", \"arbb\", \"arba\", \"arar\", \"arag\", \"arab\", \"araa\", \"agrr\", \"agrg\", \"agrb\", \"agra\", \"aggr\", \"aggg\", \"aggb\", \"agga\", \"agbr\", \"agbg\", \"agbb\", \"agba\", \"agar\", \"agag\", \"agab\", \"agaa\", \"abrr\", \"abrg\", \"abrb\", \"abra\", \"abgr\", \"abgg\", \"abgb\", \"abga\", \"abbr\", \"abbg\", \"abbb\", \"abba\", \"abar\", \"abag\", \"abab\", \"abaa\", \"aarr\", \"aarg\", \"aarb\", \"aara\", \"aagr\", \"aagg\", \"aagb\", \"aaga\", \"aabr\", \"aabg\", \"aabb\", \"aaba\", \"aaar\", \"aaag\", \"aaab\", \"aaaa\"];\n const SWIZZLE_INDEX = {\n x: 0,\n r: 0,\n y: 1,\n g: 1,\n z: 2,\n b: 2,\n w: 3,\n a: 3\n };\n function getSwizzleImpl(swizzle) {\n switch (swizzle.length) {\n case 2:\n return function() {\n return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]);\n };\n case 3:\n return function() {\n return new Vec3(\n this[SWIZZLE_INDEX[swizzle[0]]],\n this[SWIZZLE_INDEX[swizzle[1]]],\n this[SWIZZLE_INDEX[swizzle[2]]]\n );\n };\n case 4:\n return function() {\n return new Vec4(\n this[SWIZZLE_INDEX[swizzle[0]]],\n this[SWIZZLE_INDEX[swizzle[1]]],\n this[SWIZZLE_INDEX[swizzle[2]]],\n this[SWIZZLE_INDEX[swizzle[3]]]\n );\n };\n }\n throw new Error(\"Illegal swizzle length\");\n }\n for (const swizzle of VEC2_SWIZZLES) {\n const impl = getSwizzleImpl(swizzle);\n Object.defineProperty(Vec2.prototype, swizzle, {\n get: impl\n });\n Object.defineProperty(Vec3.prototype, swizzle, {\n get: impl\n });\n Object.defineProperty(Vec4.prototype, swizzle, {\n get: impl\n });\n }\n for (const swizzle of VEC3_SWIZZLES) {\n const impl = getSwizzleImpl(swizzle);\n Object.defineProperty(Vec3.prototype, swizzle, {\n get: impl\n });\n Object.defineProperty(Vec4.prototype, swizzle, {\n get: impl\n });\n }\n for (const swizzle of VEC4_SWIZZLES) {\n const impl = getSwizzleImpl(swizzle);\n Object.defineProperty(Vec4.prototype, swizzle, {\n get: impl\n });\n }\n GLM_SWIZZLES_ENABLED_F64 = true;\n}\n\n// src/util/angleConversion.ts\nvar GLM_DEG_TO_RAD = Math.PI / 180;\nvar GLM_RAD_TO_DEG = 180 / Math.PI;\nfunction toDegree(value) {\n return value * GLM_RAD_TO_DEG;\n}\nfunction toRadian(value) {\n return value * GLM_DEG_TO_RAD;\n}\nexport {\n EnableSwizzlesF64,\n Mat2,\n Mat2d,\n Mat3,\n Mat4,\n Quat,\n Quat2,\n Vec2,\n Vec3,\n Vec4,\n toDegree,\n toRadian\n};\n//# sourceMappingURL=gl-matrix-f64.js.map\n"],"names":["GLM_EPSILON"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist-cdn/umd/gl-matrix-f64.min.js b/dist-cdn/umd/gl-matrix-f64.min.js new file mode 100644 index 00000000..ea722ec7 --- /dev/null +++ b/dist-cdn/umd/gl-matrix-f64.min.js @@ -0,0 +1,4449 @@ +// gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library. +// @author Brandon Jones +// @author Colin MacKenzie IV +// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md) +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.glMatrixF64 = {})); +})(this, (function (exports) { 'use strict'; + + function _assertThisInitialized(e) { + if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return e; + } + function _callSuper(t, o, e) { + return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); + } + function _classCallCheck(a, n) { + if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); + } + function _construct(t, e, r) { + if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); + var o = [null]; + o.push.apply(o, e); + var p = new (t.bind.apply(t, o))(); + return r && _setPrototypeOf(p, r.prototype), p; + } + function _defineProperties(e, r) { + for (var t = 0; t < r.length; t++) { + var o = r[t]; + o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); + } + } + function _createClass(e, r, t) { + return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { + writable: !1 + }), e; + } + function _get() { + return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { + var p = _superPropBase(e, t); + if (p) { + var n = Object.getOwnPropertyDescriptor(p, t); + return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; + } + }, _get.apply(null, arguments); + } + function _getPrototypeOf(t) { + return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { + return t.__proto__ || Object.getPrototypeOf(t); + }, _getPrototypeOf(t); + } + function _inherits(t, e) { + if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); + t.prototype = Object.create(e && e.prototype, { + constructor: { + value: t, + writable: !0, + configurable: !0 + } + }), Object.defineProperty(t, "prototype", { + writable: !1 + }), e && _setPrototypeOf(t, e); + } + function _isNativeFunction(t) { + try { + return -1 !== Function.toString.call(t).indexOf("[native code]"); + } catch (n) { + return "function" == typeof t; + } + } + function _isNativeReflectConstruct() { + try { + var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + } catch (t) {} + return (_isNativeReflectConstruct = function () { + return !!t; + })(); + } + function _possibleConstructorReturn(t, e) { + if (e && ("object" == typeof e || "function" == typeof e)) return e; + if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); + return _assertThisInitialized(t); + } + function _setPrototypeOf(t, e) { + return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { + return t.__proto__ = e, t; + }, _setPrototypeOf(t, e); + } + function _superPropBase(t, o) { + for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); + return t; + } + function _superPropGet(t, o, e, r) { + var p = _get(_getPrototypeOf(t.prototype ), o, e); + return "function" == typeof p ? function (t) { + return p.apply(e, t); + } : p; + } + function _toPrimitive(t, r) { + if ("object" != typeof t || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r); + if ("object" != typeof i) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return (String )(t); + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == typeof i ? i : i + ""; + } + function _wrapNativeSuper(t) { + var r = "function" == typeof Map ? new Map() : void 0; + return _wrapNativeSuper = function (t) { + if (null === t || !_isNativeFunction(t)) return t; + if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); + if (void 0 !== r) { + if (r.has(t)) return r.get(t); + r.set(t, Wrapper); + } + function Wrapper() { + return _construct(t, arguments, _getPrototypeOf(this).constructor); + } + return Wrapper.prototype = Object.create(t.prototype, { + constructor: { + value: Wrapper, + enumerable: !1, + writable: !0, + configurable: !0 + } + }), _setPrototypeOf(Wrapper, t); + }, _wrapNativeSuper(t); + } + + // gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library. + // @author Brandon Jones + // @author Colin MacKenzie IV + // @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md) + var de = function de(A) { + throw TypeError(A); + }; + var oe = function oe(A, e, t) { + return e.has(A) || de("Cannot " + t); + }; + var E = function E(A, e, t) { + return oe(A, e, "read from private field"), t ? t.call(A) : e.get(A); + }, + Z = function Z(A, e, t) { + return e.has(A) ? de("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(A) : e.set(A, t); + }; + var ne, + C = /*#__PURE__*/function (_Float64Array) { + function C() { + var _this; + _classCallCheck(this, C); + for (var _len = arguments.length, e = new Array(_len), _key = 0; _key < _len; _key++) { + e[_key] = arguments[_key]; + } + switch (e.length) { + case 4: + _this = _callSuper(this, C, [e]); + break; + case 2: + _this = _callSuper(this, C, [e[0], e[1], 4]); + break; + case 1: + var t = e[0]; + typeof t == "number" ? _this = _callSuper(this, C, [[t, t, t, t]]) : _this = _callSuper(this, C, [t, 0, 4]); + break; + default: + _this = _callSuper(this, C, [E(C, ne)]); + break; + } + return _assertThisInitialized(_this); + } + _inherits(C, _Float64Array); + return _createClass(C, [{ + key: "str", + get: function get() { + return C.str(this); + } + }, { + key: "copy", + value: function copy(e) { + return this.set(e), this; + } + }, { + key: "identity", + value: function identity() { + return this.set(E(C, ne)), this; + } + }, { + key: "multiply", + value: function multiply(e) { + return C.multiply(this, this, e); + } + }, { + key: "mul", + value: function mul(e) { + return this; + } + }, { + key: "transpose", + value: function transpose() { + return C.transpose(this, this); + } + }, { + key: "invert", + value: function invert() { + return C.invert(this, this); + } + }, { + key: "scale", + value: function scale(e) { + return C.scale(this, this, e); + } + }, { + key: "rotate", + value: function rotate(e) { + return C.rotate(this, this, e); + } + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 4 * Float64Array.BYTES_PER_ELEMENT; + } + }, { + key: "create", + value: function create() { + return new C(); + } + }, { + key: "clone", + value: function clone(e) { + return new C(e); + } + }, { + key: "copy", + value: function copy(e, t) { + return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e; + } + }, { + key: "fromValues", + value: function fromValues() { + for (var _len2 = arguments.length, e = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + e[_key2] = arguments[_key2]; + } + return _construct(C, e); + } + }, { + key: "set", + value: function set(e) { + return e[0] = arguments.length <= 1 ? undefined : arguments[1], e[1] = arguments.length <= 2 ? undefined : arguments[2], e[2] = arguments.length <= 3 ? undefined : arguments[3], e[3] = arguments.length <= 4 ? undefined : arguments[4], e; + } + }, { + key: "identity", + value: function identity(e) { + return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 1, e; + } + }, { + key: "transpose", + value: function transpose(e, t) { + if (e === t) { + var n = t[1]; + e[1] = t[2], e[2] = n; + } else e[0] = t[0], e[1] = t[2], e[2] = t[1], e[3] = t[3]; + return e; + } + }, { + key: "invert", + value: function invert(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = n * a - r * s; + return i ? (i = 1 / i, e[0] = a * i, e[1] = -s * i, e[2] = -r * i, e[3] = n * i, e) : null; + } + }, { + key: "adjoint", + value: function adjoint(e, t) { + var n = t[0]; + return e[0] = t[3], e[1] = -t[1], e[2] = -t[2], e[3] = n, e; + } + }, { + key: "determinant", + value: function determinant(e) { + return e[0] * e[3] - e[2] * e[1]; + } + }, { + key: "add", + value: function add(e, t, n) { + return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e[2] = t[2] + n[2], e[3] = t[3] + n[3], e; + } + }, { + key: "subtract", + value: function subtract(e, t, n) { + return e[0] = t[0] - n[0], e[1] = t[1] - n[1], e[2] = t[2] - n[2], e[3] = t[3] - n[3], e; + } + }, { + key: "sub", + value: function sub(e, t, n) { + return e; + } + }, { + key: "multiply", + value: function multiply(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = n[0], + y = n[1], + L = n[2], + k = n[3]; + return e[0] = s * c + a * y, e[1] = r * c + i * y, e[2] = s * L + a * k, e[3] = r * L + i * k, e; + } + }, { + key: "mul", + value: function mul(e, t, n) { + return e; + } + }, { + key: "rotate", + value: function rotate(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = Math.sin(n), + y = Math.cos(n); + return e[0] = s * y + a * c, e[1] = r * y + i * c, e[2] = s * -c + a * y, e[3] = r * -c + i * y, e; + } + }, { + key: "scale", + value: function scale(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = n[0], + y = n[1]; + return e[0] = s * c, e[1] = r * c, e[2] = a * y, e[3] = i * y, e; + } + }, { + key: "fromRotation", + value: function fromRotation(e, t) { + var n = Math.sin(t), + s = Math.cos(t); + return e[0] = s, e[1] = n, e[2] = -n, e[3] = s, e; + } + }, { + key: "fromScaling", + value: function fromScaling(e, t) { + return e[0] = t[0], e[1] = 0, e[2] = 0, e[3] = t[1], e; + } + }, { + key: "frob", + value: function frob(e) { + return Math.sqrt(e[0] * e[0] + e[1] * e[1] + e[2] * e[2] + e[3] * e[3]); + } + }, { + key: "multiplyScalar", + value: function multiplyScalar(e, t, n) { + return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e[3] = t[3] * n, e; + } + }, { + key: "multiplyScalarAndAdd", + value: function multiplyScalarAndAdd(e, t, n, s) { + return e[0] = t[0] + n[0] * s, e[1] = t[1] + n[1] * s, e[2] = t[2] + n[2] * s, e[3] = t[3] + n[3] * s, e; + } + }, { + key: "LDU", + value: function LDU(e, t, n, s) { + return e[2] = s[2] / s[0], n[0] = s[0], n[1] = s[1], n[3] = s[3] - e[2] * n[1], [e, t, n]; + } + }, { + key: "exactEquals", + value: function exactEquals(e, t) { + return e[0] === t[0] && e[1] === t[1] && e[2] === t[2] && e[3] === t[3]; + } + }, { + key: "equals", + value: function equals(e, t) { + var n = e[0], + s = e[1], + r = e[2], + a = e[3], + i = t[0], + c = t[1], + y = t[2], + L = t[3]; + return Math.abs(n - i) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(i)) && Math.abs(s - c) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(c)) && Math.abs(r - y) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(y)) && Math.abs(a - L) <= 1e-6 * Math.max(1, Math.abs(a), Math.abs(L)); + } + }, { + key: "str", + value: function str(e) { + return "Mat2(".concat(e.join(", "), ")"); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float64Array)); + ne = new WeakMap(), Z(C, ne, new Float64Array([1, 0, 0, 1])); + var v = C; + v.prototype.mul = v.prototype.multiply; + v.mul = v.multiply; + v.sub = v.subtract; + var se, + H = /*#__PURE__*/function (_Float64Array2) { + function H() { + var _this2; + _classCallCheck(this, H); + for (var _len3 = arguments.length, e = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + e[_key3] = arguments[_key3]; + } + switch (e.length) { + case 6: + _this2 = _callSuper(this, H, [e]); + break; + case 2: + _this2 = _callSuper(this, H, [e[0], e[1], 6]); + break; + case 1: + var t = e[0]; + typeof t == "number" ? _this2 = _callSuper(this, H, [[t, t, t, t, t, t]]) : _this2 = _callSuper(this, H, [t, 0, 6]); + break; + default: + _this2 = _callSuper(this, H, [E(H, se)]); + break; + } + return _assertThisInitialized(_this2); + } + _inherits(H, _Float64Array2); + return _createClass(H, [{ + key: "str", + get: function get() { + return H.str(this); + } + }, { + key: "copy", + value: function copy(e) { + return this.set(e), this; + } + }, { + key: "identity", + value: function identity() { + return this.set(E(H, se)), this; + } + }, { + key: "multiply", + value: function multiply(e) { + return H.multiply(this, this, e); + } + }, { + key: "mul", + value: function mul(e) { + return this; + } + }, { + key: "translate", + value: function translate(e) { + return H.translate(this, this, e); + } + }, { + key: "rotate", + value: function rotate(e) { + return H.rotate(this, this, e); + } + }, { + key: "scale", + value: function scale(e) { + return H.scale(this, this, e); + } + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 6 * Float64Array.BYTES_PER_ELEMENT; + } + }, { + key: "create", + value: function create() { + return new H(); + } + }, { + key: "clone", + value: function clone(e) { + return new H(e); + } + }, { + key: "copy", + value: function copy(e, t) { + 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; + } + }, { + key: "fromValues", + value: function fromValues() { + for (var _len4 = arguments.length, e = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + e[_key4] = arguments[_key4]; + } + return _construct(H, e); + } + }, { + key: "set", + value: function set(e) { + return e[0] = arguments.length <= 1 ? undefined : arguments[1], e[1] = arguments.length <= 2 ? undefined : arguments[2], e[2] = arguments.length <= 3 ? undefined : arguments[3], e[3] = arguments.length <= 4 ? undefined : arguments[4], e[4] = arguments.length <= 5 ? undefined : arguments[5], e[5] = arguments.length <= 6 ? undefined : arguments[6], e; + } + }, { + key: "identity", + value: function identity(e) { + return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 1, e[4] = 0, e[5] = 0, e; + } + }, { + key: "invert", + value: function invert(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = t[4], + c = t[5], + y = n * a - s * r; + return y ? (y = 1 / y, e[0] = a * y, e[1] = -s * y, e[2] = -r * y, e[3] = n * y, e[4] = (r * c - a * i) * y, e[5] = (s * i - n * c) * y, e) : null; + } + }, { + key: "determinant", + value: function determinant(e) { + return e[0] * e[3] - e[1] * e[2]; + } + }, { + key: "add", + value: function add(e, t, n) { + return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e[2] = t[2] + n[2], e[3] = t[3] + n[3], e[4] = t[4] + n[4], e[5] = t[5] + n[5], e; + } + }, { + key: "subtract", + value: function subtract(e, t, n) { + return e[0] = t[0] - n[0], e[1] = t[1] - n[1], e[2] = t[2] - n[2], e[3] = t[3] - n[3], e[4] = t[4] - n[4], e[5] = t[5] - n[5], e; + } + }, { + key: "sub", + value: function sub(e, t, n) { + return e; + } + }, { + key: "multiply", + value: function multiply(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = t[4], + y = t[5], + L = n[0], + k = n[1], + l = n[2], + M = n[3], + h = n[4], + b = n[5]; + return e[0] = s * L + a * k, e[1] = r * L + i * k, e[2] = s * l + a * M, e[3] = r * l + i * M, e[4] = s * h + a * b + c, e[5] = r * h + i * b + y, e; + } + }, { + key: "mul", + value: function mul(e, t, n) { + return e; + } + }, { + key: "translate", + value: function translate(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = t[4], + y = t[5], + L = n[0], + k = n[1]; + return e[0] = s, e[1] = r, e[2] = a, e[3] = i, e[4] = s * L + a * k + c, e[5] = r * L + i * k + y, e; + } + }, { + key: "rotate", + value: function rotate(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = t[4], + y = t[5], + L = Math.sin(n), + k = Math.cos(n); + return e[0] = s * k + a * L, e[1] = r * k + i * L, e[2] = s * -L + a * k, e[3] = r * -L + i * k, e[4] = c, e[5] = y, e; + } + }, { + key: "scale", + value: function scale(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = t[4], + y = t[5], + L = n[0], + k = n[1]; + return e[0] = s * L, e[1] = r * L, e[2] = a * k, e[3] = i * k, e[4] = c, e[5] = y, e; + } + }, { + key: "fromTranslation", + value: function fromTranslation(e, t) { + return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 1, e[4] = t[0], e[5] = t[1], e; + } + }, { + key: "fromRotation", + value: function fromRotation(e, t) { + var n = Math.sin(t), + s = Math.cos(t); + return e[0] = s, e[1] = n, e[2] = -n, e[3] = s, e[4] = 0, e[5] = 0, e; + } + }, { + key: "fromScaling", + value: function fromScaling(e, t) { + return e[0] = t[0], e[1] = 0, e[2] = 0, e[3] = t[1], e[4] = 0, e[5] = 0, e; + } + }, { + key: "frob", + value: function frob(e) { + return Math.sqrt(e[0] * e[0] + e[1] * e[1] + e[2] * e[2] + e[3] * e[3] + e[4] * e[4] + e[5] * e[5] + 1); + } + }, { + key: "multiplyScalar", + value: function multiplyScalar(e, t, n) { + return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e[3] = t[3] * n, e[4] = t[4] * n, e[5] = t[5] * n, e; + } + }, { + key: "multiplyScalarAndAdd", + value: function multiplyScalarAndAdd(e, t, n, s) { + return e[0] = t[0] + n[0] * s, e[1] = t[1] + n[1] * s, e[2] = t[2] + n[2] * s, e[3] = t[3] + n[3] * s, e[4] = t[4] + n[4] * s, e[5] = t[5] + n[5] * s, e; + } + }, { + key: "exactEquals", + value: function exactEquals(e, t) { + 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]; + } + }, { + key: "equals", + value: function equals(e, t) { + var n = e[0], + s = e[1], + r = e[2], + a = e[3], + i = e[4], + c = e[5], + y = t[0], + L = t[1], + k = t[2], + l = t[3], + M = t[4], + h = t[5]; + return Math.abs(n - y) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(y)) && Math.abs(s - L) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(L)) && Math.abs(r - k) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(k)) && Math.abs(a - l) <= 1e-6 * Math.max(1, Math.abs(a), Math.abs(l)) && Math.abs(i - M) <= 1e-6 * Math.max(1, Math.abs(i), Math.abs(M)) && Math.abs(c - h) <= 1e-6 * Math.max(1, Math.abs(c), Math.abs(h)); + } + }, { + key: "str", + value: function str(e) { + return "Mat2d(".concat(e.join(", "), ")"); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float64Array)); + se = new WeakMap(), Z(H, se, new Float64Array([1, 0, 0, 1, 0, 0])); + var _ = H; + _.mul = _.multiply; + _.sub = _.subtract; + var re, + X = /*#__PURE__*/function (_Float64Array3) { + function X() { + var _this3; + _classCallCheck(this, X); + for (var _len5 = arguments.length, e = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { + e[_key5] = arguments[_key5]; + } + switch (e.length) { + case 9: + _this3 = _callSuper(this, X, [e]); + break; + case 2: + _this3 = _callSuper(this, X, [e[0], e[1], 9]); + break; + case 1: + var t = e[0]; + typeof t == "number" ? _this3 = _callSuper(this, X, [[t, t, t, t, t, t, t, t, t]]) : _this3 = _callSuper(this, X, [t, 0, 9]); + break; + default: + _this3 = _callSuper(this, X, [E(X, re)]); + break; + } + return _assertThisInitialized(_this3); + } + _inherits(X, _Float64Array3); + return _createClass(X, [{ + key: "str", + get: function get() { + return X.str(this); + } + }, { + key: "copy", + value: function copy(e) { + return this.set(e), this; + } + }, { + key: "identity", + value: function identity() { + return this.set(E(X, re)), this; + } + }, { + key: "multiply", + value: function multiply(e) { + return X.multiply(this, this, e); + } + }, { + key: "mul", + value: function mul(e) { + return this; + } + }, { + key: "transpose", + value: function transpose() { + return X.transpose(this, this); + } + }, { + key: "invert", + value: function invert() { + return X.invert(this, this); + } + }, { + key: "translate", + value: function translate(e) { + return X.translate(this, this, e); + } + }, { + key: "rotate", + value: function rotate(e) { + return X.rotate(this, this, e); + } + }, { + key: "scale", + value: function scale(e) { + return X.scale(this, this, e); + } + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 9 * Float64Array.BYTES_PER_ELEMENT; + } + }, { + key: "create", + value: function create() { + return new X(); + } + }, { + key: "clone", + value: function clone(e) { + return new X(e); + } + }, { + key: "copy", + value: function copy(e, t) { + 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; + } + }, { + key: "fromValues", + value: function fromValues() { + for (var _len6 = arguments.length, e = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { + e[_key6] = arguments[_key6]; + } + return _construct(X, e); + } + }, { + key: "set", + value: function set(e) { + return e[0] = arguments.length <= 1 ? undefined : arguments[1], e[1] = arguments.length <= 2 ? undefined : arguments[2], e[2] = arguments.length <= 3 ? undefined : arguments[3], e[3] = arguments.length <= 4 ? undefined : arguments[4], e[4] = arguments.length <= 5 ? undefined : arguments[5], e[5] = arguments.length <= 6 ? undefined : arguments[6], e[6] = arguments.length <= 7 ? undefined : arguments[7], e[7] = arguments.length <= 8 ? undefined : arguments[8], e[8] = arguments.length <= 9 ? undefined : arguments[9], e; + } + }, { + key: "identity", + value: function identity(e) { + return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 1, e[5] = 0, e[6] = 0, e[7] = 0, e[8] = 1, e; + } + }, { + key: "transpose", + value: function transpose(e, t) { + if (e === t) { + var n = t[1], + s = t[2], + r = t[5]; + e[1] = t[3], e[2] = t[6], e[3] = n, e[5] = t[7], e[6] = s, e[7] = r; + } else e[0] = t[0], e[1] = t[3], e[2] = t[6], e[3] = t[1], e[4] = t[4], e[5] = t[7], e[6] = t[2], e[7] = t[5], e[8] = t[8]; + return e; + } + }, { + key: "invert", + value: function invert(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = t[4], + c = t[5], + y = t[6], + L = t[7], + k = t[8], + l = k * i - c * L, + M = -k * a + c * y, + h = L * a - i * y, + b = n * l + s * M + r * h; + return b ? (b = 1 / b, e[0] = l * b, e[1] = (-k * s + r * L) * b, e[2] = (c * s - r * i) * b, e[3] = M * b, e[4] = (k * n - r * y) * b, e[5] = (-c * n + r * a) * b, e[6] = h * b, e[7] = (-L * n + s * y) * b, e[8] = (i * n - s * a) * b, e) : null; + } + }, { + key: "adjoint", + value: function adjoint(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = t[4], + c = t[5], + y = t[6], + L = t[7], + k = t[8]; + return e[0] = i * k - c * L, e[1] = r * L - s * k, e[2] = s * c - r * i, e[3] = c * y - a * k, e[4] = n * k - r * y, e[5] = r * a - n * c, e[6] = a * L - i * y, e[7] = s * y - n * L, e[8] = n * i - s * a, e; + } + }, { + key: "determinant", + value: function determinant(e) { + var t = e[0], + n = e[1], + s = e[2], + r = e[3], + a = e[4], + i = e[5], + c = e[6], + y = e[7], + L = e[8]; + return t * (L * a - i * y) + n * (-L * r + i * c) + s * (y * r - a * c); + } + }, { + key: "add", + value: function add(e, t, n) { + return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e[2] = t[2] + n[2], e[3] = t[3] + n[3], e[4] = t[4] + n[4], e[5] = t[5] + n[5], e[6] = t[6] + n[6], e[7] = t[7] + n[7], e[8] = t[8] + n[8], e; + } + }, { + key: "subtract", + value: function subtract(e, t, n) { + return e[0] = t[0] - n[0], e[1] = t[1] - n[1], e[2] = t[2] - n[2], e[3] = t[3] - n[3], e[4] = t[4] - n[4], e[5] = t[5] - n[5], e[6] = t[6] - n[6], e[7] = t[7] - n[7], e[8] = t[8] - n[8], e; + } + }, { + key: "sub", + value: function sub(e, t, n) { + return e; + } + }, { + key: "multiply", + value: function multiply(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = t[4], + y = t[5], + L = t[6], + k = t[7], + l = t[8], + M = n[0], + h = n[1], + b = n[2]; + return e[0] = M * s + h * i + b * L, e[1] = M * r + h * c + b * k, e[2] = M * a + h * y + b * l, M = n[3], h = n[4], b = n[5], e[3] = M * s + h * i + b * L, e[4] = M * r + h * c + b * k, e[5] = M * a + h * y + b * l, M = n[6], h = n[7], b = n[8], e[6] = M * s + h * i + b * L, e[7] = M * r + h * c + b * k, e[8] = M * a + h * y + b * l, e; + } + }, { + key: "mul", + value: function mul(e, t, n) { + return e; + } + }, { + key: "translate", + value: function translate(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = t[4], + y = t[5], + L = t[6], + k = t[7], + l = t[8], + M = n[0], + h = n[1]; + return e[0] = s, e[1] = r, e[2] = a, e[3] = i, e[4] = c, e[5] = y, e[6] = M * s + h * i + L, e[7] = M * r + h * c + k, e[8] = M * a + h * y + l, e; + } + }, { + key: "rotate", + value: function rotate(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = t[4], + y = t[5], + L = t[6], + k = t[7], + l = t[8], + M = Math.sin(n), + h = Math.cos(n); + return e[0] = h * s + M * i, e[1] = h * r + M * c, e[2] = h * a + M * y, e[3] = h * i - M * s, e[4] = h * c - M * r, e[5] = h * y - M * a, e[6] = L, e[7] = k, e[8] = l, e; + } + }, { + key: "scale", + value: function scale(e, t, n) { + var s = n[0], + r = n[1]; + return e[0] = s * t[0], e[1] = s * t[1], e[2] = s * t[2], e[3] = r * t[3], e[4] = r * t[4], e[5] = r * t[5], e[6] = t[6], e[7] = t[7], e[8] = t[8], e; + } + }, { + key: "fromTranslation", + value: function fromTranslation(e, t) { + return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 1, e[5] = 0, e[6] = t[0], e[7] = t[1], e[8] = 1, e; + } + }, { + key: "fromRotation", + value: function fromRotation(e, t) { + var n = Math.sin(t), + s = Math.cos(t); + return e[0] = s, e[1] = n, e[2] = 0, e[3] = -n, e[4] = s, e[5] = 0, e[6] = 0, e[7] = 0, e[8] = 1, e; + } + }, { + key: "fromScaling", + value: function fromScaling(e, t) { + return e[0] = t[0], e[1] = 0, e[2] = 0, e[3] = 0, e[4] = t[1], e[5] = 0, e[6] = 0, e[7] = 0, e[8] = 1, e; + } + }, { + key: "fromMat2d", + value: function fromMat2d(e, t) { + return e[0] = t[0], e[1] = t[1], e[2] = 0, e[3] = t[2], e[4] = t[3], e[5] = 0, e[6] = t[4], e[7] = t[5], e[8] = 1, e; + } + }, { + key: "fromQuat", + value: function fromQuat(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = n + n, + c = s + s, + y = r + r, + L = n * i, + k = s * i, + l = s * c, + M = r * i, + h = r * c, + b = r * y, + d = a * i, + m = a * c, + o = a * y; + return e[0] = 1 - l - b, e[3] = k - o, e[6] = M + m, e[1] = k + o, e[4] = 1 - L - b, e[7] = h - d, e[2] = M - m, e[5] = h + d, e[8] = 1 - L - l, e; + } + }, { + key: "fromMat4", + value: function fromMat4(e, t) { + return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[4], e[4] = t[5], e[5] = t[6], e[6] = t[8], e[7] = t[9], e[8] = t[10], e; + } + }, { + key: "normalFromMat4", + value: function normalFromMat4(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = t[4], + c = t[5], + y = t[6], + L = t[7], + k = t[8], + l = t[9], + M = t[10], + h = t[11], + b = t[12], + d = t[13], + m = t[14], + o = t[15], + V = n * c - s * i, + x = n * y - r * i, + R = n * L - a * i, + z = s * y - r * c, + g = s * L - a * c, + B = r * L - a * y, + D = k * d - l * b, + F = k * m - M * b, + p = k * o - h * b, + Y = l * m - M * d, + I = l * o - h * d, + P = M * o - h * m, + Q = V * P - x * I + R * Y + z * p - g * F + B * D; + return Q ? (Q = 1 / Q, e[0] = (c * P - y * I + L * Y) * Q, e[1] = (y * p - i * P - L * F) * Q, e[2] = (i * I - c * p + L * D) * Q, e[3] = (r * I - s * P - a * Y) * Q, e[4] = (n * P - r * p + a * F) * Q, e[5] = (s * p - n * I - a * D) * Q, e[6] = (d * B - m * g + o * z) * Q, e[7] = (m * R - b * B - o * x) * Q, e[8] = (b * g - d * R + o * V) * Q, e) : null; + } + }, { + key: "normalFromMat4Fast", + value: function normalFromMat4Fast(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[4], + i = t[5], + c = t[6], + y = t[8], + L = t[9], + k = t[10]; + return e[0] = i * k - k * L, e[1] = c * y - y * k, e[2] = a * L - L * y, e[3] = L * r - k * s, e[4] = k * n - y * r, e[5] = y * s - L * n, e[6] = s * c - r * i, e[7] = r * a - n * c, e[8] = n * i - s * a, e; + } + }, { + key: "projection", + value: function projection(e, t, n) { + return e[0] = 2 / t, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = -2 / n, e[5] = 0, e[6] = -1, e[7] = 1, e[8] = 1, e; + } + }, { + key: "frob", + value: function frob(e) { + return Math.sqrt(e[0] * e[0] + e[1] * e[1] + e[2] * e[2] + e[3] * e[3] + e[4] * e[4] + e[5] * e[5] + e[6] * e[6] + e[7] * e[7] + e[8] * e[8]); + } + }, { + key: "multiplyScalar", + value: function multiplyScalar(e, t, n) { + return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e[3] = t[3] * n, e[4] = t[4] * n, e[5] = t[5] * n, e[6] = t[6] * n, e[7] = t[7] * n, e[8] = t[8] * n, e; + } + }, { + key: "multiplyScalarAndAdd", + value: function multiplyScalarAndAdd(e, t, n, s) { + return e[0] = t[0] + n[0] * s, e[1] = t[1] + n[1] * s, e[2] = t[2] + n[2] * s, e[3] = t[3] + n[3] * s, e[4] = t[4] + n[4] * s, e[5] = t[5] + n[5] * s, e[6] = t[6] + n[6] * s, e[7] = t[7] + n[7] * s, e[8] = t[8] + n[8] * s, e; + } + }, { + key: "exactEquals", + value: function exactEquals(e, t) { + 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]; + } + }, { + key: "equals", + value: function equals(e, t) { + var n = e[0], + s = e[1], + r = e[2], + a = e[3], + i = e[4], + c = e[5], + y = e[6], + L = e[7], + k = e[8], + l = t[0], + M = t[1], + h = t[2], + b = t[3], + d = t[4], + m = t[5], + o = t[6], + V = t[7], + x = t[8]; + return Math.abs(n - l) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(l)) && Math.abs(s - M) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(M)) && Math.abs(r - h) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(h)) && Math.abs(a - b) <= 1e-6 * Math.max(1, Math.abs(a), Math.abs(b)) && Math.abs(i - d) <= 1e-6 * Math.max(1, Math.abs(i), Math.abs(d)) && Math.abs(c - m) <= 1e-6 * Math.max(1, Math.abs(c), Math.abs(m)) && Math.abs(y - o) <= 1e-6 * Math.max(1, Math.abs(y), Math.abs(o)) && Math.abs(L - V) <= 1e-6 * Math.max(1, Math.abs(L), Math.abs(V)) && Math.abs(k - x) <= 1e-6 * Math.max(1, Math.abs(k), Math.abs(x)); + } + }, { + key: "str", + value: function str(e) { + return "Mat3(".concat(e.join(", "), ")"); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float64Array)); + re = new WeakMap(), Z(X, re, new Float64Array([1, 0, 0, 0, 1, 0, 0, 0, 1])); + var u = X; + u.prototype.mul = u.prototype.multiply; + u.mul = u.multiply; + u.sub = u.subtract; + var ae, + $, + S = /*#__PURE__*/function (_Float64Array4) { + function S() { + var _this4; + _classCallCheck(this, S); + for (var _len7 = arguments.length, e = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { + e[_key7] = arguments[_key7]; + } + switch (e.length) { + case 16: + _this4 = _callSuper(this, S, [e]); + break; + case 2: + _this4 = _callSuper(this, S, [e[0], e[1], 16]); + break; + case 1: + var t = e[0]; + typeof t == "number" ? _this4 = _callSuper(this, S, [[t, t, t, t, t, t, t, t, t, t, t, t, t, t, t, t]]) : _this4 = _callSuper(this, S, [t, 0, 16]); + break; + default: + _this4 = _callSuper(this, S, [E(S, ae)]); + break; + } + return _assertThisInitialized(_this4); + } + _inherits(S, _Float64Array4); + return _createClass(S, [{ + key: "str", + get: function get() { + return S.str(this); + } + }, { + key: "copy", + value: function copy(e) { + return this.set(e), this; + } + }, { + key: "identity", + value: function identity() { + return this.set(E(S, ae)), this; + } + }, { + key: "multiply", + value: function multiply(e) { + return S.multiply(this, this, e); + } + }, { + key: "mul", + value: function mul(e) { + return this; + } + }, { + key: "transpose", + value: function transpose() { + return S.transpose(this, this); + } + }, { + key: "invert", + value: function invert() { + return S.invert(this, this); + } + }, { + key: "translate", + value: function translate(e) { + return S.translate(this, this, e); + } + }, { + key: "rotate", + value: function rotate(e, t) { + return S.rotate(this, this, e, t); + } + }, { + key: "scale", + value: function scale(e) { + return S.scale(this, this, e); + } + }, { + key: "rotateX", + value: function rotateX(e) { + return S.rotateX(this, this, e); + } + }, { + key: "rotateY", + value: function rotateY(e) { + return S.rotateY(this, this, e); + } + }, { + key: "rotateZ", + value: function rotateZ(e) { + return S.rotateZ(this, this, e); + } + }, { + key: "perspectiveNO", + value: function perspectiveNO(e, t, n, s) { + return S.perspectiveNO(this, e, t, n, s); + } + }, { + key: "perspectiveZO", + value: function perspectiveZO(e, t, n, s) { + return S.perspectiveZO(this, e, t, n, s); + } + }, { + key: "orthoNO", + value: function orthoNO(e, t, n, s, r, a) { + return S.orthoNO(this, e, t, n, s, r, a); + } + }, { + key: "orthoZO", + value: function orthoZO(e, t, n, s, r, a) { + return S.orthoZO(this, e, t, n, s, r, a); + } + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 16 * Float64Array.BYTES_PER_ELEMENT; + } + }, { + key: "create", + value: function create() { + return new S(); + } + }, { + key: "clone", + value: function clone(e) { + return new S(e); + } + }, { + key: "copy", + value: function copy(e, t) { + 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; + } + }, { + key: "fromValues", + value: function fromValues() { + for (var _len8 = arguments.length, e = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) { + e[_key8] = arguments[_key8]; + } + return _construct(S, e); + } + }, { + key: "set", + value: function set(e) { + return e[0] = arguments.length <= 1 ? undefined : arguments[1], e[1] = arguments.length <= 2 ? undefined : arguments[2], e[2] = arguments.length <= 3 ? undefined : arguments[3], e[3] = arguments.length <= 4 ? undefined : arguments[4], e[4] = arguments.length <= 5 ? undefined : arguments[5], e[5] = arguments.length <= 6 ? undefined : arguments[6], e[6] = arguments.length <= 7 ? undefined : arguments[7], e[7] = arguments.length <= 8 ? undefined : arguments[8], e[8] = arguments.length <= 9 ? undefined : arguments[9], e[9] = arguments.length <= 10 ? undefined : arguments[10], e[10] = arguments.length <= 11 ? undefined : arguments[11], e[11] = arguments.length <= 12 ? undefined : arguments[12], e[12] = arguments.length <= 13 ? undefined : arguments[13], e[13] = arguments.length <= 14 ? undefined : arguments[14], e[14] = arguments.length <= 15 ? undefined : arguments[15], e[15] = arguments.length <= 16 ? undefined : arguments[16], e; + } + }, { + key: "identity", + value: function identity(e) { + 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; + } + }, { + key: "transpose", + value: function transpose(e, t) { + if (e === t) { + var n = t[1], + s = t[2], + r = t[3], + a = t[6], + i = t[7], + c = t[11]; + e[1] = t[4], e[2] = t[8], e[3] = t[12], e[4] = n, e[6] = t[9], e[7] = t[13], e[8] = s, e[9] = a, e[11] = t[14], e[12] = r, e[13] = i, e[14] = c; + } else e[0] = t[0], e[1] = t[4], e[2] = t[8], e[3] = t[12], e[4] = t[1], e[5] = t[5], e[6] = t[9], e[7] = t[13], e[8] = t[2], e[9] = t[6], e[10] = t[10], e[11] = t[14], e[12] = t[3], e[13] = t[7], e[14] = t[11], e[15] = t[15]; + return e; + } + }, { + key: "invert", + value: function invert(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = t[4], + c = t[5], + y = t[6], + L = t[7], + k = t[8], + l = t[9], + M = t[10], + h = t[11], + b = t[12], + d = t[13], + m = t[14], + o = t[15], + V = n * c - s * i, + x = n * y - r * i, + R = n * L - a * i, + z = s * y - r * c, + g = s * L - a * c, + B = r * L - a * y, + D = k * d - l * b, + F = k * m - M * b, + p = k * o - h * b, + Y = l * m - M * d, + I = l * o - h * d, + P = M * o - h * m, + Q = V * P - x * I + R * Y + z * p - g * F + B * D; + return Q ? (Q = 1 / Q, e[0] = (c * P - y * I + L * Y) * Q, e[1] = (r * I - s * P - a * Y) * Q, e[2] = (d * B - m * g + o * z) * Q, e[3] = (M * g - l * B - h * z) * Q, e[4] = (y * p - i * P - L * F) * Q, e[5] = (n * P - r * p + a * F) * Q, e[6] = (m * R - b * B - o * x) * Q, e[7] = (k * B - M * R + h * x) * Q, e[8] = (i * I - c * p + L * D) * Q, e[9] = (s * p - n * I - a * D) * Q, e[10] = (b * g - d * R + o * V) * Q, e[11] = (l * R - k * g - h * V) * Q, e[12] = (c * F - i * Y - y * D) * Q, e[13] = (n * Y - s * F + r * D) * Q, e[14] = (d * x - b * z - m * V) * Q, e[15] = (k * z - l * x + M * V) * Q, e) : null; + } + }, { + key: "adjoint", + value: function adjoint(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = t[4], + c = t[5], + y = t[6], + L = t[7], + k = t[8], + l = t[9], + M = t[10], + h = t[11], + b = t[12], + d = t[13], + m = t[14], + o = t[15], + V = n * c - s * i, + x = n * y - r * i, + R = n * L - a * i, + z = s * y - r * c, + g = s * L - a * c, + B = r * L - a * y, + D = k * d - l * b, + F = k * m - M * b, + p = k * o - h * b, + Y = l * m - M * d, + I = l * o - h * d, + P = M * o - h * m; + return e[0] = c * P - y * I + L * Y, e[1] = r * I - s * P - a * Y, e[2] = d * B - m * g + o * z, e[3] = M * g - l * B - h * z, e[4] = y * p - i * P - L * F, e[5] = n * P - r * p + a * F, e[6] = m * R - b * B - o * x, e[7] = k * B - M * R + h * x, e[8] = i * I - c * p + L * D, e[9] = s * p - n * I - a * D, e[10] = b * g - d * R + o * V, e[11] = l * R - k * g - h * V, e[12] = c * F - i * Y - y * D, e[13] = n * Y - s * F + r * D, e[14] = d * x - b * z - m * V, e[15] = k * z - l * x + M * V, e; + } + }, { + key: "determinant", + value: function determinant(e) { + var t = e[0], + n = e[1], + s = e[2], + r = e[3], + a = e[4], + i = e[5], + c = e[6], + y = e[7], + L = e[8], + k = e[9], + l = e[10], + M = e[11], + h = e[12], + b = e[13], + d = e[14], + m = e[15], + o = t * i - n * a, + V = t * c - s * a, + x = n * c - s * i, + R = L * b - k * h, + z = L * d - l * h, + g = k * d - l * b, + B = t * g - n * z + s * R, + D = a * g - i * z + c * R, + F = L * x - k * V + l * o, + p = h * x - b * V + d * o; + return y * B - r * D + m * F - M * p; + } + }, { + key: "multiply", + value: function multiply(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = t[4], + y = t[5], + L = t[6], + k = t[7], + l = t[8], + M = t[9], + h = t[10], + b = t[11], + d = t[12], + m = t[13], + o = t[14], + V = t[15], + x = n[0], + R = n[1], + z = n[2], + g = n[3]; + return e[0] = x * s + R * c + z * l + g * d, e[1] = x * r + R * y + z * M + g * m, e[2] = x * a + R * L + z * h + g * o, e[3] = x * i + R * k + z * b + g * V, x = n[4], R = n[5], z = n[6], g = n[7], e[4] = x * s + R * c + z * l + g * d, e[5] = x * r + R * y + z * M + g * m, e[6] = x * a + R * L + z * h + g * o, e[7] = x * i + R * k + z * b + g * V, x = n[8], R = n[9], z = n[10], g = n[11], e[8] = x * s + R * c + z * l + g * d, e[9] = x * r + R * y + z * M + g * m, e[10] = x * a + R * L + z * h + g * o, e[11] = x * i + R * k + z * b + g * V, x = n[12], R = n[13], z = n[14], g = n[15], e[12] = x * s + R * c + z * l + g * d, e[13] = x * r + R * y + z * M + g * m, e[14] = x * a + R * L + z * h + g * o, e[15] = x * i + R * k + z * b + g * V, e; + } + }, { + key: "mul", + value: function mul(e, t, n) { + return e; + } + }, { + key: "translate", + value: function translate(e, t, n) { + var s = n[0], + r = n[1], + a = n[2]; + if (t === e) e[12] = t[0] * s + t[4] * r + t[8] * a + t[12], e[13] = t[1] * s + t[5] * r + t[9] * a + t[13], e[14] = t[2] * s + t[6] * r + t[10] * a + t[14], e[15] = t[3] * s + t[7] * r + t[11] * a + t[15];else { + var i = t[0], + c = t[1], + y = t[2], + L = t[3], + k = t[4], + l = t[5], + M = t[6], + h = t[7], + b = t[8], + d = t[9], + m = t[10], + o = t[11]; + e[0] = i, e[1] = c, e[2] = y, e[3] = L, e[4] = k, e[5] = l, e[6] = M, e[7] = h, e[8] = b, e[9] = d, e[10] = m, e[11] = o, e[12] = i * s + k * r + b * a + t[12], e[13] = c * s + l * r + d * a + t[13], e[14] = y * s + M * r + m * a + t[14], e[15] = L * s + h * r + o * a + t[15]; + } + return e; + } + }, { + key: "scale", + value: function scale(e, t, n) { + var s = n[0], + r = n[1], + a = n[2]; + return e[0] = t[0] * s, e[1] = t[1] * s, e[2] = t[2] * s, e[3] = t[3] * s, e[4] = t[4] * r, e[5] = t[5] * r, e[6] = t[6] * r, e[7] = t[7] * r, e[8] = t[8] * a, e[9] = t[9] * a, e[10] = t[10] * a, e[11] = t[11] * a, e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15], e; + } + }, { + key: "rotate", + value: function rotate(e, t, n, s) { + var r = s[0], + a = s[1], + i = s[2], + c = Math.sqrt(r * r + a * a + i * i); + if (c < 1e-6) return null; + c = 1 / c, r *= c, a *= c, i *= c; + var y = Math.sin(n), + L = Math.cos(n), + k = 1 - L, + l = t[0], + M = t[1], + h = t[2], + b = t[3], + d = t[4], + m = t[5], + o = t[6], + V = t[7], + x = t[8], + R = t[9], + z = t[10], + g = t[11], + B = r * r * k + L, + D = a * r * k + i * y, + F = i * r * k - a * y, + p = r * a * k - i * y, + Y = a * a * k + L, + I = i * a * k + r * y, + P = r * i * k + a * y, + Q = a * i * k - r * y, + K = i * i * k + L; + return e[0] = l * B + d * D + x * F, e[1] = M * B + m * D + R * F, e[2] = h * B + o * D + z * F, e[3] = b * B + V * D + g * F, e[4] = l * p + d * Y + x * I, e[5] = M * p + m * Y + R * I, e[6] = h * p + o * Y + z * I, e[7] = b * p + V * Y + g * I, e[8] = l * P + d * Q + x * K, e[9] = M * P + m * Q + R * K, e[10] = h * P + o * Q + z * K, e[11] = b * P + V * Q + g * K, t !== e && (e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e; + } + }, { + key: "rotateX", + value: function rotateX(e, t, n) { + var s = Math.sin(n), + r = Math.cos(n), + a = t[4], + i = t[5], + c = t[6], + y = t[7], + L = t[8], + k = t[9], + l = t[10], + M = t[11]; + return t !== e && (e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[4] = a * r + L * s, e[5] = i * r + k * s, e[6] = c * r + l * s, e[7] = y * r + M * s, e[8] = L * r - a * s, e[9] = k * r - i * s, e[10] = l * r - c * s, e[11] = M * r - y * s, e; + } + }, { + key: "rotateY", + value: function rotateY(e, t, n) { + var s = Math.sin(n), + r = Math.cos(n), + a = t[0], + i = t[1], + c = t[2], + y = t[3], + L = t[8], + k = t[9], + l = t[10], + M = t[11]; + return t !== e && (e[4] = t[4], e[5] = t[5], e[6] = t[6], e[7] = t[7], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[0] = a * r - L * s, e[1] = i * r - k * s, e[2] = c * r - l * s, e[3] = y * r - M * s, e[8] = a * s + L * r, e[9] = i * s + k * r, e[10] = c * s + l * r, e[11] = y * s + M * r, e; + } + }, { + key: "rotateZ", + value: function rotateZ(e, t, n) { + var s = Math.sin(n), + r = Math.cos(n), + a = t[0], + i = t[1], + c = t[2], + y = t[3], + L = t[4], + k = t[5], + l = t[6], + M = t[7]; + return t !== e && (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[0] = a * r + L * s, e[1] = i * r + k * s, e[2] = c * r + l * s, e[3] = y * r + M * s, e[4] = L * r - a * s, e[5] = k * r - i * s, e[6] = l * r - c * s, e[7] = M * r - y * s, e; + } + }, { + key: "fromTranslation", + value: function fromTranslation(e, t) { + 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] = t[0], e[13] = t[1], e[14] = t[2], e[15] = 1, e; + } + }, { + key: "fromScaling", + value: function fromScaling(e, t) { + return e[0] = t[0], e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = t[1], e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = t[2], e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e; + } + }, { + key: "fromRotation", + value: function fromRotation(e, t, n) { + var s = n[0], + r = n[1], + a = n[2], + i = Math.sqrt(s * s + r * r + a * a); + if (i < 1e-6) return null; + i = 1 / i, s *= i, r *= i, a *= i; + var c = Math.sin(t), + y = Math.cos(t), + L = 1 - y; + return e[0] = s * s * L + y, e[1] = r * s * L + a * c, e[2] = a * s * L - r * c, e[3] = 0, e[4] = s * r * L - a * c, e[5] = r * r * L + y, e[6] = a * r * L + s * c, e[7] = 0, e[8] = s * a * L + r * c, e[9] = r * a * L - s * c, e[10] = a * a * L + y, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e; + } + }, { + key: "fromXRotation", + value: function fromXRotation(e, t) { + var n = Math.sin(t), + s = Math.cos(t); + return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = s, e[6] = n, e[7] = 0, e[8] = 0, e[9] = -n, e[10] = s, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e; + } + }, { + key: "fromYRotation", + value: function fromYRotation(e, t) { + var n = Math.sin(t), + s = Math.cos(t); + return e[0] = s, e[1] = 0, e[2] = -n, e[3] = 0, e[4] = 0, e[5] = 1, e[6] = 0, e[7] = 0, e[8] = n, e[9] = 0, e[10] = s, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e; + } + }, { + key: "fromZRotation", + value: function fromZRotation(e, t) { + var n = Math.sin(t), + s = Math.cos(t); + return e[0] = s, e[1] = n, e[2] = 0, e[3] = 0, e[4] = -n, e[5] = s, 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; + } + }, { + key: "fromRotationTranslation", + value: function fromRotationTranslation(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = s + s, + y = r + r, + L = a + a, + k = s * c, + l = s * y, + M = s * L, + h = r * y, + b = r * L, + d = a * L, + m = i * c, + o = i * y, + V = i * L; + return e[0] = 1 - (h + d), e[1] = l + V, e[2] = M - o, e[3] = 0, e[4] = l - V, e[5] = 1 - (k + d), e[6] = b + m, e[7] = 0, e[8] = M + o, e[9] = b - m, e[10] = 1 - (k + h), e[11] = 0, e[12] = n[0], e[13] = n[1], e[14] = n[2], e[15] = 1, e; + } + }, { + key: "fromQuat2", + value: function fromQuat2(e, t) { + var n = -t[0], + s = -t[1], + r = -t[2], + a = t[3], + i = t[4], + c = t[5], + y = t[6], + L = t[7], + k = n * n + s * s + r * r + a * a; + return k > 0 ? (E(S, $)[0] = (i * a + L * n + c * r - y * s) * 2 / k, E(S, $)[1] = (c * a + L * s + y * n - i * r) * 2 / k, E(S, $)[2] = (y * a + L * r + i * s - c * n) * 2 / k) : (E(S, $)[0] = (i * a + L * n + c * r - y * s) * 2, E(S, $)[1] = (c * a + L * s + y * n - i * r) * 2, E(S, $)[2] = (y * a + L * r + i * s - c * n) * 2), S.fromRotationTranslation(e, t, E(S, $)), e; + } + }, { + key: "normalFromMat4", + value: function normalFromMat4(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = t[4], + c = t[5], + y = t[6], + L = t[7], + k = t[8], + l = t[9], + M = t[10], + h = t[11], + b = t[12], + d = t[13], + m = t[14], + o = t[15], + V = n * c - s * i, + x = n * y - r * i, + R = n * L - a * i, + z = s * y - r * c, + g = s * L - a * c, + B = r * L - a * y, + D = k * d - l * b, + F = k * m - M * b, + p = k * o - h * b, + Y = l * m - M * d, + I = l * o - h * d, + P = M * o - h * m, + Q = V * P - x * I + R * Y + z * p - g * F + B * D; + return Q ? (Q = 1 / Q, e[0] = (c * P - y * I + L * Y) * Q, e[1] = (y * p - i * P - L * F) * Q, e[2] = (i * I - c * p + L * D) * Q, e[3] = 0, e[4] = (r * I - s * P - a * Y) * Q, e[5] = (n * P - r * p + a * F) * Q, e[6] = (s * p - n * I - a * D) * Q, e[7] = 0, e[8] = (d * B - m * g + o * z) * Q, e[9] = (m * R - b * B - o * x) * Q, e[10] = (b * g - d * R + o * V) * Q, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e) : null; + } + }, { + key: "normalFromMat4Fast", + value: function normalFromMat4Fast(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[4], + i = t[5], + c = t[6], + y = t[8], + L = t[9], + k = t[10]; + return e[0] = i * k - k * L, e[1] = c * y - y * k, e[2] = a * L - L * y, e[3] = 0, e[4] = L * r - k * s, e[5] = k * n - y * r, e[6] = y * s - L * n, e[7] = 0, e[8] = s * c - r * i, e[9] = r * a - n * c, e[10] = n * i - s * a, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e; + } + }, { + key: "getTranslation", + value: function getTranslation(e, t) { + return e[0] = t[12], e[1] = t[13], e[2] = t[14], e; + } + }, { + key: "getScaling", + value: function getScaling(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[4], + i = t[5], + c = t[6], + y = t[8], + L = t[9], + k = t[10]; + return e[0] = Math.sqrt(n * n + s * s + r * r), e[1] = Math.sqrt(a * a + i * i + c * c), e[2] = Math.sqrt(y * y + L * L + k * k), e; + } + }, { + key: "getRotation", + value: function getRotation(e, t) { + S.getScaling(E(S, $), t); + var n = 1 / E(S, $)[0], + s = 1 / E(S, $)[1], + r = 1 / E(S, $)[2], + a = t[0] * n, + i = t[1] * s, + c = t[2] * r, + y = t[4] * n, + L = t[5] * s, + k = t[6] * r, + l = t[8] * n, + M = t[9] * s, + h = t[10] * r, + b = a + L + h, + d = 0; + return b > 0 ? (d = Math.sqrt(b + 1) * 2, e[3] = .25 * d, e[0] = (k - M) / d, e[1] = (l - c) / d, e[2] = (i - y) / d) : a > L && a > h ? (d = Math.sqrt(1 + a - L - h) * 2, e[3] = (k - M) / d, e[0] = .25 * d, e[1] = (i + y) / d, e[2] = (l + c) / d) : L > h ? (d = Math.sqrt(1 + L - a - h) * 2, e[3] = (l - c) / d, e[0] = (i + y) / d, e[1] = .25 * d, e[2] = (k + M) / d) : (d = Math.sqrt(1 + h - a - L) * 2, e[3] = (i - y) / d, e[0] = (l + c) / d, e[1] = (k + M) / d, e[2] = .25 * d), e; + } + }, { + key: "decompose", + value: function decompose(e, t, n, s) { + t[0] = s[12], t[1] = s[13], t[2] = s[14]; + var r = s[0], + a = s[1], + i = s[2], + c = s[4], + y = s[5], + L = s[6], + k = s[8], + l = s[9], + M = s[10]; + n[0] = Math.sqrt(r * r + a * a + i * i), n[1] = Math.sqrt(c * c + y * y + L * L), n[2] = Math.sqrt(k * k + l * l + M * M); + var h = 1 / n[0], + b = 1 / n[1], + d = 1 / n[2], + m = r * h, + o = a * b, + V = i * d, + x = c * h, + R = y * b, + z = L * d, + g = k * h, + B = l * b, + D = M * d, + F = m + R + D, + p = 0; + return F > 0 ? (p = Math.sqrt(F + 1) * 2, e[3] = .25 * p, e[0] = (z - B) / p, e[1] = (g - V) / p, e[2] = (o - x) / p) : m > R && m > D ? (p = Math.sqrt(1 + m - R - D) * 2, e[3] = (z - B) / p, e[0] = .25 * p, e[1] = (o + x) / p, e[2] = (g + V) / p) : R > D ? (p = Math.sqrt(1 + R - m - D) * 2, e[3] = (g - V) / p, e[0] = (o + x) / p, e[1] = .25 * p, e[2] = (z + B) / p) : (p = Math.sqrt(1 + D - m - R) * 2, e[3] = (o - x) / p, e[0] = (g + V) / p, e[1] = (z + B) / p, e[2] = .25 * p), e; + } + }, { + key: "fromRotationTranslationScale", + value: function fromRotationTranslationScale(e, t, n, s) { + var r = t[0], + a = t[1], + i = t[2], + c = t[3], + y = r + r, + L = a + a, + k = i + i, + l = r * y, + M = r * L, + h = r * k, + b = a * L, + d = a * k, + m = i * k, + o = c * y, + V = c * L, + x = c * k, + R = s[0], + z = s[1], + g = s[2]; + return e[0] = (1 - (b + m)) * R, e[1] = (M + x) * R, e[2] = (h - V) * R, e[3] = 0, e[4] = (M - x) * z, e[5] = (1 - (l + m)) * z, e[6] = (d + o) * z, e[7] = 0, e[8] = (h + V) * g, e[9] = (d - o) * g, e[10] = (1 - (l + b)) * g, e[11] = 0, e[12] = n[0], e[13] = n[1], e[14] = n[2], e[15] = 1, e; + } + }, { + key: "fromRotationTranslationScaleOrigin", + value: function fromRotationTranslationScaleOrigin(e, t, n, s, r) { + var a = t[0], + i = t[1], + c = t[2], + y = t[3], + L = a + a, + k = i + i, + l = c + c, + M = a * L, + h = a * k, + b = a * l, + d = i * k, + m = i * l, + o = c * l, + V = y * L, + x = y * k, + R = y * l, + z = s[0], + g = s[1], + B = s[2], + D = r[0], + F = r[1], + p = r[2], + Y = (1 - (d + o)) * z, + I = (h + R) * z, + P = (b - x) * z, + Q = (h - R) * g, + K = (1 - (M + o)) * g, + ee = (m + V) * g, + te = (b + x) * B, + Me = (m - V) * B, + be = (1 - (M + d)) * B; + return e[0] = Y, e[1] = I, e[2] = P, e[3] = 0, e[4] = Q, e[5] = K, e[6] = ee, e[7] = 0, e[8] = te, e[9] = Me, e[10] = be, e[11] = 0, e[12] = n[0] + D - (Y * D + Q * F + te * p), e[13] = n[1] + F - (I * D + K * F + Me * p), e[14] = n[2] + p - (P * D + ee * F + be * p), e[15] = 1, e; + } + }, { + key: "fromQuat", + value: function fromQuat(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = n + n, + c = s + s, + y = r + r, + L = n * i, + k = s * i, + l = s * c, + M = r * i, + h = r * c, + b = r * y, + d = a * i, + m = a * c, + o = a * y; + return e[0] = 1 - l - b, e[1] = k + o, e[2] = M - m, e[3] = 0, e[4] = k - o, e[5] = 1 - L - b, e[6] = h + d, e[7] = 0, e[8] = M + m, e[9] = h - d, e[10] = 1 - L - l, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e; + } + }, { + key: "frustumNO", + value: function frustumNO(e, t, n, s, r, a) { + var i = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 1 / 0; + var c = 1 / (n - t), + y = 1 / (r - s); + if (e[0] = a * 2 * c, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = a * 2 * y, e[6] = 0, e[7] = 0, e[8] = (n + t) * c, e[9] = (r + s) * y, e[11] = -1, e[12] = 0, e[13] = 0, e[15] = 0, i != null && i !== 1 / 0) { + var L = 1 / (a - i); + e[10] = (i + a) * L, e[14] = 2 * i * a * L; + } else e[10] = -1, e[14] = -2 * a; + return e; + } + }, { + key: "frustum", + value: function frustum(e, t, n, s, r, a) { + return e; + } + }, { + key: "frustumZO", + value: function frustumZO(e, t, n, s, r, a) { + var i = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 1 / 0; + var c = 1 / (n - t), + y = 1 / (r - s); + if (e[0] = a * 2 * c, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = a * 2 * y, e[6] = 0, e[7] = 0, e[8] = (n + t) * c, e[9] = (r + s) * y, e[11] = -1, e[12] = 0, e[13] = 0, e[15] = 0, i != null && i !== 1 / 0) { + var L = 1 / (a - i); + e[10] = i * L, e[14] = i * a * L; + } else e[10] = -1, e[14] = -a; + return e; + } + }, { + key: "perspectiveNO", + value: function perspectiveNO(e, t, n, s) { + var r = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1 / 0; + var a = 1 / Math.tan(t / 2); + if (e[0] = a / n, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = a, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[11] = -1, e[12] = 0, e[13] = 0, e[15] = 0, r != null && r !== 1 / 0) { + var i = 1 / (s - r); + e[10] = (r + s) * i, e[14] = 2 * r * s * i; + } else e[10] = -1, e[14] = -2 * s; + return e; + } + }, { + key: "perspective", + value: function perspective(e, t, n, s) { + return e; + } + }, { + key: "perspectiveZO", + value: function perspectiveZO(e, t, n, s) { + var r = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1 / 0; + var a = 1 / Math.tan(t / 2); + if (e[0] = a / n, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = a, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[11] = -1, e[12] = 0, e[13] = 0, e[15] = 0, r != null && r !== 1 / 0) { + var i = 1 / (s - r); + e[10] = r * i, e[14] = r * s * i; + } else e[10] = -1, e[14] = -s; + return e; + } + }, { + key: "perspectiveFromFieldOfView", + value: function perspectiveFromFieldOfView(e, t, n, s) { + var r = Math.tan(t.upDegrees * Math.PI / 180), + a = Math.tan(t.downDegrees * Math.PI / 180), + i = Math.tan(t.leftDegrees * Math.PI / 180), + c = Math.tan(t.rightDegrees * Math.PI / 180), + y = 2 / (i + c), + L = 2 / (r + a); + return e[0] = y, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = L, e[6] = 0, e[7] = 0, e[8] = -((i - c) * y * .5), e[9] = (r - a) * L * .5, e[10] = s / (n - s), e[11] = -1, e[12] = 0, e[13] = 0, e[14] = s * n / (n - s), e[15] = 0, e; + } + }, { + key: "orthoNO", + value: function orthoNO(e, t, n, s, r, a, i) { + var c = 1 / (t - n), + y = 1 / (s - r), + L = 1 / (a - i); + return e[0] = -2 * c, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = -2 * y, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = 2 * L, e[11] = 0, e[12] = (t + n) * c, e[13] = (r + s) * y, e[14] = (i + a) * L, e[15] = 1, e; + } + }, { + key: "ortho", + value: function ortho(e, t, n, s, r, a, i) { + return e; + } + }, { + key: "orthoZO", + value: function orthoZO(e, t, n, s, r, a, i) { + var c = 1 / (t - n), + y = 1 / (s - r), + L = 1 / (a - i); + return e[0] = -2 * c, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = -2 * y, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = L, e[11] = 0, e[12] = (t + n) * c, e[13] = (r + s) * y, e[14] = a * L, e[15] = 1, e; + } + }, { + key: "lookAt", + value: function lookAt(e, t, n, s) { + var r = t[0], + a = t[1], + i = t[2], + c = s[0], + y = s[1], + L = s[2], + k = n[0], + l = n[1], + M = n[2]; + if (Math.abs(r - k) < 1e-6 && Math.abs(a - l) < 1e-6 && Math.abs(i - M) < 1e-6) return S.identity(e); + var h = r - k, + b = a - l, + d = i - M, + m = 1 / Math.sqrt(h * h + b * b + d * d); + h *= m, b *= m, d *= m; + var o = y * d - L * b, + V = L * h - c * d, + x = c * b - y * h; + m = Math.sqrt(o * o + V * V + x * x), m ? (m = 1 / m, o *= m, V *= m, x *= m) : (o = 0, V = 0, x = 0); + var R = b * x - d * V, + z = d * o - h * x, + g = h * V - b * o; + return m = Math.sqrt(R * R + z * z + g * g), m ? (m = 1 / m, R *= m, z *= m, g *= m) : (R = 0, z = 0, g = 0), e[0] = o, e[1] = R, e[2] = h, e[3] = 0, e[4] = V, e[5] = z, e[6] = b, e[7] = 0, e[8] = x, e[9] = g, e[10] = d, e[11] = 0, e[12] = -(o * r + V * a + x * i), e[13] = -(R * r + z * a + g * i), e[14] = -(h * r + b * a + d * i), e[15] = 1, e; + } + }, { + key: "targetTo", + value: function targetTo(e, t, n, s) { + var r = t[0], + a = t[1], + i = t[2], + c = s[0], + y = s[1], + L = s[2], + k = r - n[0], + l = a - n[1], + M = i - n[2], + h = k * k + l * l + M * M; + h > 0 && (h = 1 / Math.sqrt(h), k *= h, l *= h, M *= h); + var b = y * M - L * l, + d = L * k - c * M, + m = c * l - y * k; + return h = b * b + d * d + m * m, h > 0 && (h = 1 / Math.sqrt(h), b *= h, d *= h, m *= h), e[0] = b, e[1] = d, e[2] = m, e[3] = 0, e[4] = l * m - M * d, e[5] = M * b - k * m, e[6] = k * d - l * b, e[7] = 0, e[8] = k, e[9] = l, e[10] = M, e[11] = 0, e[12] = r, e[13] = a, e[14] = i, e[15] = 1, e; + } + }, { + key: "frob", + value: function frob(e) { + return Math.sqrt(e[0] * e[0] + e[1] * e[1] + e[2] * e[2] + e[3] * e[3] + e[4] * e[4] + e[5] * e[5] + e[6] * e[6] + e[7] * e[7] + e[8] * e[8] + e[9] * e[9] + e[10] * e[10] + e[11] * e[11] + e[12] * e[12] + e[13] * e[13] + e[14] * e[14] + e[15] * e[15]); + } + }, { + key: "add", + value: function add(e, t, n) { + return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e[2] = t[2] + n[2], e[3] = t[3] + n[3], e[4] = t[4] + n[4], e[5] = t[5] + n[5], e[6] = t[6] + n[6], e[7] = t[7] + n[7], e[8] = t[8] + n[8], e[9] = t[9] + n[9], e[10] = t[10] + n[10], e[11] = t[11] + n[11], e[12] = t[12] + n[12], e[13] = t[13] + n[13], e[14] = t[14] + n[14], e[15] = t[15] + n[15], e; + } + }, { + key: "subtract", + value: function subtract(e, t, n) { + return e[0] = t[0] - n[0], e[1] = t[1] - n[1], e[2] = t[2] - n[2], e[3] = t[3] - n[3], e[4] = t[4] - n[4], e[5] = t[5] - n[5], e[6] = t[6] - n[6], e[7] = t[7] - n[7], e[8] = t[8] - n[8], e[9] = t[9] - n[9], e[10] = t[10] - n[10], e[11] = t[11] - n[11], e[12] = t[12] - n[12], e[13] = t[13] - n[13], e[14] = t[14] - n[14], e[15] = t[15] - n[15], e; + } + }, { + key: "sub", + value: function sub(e, t, n) { + return e; + } + }, { + key: "multiplyScalar", + value: function multiplyScalar(e, t, n) { + return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e[3] = t[3] * n, e[4] = t[4] * n, e[5] = t[5] * n, e[6] = t[6] * n, e[7] = t[7] * n, e[8] = t[8] * n, e[9] = t[9] * n, e[10] = t[10] * n, e[11] = t[11] * n, e[12] = t[12] * n, e[13] = t[13] * n, e[14] = t[14] * n, e[15] = t[15] * n, e; + } + }, { + key: "multiplyScalarAndAdd", + value: function multiplyScalarAndAdd(e, t, n, s) { + return e[0] = t[0] + n[0] * s, e[1] = t[1] + n[1] * s, e[2] = t[2] + n[2] * s, e[3] = t[3] + n[3] * s, e[4] = t[4] + n[4] * s, e[5] = t[5] + n[5] * s, e[6] = t[6] + n[6] * s, e[7] = t[7] + n[7] * s, e[8] = t[8] + n[8] * s, e[9] = t[9] + n[9] * s, e[10] = t[10] + n[10] * s, e[11] = t[11] + n[11] * s, e[12] = t[12] + n[12] * s, e[13] = t[13] + n[13] * s, e[14] = t[14] + n[14] * s, e[15] = t[15] + n[15] * s, e; + } + }, { + key: "exactEquals", + value: function exactEquals(e, t) { + 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]; + } + }, { + key: "equals", + value: function equals(e, t) { + var n = e[0], + s = e[1], + r = e[2], + a = e[3], + i = e[4], + c = e[5], + y = e[6], + L = e[7], + k = e[8], + l = e[9], + M = e[10], + h = e[11], + b = e[12], + d = e[13], + m = e[14], + o = e[15], + V = t[0], + x = t[1], + R = t[2], + z = t[3], + g = t[4], + B = t[5], + D = t[6], + F = t[7], + p = t[8], + Y = t[9], + I = t[10], + P = t[11], + Q = t[12], + K = t[13], + ee = t[14], + te = t[15]; + return Math.abs(n - V) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(V)) && Math.abs(s - x) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(x)) && Math.abs(r - R) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(R)) && Math.abs(a - z) <= 1e-6 * Math.max(1, Math.abs(a), Math.abs(z)) && Math.abs(i - g) <= 1e-6 * Math.max(1, Math.abs(i), Math.abs(g)) && Math.abs(c - B) <= 1e-6 * Math.max(1, Math.abs(c), Math.abs(B)) && Math.abs(y - D) <= 1e-6 * Math.max(1, Math.abs(y), Math.abs(D)) && Math.abs(L - F) <= 1e-6 * Math.max(1, Math.abs(L), Math.abs(F)) && Math.abs(k - p) <= 1e-6 * Math.max(1, Math.abs(k), Math.abs(p)) && Math.abs(l - Y) <= 1e-6 * Math.max(1, Math.abs(l), Math.abs(Y)) && Math.abs(M - I) <= 1e-6 * Math.max(1, Math.abs(M), Math.abs(I)) && Math.abs(h - P) <= 1e-6 * Math.max(1, Math.abs(h), Math.abs(P)) && Math.abs(b - Q) <= 1e-6 * Math.max(1, Math.abs(b), Math.abs(Q)) && Math.abs(d - K) <= 1e-6 * Math.max(1, Math.abs(d), Math.abs(K)) && Math.abs(m - ee) <= 1e-6 * Math.max(1, Math.abs(m), Math.abs(ee)) && Math.abs(o - te) <= 1e-6 * Math.max(1, Math.abs(o), Math.abs(te)); + } + }, { + key: "str", + value: function str(e) { + return "Mat4(".concat(e.join(", "), ")"); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float64Array)); + ae = new WeakMap(), $ = new WeakMap(), Z(S, ae, new Float64Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])), Z(S, $, new Float64Array(3)); + var G = S; + G.prototype.mul = G.prototype.multiply; + G.sub = G.subtract; + G.mul = G.multiply; + G.frustum = G.frustumNO; + G.perspective = G.perspectiveNO; + G.ortho = G.orthoNO; + var T = /*#__PURE__*/function (_Float64Array5) { + function A() { + var _this5; + _classCallCheck(this, A); + for (var _len9 = arguments.length, e = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) { + e[_key9] = arguments[_key9]; + } + switch (e.length) { + case 3: + _this5 = _callSuper(this, A, [e]); + break; + case 2: + _this5 = _callSuper(this, A, [e[0], e[1], 3]); + break; + case 1: + { + var t = e[0]; + typeof t == "number" ? _this5 = _callSuper(this, A, [[t, t, t]]) : _this5 = _callSuper(this, A, [t, 0, 3]); + break; + } + default: + _this5 = _callSuper(this, A, [3]); + break; + } + return _assertThisInitialized(_this5); + } + _inherits(A, _Float64Array5); + return _createClass(A, [{ + key: "x", + get: function get() { + return this[0]; + }, + set: function set(e) { + this[0] = e; + } + }, { + key: "y", + get: function get() { + return this[1]; + }, + set: function set(e) { + this[1] = e; + } + }, { + key: "z", + get: function get() { + return this[2]; + }, + set: function set(e) { + this[2] = e; + } + }, { + key: "r", + get: function get() { + return this[0]; + }, + set: function set(e) { + this[0] = e; + } + }, { + key: "g", + get: function get() { + return this[1]; + }, + set: function set(e) { + this[1] = e; + } + }, { + key: "b", + get: function get() { + return this[2]; + }, + set: function set(e) { + this[2] = e; + } + }, { + key: "magnitude", + get: function get() { + var e = this[0], + t = this[1], + n = this[2]; + return Math.sqrt(e * e + t * t + n * n); + } + }, { + key: "mag", + get: function get() { + return this.magnitude; + } + }, { + key: "squaredMagnitude", + get: function get() { + var e = this[0], + t = this[1], + n = this[2]; + return e * e + t * t + n * n; + } + }, { + key: "sqrMag", + get: function get() { + return this.squaredMagnitude; + } + }, { + key: "str", + get: function get() { + return A.str(this); + } + }, { + key: "copy", + value: function copy(e) { + return this.set(e), this; + } + }, { + key: "add", + value: function add(e) { + return this[0] += e[0], this[1] += e[1], this[2] += e[2], this; + } + }, { + key: "subtract", + value: function subtract(e) { + return this[0] -= e[0], this[1] -= e[1], this[2] -= e[2], this; + } + }, { + key: "sub", + value: function sub(e) { + return this; + } + }, { + key: "multiply", + value: function multiply(e) { + return this[0] *= e[0], this[1] *= e[1], this[2] *= e[2], this; + } + }, { + key: "mul", + value: function mul(e) { + return this; + } + }, { + key: "divide", + value: function divide(e) { + return this[0] /= e[0], this[1] /= e[1], this[2] /= e[2], this; + } + }, { + key: "div", + value: function div(e) { + return this; + } + }, { + key: "scale", + value: function scale(e) { + return this[0] *= e, this[1] *= e, this[2] *= e, this; + } + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(e, t) { + return this[0] += e[0] * t, this[1] += e[1] * t, this[2] += e[2] * t, this; + } + }, { + key: "distance", + value: function distance(e) { + return A.distance(this, e); + } + }, { + key: "dist", + value: function dist(e) { + return 0; + } + }, { + key: "squaredDistance", + value: function squaredDistance(e) { + return A.squaredDistance(this, e); + } + }, { + key: "sqrDist", + value: function sqrDist(e) { + return 0; + } + }, { + key: "negate", + value: function negate() { + return this[0] *= -1, this[1] *= -1, this[2] *= -1, this; + } + }, { + key: "invert", + value: function invert() { + return this[0] = 1 / this[0], this[1] = 1 / this[1], this[2] = 1 / this[2], this; + } + }, { + key: "abs", + value: function abs() { + return this[0] = Math.abs(this[0]), this[1] = Math.abs(this[1]), this[2] = Math.abs(this[2]), this; + } + }, { + key: "dot", + value: function dot(e) { + return this[0] * e[0] + this[1] * e[1] + this[2] * e[2]; + } + }, { + key: "normalize", + value: function normalize() { + return A.normalize(this, this); + } + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 3 * Float64Array.BYTES_PER_ELEMENT; + } + }, { + key: "create", + value: function create() { + return new A(); + } + }, { + key: "clone", + value: function clone(e) { + return new A(e); + } + }, { + key: "magnitude", + value: function magnitude(e) { + var t = e[0], + n = e[1], + s = e[2]; + return Math.sqrt(t * t + n * n + s * s); + } + }, { + key: "mag", + value: function mag(e) { + return 0; + } + }, { + key: "length", + value: function length(e) { + return 0; + } + }, { + key: "len", + value: function len(e) { + return 0; + } + }, { + key: "fromValues", + value: function fromValues(e, t, n) { + return new A(e, t, n); + } + }, { + key: "copy", + value: function copy(e, t) { + return e[0] = t[0], e[1] = t[1], e[2] = t[2], e; + } + }, { + key: "set", + value: function set(e, t, n, s) { + return e[0] = t, e[1] = n, e[2] = s, e; + } + }, { + key: "add", + value: function add(e, t, n) { + return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e[2] = t[2] + n[2], e; + } + }, { + key: "subtract", + value: function subtract(e, t, n) { + return e[0] = t[0] - n[0], e[1] = t[1] - n[1], e[2] = t[2] - n[2], e; + } + }, { + key: "sub", + value: function sub(e, t, n) { + return [0, 0, 0]; + } + }, { + key: "multiply", + value: function multiply(e, t, n) { + return e[0] = t[0] * n[0], e[1] = t[1] * n[1], e[2] = t[2] * n[2], e; + } + }, { + key: "mul", + value: function mul(e, t, n) { + return [0, 0, 0]; + } + }, { + key: "divide", + value: function divide(e, t, n) { + return e[0] = t[0] / n[0], e[1] = t[1] / n[1], e[2] = t[2] / n[2], e; + } + }, { + key: "div", + value: function div(e, t, n) { + return [0, 0, 0]; + } + }, { + key: "ceil", + value: function ceil(e, t) { + return e[0] = Math.ceil(t[0]), e[1] = Math.ceil(t[1]), e[2] = Math.ceil(t[2]), e; + } + }, { + key: "floor", + value: function floor(e, t) { + return e[0] = Math.floor(t[0]), e[1] = Math.floor(t[1]), e[2] = Math.floor(t[2]), e; + } + }, { + key: "min", + value: function min(e, t, n) { + return e[0] = Math.min(t[0], n[0]), e[1] = Math.min(t[1], n[1]), e[2] = Math.min(t[2], n[2]), e; + } + }, { + key: "max", + value: function max(e, t, n) { + return e[0] = Math.max(t[0], n[0]), e[1] = Math.max(t[1], n[1]), e[2] = Math.max(t[2], n[2]), e; + } + }, { + key: "scale", + value: function scale(e, t, n) { + return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e; + } + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(e, t, n, s) { + return e[0] = t[0] + n[0] * s, e[1] = t[1] + n[1] * s, e[2] = t[2] + n[2] * s, e; + } + }, { + key: "distance", + value: function distance(e, t) { + var n = t[0] - e[0], + s = t[1] - e[1], + r = t[2] - e[2]; + return Math.sqrt(n * n + s * s + r * r); + } + }, { + key: "dist", + value: function dist(e, t) { + return 0; + } + }, { + key: "squaredDistance", + value: function squaredDistance(e, t) { + var n = t[0] - e[0], + s = t[1] - e[1], + r = t[2] - e[2]; + return n * n + s * s + r * r; + } + }, { + key: "sqrDist", + value: function sqrDist(e, t) { + return 0; + } + }, { + key: "squaredLength", + value: function squaredLength(e) { + var t = e[0], + n = e[1], + s = e[2]; + return t * t + n * n + s * s; + } + }, { + key: "sqrLen", + value: function sqrLen(e, t) { + return 0; + } + }, { + key: "negate", + value: function negate(e, t) { + return e[0] = -t[0], e[1] = -t[1], e[2] = -t[2], e; + } + }, { + key: "inverse", + value: function inverse(e, t) { + return e[0] = 1 / t[0], e[1] = 1 / t[1], e[2] = 1 / t[2], e; + } + }, { + key: "abs", + value: function abs(e, t) { + return e[0] = Math.abs(t[0]), e[1] = Math.abs(t[1]), e[2] = Math.abs(t[2]), e; + } + }, { + key: "normalize", + value: function normalize(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = n * n + s * s + r * r; + return a > 0 && (a = 1 / Math.sqrt(a)), e[0] = t[0] * a, e[1] = t[1] * a, e[2] = t[2] * a, e; + } + }, { + key: "dot", + value: function dot(e, t) { + return e[0] * t[0] + e[1] * t[1] + e[2] * t[2]; + } + }, { + key: "cross", + value: function cross(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = n[0], + c = n[1], + y = n[2]; + return e[0] = r * y - a * c, e[1] = a * i - s * y, e[2] = s * c - r * i, e; + } + }, { + key: "lerp", + value: function lerp(e, t, n, s) { + var r = t[0], + a = t[1], + i = t[2]; + return e[0] = r + s * (n[0] - r), e[1] = a + s * (n[1] - a), e[2] = i + s * (n[2] - i), e; + } + }, { + key: "slerp", + value: function slerp(e, t, n, s) { + var r = Math.acos(Math.min(Math.max(A.dot(t, n), -1), 1)), + a = Math.sin(r), + i = Math.sin((1 - s) * r) / a, + c = Math.sin(s * r) / a; + return e[0] = i * t[0] + c * n[0], e[1] = i * t[1] + c * n[1], e[2] = i * t[2] + c * n[2], e; + } + }, { + key: "hermite", + value: function hermite(e, t, n, s, r, a) { + var i = a * a, + c = i * (2 * a - 3) + 1, + y = i * (a - 2) + a, + L = i * (a - 1), + k = i * (3 - 2 * a); + return e[0] = t[0] * c + n[0] * y + s[0] * L + r[0] * k, e[1] = t[1] * c + n[1] * y + s[1] * L + r[1] * k, e[2] = t[2] * c + n[2] * y + s[2] * L + r[2] * k, e; + } + }, { + key: "bezier", + value: function bezier(e, t, n, s, r, a) { + var i = 1 - a, + c = i * i, + y = a * a, + L = c * i, + k = 3 * a * c, + l = 3 * y * i, + M = y * a; + return e[0] = t[0] * L + n[0] * k + s[0] * l + r[0] * M, e[1] = t[1] * L + n[1] * k + s[1] * l + r[1] * M, e[2] = t[2] * L + n[2] * k + s[2] * l + r[2] * M, e; + } + }, { + key: "transformMat4", + value: function transformMat4(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = n[3] * s + n[7] * r + n[11] * a + n[15] || 1; + return e[0] = (n[0] * s + n[4] * r + n[8] * a + n[12]) / i, e[1] = (n[1] * s + n[5] * r + n[9] * a + n[13]) / i, e[2] = (n[2] * s + n[6] * r + n[10] * a + n[14]) / i, e; + } + }, { + key: "transformMat3", + value: function transformMat3(e, t, n) { + var s = t[0], + r = t[1], + a = t[2]; + return e[0] = s * n[0] + r * n[3] + a * n[6], e[1] = s * n[1] + r * n[4] + a * n[7], e[2] = s * n[2] + r * n[5] + a * n[8], e; + } + }, { + key: "transformQuat", + value: function transformQuat(e, t, n) { + var s = n[0], + r = n[1], + a = n[2], + i = n[3] * 2, + c = t[0], + y = t[1], + L = t[2], + k = r * L - a * y, + l = a * c - s * L, + M = s * y - r * c, + h = (r * M - a * l) * 2, + b = (a * k - s * M) * 2, + d = (s * l - r * k) * 2; + return e[0] = c + k * i + h, e[1] = y + l * i + b, e[2] = L + M * i + d, e; + } + }, { + key: "rotateX", + value: function rotateX(e, t, n, s) { + var r = n[1], + a = n[2], + i = t[1] - r, + c = t[2] - a; + return e[0] = t[0], e[1] = i * Math.cos(s) - c * Math.sin(s) + r, e[2] = i * Math.sin(s) + c * Math.cos(s) + a, e; + } + }, { + key: "rotateY", + value: function rotateY(e, t, n, s) { + var r = n[0], + a = n[2], + i = t[0] - r, + c = t[2] - a; + return e[0] = c * Math.sin(s) + i * Math.cos(s) + r, e[1] = t[1], e[2] = c * Math.cos(s) - i * Math.sin(s) + a, e; + } + }, { + key: "rotateZ", + value: function rotateZ(e, t, n, s) { + var r = n[0], + a = n[1], + i = t[0] - r, + c = t[1] - a; + return e[0] = i * Math.cos(s) - c * Math.sin(s) + r, e[1] = i * Math.sin(s) + c * Math.cos(s) + a, e[2] = n[2], e; + } + }, { + key: "angle", + value: function angle(e, t) { + var n = e[0], + s = e[1], + r = e[2], + a = t[0], + i = t[1], + c = t[2], + y = Math.sqrt((n * n + s * s + r * r) * (a * a + i * i + c * c)), + L = y && A.dot(e, t) / y; + return Math.acos(Math.min(Math.max(L, -1), 1)); + } + }, { + key: "zero", + value: function zero(e) { + return e[0] = 0, e[1] = 0, e[2] = 0, e; + } + }, { + key: "str", + value: function str(e) { + return "Vec3(".concat(e.join(", "), ")"); + } + }, { + key: "exactEquals", + value: function exactEquals(e, t) { + return e[0] === t[0] && e[1] === t[1] && e[2] === t[2]; + } + }, { + key: "equals", + value: function equals(e, t) { + var n = e[0], + s = e[1], + r = e[2], + a = t[0], + i = t[1], + c = t[2]; + return Math.abs(n - a) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(a)) && Math.abs(s - i) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(i)) && Math.abs(r - c) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(c)); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float64Array)); + T.prototype.sub = T.prototype.subtract; + T.prototype.mul = T.prototype.multiply; + T.prototype.div = T.prototype.divide; + T.prototype.dist = T.prototype.distance; + T.prototype.sqrDist = T.prototype.squaredDistance; + T.sub = T.subtract; + T.mul = T.multiply; + T.div = T.divide; + T.dist = T.distance; + T.sqrDist = T.squaredDistance; + T.sqrLen = T.squaredLength; + T.mag = T.magnitude; + T.length = T.magnitude; + T.len = T.magnitude; + var q = /*#__PURE__*/function (_Float64Array6) { + function A() { + var _this6; + _classCallCheck(this, A); + for (var _len10 = arguments.length, e = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) { + e[_key10] = arguments[_key10]; + } + switch (e.length) { + case 4: + _this6 = _callSuper(this, A, [e]); + break; + case 2: + _this6 = _callSuper(this, A, [e[0], e[1], 4]); + break; + case 1: + { + var t = e[0]; + typeof t == "number" ? _this6 = _callSuper(this, A, [[t, t, t, t]]) : _this6 = _callSuper(this, A, [t, 0, 4]); + break; + } + default: + _this6 = _callSuper(this, A, [4]); + break; + } + return _assertThisInitialized(_this6); + } + _inherits(A, _Float64Array6); + return _createClass(A, [{ + key: "x", + get: function get() { + return this[0]; + }, + set: function set(e) { + this[0] = e; + } + }, { + key: "y", + get: function get() { + return this[1]; + }, + set: function set(e) { + this[1] = e; + } + }, { + key: "z", + get: function get() { + return this[2]; + }, + set: function set(e) { + this[2] = e; + } + }, { + key: "w", + get: function get() { + return this[3]; + }, + set: function set(e) { + this[3] = e; + } + }, { + key: "r", + get: function get() { + return this[0]; + }, + set: function set(e) { + this[0] = e; + } + }, { + key: "g", + get: function get() { + return this[1]; + }, + set: function set(e) { + this[1] = e; + } + }, { + key: "b", + get: function get() { + return this[2]; + }, + set: function set(e) { + this[2] = e; + } + }, { + key: "a", + get: function get() { + return this[3]; + }, + set: function set(e) { + this[3] = e; + } + }, { + key: "magnitude", + get: function get() { + var e = this[0], + t = this[1], + n = this[2], + s = this[3]; + return Math.sqrt(e * e + t * t + n * n + s * s); + } + }, { + key: "mag", + get: function get() { + return this.magnitude; + } + }, { + key: "str", + get: function get() { + return A.str(this); + } + }, { + key: "copy", + value: function copy(e) { + return _superPropGet(A, "set", this)([e]), this; + } + }, { + key: "add", + value: function add(e) { + return this[0] += e[0], this[1] += e[1], this[2] += e[2], this[3] += e[3], this; + } + }, { + key: "subtract", + value: function subtract(e) { + return this[0] -= e[0], this[1] -= e[1], this[2] -= e[2], this[3] -= e[3], this; + } + }, { + key: "sub", + value: function sub(e) { + return this; + } + }, { + key: "multiply", + value: function multiply(e) { + return this[0] *= e[0], this[1] *= e[1], this[2] *= e[2], this[3] *= e[3], this; + } + }, { + key: "mul", + value: function mul(e) { + return this; + } + }, { + key: "divide", + value: function divide(e) { + return this[0] /= e[0], this[1] /= e[1], this[2] /= e[2], this[3] /= e[3], this; + } + }, { + key: "div", + value: function div(e) { + return this; + } + }, { + key: "scale", + value: function scale(e) { + return this[0] *= e, this[1] *= e, this[2] *= e, this[3] *= e, this; + } + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(e, t) { + return this[0] += e[0] * t, this[1] += e[1] * t, this[2] += e[2] * t, this[3] += e[3] * t, this; + } + }, { + key: "distance", + value: function distance(e) { + return A.distance(this, e); + } + }, { + key: "dist", + value: function dist(e) { + return 0; + } + }, { + key: "squaredDistance", + value: function squaredDistance(e) { + return A.squaredDistance(this, e); + } + }, { + key: "sqrDist", + value: function sqrDist(e) { + return 0; + } + }, { + key: "negate", + value: function negate() { + return this[0] *= -1, this[1] *= -1, this[2] *= -1, this[3] *= -1, this; + } + }, { + key: "invert", + value: function invert() { + return this[0] = 1 / this[0], this[1] = 1 / this[1], this[2] = 1 / this[2], this[3] = 1 / this[3], this; + } + }, { + key: "abs", + value: function abs() { + return this[0] = Math.abs(this[0]), this[1] = Math.abs(this[1]), this[2] = Math.abs(this[2]), this[3] = Math.abs(this[3]), this; + } + }, { + key: "dot", + value: function dot(e) { + return this[0] * e[0] + this[1] * e[1] + this[2] * e[2] + this[3] * e[3]; + } + }, { + key: "normalize", + value: function normalize() { + return A.normalize(this, this); + } + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 4 * Float64Array.BYTES_PER_ELEMENT; + } + }, { + key: "create", + value: function create() { + return new A(); + } + }, { + key: "clone", + value: function clone(e) { + return new A(e); + } + }, { + key: "fromValues", + value: function fromValues(e, t, n, s) { + return new A(e, t, n, s); + } + }, { + key: "copy", + value: function copy(e, t) { + return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e; + } + }, { + key: "set", + value: function set(e, t, n, s, r) { + return e[0] = t, e[1] = n, e[2] = s, e[3] = r, e; + } + }, { + key: "add", + value: function add(e, t, n) { + return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e[2] = t[2] + n[2], e[3] = t[3] + n[3], e; + } + }, { + key: "subtract", + value: function subtract(e, t, n) { + return e[0] = t[0] - n[0], e[1] = t[1] - n[1], e[2] = t[2] - n[2], e[3] = t[3] - n[3], e; + } + }, { + key: "sub", + value: function sub(e, t, n) { + return e; + } + }, { + key: "multiply", + value: function multiply(e, t, n) { + return e[0] = t[0] * n[0], e[1] = t[1] * n[1], e[2] = t[2] * n[2], e[3] = t[3] * n[3], e; + } + }, { + key: "mul", + value: function mul(e, t, n) { + return e; + } + }, { + key: "divide", + value: function divide(e, t, n) { + return e[0] = t[0] / n[0], e[1] = t[1] / n[1], e[2] = t[2] / n[2], e[3] = t[3] / n[3], e; + } + }, { + key: "div", + value: function div(e, t, n) { + return e; + } + }, { + key: "ceil", + value: function ceil(e, t) { + 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; + } + }, { + key: "floor", + value: function floor(e, t) { + 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; + } + }, { + key: "min", + value: function min(e, t, n) { + return e[0] = Math.min(t[0], n[0]), e[1] = Math.min(t[1], n[1]), e[2] = Math.min(t[2], n[2]), e[3] = Math.min(t[3], n[3]), e; + } + }, { + key: "max", + value: function max(e, t, n) { + return e[0] = Math.max(t[0], n[0]), e[1] = Math.max(t[1], n[1]), e[2] = Math.max(t[2], n[2]), e[3] = Math.max(t[3], n[3]), e; + } + }, { + key: "round", + value: function round(e, t) { + 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; + } + }, { + key: "scale", + value: function scale(e, t, n) { + return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e[3] = t[3] * n, e; + } + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(e, t, n, s) { + return e[0] = t[0] + n[0] * s, e[1] = t[1] + n[1] * s, e[2] = t[2] + n[2] * s, e[3] = t[3] + n[3] * s, e; + } + }, { + key: "distance", + value: function distance(e, t) { + var n = t[0] - e[0], + s = t[1] - e[1], + r = t[2] - e[2], + a = t[3] - e[3]; + return Math.hypot(n, s, r, a); + } + }, { + key: "dist", + value: function dist(e, t) { + return 0; + } + }, { + key: "squaredDistance", + value: function squaredDistance(e, t) { + var n = t[0] - e[0], + s = t[1] - e[1], + r = t[2] - e[2], + a = t[3] - e[3]; + return n * n + s * s + r * r + a * a; + } + }, { + key: "sqrDist", + value: function sqrDist(e, t) { + return 0; + } + }, { + key: "magnitude", + value: function magnitude(e) { + var t = e[0], + n = e[1], + s = e[2], + r = e[3]; + return Math.sqrt(t * t + n * n + s * s + r * r); + } + }, { + key: "mag", + value: function mag(e) { + return 0; + } + }, { + key: "length", + value: function length(e) { + return 0; + } + }, { + key: "len", + value: function len(e) { + return 0; + } + }, { + key: "squaredLength", + value: function squaredLength(e) { + var t = e[0], + n = e[1], + s = e[2], + r = e[3]; + return t * t + n * n + s * s + r * r; + } + }, { + key: "sqrLen", + value: function sqrLen(e) { + return 0; + } + }, { + key: "negate", + value: function negate(e, t) { + return e[0] = -t[0], e[1] = -t[1], e[2] = -t[2], e[3] = -t[3], e; + } + }, { + key: "inverse", + value: function inverse(e, t) { + return e[0] = 1 / t[0], e[1] = 1 / t[1], e[2] = 1 / t[2], e[3] = 1 / t[3], e; + } + }, { + key: "abs", + value: function abs(e, t) { + return e[0] = Math.abs(t[0]), e[1] = Math.abs(t[1]), e[2] = Math.abs(t[2]), e[3] = Math.abs(t[3]), e; + } + }, { + key: "normalize", + value: function normalize(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = n * n + s * s + r * r + a * a; + return i > 0 && (i = 1 / Math.sqrt(i)), e[0] = n * i, e[1] = s * i, e[2] = r * i, e[3] = a * i, e; + } + }, { + key: "dot", + value: function dot(e, t) { + return e[0] * t[0] + e[1] * t[1] + e[2] * t[2] + e[3] * t[3]; + } + }, { + key: "cross", + value: function cross(e, t, n, s) { + var r = n[0] * s[1] - n[1] * s[0], + a = n[0] * s[2] - n[2] * s[0], + i = n[0] * s[3] - n[3] * s[0], + c = n[1] * s[2] - n[2] * s[1], + y = n[1] * s[3] - n[3] * s[1], + L = n[2] * s[3] - n[3] * s[2], + k = t[0], + l = t[1], + M = t[2], + h = t[3]; + return e[0] = l * L - M * y + h * c, e[1] = -(k * L) + M * i - h * a, e[2] = k * y - l * i + h * r, e[3] = -(k * c) + l * a - M * r, e; + } + }, { + key: "lerp", + value: function lerp(e, t, n, s) { + var r = t[0], + a = t[1], + i = t[2], + c = t[3]; + return e[0] = r + s * (n[0] - r), e[1] = a + s * (n[1] - a), e[2] = i + s * (n[2] - i), e[3] = c + s * (n[3] - c), e; + } + }, { + key: "transformMat4", + value: function transformMat4(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3]; + return e[0] = n[0] * s + n[4] * r + n[8] * a + n[12] * i, e[1] = n[1] * s + n[5] * r + n[9] * a + n[13] * i, e[2] = n[2] * s + n[6] * r + n[10] * a + n[14] * i, e[3] = n[3] * s + n[7] * r + n[11] * a + n[15] * i, e; + } + }, { + key: "transformQuat", + value: function transformQuat(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = n[0], + c = n[1], + y = n[2], + L = n[3], + k = L * s + c * a - y * r, + l = L * r + y * s - i * a, + M = L * a + i * r - c * s, + h = -i * s - c * r - y * a; + return e[0] = k * L + h * -i + l * -y - M * -c, e[1] = l * L + h * -c + M * -i - k * -y, e[2] = M * L + h * -y + k * -c - l * -i, e[3] = t[3], e; + } + }, { + key: "zero", + value: function zero(e) { + return e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 0, e; + } + }, { + key: "str", + value: function str(e) { + return "Vec4(".concat(e.join(", "), ")"); + } + }, { + key: "exactEquals", + value: function exactEquals(e, t) { + return e[0] === t[0] && e[1] === t[1] && e[2] === t[2] && e[3] === t[3]; + } + }, { + key: "equals", + value: function equals(e, t) { + var n = e[0], + s = e[1], + r = e[2], + a = e[3], + i = t[0], + c = t[1], + y = t[2], + L = t[3]; + return Math.abs(n - i) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(i)) && Math.abs(s - c) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(c)) && Math.abs(r - y) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(y)) && Math.abs(a - L) <= 1e-6 * Math.max(1, Math.abs(a), Math.abs(L)); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float64Array)); + q.prototype.sub = q.prototype.subtract; + q.prototype.mul = q.prototype.multiply; + q.prototype.div = q.prototype.divide; + q.prototype.dist = q.prototype.distance; + q.prototype.sqrDist = q.prototype.squaredDistance; + q.sub = q.subtract; + q.mul = q.multiply; + q.div = q.divide; + q.dist = q.distance; + q.sqrDist = q.squaredDistance; + q.sqrLen = q.squaredLength; + q.mag = q.magnitude; + q.length = q.magnitude; + q.len = q.magnitude; + var ke, + ie, + ce, + W, + U, + le, + he, + f = /*#__PURE__*/function (_Float64Array7) { + function f() { + var _this7; + _classCallCheck(this, f); + for (var _len11 = arguments.length, e = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) { + e[_key11] = arguments[_key11]; + } + switch (e.length) { + case 4: + _this7 = _callSuper(this, f, [e]); + break; + case 2: + _this7 = _callSuper(this, f, [e[0], e[1], 4]); + break; + case 1: + { + var t = e[0]; + typeof t == "number" ? _this7 = _callSuper(this, f, [[t, t, t, t]]) : _this7 = _callSuper(this, f, [t, 0, 4]); + break; + } + default: + _this7 = _callSuper(this, f, [4]), _this7[3] = 1; + break; + } + return _assertThisInitialized(_this7); + } + _inherits(f, _Float64Array7); + return _createClass(f, [{ + key: "x", + get: function get() { + return this[0]; + }, + set: function set(e) { + this[0] = e; + } + }, { + key: "y", + get: function get() { + return this[1]; + }, + set: function set(e) { + this[1] = e; + } + }, { + key: "z", + get: function get() { + return this[2]; + }, + set: function set(e) { + this[2] = e; + } + }, { + key: "w", + get: function get() { + return this[3]; + }, + set: function set(e) { + this[3] = e; + } + }, { + key: "magnitude", + get: function get() { + var e = this[0], + t = this[1], + n = this[2], + s = this[3]; + return Math.sqrt(e * e + t * t + n * n + s * s); + } + }, { + key: "mag", + get: function get() { + return this.magnitude; + } + }, { + key: "str", + get: function get() { + return f.str(this); + } + }, { + key: "copy", + value: function copy(e) { + return _superPropGet(f, "set", this)([e]), this; + } + }, { + key: "identity", + value: function identity() { + return this[0] = 0, this[1] = 0, this[2] = 0, this[3] = 1, this; + } + }, { + key: "multiply", + value: function multiply(e) { + return f.multiply(this, this, e); + } + }, { + key: "mul", + value: function mul(e) { + return this; + } + }, { + key: "rotateX", + value: function rotateX(e) { + return f.rotateX(this, this, e); + } + }, { + key: "rotateY", + value: function rotateY(e) { + return f.rotateY(this, this, e); + } + }, { + key: "rotateZ", + value: function rotateZ(e) { + return f.rotateZ(this, this, e); + } + }, { + key: "invert", + value: function invert() { + return f.invert(this, this); + } + }, { + key: "scale", + value: function scale(e) { + return this[0] *= e, this[1] *= e, this[2] *= e, this[3] *= e, this; + } + }, { + key: "dot", + value: function dot(e) { + return f.dot(this, e); + } + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 4 * Float64Array.BYTES_PER_ELEMENT; + } + }, { + key: "create", + value: function create() { + return new f(); + } + }, { + key: "identity", + value: function identity(e) { + return e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 1, e; + } + }, { + key: "setAxisAngle", + value: function setAxisAngle(e, t, n) { + n *= .5; + var s = Math.sin(n); + return e[0] = s * t[0], e[1] = s * t[1], e[2] = s * t[2], e[3] = Math.cos(n), e; + } + }, { + key: "getAxisAngle", + value: function getAxisAngle(e, t) { + var n = Math.acos(t[3]) * 2, + s = Math.sin(n / 2); + return s > 1e-6 ? (e[0] = t[0] / s, e[1] = t[1] / s, e[2] = t[2] / s) : (e[0] = 1, e[1] = 0, e[2] = 0), n; + } + }, { + key: "getAngle", + value: function getAngle(e, t) { + var n = f.dot(e, t); + return Math.acos(2 * n * n - 1); + } + }, { + key: "multiply", + value: function multiply(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = n[0], + y = n[1], + L = n[2], + k = n[3]; + return e[0] = s * k + i * c + r * L - a * y, e[1] = r * k + i * y + a * c - s * L, e[2] = a * k + i * L + s * y - r * c, e[3] = i * k - s * c - r * y - a * L, e; + } + }, { + key: "rotateX", + value: function rotateX(e, t, n) { + n *= .5; + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = Math.sin(n), + y = Math.cos(n); + return e[0] = s * y + i * c, e[1] = r * y + a * c, e[2] = a * y - r * c, e[3] = i * y - s * c, e; + } + }, { + key: "rotateY", + value: function rotateY(e, t, n) { + n *= .5; + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = Math.sin(n), + y = Math.cos(n); + return e[0] = s * y - a * c, e[1] = r * y + i * c, e[2] = a * y + s * c, e[3] = i * y - r * c, e; + } + }, { + key: "rotateZ", + value: function rotateZ(e, t, n) { + n *= .5; + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = Math.sin(n), + y = Math.cos(n); + return e[0] = s * y + r * c, e[1] = r * y - s * c, e[2] = a * y + i * c, e[3] = i * y - a * c, e; + } + }, { + key: "calculateW", + value: function calculateW(e, t) { + var n = t[0], + s = t[1], + r = t[2]; + return e[0] = n, e[1] = s, e[2] = r, e[3] = Math.sqrt(Math.abs(1 - n * n - s * s - r * r)), e; + } + }, { + key: "exp", + value: function exp(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = Math.sqrt(n * n + s * s + r * r), + c = Math.exp(a), + y = i > 0 ? c * Math.sin(i) / i : 0; + return e[0] = n * y, e[1] = s * y, e[2] = r * y, e[3] = c * Math.cos(i), e; + } + }, { + key: "ln", + value: function ln(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = Math.sqrt(n * n + s * s + r * r), + c = i > 0 ? Math.atan2(i, a) / i : 0; + return e[0] = n * c, e[1] = s * c, e[2] = r * c, e[3] = .5 * Math.log(n * n + s * s + r * r + a * a), e; + } + }, { + key: "pow", + value: function pow(e, t, n) { + return f.ln(e, t), f.scale(e, e, n), f.exp(e, e), e; + } + }, { + key: "slerp", + value: function slerp(e, t, n, s) { + var r = t[0], + a = t[1], + i = t[2], + c = t[3], + y = n[0], + L = n[1], + k = n[2], + l = n[3], + M, + h, + b = r * y + a * L + i * k + c * l; + if (b < 0 && (b = -b, y = -y, L = -L, k = -k, l = -l), 1 - b > 1e-6) { + var d = Math.acos(b), + m = Math.sin(d); + M = Math.sin((1 - s) * d) / m, h = Math.sin(s * d) / m; + } else M = 1 - s, h = s; + return e[0] = M * r + h * y, e[1] = M * a + h * L, e[2] = M * i + h * k, e[3] = M * c + h * l, e; + } + }, { + key: "invert", + value: function invert(e, t) { + var n = t[0], + s = t[1], + r = t[2], + a = t[3], + i = n * n + s * s + r * r + a * a, + c = i ? 1 / i : 0; + return e[0] = -n * c, e[1] = -s * c, e[2] = -r * c, e[3] = a * c, e; + } + }, { + key: "conjugate", + value: function conjugate(e, t) { + return e[0] = -t[0], e[1] = -t[1], e[2] = -t[2], e[3] = t[3], e; + } + }, { + key: "fromMat3", + value: function fromMat3(e, t) { + var n = t[0] + t[4] + t[8], + s; + if (n > 0) s = Math.sqrt(n + 1), e[3] = .5 * s, s = .5 / s, e[0] = (t[5] - t[7]) * s, e[1] = (t[6] - t[2]) * s, e[2] = (t[1] - t[3]) * s;else { + var r = 0; + t[4] > t[0] && (r = 1), t[8] > t[r * 3 + r] && (r = 2); + var a = (r + 1) % 3, + i = (r + 2) % 3; + s = Math.sqrt(t[r * 3 + r] - t[a * 3 + a] - t[i * 3 + i] + 1), e[r] = .5 * s, s = .5 / s, e[3] = (t[a * 3 + i] - t[i * 3 + a]) * s, e[a] = (t[a * 3 + r] + t[r * 3 + a]) * s, e[i] = (t[i * 3 + r] + t[r * 3 + i]) * s; + } + return e; + } + }, { + key: "fromEuler", + value: function fromEuler(e, t, n, s) { + var r = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : E(f, ke); + var a = .5 * Math.PI / 180; + t *= a, n *= a, s *= a; + var i = Math.sin(t), + c = Math.cos(t), + y = Math.sin(n), + L = Math.cos(n), + k = Math.sin(s), + l = Math.cos(s); + switch (r) { + case "xyz": + e[0] = i * L * l + c * y * k, e[1] = c * y * l - i * L * k, e[2] = c * L * k + i * y * l, e[3] = c * L * l - i * y * k; + break; + case "xzy": + e[0] = i * L * l - c * y * k, e[1] = c * y * l - i * L * k, e[2] = c * L * k + i * y * l, e[3] = c * L * l + i * y * k; + break; + case "yxz": + e[0] = i * L * l + c * y * k, e[1] = c * y * l - i * L * k, e[2] = c * L * k - i * y * l, e[3] = c * L * l + i * y * k; + break; + case "yzx": + e[0] = i * L * l + c * y * k, e[1] = c * y * l + i * L * k, e[2] = c * L * k - i * y * l, e[3] = c * L * l - i * y * k; + break; + case "zxy": + e[0] = i * L * l - c * y * k, e[1] = c * y * l + i * L * k, e[2] = c * L * k + i * y * l, e[3] = c * L * l - i * y * k; + break; + case "zyx": + e[0] = i * L * l - c * y * k, e[1] = c * y * l + i * L * k, e[2] = c * L * k - i * y * l, e[3] = c * L * l + i * y * k; + break; + default: + throw new Error("Unknown angle order ".concat(r)); + } + return e; + } + }, { + key: "str", + value: function str(e) { + return "Quat(".concat(e.join(", "), ")"); + } + }, { + key: "clone", + value: function clone(e) { + return new f(e); + } + }, { + key: "fromValues", + value: function fromValues(e, t, n, s) { + return new f(e, t, n, s); + } + }, { + key: "copy", + value: function copy(e, t) { + return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e; + } + }, { + key: "set", + value: function set(e, t, n, s, r) { + return e; + } + }, { + key: "add", + value: function add(e, t, n) { + return e; + } + }, { + key: "mul", + value: function mul(e, t, n) { + return e; + } + }, { + key: "scale", + value: function scale(e, t, n) { + return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e[3] = t[3] * n, e; + } + }, { + key: "dot", + value: function dot(e, t) { + return e[0] * t[0] + e[1] * t[1] + e[2] * t[2] + e[3] * t[3]; + } + }, { + key: "lerp", + value: function lerp(e, t, n, s) { + return e; + } + }, { + key: "magnitude", + value: function magnitude(e) { + return 0; + } + }, { + key: "mag", + value: function mag(e) { + return 0; + } + }, { + key: "length", + value: function length(e) { + return 0; + } + }, { + key: "len", + value: function len(e) { + return 0; + } + }, { + key: "squaredLength", + value: function squaredLength(e) { + return 0; + } + }, { + key: "sqrLen", + value: function sqrLen(e) { + return 0; + } + }, { + key: "normalize", + value: function normalize(e, t) { + return e; + } + }, { + key: "exactEquals", + value: function exactEquals(e, t) { + return !1; + } + }, { + key: "equals", + value: function equals(e, t) { + return !1; + } + }, { + key: "rotationTo", + value: function rotationTo(e, t, n) { + var s = T.dot(t, n); + return s < -.999999 ? (T.cross(E(f, U), E(f, le), t), T.mag(E(f, U)) < 1e-6 && T.cross(E(f, U), E(f, he), t), T.normalize(E(f, U), E(f, U)), f.setAxisAngle(e, E(f, U), Math.PI), e) : s > .999999 ? (e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 1, e) : (T.cross(E(f, U), t, n), e[0] = E(f, U)[0], e[1] = E(f, U)[1], e[2] = E(f, U)[2], e[3] = 1 + s, f.normalize(e, e)); + } + }, { + key: "sqlerp", + value: function sqlerp(e, t, n, s, r, a) { + return f.slerp(E(f, ie), t, r, a), f.slerp(E(f, ce), n, s, a), f.slerp(e, E(f, ie), E(f, ce), 2 * a * (1 - a)), e; + } + }, { + key: "setAxes", + value: function setAxes(e, t, n, s) { + return E(f, W)[0] = n[0], E(f, W)[3] = n[1], E(f, W)[6] = n[2], E(f, W)[1] = s[0], E(f, W)[4] = s[1], E(f, W)[7] = s[2], E(f, W)[2] = -t[0], E(f, W)[5] = -t[1], E(f, W)[8] = -t[2], f.normalize(e, f.fromMat3(e, E(f, W))); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float64Array)); + ke = new WeakMap(), ie = new WeakMap(), ce = new WeakMap(), W = new WeakMap(), U = new WeakMap(), le = new WeakMap(), he = new WeakMap(), Z(f, ke, "zyx"), Z(f, ie, new Float64Array(4)), Z(f, ce, new Float64Array(4)), Z(f, W, new Float64Array(9)), Z(f, U, new Float64Array(3)), Z(f, le, new Float64Array([1, 0, 0])), Z(f, he, new Float64Array([0, 1, 0])); + var O = f; + O.set = q.set; + O.add = q.add; + O.lerp = q.lerp; + O.normalize = q.normalize; + O.squaredLength = q.squaredLength; + O.sqrLen = q.squaredLength; + O.exactEquals = q.exactEquals; + O.equals = q.equals; + O.magnitude = q.magnitude; + O.prototype.mul = O.prototype.multiply; + O.mul = O.multiply; + O.mag = O.magnitude; + O.length = O.magnitude; + O.len = O.magnitude; + var ye, + Le, + j = /*#__PURE__*/function (_Float64Array8) { + function j() { + var _this8; + _classCallCheck(this, j); + for (var _len12 = arguments.length, e = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) { + e[_key12] = arguments[_key12]; + } + switch (e.length) { + case 8: + _this8 = _callSuper(this, j, [e]); + break; + case 2: + _this8 = _callSuper(this, j, [e[0], e[1], 8]); + break; + case 1: + { + var t = e[0]; + typeof t == "number" ? _this8 = _callSuper(this, j, [[t, t, t, t, t, t, t, t]]) : _this8 = _callSuper(this, j, [t, 0, 8]); + break; + } + default: + _this8 = _callSuper(this, j, [8]), _this8[3] = 1; + break; + } + return _assertThisInitialized(_this8); + } + _inherits(j, _Float64Array8); + return _createClass(j, [{ + key: "str", + get: function get() { + return j.str(this); + } + }, { + key: "copy", + value: function copy(e) { + return _superPropGet(j, "set", this)([e]), this; + } + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 8 * Float64Array.BYTES_PER_ELEMENT; + } + }, { + key: "create", + value: function create() { + return new j(); + } + }, { + key: "clone", + value: function clone(e) { + return new j(e); + } + }, { + key: "fromValues", + value: function fromValues(e, t, n, s, r, a, i, c) { + return new j(e, t, n, s, r, a, i, c); + } + }, { + key: "fromRotationTranslationValues", + value: function fromRotationTranslationValues(e, t, n, s, r, a, i) { + var c = r * .5, + y = a * .5, + L = i * .5; + return new j(e, t, n, s, c * s + y * n - L * t, y * s + L * e - c * n, L * s + c * t - y * e, -c * e - y * t - L * n); + } + }, { + key: "fromRotationTranslation", + value: function fromRotationTranslation(e, t, n) { + var s = n[0] * .5, + r = n[1] * .5, + a = n[2] * .5, + i = t[0], + c = t[1], + y = t[2], + L = t[3]; + return e[0] = i, e[1] = c, e[2] = y, e[3] = L, e[4] = s * L + r * y - a * c, e[5] = r * L + a * i - s * y, e[6] = a * L + s * c - r * i, e[7] = -s * i - r * c - a * y, e; + } + }, { + key: "fromTranslation", + value: function fromTranslation(e, t) { + return e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 1, e[4] = t[0] * .5, e[5] = t[1] * .5, e[6] = t[2] * .5, e[7] = 0, e; + } + }, { + key: "fromRotation", + value: function fromRotation(e, t) { + return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[4] = 0, e[5] = 0, e[6] = 0, e[7] = 0, e; + } + }, { + key: "fromMat4", + value: function fromMat4(e, t) { + return G.getRotation(E(j, ye), t), G.getTranslation(E(j, Le), t), j.fromRotationTranslation(e, E(j, ye), E(j, Le)); + } + }, { + key: "copy", + value: function copy(e, t) { + 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; + } + }, { + key: "identity", + value: function identity(e) { + return e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 1, e[4] = 0, e[5] = 0, e[6] = 0, e[7] = 0, e; + } + }, { + key: "set", + value: function set(e, t, n, s, r, a, i, c, y) { + return e[0] = t, e[1] = n, e[2] = s, e[3] = r, e[4] = a, e[5] = i, e[6] = c, e[7] = y, e; + } + }, { + key: "getReal", + value: function getReal(e, t) { + return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e; + } + }, { + key: "getDual", + value: function getDual(e, t) { + return e[0] = t[4], e[1] = t[5], e[2] = t[6], e[3] = t[7], e; + } + }, { + key: "setReal", + value: function setReal(e, t) { + return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e; + } + }, { + key: "setDual", + value: function setDual(e, t) { + return e[4] = t[0], e[5] = t[1], e[6] = t[2], e[7] = t[3], e; + } + }, { + key: "getTranslation", + value: function getTranslation(e, t) { + var n = t[4], + s = t[5], + r = t[6], + a = t[7], + i = -t[0], + c = -t[1], + y = -t[2], + L = t[3]; + return e[0] = (n * L + a * i + s * y - r * c) * 2, e[1] = (s * L + a * c + r * i - n * y) * 2, e[2] = (r * L + a * y + n * c - s * i) * 2, e; + } + }, { + key: "translate", + value: function translate(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = n[0] * .5, + y = n[1] * .5, + L = n[2] * .5, + k = t[4], + l = t[5], + M = t[6], + h = t[7]; + return e[0] = s, e[1] = r, e[2] = a, e[3] = i, e[4] = i * c + r * L - a * y + k, e[5] = i * y + a * c - s * L + l, e[6] = i * L + s * y - r * c + M, e[7] = -s * c - r * y - a * L + h, e; + } + }, { + key: "rotateX", + value: function rotateX(e, t, n) { + var s = -t[0], + r = -t[1], + a = -t[2], + i = t[3], + c = t[4], + y = t[5], + L = t[6], + k = t[7], + l = c * i + k * s + y * a - L * r, + M = y * i + k * r + L * s - c * a, + h = L * i + k * a + c * r - y * s, + b = k * i - c * s - y * r - L * a; + return O.rotateX(e, t, n), s = e[0], r = e[1], a = e[2], i = e[3], e[4] = l * i + b * s + M * a - h * r, e[5] = M * i + b * r + h * s - l * a, e[6] = h * i + b * a + l * r - M * s, e[7] = b * i - l * s - M * r - h * a, e; + } + }, { + key: "rotateY", + value: function rotateY(e, t, n) { + var s = -t[0], + r = -t[1], + a = -t[2], + i = t[3], + c = t[4], + y = t[5], + L = t[6], + k = t[7], + l = c * i + k * s + y * a - L * r, + M = y * i + k * r + L * s - c * a, + h = L * i + k * a + c * r - y * s, + b = k * i - c * s - y * r - L * a; + return O.rotateY(e, t, n), s = e[0], r = e[1], a = e[2], i = e[3], e[4] = l * i + b * s + M * a - h * r, e[5] = M * i + b * r + h * s - l * a, e[6] = h * i + b * a + l * r - M * s, e[7] = b * i - l * s - M * r - h * a, e; + } + }, { + key: "rotateZ", + value: function rotateZ(e, t, n) { + var s = -t[0], + r = -t[1], + a = -t[2], + i = t[3], + c = t[4], + y = t[5], + L = t[6], + k = t[7], + l = c * i + k * s + y * a - L * r, + M = y * i + k * r + L * s - c * a, + h = L * i + k * a + c * r - y * s, + b = k * i - c * s - y * r - L * a; + return O.rotateZ(e, t, n), s = e[0], r = e[1], a = e[2], i = e[3], e[4] = l * i + b * s + M * a - h * r, e[5] = M * i + b * r + h * s - l * a, e[6] = h * i + b * a + l * r - M * s, e[7] = b * i - l * s - M * r - h * a, e; + } + }, { + key: "rotateByQuatAppend", + value: function rotateByQuatAppend(e, t, n) { + var s = n[0], + r = n[1], + a = n[2], + i = n[3], + c = t[0], + y = t[1], + L = t[2], + k = t[3]; + return e[0] = c * i + k * s + y * a - L * r, e[1] = y * i + k * r + L * s - c * a, e[2] = L * i + k * a + c * r - y * s, e[3] = k * i - c * s - y * r - L * a, c = t[4], y = t[5], L = t[6], k = t[7], e[4] = c * i + k * s + y * a - L * r, e[5] = y * i + k * r + L * s - c * a, e[6] = L * i + k * a + c * r - y * s, e[7] = k * i - c * s - y * r - L * a, e; + } + }, { + key: "rotateByQuatPrepend", + value: function rotateByQuatPrepend(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = n[0], + y = n[1], + L = n[2], + k = n[3]; + return e[0] = s * k + i * c + r * L - a * y, e[1] = r * k + i * y + a * c - s * L, e[2] = a * k + i * L + s * y - r * c, e[3] = i * k - s * c - r * y - a * L, c = n[4], y = n[5], L = n[6], k = n[7], e[4] = s * k + i * c + r * L - a * y, e[5] = r * k + i * y + a * c - s * L, e[6] = a * k + i * L + s * y - r * c, e[7] = i * k - s * c - r * y - a * L, e; + } + }, { + key: "rotateAroundAxis", + value: function rotateAroundAxis(e, t, n, s) { + if (Math.abs(s) < 1e-6) return j.copy(e, t); + var r = Math.sqrt(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]); + s *= .5; + var a = Math.sin(s), + i = a * n[0] / r, + c = a * n[1] / r, + y = a * n[2] / r, + L = Math.cos(s), + k = t[0], + l = t[1], + M = t[2], + h = t[3]; + e[0] = k * L + h * i + l * y - M * c, e[1] = l * L + h * c + M * i - k * y, e[2] = M * L + h * y + k * c - l * i, e[3] = h * L - k * i - l * c - M * y; + var b = t[4], + d = t[5], + m = t[6], + o = t[7]; + return e[4] = b * L + o * i + d * y - m * c, e[5] = d * L + o * c + m * i - b * y, e[6] = m * L + o * y + b * c - d * i, e[7] = o * L - b * i - d * c - m * y, e; + } + }, { + key: "add", + value: function add(e, t, n) { + return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e[2] = t[2] + n[2], e[3] = t[3] + n[3], e[4] = t[4] + n[4], e[5] = t[5] + n[5], e[6] = t[6] + n[6], e[7] = t[7] + n[7], e; + } + }, { + key: "multiply", + value: function multiply(e, t, n) { + var s = t[0], + r = t[1], + a = t[2], + i = t[3], + c = n[4], + y = n[5], + L = n[6], + k = n[7], + l = t[4], + M = t[5], + h = t[6], + b = t[7], + d = n[0], + m = n[1], + o = n[2], + V = n[3]; + return e[0] = s * V + i * d + r * o - a * m, e[1] = r * V + i * m + a * d - s * o, e[2] = a * V + i * o + s * m - r * d, e[3] = i * V - s * d - r * m - a * o, e[4] = s * k + i * c + r * L - a * y + l * V + b * d + M * o - h * m, e[5] = r * k + i * y + a * c - s * L + M * V + b * m + h * d - l * o, e[6] = a * k + i * L + s * y - r * c + h * V + b * o + l * m - M * d, e[7] = i * k - s * c - r * y - a * L + b * V - l * d - M * m - h * o, e; + } + }, { + key: "mul", + value: function mul(e, t, n) { + return e; + } + }, { + key: "scale", + value: function scale(e, t, n) { + return e[0] = t[0] * n, e[1] = t[1] * n, e[2] = t[2] * n, e[3] = t[3] * n, e[4] = t[4] * n, e[5] = t[5] * n, e[6] = t[6] * n, e[7] = t[7] * n, e; + } + }, { + key: "dot", + value: function dot(e, t) { + return 0; + } + }, { + key: "lerp", + value: function lerp(e, t, n, s) { + var r = 1 - s; + return j.dot(t, n) < 0 && (s = -s), e[0] = t[0] * r + n[0] * s, e[1] = t[1] * r + n[1] * s, e[2] = t[2] * r + n[2] * s, e[3] = t[3] * r + n[3] * s, e[4] = t[4] * r + n[4] * s, e[5] = t[5] * r + n[5] * s, e[6] = t[6] * r + n[6] * s, e[7] = t[7] * r + n[7] * s, e; + } + }, { + key: "invert", + value: function invert(e, t) { + var n = j.squaredLength(t); + return e[0] = -t[0] / n, e[1] = -t[1] / n, e[2] = -t[2] / n, e[3] = t[3] / n, e[4] = -t[4] / n, e[5] = -t[5] / n, e[6] = -t[6] / n, e[7] = t[7] / n, e; + } + }, { + key: "conjugate", + value: function conjugate(e, t) { + 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; + } + }, { + key: "magnitude", + value: function magnitude(e) { + return 0; + } + }, { + key: "mag", + value: function mag(e) { + return 0; + } + }, { + key: "length", + value: function length(e) { + return 0; + } + }, { + key: "len", + value: function len(e) { + return 0; + } + }, { + key: "squaredLength", + value: function squaredLength(e) { + return 0; + } + }, { + key: "sqrLen", + value: function sqrLen(e) { + return 0; + } + }, { + key: "normalize", + value: function normalize(e, t) { + var n = j.squaredLength(t); + if (n > 0) { + n = Math.sqrt(n); + var s = t[0] / n, + r = t[1] / n, + a = t[2] / n, + i = t[3] / n, + c = t[4], + y = t[5], + L = t[6], + k = t[7], + l = s * c + r * y + a * L + i * k; + e[0] = s, e[1] = r, e[2] = a, e[3] = i, e[4] = (c - s * l) / n, e[5] = (y - r * l) / n, e[6] = (L - a * l) / n, e[7] = (k - i * l) / n; + } + return e; + } + }, { + key: "str", + value: function str(e) { + return "Quat2(".concat(e.join(", "), ")"); + } + }, { + key: "exactEquals", + value: function exactEquals(e, t) { + 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]; + } + }, { + key: "equals", + value: function equals(e, t) { + var n = e[0], + s = e[1], + r = e[2], + a = e[3], + i = e[4], + c = e[5], + y = e[6], + L = e[7], + k = t[0], + l = t[1], + M = t[2], + h = t[3], + b = t[4], + d = t[5], + m = t[6], + o = t[7]; + return Math.abs(n - k) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(k)) && Math.abs(s - l) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(l)) && Math.abs(r - M) <= 1e-6 * Math.max(1, Math.abs(r), Math.abs(M)) && Math.abs(a - h) <= 1e-6 * Math.max(1, Math.abs(a), Math.abs(h)) && Math.abs(i - b) <= 1e-6 * Math.max(1, Math.abs(i), Math.abs(b)) && Math.abs(c - d) <= 1e-6 * Math.max(1, Math.abs(c), Math.abs(d)) && Math.abs(y - m) <= 1e-6 * Math.max(1, Math.abs(y), Math.abs(m)) && Math.abs(L - o) <= 1e-6 * Math.max(1, Math.abs(L), Math.abs(o)); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float64Array)); + ye = new WeakMap(), Le = new WeakMap(), Z(j, ye, new Float64Array(4)), Z(j, Le, new Float64Array(3)); + var J = j; + J.dot = O.dot; + J.squaredLength = O.squaredLength; + J.sqrLen = O.squaredLength; + J.mag = O.magnitude; + J.length = O.magnitude; + J.len = O.magnitude; + J.mul = J.multiply; + var N = /*#__PURE__*/function (_Float64Array9) { + function A() { + var _this9; + _classCallCheck(this, A); + switch (arguments.length) { + case 2: + { + var t = arguments.length <= 0 ? undefined : arguments[0]; + typeof t == "number" ? _this9 = _callSuper(this, A, [[t, arguments.length <= 1 ? undefined : arguments[1]]]) : _this9 = _callSuper(this, A, [t, arguments.length <= 1 ? undefined : arguments[1], 2]); + break; + } + case 1: + { + var _t = arguments.length <= 0 ? undefined : arguments[0]; + typeof _t == "number" ? _this9 = _callSuper(this, A, [[_t, _t]]) : _this9 = _callSuper(this, A, [_t, 0, 2]); + break; + } + default: + _this9 = _callSuper(this, A, [2]); + break; + } + return _assertThisInitialized(_this9); + } + _inherits(A, _Float64Array9); + return _createClass(A, [{ + key: "x", + get: function get() { + return this[0]; + }, + set: function set(e) { + this[0] = e; + } + }, { + key: "y", + get: function get() { + return this[1]; + }, + set: function set(e) { + this[1] = e; + } + }, { + key: "r", + get: function get() { + return this[0]; + }, + set: function set(e) { + this[0] = e; + } + }, { + key: "g", + get: function get() { + return this[1]; + }, + set: function set(e) { + this[1] = e; + } + }, { + key: "magnitude", + get: function get() { + return Math.hypot(this[0], this[1]); + } + }, { + key: "mag", + get: function get() { + return this.magnitude; + } + }, { + key: "squaredMagnitude", + get: function get() { + var e = this[0], + t = this[1]; + return e * e + t * t; + } + }, { + key: "sqrMag", + get: function get() { + return this.squaredMagnitude; + } + }, { + key: "str", + get: function get() { + return A.str(this); + } + }, { + key: "copy", + value: function copy(e) { + return this.set(e), this; + } + }, { + key: "add", + value: function add(e) { + return this[0] += e[0], this[1] += e[1], this; + } + }, { + key: "subtract", + value: function subtract(e) { + return this[0] -= e[0], this[1] -= e[1], this; + } + }, { + key: "sub", + value: function sub(e) { + return this; + } + }, { + key: "multiply", + value: function multiply(e) { + return this[0] *= e[0], this[1] *= e[1], this; + } + }, { + key: "mul", + value: function mul(e) { + return this; + } + }, { + key: "divide", + value: function divide(e) { + return this[0] /= e[0], this[1] /= e[1], this; + } + }, { + key: "div", + value: function div(e) { + return this; + } + }, { + key: "scale", + value: function scale(e) { + return this[0] *= e, this[1] *= e, this; + } + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(e, t) { + return this[0] += e[0] * t, this[1] += e[1] * t, this; + } + }, { + key: "distance", + value: function distance(e) { + return A.distance(this, e); + } + }, { + key: "dist", + value: function dist(e) { + return 0; + } + }, { + key: "squaredDistance", + value: function squaredDistance(e) { + return A.squaredDistance(this, e); + } + }, { + key: "sqrDist", + value: function sqrDist(e) { + return 0; + } + }, { + key: "negate", + value: function negate() { + return this[0] *= -1, this[1] *= -1, this; + } + }, { + key: "invert", + value: function invert() { + return this[0] = 1 / this[0], this[1] = 1 / this[1], this; + } + }, { + key: "abs", + value: function abs() { + return this[0] = Math.abs(this[0]), this[1] = Math.abs(this[1]), this; + } + }, { + key: "dot", + value: function dot(e) { + return this[0] * e[0] + this[1] * e[1]; + } + }, { + key: "normalize", + value: function normalize() { + return A.normalize(this, this); + } + }], [{ + key: "BYTE_LENGTH", + get: function get() { + return 2 * Float64Array.BYTES_PER_ELEMENT; + } + }, { + key: "create", + value: function create() { + return new A(); + } + }, { + key: "clone", + value: function clone(e) { + return new A(e); + } + }, { + key: "fromValues", + value: function fromValues(e, t) { + return new A(e, t); + } + }, { + key: "copy", + value: function copy(e, t) { + return e[0] = t[0], e[1] = t[1], e; + } + }, { + key: "set", + value: function set(e, t, n) { + return e[0] = t, e[1] = n, e; + } + }, { + key: "add", + value: function add(e, t, n) { + return e[0] = t[0] + n[0], e[1] = t[1] + n[1], e; + } + }, { + key: "subtract", + value: function subtract(e, t, n) { + return e[0] = t[0] - n[0], e[1] = t[1] - n[1], e; + } + }, { + key: "sub", + value: function sub(e, t, n) { + return [0, 0]; + } + }, { + key: "multiply", + value: function multiply(e, t, n) { + return e[0] = t[0] * n[0], e[1] = t[1] * n[1], e; + } + }, { + key: "mul", + value: function mul(e, t, n) { + return [0, 0]; + } + }, { + key: "divide", + value: function divide(e, t, n) { + return e[0] = t[0] / n[0], e[1] = t[1] / n[1], e; + } + }, { + key: "div", + value: function div(e, t, n) { + return [0, 0]; + } + }, { + key: "ceil", + value: function ceil(e, t) { + return e[0] = Math.ceil(t[0]), e[1] = Math.ceil(t[1]), e; + } + }, { + key: "floor", + value: function floor(e, t) { + return e[0] = Math.floor(t[0]), e[1] = Math.floor(t[1]), e; + } + }, { + key: "min", + value: function min(e, t, n) { + return e[0] = Math.min(t[0], n[0]), e[1] = Math.min(t[1], n[1]), e; + } + }, { + key: "max", + value: function max(e, t, n) { + return e[0] = Math.max(t[0], n[0]), e[1] = Math.max(t[1], n[1]), e; + } + }, { + key: "round", + value: function round(e, t) { + return e[0] = Math.round(t[0]), e[1] = Math.round(t[1]), e; + } + }, { + key: "scale", + value: function scale(e, t, n) { + return e[0] = t[0] * n, e[1] = t[1] * n, e; + } + }, { + key: "scaleAndAdd", + value: function scaleAndAdd(e, t, n, s) { + return e[0] = t[0] + n[0] * s, e[1] = t[1] + n[1] * s, e; + } + }, { + key: "distance", + value: function distance(e, t) { + return Math.hypot(t[0] - e[0], t[1] - e[1]); + } + }, { + key: "dist", + value: function dist(e, t) { + return 0; + } + }, { + key: "squaredDistance", + value: function squaredDistance(e, t) { + var n = t[0] - e[0], + s = t[1] - e[1]; + return n * n + s * s; + } + }, { + key: "sqrDist", + value: function sqrDist(e, t) { + return 0; + } + }, { + key: "magnitude", + value: function magnitude(e) { + var t = e[0], + n = e[1]; + return Math.sqrt(t * t + n * n); + } + }, { + key: "mag", + value: function mag(e) { + return 0; + } + }, { + key: "length", + value: function length(e) { + return 0; + } + }, { + key: "len", + value: function len(e) { + return 0; + } + }, { + key: "squaredLength", + value: function squaredLength(e) { + var t = e[0], + n = e[1]; + return t * t + n * n; + } + }, { + key: "sqrLen", + value: function sqrLen(e, t) { + return 0; + } + }, { + key: "negate", + value: function negate(e, t) { + return e[0] = -t[0], e[1] = -t[1], e; + } + }, { + key: "inverse", + value: function inverse(e, t) { + return e[0] = 1 / t[0], e[1] = 1 / t[1], e; + } + }, { + key: "abs", + value: function abs(e, t) { + return e[0] = Math.abs(t[0]), e[1] = Math.abs(t[1]), e; + } + }, { + key: "normalize", + value: function normalize(e, t) { + var n = t[0], + s = t[1], + r = n * n + s * s; + return r > 0 && (r = 1 / Math.sqrt(r)), e[0] = t[0] * r, e[1] = t[1] * r, e; + } + }, { + key: "dot", + value: function dot(e, t) { + return e[0] * t[0] + e[1] * t[1]; + } + }, { + key: "cross", + value: function cross(e, t, n) { + var s = t[0] * n[1] - t[1] * n[0]; + return e[0] = e[1] = 0, e[2] = s, e; + } + }, { + key: "lerp", + value: function lerp(e, t, n, s) { + var r = t[0], + a = t[1]; + return e[0] = r + s * (n[0] - r), e[1] = a + s * (n[1] - a), e; + } + }, { + key: "transformMat2", + value: function transformMat2(e, t, n) { + var s = t[0], + r = t[1]; + return e[0] = n[0] * s + n[2] * r, e[1] = n[1] * s + n[3] * r, e; + } + }, { + key: "transformMat2d", + value: function transformMat2d(e, t, n) { + var s = t[0], + r = t[1]; + return e[0] = n[0] * s + n[2] * r + n[4], e[1] = n[1] * s + n[3] * r + n[5], e; + } + }, { + key: "transformMat3", + value: function transformMat3(e, t, n) { + var s = t[0], + r = t[1]; + return e[0] = n[0] * s + n[3] * r + n[6], e[1] = n[1] * s + n[4] * r + n[7], e; + } + }, { + key: "transformMat4", + value: function transformMat4(e, t, n) { + var s = t[0], + r = t[1]; + return e[0] = n[0] * s + n[4] * r + n[12], e[1] = n[1] * s + n[5] * r + n[13], e; + } + }, { + key: "rotate", + value: function rotate(e, t, n, s) { + var r = t[0] - n[0], + a = t[1] - n[1], + i = Math.sin(s), + c = Math.cos(s); + return e[0] = r * c - a * i + n[0], e[1] = r * i + a * c + n[1], e; + } + }, { + key: "angle", + value: function angle(e, t) { + var n = e[0], + s = e[1], + r = t[0], + a = t[1], + i = Math.sqrt(n * n + s * s) * Math.sqrt(r * r + a * a), + c = i && (n * r + s * a) / i; + return Math.acos(Math.min(Math.max(c, -1), 1)); + } + }, { + key: "zero", + value: function zero(e) { + return e[0] = 0, e[1] = 0, e; + } + }, { + key: "exactEquals", + value: function exactEquals(e, t) { + return e[0] === t[0] && e[1] === t[1]; + } + }, { + key: "equals", + value: function equals(e, t) { + var n = e[0], + s = e[1], + r = t[0], + a = t[1]; + return Math.abs(n - r) <= 1e-6 * Math.max(1, Math.abs(n), Math.abs(r)) && Math.abs(s - a) <= 1e-6 * Math.max(1, Math.abs(s), Math.abs(a)); + } + }, { + key: "str", + value: function str(e) { + return "Vec2(".concat(e.join(", "), ")"); + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(Float64Array)); + N.prototype.sub = N.prototype.subtract; + N.prototype.mul = N.prototype.multiply; + N.prototype.div = N.prototype.divide; + N.prototype.dist = N.prototype.distance; + N.prototype.sqrDist = N.prototype.squaredDistance; + N.sub = N.subtract; + N.mul = N.multiply; + N.div = N.divide; + N.dist = N.distance; + N.sqrDist = N.squaredDistance; + N.sqrLen = N.squaredLength; + N.mag = N.magnitude; + N.length = N.magnitude; + N.len = N.magnitude; + var me = !1; + function ve() { + if (me) return; + var A = ["xx", "xy", "yx", "yy", "xxx", "xxy", "xyx", "xyy", "yxx", "yxy", "yyx", "yyy", "xxxx", "xxxy", "xxyx", "xxyy", "xyxx", "xyxy", "xyyx", "xyyy", "yxxx", "yxxy", "yxyx", "yxyy", "yyxx", "yyxy", "yyyx", "yyyy", "rr", "rg", "gr", "gg", "rrr", "rrg", "rgr", "rgg", "grr", "grg", "ggr", "ggg", "rrrr", "rrrg", "rrgr", "rrgg", "rgrr", "rgrg", "rggr", "rggg", "grrr", "grrg", "grgr", "grgg", "ggrr", "ggrg", "gggr", "gggg"], + e = ["xz", "yz", "zx", "zy", "zz", "xxz", "xyz", "xzx", "xzy", "xzz", "yxz", "yyz", "yzx", "yzy", "yzz", "zxx", "zxy", "zxz", "zyx", "zyy", "zyz", "zzx", "zzy", "zzz", "xxxz", "xxyz", "xxzx", "xxzy", "xxzz", "xyxz", "xyyz", "xyzx", "xyzy", "xyzz", "xzxx", "xzxy", "xzxz", "xzyx", "xzyy", "xzyz", "xzzx", "xzzy", "xzzz", "yxxz", "yxyz", "yxzx", "yxzy", "yxzz", "yyxz", "yyyz", "yyzx", "yyzy", "yyzz", "yzxx", "yzxy", "yzxz", "yzyx", "yzyy", "yzyz", "yzzx", "yzzy", "yzzz", "zxxx", "zxxy", "zxxz", "zxyx", "zxyy", "zxyz", "zxzx", "zxzy", "zxzz", "zyxx", "zyxy", "zyxz", "zyyx", "zyyy", "zyyz", "zyzx", "zyzy", "zyzz", "zzxx", "zzxy", "zzxz", "zzyx", "zzyy", "zzyz", "zzzx", "zzzy", "zzzz", "rb", "gb", "br", "bg", "bb", "rrb", "rgb", "rbr", "rbg", "rbb", "grb", "ggb", "gbr", "gbg", "gbb", "brr", "brg", "brb", "bgr", "bgg", "bgb", "bbr", "bbg", "bbb", "rrrb", "rrgb", "rrbr", "rrbg", "rrbb", "rgrb", "rggb", "rgbr", "rgbg", "rgbb", "rbrr", "rbrg", "rbrb", "rbgr", "rbgg", "rbgb", "rbbr", "rbbg", "rbbb", "grrb", "grgb", "grbr", "grbg", "grbb", "ggrb", "gggb", "ggbr", "ggbg", "ggbb", "gbrr", "gbrg", "gbrb", "gbgr", "gbgg", "gbgb", "gbbr", "gbbg", "gbbb", "brrr", "brrg", "brrb", "brgr", "brgg", "brgb", "brbr", "brbg", "brbb", "bgrr", "bgrg", "bgrb", "bggr", "bggg", "bggb", "bgbr", "bgbg", "bgbb", "bbrr", "bbrg", "bbrb", "bbgr", "bbgg", "bbgb", "bbbr", "bbbg", "bbbb"], + t = ["xw", "yw", "zw", "wx", "wy", "wz", "ww", "xxw", "xyw", "xzw", "xwx", "xwy", "xwz", "xww", "yxw", "yyw", "yzw", "ywx", "ywy", "ywz", "yww", "zxw", "zyw", "zzw", "zwx", "zwy", "zwz", "zww", "wxx", "wxy", "wxz", "wxw", "wyx", "wyy", "wyz", "wyw", "wzx", "wzy", "wzz", "wzw", "wwx", "wwy", "wwz", "www", "xxxw", "xxyw", "xxzw", "xxwx", "xxwy", "xxwz", "xxww", "xyxw", "xyyw", "xyzw", "xywx", "xywy", "xywz", "xyww", "xzxw", "xzyw", "xzzw", "xzwx", "xzwy", "xzwz", "xzww", "xwxx", "xwxy", "xwxz", "xwxw", "xwyx", "xwyy", "xwyz", "xwyw", "xwzx", "xwzy", "xwzz", "xwzw", "xwwx", "xwwy", "xwwz", "xwww", "yxxw", "yxyw", "yxzw", "yxwx", "yxwy", "yxwz", "yxww", "yyxw", "yyyw", "yyzw", "yywx", "yywy", "yywz", "yyww", "yzxw", "yzyw", "yzzw", "yzwx", "yzwy", "yzwz", "yzww", "ywxx", "ywxy", "ywxz", "ywxw", "ywyx", "ywyy", "ywyz", "ywyw", "ywzx", "ywzy", "ywzz", "ywzw", "ywwx", "ywwy", "ywwz", "ywww", "zxxw", "zxyw", "zxzw", "zxwx", "zxwy", "zxwz", "zxww", "zyxw", "zyyw", "zyzw", "zywx", "zywy", "zywz", "zyww", "zzxw", "zzyw", "zzzw", "zzwx", "zzwy", "zzwz", "zzww", "zwxx", "zwxy", "zwxz", "zwxw", "zwyx", "zwyy", "zwyz", "zwyw", "zwzx", "zwzy", "zwzz", "zwzw", "zwwx", "zwwy", "zwwz", "zwww", "wxxx", "wxxy", "wxxz", "wxxw", "wxyx", "wxyy", "wxyz", "wxyw", "wxzx", "wxzy", "wxzz", "wxzw", "wxwx", "wxwy", "wxwz", "wxww", "wyxx", "wyxy", "wyxz", "wyxw", "wyyx", "wyyy", "wyyz", "wyyw", "wyzx", "wyzy", "wyzz", "wyzw", "wywx", "wywy", "wywz", "wyww", "wzxx", "wzxy", "wzxz", "wzxw", "wzyx", "wzyy", "wzyz", "wzyw", "wzzx", "wzzy", "wzzz", "wzzw", "wzwx", "wzwy", "wzwz", "wzww", "wwxx", "wwxy", "wwxz", "wwxw", "wwyx", "wwyy", "wwyz", "wwyw", "wwzx", "wwzy", "wwzz", "wwzw", "wwwx", "wwwy", "wwwz", "wwww", "ra", "ga", "ba", "ar", "ag", "ab", "aa", "rra", "rga", "rba", "rar", "rag", "rab", "raa", "gra", "gga", "gba", "gar", "gag", "gab", "gaa", "bra", "bga", "bba", "bar", "bag", "bab", "baa", "arr", "arg", "arb", "ara", "agr", "agg", "agb", "aga", "abr", "abg", "abb", "aba", "aar", "aag", "aab", "aaa", "rrra", "rrga", "rrba", "rrar", "rrag", "rrab", "rraa", "rgra", "rgga", "rgba", "rgar", "rgag", "rgab", "rgaa", "rbra", "rbga", "rbba", "rbar", "rbag", "rbab", "rbaa", "rarr", "rarg", "rarb", "rara", "ragr", "ragg", "ragb", "raga", "rabr", "rabg", "rabb", "raba", "raar", "raag", "raab", "raaa", "grra", "grga", "grba", "grar", "grag", "grab", "graa", "ggra", "ggga", "ggba", "ggar", "ggag", "ggab", "ggaa", "gbra", "gbga", "gbba", "gbar", "gbag", "gbab", "gbaa", "garr", "garg", "garb", "gara", "gagr", "gagg", "gagb", "gaga", "gabr", "gabg", "gabb", "gaba", "gaar", "gaag", "gaab", "gaaa", "brra", "brga", "brba", "brar", "brag", "brab", "braa", "bgra", "bgga", "bgba", "bgar", "bgag", "bgab", "bgaa", "bbra", "bbga", "bbba", "bbar", "bbag", "bbab", "bbaa", "barr", "barg", "barb", "bara", "bagr", "bagg", "bagb", "baga", "babr", "babg", "babb", "baba", "baar", "baag", "baab", "baaa", "arrr", "arrg", "arrb", "arra", "argr", "argg", "argb", "arga", "arbr", "arbg", "arbb", "arba", "arar", "arag", "arab", "araa", "agrr", "agrg", "agrb", "agra", "aggr", "aggg", "aggb", "agga", "agbr", "agbg", "agbb", "agba", "agar", "agag", "agab", "agaa", "abrr", "abrg", "abrb", "abra", "abgr", "abgg", "abgb", "abga", "abbr", "abbg", "abbb", "abba", "abar", "abag", "abab", "abaa", "aarr", "aarg", "aarb", "aara", "aagr", "aagg", "aagb", "aaga", "aabr", "aabg", "aabb", "aaba", "aaar", "aaag", "aaab", "aaaa"], + n = { + x: 0, + r: 0, + y: 1, + g: 1, + z: 2, + b: 2, + w: 3, + a: 3 + }; + function s(r) { + switch (r.length) { + case 2: + return function () { + return new N(this[n[r[0]]], this[n[r[1]]]); + }; + case 3: + return function () { + return new T(this[n[r[0]]], this[n[r[1]]], this[n[r[2]]]); + }; + case 4: + return function () { + return new q(this[n[r[0]]], this[n[r[1]]], this[n[r[2]]], this[n[r[3]]]); + }; + } + throw new Error("Illegal swizzle length"); + } + for (var _i = 0, _A = A; _i < _A.length; _i++) { + var r = _A[_i]; + var a = s(r); + Object.defineProperty(N.prototype, r, { + get: a + }), Object.defineProperty(T.prototype, r, { + get: a + }), Object.defineProperty(q.prototype, r, { + get: a + }); + } + for (var _i2 = 0, _e2 = e; _i2 < _e2.length; _i2++) { + var _r = _e2[_i2]; + var _a = s(_r); + Object.defineProperty(T.prototype, _r, { + get: _a + }), Object.defineProperty(q.prototype, _r, { + get: _a + }); + } + for (var _i3 = 0, _t2 = t; _i3 < _t2.length; _i3++) { + var _r2 = _t2[_i3]; + var _a2 = s(_r2); + Object.defineProperty(q.prototype, _r2, { + get: _a2 + }); + } + me = !0; + } + var xe = Math.PI / 180, + Re = 180 / Math.PI; + function _e(A) { + return A * Re; + } + function et(A) { + return A * xe; + } + + exports.EnableSwizzlesF64 = ve; + exports.Mat2 = v; + exports.Mat2d = _; + exports.Mat3 = u; + exports.Mat4 = G; + exports.Quat = O; + exports.Quat2 = J; + exports.Vec2 = N; + exports.Vec3 = T; + exports.Vec4 = q; + exports.toDegree = _e; + exports.toRadian = et; + +})); +//# sourceMappingURL=gl-matrix-f64.min.js.map diff --git a/dist-cdn/umd/gl-matrix-f64.min.js.map b/dist-cdn/umd/gl-matrix-f64.min.js.map new file mode 100644 index 00000000..4b0b7336 --- /dev/null +++ b/dist-cdn/umd/gl-matrix-f64.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"gl-matrix-f64.min.js","sources":["../esm/2016/gl-matrix-f64.min.js"],"sourcesContent":["// gl-matrix - v4.0.0-beta.3 - A high performance matrix and vector library.\n// @author Brandon Jones\n// @author Colin MacKenzie IV\n// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md)\nvar de=A=>{throw TypeError(A)};var oe=(A,e,t)=>e.has(A)||de(\"Cannot \"+t);var E=(A,e,t)=>(oe(A,e,\"read from private field\"),t?t.call(A):e.get(A)),Z=(A,e,t)=>e.has(A)?de(\"Cannot add the same private member more than once\"):e instanceof WeakSet?e.add(A):e.set(A,t);var ne,C=class C extends Float64Array{constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:let t=e[0];typeof t==\"number\"?super([t,t,t,t]):super(t,0,4);break;default:super(E(C,ne));break}}get str(){return C.str(this)}copy(e){return this.set(e),this}identity(){return this.set(E(C,ne)),this}multiply(e){return C.multiply(this,this,e)}mul(e){return this}transpose(){return C.transpose(this,this)}invert(){return C.invert(this,this)}scale(e){return C.scale(this,this,e)}rotate(e){return C.rotate(this,this,e)}static get BYTE_LENGTH(){return 4*Float64Array.BYTES_PER_ELEMENT}static create(){return new C}static clone(e){return new C(e)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static fromValues(...e){return new C(...e)}static set(e,...t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}static transpose(e,t){if(e===t){let n=t[1];e[1]=t[2],e[2]=n}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*a-r*s;return i?(i=1/i,e[0]=a*i,e[1]=-s*i,e[2]=-r*i,e[3]=n*i,e):null}static adjoint(e,t){let n=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=n,e}static determinant(e){return e[0]*e[3]-e[2]*e[1]}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*c+a*y,e[1]=r*c+i*y,e[2]=s*L+a*k,e[3]=r*L+i*k,e}static mul(e,t,n){return e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+a*c,e[1]=r*y+i*c,e[2]=s*-c+a*y,e[3]=r*-c+i*y,e}static scale(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1];return e[0]=s*c,e[1]=r*c,e[2]=a*y,e[3]=i*y,e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=-n,e[3]=s,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3])}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e}static LDU(e,t,n,s){return e[2]=s[2]/s[0],n[0]=s[0],n[1]=s[1],n[3]=s[3]-e[2]*n[1],[e,t,n]}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=t[0],c=t[1],y=t[2],L=t[3];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(a-L)<=1e-6*Math.max(1,Math.abs(a),Math.abs(L))}static str(e){return`Mat2(${e.join(\", \")})`}};ne=new WeakMap,Z(C,ne,new Float64Array([1,0,0,1]));var v=C;v.prototype.mul=v.prototype.multiply;v.mul=v.multiply;v.sub=v.subtract;var se,H=class H extends Float64Array{constructor(...e){switch(e.length){case 6:super(e);break;case 2:super(e[0],e[1],6);break;case 1:let t=e[0];typeof t==\"number\"?super([t,t,t,t,t,t]):super(t,0,6);break;default:super(E(H,se));break}}get str(){return H.str(this)}copy(e){return this.set(e),this}identity(){return this.set(E(H,se)),this}multiply(e){return H.multiply(this,this,e)}mul(e){return this}translate(e){return H.translate(this,this,e)}rotate(e){return H.rotate(this,this,e)}scale(e){return H.scale(this,this,e)}static get BYTE_LENGTH(){return 6*Float64Array.BYTES_PER_ELEMENT}static create(){return new H}static clone(e){return new H(e)}static copy(e,t){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}static fromValues(...e){return new H(...e)}static set(e,...t){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}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=n*a-s*r;return y?(y=1/y,e[0]=a*y,e[1]=-s*y,e[2]=-r*y,e[3]=n*y,e[4]=(r*c-a*i)*y,e[5]=(s*i-n*c)*y,e):null}static determinant(e){return e[0]*e[3]-e[1]*e[2]}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1],l=n[2],M=n[3],h=n[4],b=n[5];return e[0]=s*L+a*k,e[1]=r*L+i*k,e[2]=s*l+a*M,e[3]=r*l+i*M,e[4]=s*h+a*b+c,e[5]=r*h+i*b+y,e}static mul(e,t,n){return e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=s*L+a*k+c,e[5]=r*L+i*k+y,e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=Math.sin(n),k=Math.cos(n);return e[0]=s*k+a*L,e[1]=r*k+i*L,e[2]=s*-L+a*k,e[3]=r*-L+i*k,e[4]=c,e[5]=y,e}static scale(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=n[0],k=n[1];return e[0]=s*L,e[1]=r*L,e[2]=a*k,e[3]=i*k,e[4]=c,e[5]=y,e}static fromTranslation(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0],e[5]=t[1],e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=-n,e[3]=s,e[4]=0,e[5]=0,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e[4]=0,e[5]=0,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+1)}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=t[0],L=t[1],k=t[2],l=t[3],M=t[4],h=t[5];return Math.abs(n-y)<=1e-6*Math.max(1,Math.abs(n),Math.abs(y))&&Math.abs(s-L)<=1e-6*Math.max(1,Math.abs(s),Math.abs(L))&&Math.abs(r-k)<=1e-6*Math.max(1,Math.abs(r),Math.abs(k))&&Math.abs(a-l)<=1e-6*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(i-M)<=1e-6*Math.max(1,Math.abs(i),Math.abs(M))&&Math.abs(c-h)<=1e-6*Math.max(1,Math.abs(c),Math.abs(h))}static str(e){return`Mat2d(${e.join(\", \")})`}};se=new WeakMap,Z(H,se,new Float64Array([1,0,0,1,0,0]));var _=H;_.mul=_.multiply;_.sub=_.subtract;var re,X=class X extends Float64Array{constructor(...e){switch(e.length){case 9:super(e);break;case 2:super(e[0],e[1],9);break;case 1:let t=e[0];typeof t==\"number\"?super([t,t,t,t,t,t,t,t,t]):super(t,0,9);break;default:super(E(X,re));break}}get str(){return X.str(this)}copy(e){return this.set(e),this}identity(){return this.set(E(X,re)),this}multiply(e){return X.multiply(this,this,e)}mul(e){return this}transpose(){return X.transpose(this,this)}invert(){return X.invert(this,this)}translate(e){return X.translate(this,this,e)}rotate(e){return X.rotate(this,this,e)}scale(e){return X.scale(this,this,e)}static get BYTE_LENGTH(){return 9*Float64Array.BYTES_PER_ELEMENT}static create(){return new X}static clone(e){return new X(e)}static copy(e,t){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}static fromValues(...e){return new X(...e)}static set(e,...t){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}static identity(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static transpose(e,t){if(e===t){let n=t[1],s=t[2],r=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=s,e[7]=r}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=k*i-c*L,M=-k*a+c*y,h=L*a-i*y,b=n*l+s*M+r*h;return b?(b=1/b,e[0]=l*b,e[1]=(-k*s+r*L)*b,e[2]=(c*s-r*i)*b,e[3]=M*b,e[4]=(k*n-r*y)*b,e[5]=(-c*n+r*a)*b,e[6]=h*b,e[7]=(-L*n+s*y)*b,e[8]=(i*n-s*a)*b,e):null}static adjoint(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8];return e[0]=i*k-c*L,e[1]=r*L-s*k,e[2]=s*c-r*i,e[3]=c*y-a*k,e[4]=n*k-r*y,e[5]=r*a-n*c,e[6]=a*L-i*y,e[7]=s*y-n*L,e[8]=n*i-s*a,e}static determinant(e){let t=e[0],n=e[1],s=e[2],r=e[3],a=e[4],i=e[5],c=e[6],y=e[7],L=e[8];return t*(L*a-i*y)+n*(-L*r+i*c)+s*(y*r-a*c)}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e}static sub(e,t,n){return e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=n[0],h=n[1],b=n[2];return e[0]=M*s+h*i+b*L,e[1]=M*r+h*c+b*k,e[2]=M*a+h*y+b*l,M=n[3],h=n[4],b=n[5],e[3]=M*s+h*i+b*L,e[4]=M*r+h*c+b*k,e[5]=M*a+h*y+b*l,M=n[6],h=n[7],b=n[8],e[6]=M*s+h*i+b*L,e[7]=M*r+h*c+b*k,e[8]=M*a+h*y+b*l,e}static mul(e,t,n){return e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=n[0],h=n[1];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=c,e[5]=y,e[6]=M*s+h*i+L,e[7]=M*r+h*c+k,e[8]=M*a+h*y+l,e}static rotate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=Math.sin(n),h=Math.cos(n);return e[0]=h*s+M*i,e[1]=h*r+M*c,e[2]=h*a+M*y,e[3]=h*i-M*s,e[4]=h*c-M*r,e[5]=h*y-M*a,e[6]=L,e[7]=k,e[8]=l,e}static scale(e,t,n){let s=n[0],r=n[1];return e[0]=s*t[0],e[1]=s*t[1],e[2]=s*t[2],e[3]=r*t[3],e[4]=r*t[4],e[5]=r*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}static fromTranslation(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}static fromRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=0,e[3]=-n,e[4]=s,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}static fromMat2d(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}static fromQuat(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n+n,c=s+s,y=r+r,L=n*i,k=s*i,l=s*c,M=r*i,h=r*c,b=r*y,d=a*i,m=a*c,o=a*y;return e[0]=1-l-b,e[3]=k-o,e[6]=M+m,e[1]=k+o,e[4]=1-L-b,e[7]=h-d,e[2]=M-m,e[5]=h+d,e[8]=1-L-l,e}static fromMat4(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}static normalFromMat4(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],M=t[10],h=t[11],b=t[12],d=t[13],m=t[14],o=t[15],V=n*c-s*i,x=n*y-r*i,R=n*L-a*i,z=s*y-r*c,g=s*L-a*c,B=r*L-a*y,D=k*d-l*b,F=k*m-M*b,p=k*o-h*b,Y=l*m-M*d,I=l*o-h*d,P=M*o-h*m,Q=V*P-x*I+R*Y+z*p-g*F+B*D;return Q?(Q=1/Q,e[0]=(c*P-y*I+L*Y)*Q,e[1]=(y*p-i*P-L*F)*Q,e[2]=(i*I-c*p+L*D)*Q,e[3]=(r*I-s*P-a*Y)*Q,e[4]=(n*P-r*p+a*F)*Q,e[5]=(s*p-n*I-a*D)*Q,e[6]=(d*B-m*g+o*z)*Q,e[7]=(m*R-b*B-o*x)*Q,e[8]=(b*g-d*R+o*V)*Q,e):null}static normalFromMat4Fast(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=i*k-k*L,e[1]=c*y-y*k,e[2]=a*L-L*y,e[3]=L*r-k*s,e[4]=k*n-y*r,e[5]=y*s-L*n,e[6]=s*c-r*i,e[7]=r*a-n*c,e[8]=n*i-s*a,e}static projection(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8])}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e[6]=t[6]+n[6]*s,e[7]=t[7]+n[7]*s,e[8]=t[8]+n[8]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=e[8],l=t[0],M=t[1],h=t[2],b=t[3],d=t[4],m=t[5],o=t[6],V=t[7],x=t[8];return Math.abs(n-l)<=1e-6*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(s-M)<=1e-6*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(r-h)<=1e-6*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(a-b)<=1e-6*Math.max(1,Math.abs(a),Math.abs(b))&&Math.abs(i-d)<=1e-6*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(c-m)<=1e-6*Math.max(1,Math.abs(c),Math.abs(m))&&Math.abs(y-o)<=1e-6*Math.max(1,Math.abs(y),Math.abs(o))&&Math.abs(L-V)<=1e-6*Math.max(1,Math.abs(L),Math.abs(V))&&Math.abs(k-x)<=1e-6*Math.max(1,Math.abs(k),Math.abs(x))}static str(e){return`Mat3(${e.join(\", \")})`}};re=new WeakMap,Z(X,re,new Float64Array([1,0,0,0,1,0,0,0,1]));var u=X;u.prototype.mul=u.prototype.multiply;u.mul=u.multiply;u.sub=u.subtract;var ae,$,S=class S extends Float64Array{constructor(...e){switch(e.length){case 16:super(e);break;case 2:super(e[0],e[1],16);break;case 1:let t=e[0];typeof t==\"number\"?super([t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t]):super(t,0,16);break;default:super(E(S,ae));break}}get str(){return S.str(this)}copy(e){return this.set(e),this}identity(){return this.set(E(S,ae)),this}multiply(e){return S.multiply(this,this,e)}mul(e){return this}transpose(){return S.transpose(this,this)}invert(){return S.invert(this,this)}translate(e){return S.translate(this,this,e)}rotate(e,t){return S.rotate(this,this,e,t)}scale(e){return S.scale(this,this,e)}rotateX(e){return S.rotateX(this,this,e)}rotateY(e){return S.rotateY(this,this,e)}rotateZ(e){return S.rotateZ(this,this,e)}perspectiveNO(e,t,n,s){return S.perspectiveNO(this,e,t,n,s)}perspectiveZO(e,t,n,s){return S.perspectiveZO(this,e,t,n,s)}orthoNO(e,t,n,s,r,a){return S.orthoNO(this,e,t,n,s,r,a)}orthoZO(e,t,n,s,r,a){return S.orthoZO(this,e,t,n,s,r,a)}static get BYTE_LENGTH(){return 16*Float64Array.BYTES_PER_ELEMENT}static create(){return new S}static clone(e){return new S(e)}static copy(e,t){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}static fromValues(...e){return new S(...e)}static set(e,...t){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}static identity(e){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}static transpose(e,t){if(e===t){let n=t[1],s=t[2],r=t[3],a=t[6],i=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=s,e[9]=a,e[11]=t[14],e[12]=r,e[13]=i,e[14]=c}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e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[8]=i*I-c*p+L*D,e[9]=s*p-n*I-a*D,e[10]=b*g-d*R+o*V,e[11]=l*R-k*g-h*V,e[12]=c*F-i*Y-y*D,e[13]=n*Y-s*F+r*D,e[14]=d*x-b*z-m*V,e[15]=k*z-l*x+M*V,e}static determinant(e){let t=e[0],n=e[1],s=e[2],r=e[3],a=e[4],i=e[5],c=e[6],y=e[7],L=e[8],k=e[9],l=e[10],M=e[11],h=e[12],b=e[13],d=e[14],m=e[15],o=t*i-n*a,V=t*c-s*a,x=n*c-s*i,R=L*b-k*h,z=L*d-l*h,g=k*d-l*b,B=t*g-n*z+s*R,D=a*g-i*z+c*R,F=L*x-k*V+l*o,p=h*x-b*V+d*o;return y*B-r*D+m*F-M*p}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=t[8],M=t[9],h=t[10],b=t[11],d=t[12],m=t[13],o=t[14],V=t[15],x=n[0],R=n[1],z=n[2],g=n[3];return e[0]=x*s+R*c+z*l+g*d,e[1]=x*r+R*y+z*M+g*m,e[2]=x*a+R*L+z*h+g*o,e[3]=x*i+R*k+z*b+g*V,x=n[4],R=n[5],z=n[6],g=n[7],e[4]=x*s+R*c+z*l+g*d,e[5]=x*r+R*y+z*M+g*m,e[6]=x*a+R*L+z*h+g*o,e[7]=x*i+R*k+z*b+g*V,x=n[8],R=n[9],z=n[10],g=n[11],e[8]=x*s+R*c+z*l+g*d,e[9]=x*r+R*y+z*M+g*m,e[10]=x*a+R*L+z*h+g*o,e[11]=x*i+R*k+z*b+g*V,x=n[12],R=n[13],z=n[14],g=n[15],e[12]=x*s+R*c+z*l+g*d,e[13]=x*r+R*y+z*M+g*m,e[14]=x*a+R*L+z*h+g*o,e[15]=x*i+R*k+z*b+g*V,e}static mul(e,t,n){return e}static translate(e,t,n){let s=n[0],r=n[1],a=n[2];if(t===e)e[12]=t[0]*s+t[4]*r+t[8]*a+t[12],e[13]=t[1]*s+t[5]*r+t[9]*a+t[13],e[14]=t[2]*s+t[6]*r+t[10]*a+t[14],e[15]=t[3]*s+t[7]*r+t[11]*a+t[15];else{let i=t[0],c=t[1],y=t[2],L=t[3],k=t[4],l=t[5],M=t[6],h=t[7],b=t[8],d=t[9],m=t[10],o=t[11];e[0]=i,e[1]=c,e[2]=y,e[3]=L,e[4]=k,e[5]=l,e[6]=M,e[7]=h,e[8]=b,e[9]=d,e[10]=m,e[11]=o,e[12]=i*s+k*r+b*a+t[12],e[13]=c*s+l*r+d*a+t[13],e[14]=y*s+M*r+m*a+t[14],e[15]=L*s+h*r+o*a+t[15]}return e}static scale(e,t,n){let s=n[0],r=n[1],a=n[2];return e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e[3]=t[3]*s,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}static rotate(e,t,n,s){let r=s[0],a=s[1],i=s[2],c=Math.sqrt(r*r+a*a+i*i);if(c<1e-6)return null;c=1/c,r*=c,a*=c,i*=c;let y=Math.sin(n),L=Math.cos(n),k=1-L,l=t[0],M=t[1],h=t[2],b=t[3],d=t[4],m=t[5],o=t[6],V=t[7],x=t[8],R=t[9],z=t[10],g=t[11],B=r*r*k+L,D=a*r*k+i*y,F=i*r*k-a*y,p=r*a*k-i*y,Y=a*a*k+L,I=i*a*k+r*y,P=r*i*k+a*y,Q=a*i*k-r*y,K=i*i*k+L;return e[0]=l*B+d*D+x*F,e[1]=M*B+m*D+R*F,e[2]=h*B+o*D+z*F,e[3]=b*B+V*D+g*F,e[4]=l*p+d*Y+x*I,e[5]=M*p+m*Y+R*I,e[6]=h*p+o*Y+z*I,e[7]=b*p+V*Y+g*I,e[8]=l*P+d*Q+x*K,e[9]=M*P+m*Q+R*K,e[10]=h*P+o*Q+z*K,e[11]=b*P+V*Q+g*K,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e}static rotateX(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[4],i=t[5],c=t[6],y=t[7],L=t[8],k=t[9],l=t[10],M=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*r+L*s,e[5]=i*r+k*s,e[6]=c*r+l*s,e[7]=y*r+M*s,e[8]=L*r-a*s,e[9]=k*r-i*s,e[10]=l*r-c*s,e[11]=M*r-y*s,e}static rotateY(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[0],i=t[1],c=t[2],y=t[3],L=t[8],k=t[9],l=t[10],M=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*r-L*s,e[1]=i*r-k*s,e[2]=c*r-l*s,e[3]=y*r-M*s,e[8]=a*s+L*r,e[9]=i*s+k*r,e[10]=c*s+l*r,e[11]=y*s+M*r,e}static rotateZ(e,t,n){let s=Math.sin(n),r=Math.cos(n),a=t[0],i=t[1],c=t[2],y=t[3],L=t[4],k=t[5],l=t[6],M=t[7];return t!==e&&(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[0]=a*r+L*s,e[1]=i*r+k*s,e[2]=c*r+l*s,e[3]=y*r+M*s,e[4]=L*r-a*s,e[5]=k*r-i*s,e[6]=l*r-c*s,e[7]=M*r-y*s,e}static fromTranslation(e,t){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]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}static fromScaling(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromRotation(e,t,n){let s=n[0],r=n[1],a=n[2],i=Math.sqrt(s*s+r*r+a*a);if(i<1e-6)return null;i=1/i,s*=i,r*=i,a*=i;let c=Math.sin(t),y=Math.cos(t),L=1-y;return e[0]=s*s*L+y,e[1]=r*s*L+a*c,e[2]=a*s*L-r*c,e[3]=0,e[4]=s*r*L-a*c,e[5]=r*r*L+y,e[6]=a*r*L+s*c,e[7]=0,e[8]=s*a*L+r*c,e[9]=r*a*L-s*c,e[10]=a*a*L+y,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromXRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=n,e[7]=0,e[8]=0,e[9]=-n,e[10]=s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromYRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static fromZRotation(e,t){let n=Math.sin(t),s=Math.cos(t);return e[0]=s,e[1]=n,e[2]=0,e[3]=0,e[4]=-n,e[5]=s,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}static fromRotationTranslation(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=s+s,y=r+r,L=a+a,k=s*c,l=s*y,M=s*L,h=r*y,b=r*L,d=a*L,m=i*c,o=i*y,V=i*L;return e[0]=1-(h+d),e[1]=l+V,e[2]=M-o,e[3]=0,e[4]=l-V,e[5]=1-(k+d),e[6]=b+m,e[7]=0,e[8]=M+o,e[9]=b-m,e[10]=1-(k+h),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}static fromQuat2(e,t){let n=-t[0],s=-t[1],r=-t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=n*n+s*s+r*r+a*a;return k>0?(E(S,$)[0]=(i*a+L*n+c*r-y*s)*2/k,E(S,$)[1]=(c*a+L*s+y*n-i*r)*2/k,E(S,$)[2]=(y*a+L*r+i*s-c*n)*2/k):(E(S,$)[0]=(i*a+L*n+c*r-y*s)*2,E(S,$)[1]=(c*a+L*s+y*n-i*r)*2,E(S,$)[2]=(y*a+L*r+i*s-c*n)*2),S.fromRotationTranslation(e,t,E(S,$)),e}static normalFromMat4(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=t[4],c=t[5],y=t[6],L=t[7],k=t[8],l=t[9],M=t[10],h=t[11],b=t[12],d=t[13],m=t[14],o=t[15],V=n*c-s*i,x=n*y-r*i,R=n*L-a*i,z=s*y-r*c,g=s*L-a*c,B=r*L-a*y,D=k*d-l*b,F=k*m-M*b,p=k*o-h*b,Y=l*m-M*d,I=l*o-h*d,P=M*o-h*m,Q=V*P-x*I+R*Y+z*p-g*F+B*D;return Q?(Q=1/Q,e[0]=(c*P-y*I+L*Y)*Q,e[1]=(y*p-i*P-L*F)*Q,e[2]=(i*I-c*p+L*D)*Q,e[3]=0,e[4]=(r*I-s*P-a*Y)*Q,e[5]=(n*P-r*p+a*F)*Q,e[6]=(s*p-n*I-a*D)*Q,e[7]=0,e[8]=(d*B-m*g+o*z)*Q,e[9]=(m*R-b*B-o*x)*Q,e[10]=(b*g-d*R+o*V)*Q,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):null}static normalFromMat4Fast(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=i*k-k*L,e[1]=c*y-y*k,e[2]=a*L-L*y,e[3]=0,e[4]=L*r-k*s,e[5]=k*n-y*r,e[6]=y*s-L*n,e[7]=0,e[8]=s*c-r*i,e[9]=r*a-n*c,e[10]=n*i-s*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static getTranslation(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}static getScaling(e,t){let n=t[0],s=t[1],r=t[2],a=t[4],i=t[5],c=t[6],y=t[8],L=t[9],k=t[10];return e[0]=Math.sqrt(n*n+s*s+r*r),e[1]=Math.sqrt(a*a+i*i+c*c),e[2]=Math.sqrt(y*y+L*L+k*k),e}static getRotation(e,t){S.getScaling(E(S,$),t);let n=1/E(S,$)[0],s=1/E(S,$)[1],r=1/E(S,$)[2],a=t[0]*n,i=t[1]*s,c=t[2]*r,y=t[4]*n,L=t[5]*s,k=t[6]*r,l=t[8]*n,M=t[9]*s,h=t[10]*r,b=a+L+h,d=0;return b>0?(d=Math.sqrt(b+1)*2,e[3]=.25*d,e[0]=(k-M)/d,e[1]=(l-c)/d,e[2]=(i-y)/d):a>L&&a>h?(d=Math.sqrt(1+a-L-h)*2,e[3]=(k-M)/d,e[0]=.25*d,e[1]=(i+y)/d,e[2]=(l+c)/d):L>h?(d=Math.sqrt(1+L-a-h)*2,e[3]=(l-c)/d,e[0]=(i+y)/d,e[1]=.25*d,e[2]=(k+M)/d):(d=Math.sqrt(1+h-a-L)*2,e[3]=(i-y)/d,e[0]=(l+c)/d,e[1]=(k+M)/d,e[2]=.25*d),e}static decompose(e,t,n,s){t[0]=s[12],t[1]=s[13],t[2]=s[14];let r=s[0],a=s[1],i=s[2],c=s[4],y=s[5],L=s[6],k=s[8],l=s[9],M=s[10];n[0]=Math.sqrt(r*r+a*a+i*i),n[1]=Math.sqrt(c*c+y*y+L*L),n[2]=Math.sqrt(k*k+l*l+M*M);let h=1/n[0],b=1/n[1],d=1/n[2],m=r*h,o=a*b,V=i*d,x=c*h,R=y*b,z=L*d,g=k*h,B=l*b,D=M*d,F=m+R+D,p=0;return F>0?(p=Math.sqrt(F+1)*2,e[3]=.25*p,e[0]=(z-B)/p,e[1]=(g-V)/p,e[2]=(o-x)/p):m>R&&m>D?(p=Math.sqrt(1+m-R-D)*2,e[3]=(z-B)/p,e[0]=.25*p,e[1]=(o+x)/p,e[2]=(g+V)/p):R>D?(p=Math.sqrt(1+R-m-D)*2,e[3]=(g-V)/p,e[0]=(o+x)/p,e[1]=.25*p,e[2]=(z+B)/p):(p=Math.sqrt(1+D-m-R)*2,e[3]=(o-x)/p,e[0]=(g+V)/p,e[1]=(z+B)/p,e[2]=.25*p),e}static fromRotationTranslationScale(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3],y=r+r,L=a+a,k=i+i,l=r*y,M=r*L,h=r*k,b=a*L,d=a*k,m=i*k,o=c*y,V=c*L,x=c*k,R=s[0],z=s[1],g=s[2];return e[0]=(1-(b+m))*R,e[1]=(M+x)*R,e[2]=(h-V)*R,e[3]=0,e[4]=(M-x)*z,e[5]=(1-(l+m))*z,e[6]=(d+o)*z,e[7]=0,e[8]=(h+V)*g,e[9]=(d-o)*g,e[10]=(1-(l+b))*g,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}static fromRotationTranslationScaleOrigin(e,t,n,s,r){let a=t[0],i=t[1],c=t[2],y=t[3],L=a+a,k=i+i,l=c+c,M=a*L,h=a*k,b=a*l,d=i*k,m=i*l,o=c*l,V=y*L,x=y*k,R=y*l,z=s[0],g=s[1],B=s[2],D=r[0],F=r[1],p=r[2],Y=(1-(d+o))*z,I=(h+R)*z,P=(b-x)*z,Q=(h-R)*g,K=(1-(M+o))*g,ee=(m+V)*g,te=(b+x)*B,Me=(m-V)*B,be=(1-(M+d))*B;return e[0]=Y,e[1]=I,e[2]=P,e[3]=0,e[4]=Q,e[5]=K,e[6]=ee,e[7]=0,e[8]=te,e[9]=Me,e[10]=be,e[11]=0,e[12]=n[0]+D-(Y*D+Q*F+te*p),e[13]=n[1]+F-(I*D+K*F+Me*p),e[14]=n[2]+p-(P*D+ee*F+be*p),e[15]=1,e}static fromQuat(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n+n,c=s+s,y=r+r,L=n*i,k=s*i,l=s*c,M=r*i,h=r*c,b=r*y,d=a*i,m=a*c,o=a*y;return e[0]=1-l-b,e[1]=k+o,e[2]=M-m,e[3]=0,e[4]=k-o,e[5]=1-L-b,e[6]=h+d,e[7]=0,e[8]=M+m,e[9]=h-d,e[10]=1-L-l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}static frustumNO(e,t,n,s,r,a,i=1/0){let c=1/(n-t),y=1/(r-s);if(e[0]=a*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*y,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(r+s)*y,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let L=1/(a-i);e[10]=(i+a)*L,e[14]=2*i*a*L}else e[10]=-1,e[14]=-2*a;return e}static frustum(e,t,n,s,r,a,i=1/0){return e}static frustumZO(e,t,n,s,r,a,i=1/0){let c=1/(n-t),y=1/(r-s);if(e[0]=a*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*y,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(r+s)*y,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let L=1/(a-i);e[10]=i*L,e[14]=i*a*L}else e[10]=-1,e[14]=-a;return e}static perspectiveNO(e,t,n,s,r=1/0){let a=1/Math.tan(t/2);if(e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,r!=null&&r!==1/0){let i=1/(s-r);e[10]=(r+s)*i,e[14]=2*r*s*i}else e[10]=-1,e[14]=-2*s;return e}static perspective(e,t,n,s,r=1/0){return e}static perspectiveZO(e,t,n,s,r=1/0){let a=1/Math.tan(t/2);if(e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,r!=null&&r!==1/0){let i=1/(s-r);e[10]=r*i,e[14]=r*s*i}else e[10]=-1,e[14]=-s;return e}static perspectiveFromFieldOfView(e,t,n,s){let r=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),i=Math.tan(t.leftDegrees*Math.PI/180),c=Math.tan(t.rightDegrees*Math.PI/180),y=2/(i+c),L=2/(r+a);return e[0]=y,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=L,e[6]=0,e[7]=0,e[8]=-((i-c)*y*.5),e[9]=(r-a)*L*.5,e[10]=s/(n-s),e[11]=-1,e[12]=0,e[13]=0,e[14]=s*n/(n-s),e[15]=0,e}static orthoNO(e,t,n,s,r,a,i){let c=1/(t-n),y=1/(s-r),L=1/(a-i);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*L,e[11]=0,e[12]=(t+n)*c,e[13]=(r+s)*y,e[14]=(i+a)*L,e[15]=1,e}static ortho(e,t,n,s,r,a,i){return e}static orthoZO(e,t,n,s,r,a,i){let c=1/(t-n),y=1/(s-r),L=1/(a-i);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=L,e[11]=0,e[12]=(t+n)*c,e[13]=(r+s)*y,e[14]=a*L,e[15]=1,e}static lookAt(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=s[0],y=s[1],L=s[2],k=n[0],l=n[1],M=n[2];if(Math.abs(r-k)<1e-6&&Math.abs(a-l)<1e-6&&Math.abs(i-M)<1e-6)return S.identity(e);let h=r-k,b=a-l,d=i-M,m=1/Math.sqrt(h*h+b*b+d*d);h*=m,b*=m,d*=m;let o=y*d-L*b,V=L*h-c*d,x=c*b-y*h;m=Math.sqrt(o*o+V*V+x*x),m?(m=1/m,o*=m,V*=m,x*=m):(o=0,V=0,x=0);let R=b*x-d*V,z=d*o-h*x,g=h*V-b*o;return m=Math.sqrt(R*R+z*z+g*g),m?(m=1/m,R*=m,z*=m,g*=m):(R=0,z=0,g=0),e[0]=o,e[1]=R,e[2]=h,e[3]=0,e[4]=V,e[5]=z,e[6]=b,e[7]=0,e[8]=x,e[9]=g,e[10]=d,e[11]=0,e[12]=-(o*r+V*a+x*i),e[13]=-(R*r+z*a+g*i),e[14]=-(h*r+b*a+d*i),e[15]=1,e}static targetTo(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=s[0],y=s[1],L=s[2],k=r-n[0],l=a-n[1],M=i-n[2],h=k*k+l*l+M*M;h>0&&(h=1/Math.sqrt(h),k*=h,l*=h,M*=h);let b=y*M-L*l,d=L*k-c*M,m=c*l-y*k;return h=b*b+d*d+m*m,h>0&&(h=1/Math.sqrt(h),b*=h,d*=h,m*=h),e[0]=b,e[1]=d,e[2]=m,e[3]=0,e[4]=l*m-M*d,e[5]=M*b-k*m,e[6]=k*d-l*b,e[7]=0,e[8]=k,e[9]=l,e[10]=M,e[11]=0,e[12]=r,e[13]=a,e[14]=i,e[15]=1,e}static frob(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8]+e[9]*e[9]+e[10]*e[10]+e[11]*e[11]+e[12]*e[12]+e[13]*e[13]+e[14]*e[14]+e[15]*e[15])}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}static sub(e,t,n){return e}static multiplyScalar(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}static multiplyScalarAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e[4]=t[4]+n[4]*s,e[5]=t[5]+n[5]*s,e[6]=t[6]+n[6]*s,e[7]=t[7]+n[7]*s,e[8]=t[8]+n[8]*s,e[9]=t[9]+n[9]*s,e[10]=t[10]+n[10]*s,e[11]=t[11]+n[11]*s,e[12]=t[12]+n[12]*s,e[13]=t[13]+n[13]*s,e[14]=t[14]+n[14]*s,e[15]=t[15]+n[15]*s,e}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=e[8],l=e[9],M=e[10],h=e[11],b=e[12],d=e[13],m=e[14],o=e[15],V=t[0],x=t[1],R=t[2],z=t[3],g=t[4],B=t[5],D=t[6],F=t[7],p=t[8],Y=t[9],I=t[10],P=t[11],Q=t[12],K=t[13],ee=t[14],te=t[15];return Math.abs(n-V)<=1e-6*Math.max(1,Math.abs(n),Math.abs(V))&&Math.abs(s-x)<=1e-6*Math.max(1,Math.abs(s),Math.abs(x))&&Math.abs(r-R)<=1e-6*Math.max(1,Math.abs(r),Math.abs(R))&&Math.abs(a-z)<=1e-6*Math.max(1,Math.abs(a),Math.abs(z))&&Math.abs(i-g)<=1e-6*Math.max(1,Math.abs(i),Math.abs(g))&&Math.abs(c-B)<=1e-6*Math.max(1,Math.abs(c),Math.abs(B))&&Math.abs(y-D)<=1e-6*Math.max(1,Math.abs(y),Math.abs(D))&&Math.abs(L-F)<=1e-6*Math.max(1,Math.abs(L),Math.abs(F))&&Math.abs(k-p)<=1e-6*Math.max(1,Math.abs(k),Math.abs(p))&&Math.abs(l-Y)<=1e-6*Math.max(1,Math.abs(l),Math.abs(Y))&&Math.abs(M-I)<=1e-6*Math.max(1,Math.abs(M),Math.abs(I))&&Math.abs(h-P)<=1e-6*Math.max(1,Math.abs(h),Math.abs(P))&&Math.abs(b-Q)<=1e-6*Math.max(1,Math.abs(b),Math.abs(Q))&&Math.abs(d-K)<=1e-6*Math.max(1,Math.abs(d),Math.abs(K))&&Math.abs(m-ee)<=1e-6*Math.max(1,Math.abs(m),Math.abs(ee))&&Math.abs(o-te)<=1e-6*Math.max(1,Math.abs(o),Math.abs(te))}static str(e){return`Mat4(${e.join(\", \")})`}};ae=new WeakMap,$=new WeakMap,Z(S,ae,new Float64Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])),Z(S,$,new Float64Array(3));var G=S;G.prototype.mul=G.prototype.multiply;G.sub=G.subtract;G.mul=G.multiply;G.frustum=G.frustumNO;G.perspective=G.perspectiveNO;G.ortho=G.orthoNO;var T=class A extends Float64Array{constructor(...e){switch(e.length){case 3:super(e);break;case 2:super(e[0],e[1],3);break;case 1:{let t=e[0];typeof t==\"number\"?super([t,t,t]):super(t,0,3);break}default:super(3);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get b(){return this[2]}set b(e){this[2]=e}get magnitude(){let e=this[0],t=this[1],n=this[2];return Math.sqrt(e*e+t*t+n*n)}get mag(){return this.magnitude}get squaredMagnitude(){let e=this[0],t=this[1],n=this[2];return e*e+t*t+n*n}get sqrMag(){return this.squaredMagnitude}get str(){return A.str(this)}copy(e){return this.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this[2]+=e[2],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this[2]-=e[2],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this[2]*=e[2],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this[2]/=e[2],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this[2]+=e[2]*t,this}distance(e){return A.distance(this,e)}dist(e){return 0}squaredDistance(e){return A.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this[2]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this[2]=1/this[2],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this[2]=Math.abs(this[2]),this}dot(e){return this[0]*e[0]+this[1]*e[1]+this[2]*e[2]}normalize(){return A.normalize(this,this)}static get BYTE_LENGTH(){return 3*Float64Array.BYTES_PER_ELEMENT}static create(){return new A}static clone(e){return new A(e)}static magnitude(e){let t=e[0],n=e[1],s=e[2];return Math.sqrt(t*t+n*n+s*s)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static fromValues(e,t,n){return new A(e,t,n)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}static set(e,t,n,s){return e[0]=t,e[1]=n,e[2]=s,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}static sub(e,t,n){return[0,0,0]}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}static mul(e,t,n){return[0,0,0]}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e}static div(e,t,n){return[0,0,0]}static ceil(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}static floor(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e}static distance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2];return Math.sqrt(n*n+s*s+r*r)}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2];return n*n+s*s+r*r}static sqrDist(e,t){return 0}static squaredLength(e){let t=e[0],n=e[1],s=e[2];return t*t+n*n+s*s}static sqrLen(e,t){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e}static normalize(e,t){let n=t[0],s=t[1],r=t[2],a=n*n+s*s+r*r;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}static cross(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[0],c=n[1],y=n[2];return e[0]=r*y-a*c,e[1]=a*i-s*y,e[2]=s*c-r*i,e}static lerp(e,t,n,s){let r=t[0],a=t[1],i=t[2];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e[2]=i+s*(n[2]-i),e}static slerp(e,t,n,s){let r=Math.acos(Math.min(Math.max(A.dot(t,n),-1),1)),a=Math.sin(r),i=Math.sin((1-s)*r)/a,c=Math.sin(s*r)/a;return e[0]=i*t[0]+c*n[0],e[1]=i*t[1]+c*n[1],e[2]=i*t[2]+c*n[2],e}static hermite(e,t,n,s,r,a){let i=a*a,c=i*(2*a-3)+1,y=i*(a-2)+a,L=i*(a-1),k=i*(3-2*a);return e[0]=t[0]*c+n[0]*y+s[0]*L+r[0]*k,e[1]=t[1]*c+n[1]*y+s[1]*L+r[1]*k,e[2]=t[2]*c+n[2]*y+s[2]*L+r[2]*k,e}static bezier(e,t,n,s,r,a){let i=1-a,c=i*i,y=a*a,L=c*i,k=3*a*c,l=3*y*i,M=y*a;return e[0]=t[0]*L+n[0]*k+s[0]*l+r[0]*M,e[1]=t[1]*L+n[1]*k+s[1]*l+r[1]*M,e[2]=t[2]*L+n[2]*k+s[2]*l+r[2]*M,e}static transformMat4(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[3]*s+n[7]*r+n[11]*a+n[15]||1;return e[0]=(n[0]*s+n[4]*r+n[8]*a+n[12])/i,e[1]=(n[1]*s+n[5]*r+n[9]*a+n[13])/i,e[2]=(n[2]*s+n[6]*r+n[10]*a+n[14])/i,e}static transformMat3(e,t,n){let s=t[0],r=t[1],a=t[2];return e[0]=s*n[0]+r*n[3]+a*n[6],e[1]=s*n[1]+r*n[4]+a*n[7],e[2]=s*n[2]+r*n[5]+a*n[8],e}static transformQuat(e,t,n){let s=n[0],r=n[1],a=n[2],i=n[3]*2,c=t[0],y=t[1],L=t[2],k=r*L-a*y,l=a*c-s*L,M=s*y-r*c,h=(r*M-a*l)*2,b=(a*k-s*M)*2,d=(s*l-r*k)*2;return e[0]=c+k*i+h,e[1]=y+l*i+b,e[2]=L+M*i+d,e}static rotateX(e,t,n,s){let r=n[1],a=n[2],i=t[1]-r,c=t[2]-a;return e[0]=t[0],e[1]=i*Math.cos(s)-c*Math.sin(s)+r,e[2]=i*Math.sin(s)+c*Math.cos(s)+a,e}static rotateY(e,t,n,s){let r=n[0],a=n[2],i=t[0]-r,c=t[2]-a;return e[0]=c*Math.sin(s)+i*Math.cos(s)+r,e[1]=t[1],e[2]=c*Math.cos(s)-i*Math.sin(s)+a,e}static rotateZ(e,t,n,s){let r=n[0],a=n[1],i=t[0]-r,c=t[1]-a;return e[0]=i*Math.cos(s)-c*Math.sin(s)+r,e[1]=i*Math.sin(s)+c*Math.cos(s)+a,e[2]=n[2],e}static angle(e,t){let n=e[0],s=e[1],r=e[2],a=t[0],i=t[1],c=t[2],y=Math.sqrt((n*n+s*s+r*r)*(a*a+i*i+c*c)),L=y&&A.dot(e,t)/y;return Math.acos(Math.min(Math.max(L,-1),1))}static zero(e){return e[0]=0,e[1]=0,e[2]=0,e}static str(e){return`Vec3(${e.join(\", \")})`}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=t[0],i=t[1],c=t[2];return Math.abs(n-a)<=1e-6*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(s-i)<=1e-6*Math.max(1,Math.abs(s),Math.abs(i))&&Math.abs(r-c)<=1e-6*Math.max(1,Math.abs(r),Math.abs(c))}};T.prototype.sub=T.prototype.subtract;T.prototype.mul=T.prototype.multiply;T.prototype.div=T.prototype.divide;T.prototype.dist=T.prototype.distance;T.prototype.sqrDist=T.prototype.squaredDistance;T.sub=T.subtract;T.mul=T.multiply;T.div=T.divide;T.dist=T.distance;T.sqrDist=T.squaredDistance;T.sqrLen=T.squaredLength;T.mag=T.magnitude;T.length=T.magnitude;T.len=T.magnitude;var q=class A extends Float64Array{constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:{let t=e[0];typeof t==\"number\"?super([t,t,t,t]):super(t,0,4);break}default:super(4);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get w(){return this[3]}set w(e){this[3]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get b(){return this[2]}set b(e){this[2]=e}get a(){return this[3]}set a(e){this[3]=e}get magnitude(){let e=this[0],t=this[1],n=this[2],s=this[3];return Math.sqrt(e*e+t*t+n*n+s*s)}get mag(){return this.magnitude}get str(){return A.str(this)}copy(e){return super.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this[2]+=e[2],this[3]+=e[3],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this[2]-=e[2],this[3]-=e[3],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this[2]*=e[2],this[3]*=e[3],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this[2]/=e[2],this[3]/=e[3],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this[3]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this[2]+=e[2]*t,this[3]+=e[3]*t,this}distance(e){return A.distance(this,e)}dist(e){return 0}squaredDistance(e){return A.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this[2]*=-1,this[3]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this[2]=1/this[2],this[3]=1/this[3],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this[2]=Math.abs(this[2]),this[3]=Math.abs(this[3]),this}dot(e){return this[0]*e[0]+this[1]*e[1]+this[2]*e[2]+this[3]*e[3]}normalize(){return A.normalize(this,this)}static get BYTE_LENGTH(){return 4*Float64Array.BYTES_PER_ELEMENT}static create(){return new A}static clone(e){return new A(e)}static fromValues(e,t,n,s){return new A(e,t,n,s)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static set(e,t,n,s,r){return e[0]=t,e[1]=n,e[2]=s,e[3]=r,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}static sub(e,t,n){return e}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e[3]=t[3]*n[3],e}static mul(e,t,n){return e}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e[3]=t[3]/n[3],e}static div(e,t,n){return e}static ceil(e,t){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}static floor(e,t){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}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e[3]=Math.min(t[3],n[3]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e[3]=Math.max(t[3],n[3]),e}static round(e,t){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}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e[2]=t[2]+n[2]*s,e[3]=t[3]+n[3]*s,e}static distance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2],a=t[3]-e[3];return Math.hypot(n,s,r,a)}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1],r=t[2]-e[2],a=t[3]-e[3];return n*n+s*s+r*r+a*a}static sqrDist(e,t){return 0}static magnitude(e){let t=e[0],n=e[1],s=e[2],r=e[3];return Math.sqrt(t*t+n*n+s*s+r*r)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){let t=e[0],n=e[1],s=e[2],r=e[3];return t*t+n*n+s*s+r*r}static sqrLen(e){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e[3]=Math.abs(t[3]),e}static normalize(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*n+s*s+r*r+a*a;return i>0&&(i=1/Math.sqrt(i)),e[0]=n*i,e[1]=s*i,e[2]=r*i,e[3]=a*i,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}static cross(e,t,n,s){let r=n[0]*s[1]-n[1]*s[0],a=n[0]*s[2]-n[2]*s[0],i=n[0]*s[3]-n[3]*s[0],c=n[1]*s[2]-n[2]*s[1],y=n[1]*s[3]-n[3]*s[1],L=n[2]*s[3]-n[3]*s[2],k=t[0],l=t[1],M=t[2],h=t[3];return e[0]=l*L-M*y+h*c,e[1]=-(k*L)+M*i-h*a,e[2]=k*y-l*i+h*r,e[3]=-(k*c)+l*a-M*r,e}static lerp(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e[2]=i+s*(n[2]-i),e[3]=c+s*(n[3]-c),e}static transformMat4(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3];return e[0]=n[0]*s+n[4]*r+n[8]*a+n[12]*i,e[1]=n[1]*s+n[5]*r+n[9]*a+n[13]*i,e[2]=n[2]*s+n[6]*r+n[10]*a+n[14]*i,e[3]=n[3]*s+n[7]*r+n[11]*a+n[15]*i,e}static transformQuat(e,t,n){let s=t[0],r=t[1],a=t[2],i=n[0],c=n[1],y=n[2],L=n[3],k=L*s+c*a-y*r,l=L*r+y*s-i*a,M=L*a+i*r-c*s,h=-i*s-c*r-y*a;return e[0]=k*L+h*-i+l*-y-M*-c,e[1]=l*L+h*-c+M*-i-k*-y,e[2]=M*L+h*-y+k*-c-l*-i,e[3]=t[3],e}static zero(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}static str(e){return`Vec4(${e.join(\", \")})`}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=t[0],c=t[1],y=t[2],L=t[3];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(a-L)<=1e-6*Math.max(1,Math.abs(a),Math.abs(L))}};q.prototype.sub=q.prototype.subtract;q.prototype.mul=q.prototype.multiply;q.prototype.div=q.prototype.divide;q.prototype.dist=q.prototype.distance;q.prototype.sqrDist=q.prototype.squaredDistance;q.sub=q.subtract;q.mul=q.multiply;q.div=q.divide;q.dist=q.distance;q.sqrDist=q.squaredDistance;q.sqrLen=q.squaredLength;q.mag=q.magnitude;q.length=q.magnitude;q.len=q.magnitude;var ke,ie,ce,W,U,le,he,f=class f extends Float64Array{constructor(...e){switch(e.length){case 4:super(e);break;case 2:super(e[0],e[1],4);break;case 1:{let t=e[0];typeof t==\"number\"?super([t,t,t,t]):super(t,0,4);break}default:super(4),this[3]=1;break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get z(){return this[2]}set z(e){this[2]=e}get w(){return this[3]}set w(e){this[3]=e}get magnitude(){let e=this[0],t=this[1],n=this[2],s=this[3];return Math.sqrt(e*e+t*t+n*n+s*s)}get mag(){return this.magnitude}get str(){return f.str(this)}copy(e){return super.set(e),this}identity(){return this[0]=0,this[1]=0,this[2]=0,this[3]=1,this}multiply(e){return f.multiply(this,this,e)}mul(e){return this}rotateX(e){return f.rotateX(this,this,e)}rotateY(e){return f.rotateY(this,this,e)}rotateZ(e){return f.rotateZ(this,this,e)}invert(){return f.invert(this,this)}scale(e){return this[0]*=e,this[1]*=e,this[2]*=e,this[3]*=e,this}dot(e){return f.dot(this,e)}static get BYTE_LENGTH(){return 4*Float64Array.BYTES_PER_ELEMENT}static create(){return new f}static identity(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}static setAxisAngle(e,t,n){n*=.5;let s=Math.sin(n);return e[0]=s*t[0],e[1]=s*t[1],e[2]=s*t[2],e[3]=Math.cos(n),e}static getAxisAngle(e,t){let n=Math.acos(t[3])*2,s=Math.sin(n/2);return s>1e-6?(e[0]=t[0]/s,e[1]=t[1]/s,e[2]=t[2]/s):(e[0]=1,e[1]=0,e[2]=0),n}static getAngle(e,t){let n=f.dot(e,t);return Math.acos(2*n*n-1)}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*k+i*c+r*L-a*y,e[1]=r*k+i*y+a*c-s*L,e[2]=a*k+i*L+s*y-r*c,e[3]=i*k-s*c-r*y-a*L,e}static rotateX(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+i*c,e[1]=r*y+a*c,e[2]=a*y-r*c,e[3]=i*y-s*c,e}static rotateY(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y-a*c,e[1]=r*y+i*c,e[2]=a*y+s*c,e[3]=i*y-r*c,e}static rotateZ(e,t,n){n*=.5;let s=t[0],r=t[1],a=t[2],i=t[3],c=Math.sin(n),y=Math.cos(n);return e[0]=s*y+r*c,e[1]=r*y-s*c,e[2]=a*y+i*c,e[3]=i*y-a*c,e}static calculateW(e,t){let n=t[0],s=t[1],r=t[2];return e[0]=n,e[1]=s,e[2]=r,e[3]=Math.sqrt(Math.abs(1-n*n-s*s-r*r)),e}static exp(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=Math.sqrt(n*n+s*s+r*r),c=Math.exp(a),y=i>0?c*Math.sin(i)/i:0;return e[0]=n*y,e[1]=s*y,e[2]=r*y,e[3]=c*Math.cos(i),e}static ln(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=Math.sqrt(n*n+s*s+r*r),c=i>0?Math.atan2(i,a)/i:0;return e[0]=n*c,e[1]=s*c,e[2]=r*c,e[3]=.5*Math.log(n*n+s*s+r*r+a*a),e}static pow(e,t,n){return f.ln(e,t),f.scale(e,e,n),f.exp(e,e),e}static slerp(e,t,n,s){let r=t[0],a=t[1],i=t[2],c=t[3],y=n[0],L=n[1],k=n[2],l=n[3],M,h,b=r*y+a*L+i*k+c*l;if(b<0&&(b=-b,y=-y,L=-L,k=-k,l=-l),1-b>1e-6){let d=Math.acos(b),m=Math.sin(d);M=Math.sin((1-s)*d)/m,h=Math.sin(s*d)/m}else M=1-s,h=s;return e[0]=M*r+h*y,e[1]=M*a+h*L,e[2]=M*i+h*k,e[3]=M*c+h*l,e}static invert(e,t){let n=t[0],s=t[1],r=t[2],a=t[3],i=n*n+s*s+r*r+a*a,c=i?1/i:0;return e[0]=-n*c,e[1]=-s*c,e[2]=-r*c,e[3]=a*c,e}static conjugate(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}static fromMat3(e,t){let n=t[0]+t[4]+t[8],s;if(n>0)s=Math.sqrt(n+1),e[3]=.5*s,s=.5/s,e[0]=(t[5]-t[7])*s,e[1]=(t[6]-t[2])*s,e[2]=(t[1]-t[3])*s;else{let r=0;t[4]>t[0]&&(r=1),t[8]>t[r*3+r]&&(r=2);let a=(r+1)%3,i=(r+2)%3;s=Math.sqrt(t[r*3+r]-t[a*3+a]-t[i*3+i]+1),e[r]=.5*s,s=.5/s,e[3]=(t[a*3+i]-t[i*3+a])*s,e[a]=(t[a*3+r]+t[r*3+a])*s,e[i]=(t[i*3+r]+t[r*3+i])*s}return e}static fromEuler(e,t,n,s,r=E(f,ke)){let a=.5*Math.PI/180;t*=a,n*=a,s*=a;let i=Math.sin(t),c=Math.cos(t),y=Math.sin(n),L=Math.cos(n),k=Math.sin(s),l=Math.cos(s);switch(r){case\"xyz\":e[0]=i*L*l+c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l-i*y*k;break;case\"xzy\":e[0]=i*L*l-c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l+i*y*k;break;case\"yxz\":e[0]=i*L*l+c*y*k,e[1]=c*y*l-i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l+i*y*k;break;case\"yzx\":e[0]=i*L*l+c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l-i*y*k;break;case\"zxy\":e[0]=i*L*l-c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k+i*y*l,e[3]=c*L*l-i*y*k;break;case\"zyx\":e[0]=i*L*l-c*y*k,e[1]=c*y*l+i*L*k,e[2]=c*L*k-i*y*l,e[3]=c*L*l+i*y*k;break;default:throw new Error(`Unknown angle order ${r}`)}return e}static str(e){return`Quat(${e.join(\", \")})`}static clone(e){return new f(e)}static fromValues(e,t,n,s){return new f(e,t,n,s)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static set(e,t,n,s,r){return e}static add(e,t,n){return e}static mul(e,t,n){return e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}static lerp(e,t,n,s){return e}static magnitude(e){return 0}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){return 0}static sqrLen(e){return 0}static normalize(e,t){return e}static exactEquals(e,t){return!1}static equals(e,t){return!1}static rotationTo(e,t,n){let s=T.dot(t,n);return s<-.999999?(T.cross(E(f,U),E(f,le),t),T.mag(E(f,U))<1e-6&&T.cross(E(f,U),E(f,he),t),T.normalize(E(f,U),E(f,U)),f.setAxisAngle(e,E(f,U),Math.PI),e):s>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(T.cross(E(f,U),t,n),e[0]=E(f,U)[0],e[1]=E(f,U)[1],e[2]=E(f,U)[2],e[3]=1+s,f.normalize(e,e))}static sqlerp(e,t,n,s,r,a){return f.slerp(E(f,ie),t,r,a),f.slerp(E(f,ce),n,s,a),f.slerp(e,E(f,ie),E(f,ce),2*a*(1-a)),e}static setAxes(e,t,n,s){return E(f,W)[0]=n[0],E(f,W)[3]=n[1],E(f,W)[6]=n[2],E(f,W)[1]=s[0],E(f,W)[4]=s[1],E(f,W)[7]=s[2],E(f,W)[2]=-t[0],E(f,W)[5]=-t[1],E(f,W)[8]=-t[2],f.normalize(e,f.fromMat3(e,E(f,W)))}};ke=new WeakMap,ie=new WeakMap,ce=new WeakMap,W=new WeakMap,U=new WeakMap,le=new WeakMap,he=new WeakMap,Z(f,ke,\"zyx\"),Z(f,ie,new Float64Array(4)),Z(f,ce,new Float64Array(4)),Z(f,W,new Float64Array(9)),Z(f,U,new Float64Array(3)),Z(f,le,new Float64Array([1,0,0])),Z(f,he,new Float64Array([0,1,0]));var O=f;O.set=q.set;O.add=q.add;O.lerp=q.lerp;O.normalize=q.normalize;O.squaredLength=q.squaredLength;O.sqrLen=q.squaredLength;O.exactEquals=q.exactEquals;O.equals=q.equals;O.magnitude=q.magnitude;O.prototype.mul=O.prototype.multiply;O.mul=O.multiply;O.mag=O.magnitude;O.length=O.magnitude;O.len=O.magnitude;var ye,Le,j=class j extends Float64Array{constructor(...e){switch(e.length){case 8:super(e);break;case 2:super(e[0],e[1],8);break;case 1:{let t=e[0];typeof t==\"number\"?super([t,t,t,t,t,t,t,t]):super(t,0,8);break}default:super(8),this[3]=1;break}}get str(){return j.str(this)}copy(e){return super.set(e),this}static get BYTE_LENGTH(){return 8*Float64Array.BYTES_PER_ELEMENT}static create(){return new j}static clone(e){return new j(e)}static fromValues(e,t,n,s,r,a,i,c){return new j(e,t,n,s,r,a,i,c)}static fromRotationTranslationValues(e,t,n,s,r,a,i){let c=r*.5,y=a*.5,L=i*.5;return new j(e,t,n,s,c*s+y*n-L*t,y*s+L*e-c*n,L*s+c*t-y*e,-c*e-y*t-L*n)}static fromRotationTranslation(e,t,n){let s=n[0]*.5,r=n[1]*.5,a=n[2]*.5,i=t[0],c=t[1],y=t[2],L=t[3];return e[0]=i,e[1]=c,e[2]=y,e[3]=L,e[4]=s*L+r*y-a*c,e[5]=r*L+a*i-s*y,e[6]=a*L+s*c-r*i,e[7]=-s*i-r*c-a*y,e}static fromTranslation(e,t){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0]*.5,e[5]=t[1]*.5,e[6]=t[2]*.5,e[7]=0,e}static fromRotation(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=0,e[5]=0,e[6]=0,e[7]=0,e}static fromMat4(e,t){return G.getRotation(E(j,ye),t),G.getTranslation(E(j,Le),t),j.fromRotationTranslation(e,E(j,ye),E(j,Le))}static copy(e,t){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}static identity(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e}static set(e,t,n,s,r,a,i,c,y){return e[0]=t,e[1]=n,e[2]=s,e[3]=r,e[4]=a,e[5]=i,e[6]=c,e[7]=y,e}static getReal(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static getDual(e,t){return e[0]=t[4],e[1]=t[5],e[2]=t[6],e[3]=t[7],e}static setReal(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}static setDual(e,t){return e[4]=t[0],e[5]=t[1],e[6]=t[2],e[7]=t[3],e}static getTranslation(e,t){let n=t[4],s=t[5],r=t[6],a=t[7],i=-t[0],c=-t[1],y=-t[2],L=t[3];return e[0]=(n*L+a*i+s*y-r*c)*2,e[1]=(s*L+a*c+r*i-n*y)*2,e[2]=(r*L+a*y+n*c-s*i)*2,e}static translate(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0]*.5,y=n[1]*.5,L=n[2]*.5,k=t[4],l=t[5],M=t[6],h=t[7];return e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=i*c+r*L-a*y+k,e[5]=i*y+a*c-s*L+l,e[6]=i*L+s*y-r*c+M,e[7]=-s*c-r*y-a*L+h,e}static rotateX(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,M=y*i+k*r+L*s-c*a,h=L*i+k*a+c*r-y*s,b=k*i-c*s-y*r-L*a;return O.rotateX(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+b*s+M*a-h*r,e[5]=M*i+b*r+h*s-l*a,e[6]=h*i+b*a+l*r-M*s,e[7]=b*i-l*s-M*r-h*a,e}static rotateY(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,M=y*i+k*r+L*s-c*a,h=L*i+k*a+c*r-y*s,b=k*i-c*s-y*r-L*a;return O.rotateY(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+b*s+M*a-h*r,e[5]=M*i+b*r+h*s-l*a,e[6]=h*i+b*a+l*r-M*s,e[7]=b*i-l*s-M*r-h*a,e}static rotateZ(e,t,n){let s=-t[0],r=-t[1],a=-t[2],i=t[3],c=t[4],y=t[5],L=t[6],k=t[7],l=c*i+k*s+y*a-L*r,M=y*i+k*r+L*s-c*a,h=L*i+k*a+c*r-y*s,b=k*i-c*s-y*r-L*a;return O.rotateZ(e,t,n),s=e[0],r=e[1],a=e[2],i=e[3],e[4]=l*i+b*s+M*a-h*r,e[5]=M*i+b*r+h*s-l*a,e[6]=h*i+b*a+l*r-M*s,e[7]=b*i-l*s-M*r-h*a,e}static rotateByQuatAppend(e,t,n){let s=n[0],r=n[1],a=n[2],i=n[3],c=t[0],y=t[1],L=t[2],k=t[3];return e[0]=c*i+k*s+y*a-L*r,e[1]=y*i+k*r+L*s-c*a,e[2]=L*i+k*a+c*r-y*s,e[3]=k*i-c*s-y*r-L*a,c=t[4],y=t[5],L=t[6],k=t[7],e[4]=c*i+k*s+y*a-L*r,e[5]=y*i+k*r+L*s-c*a,e[6]=L*i+k*a+c*r-y*s,e[7]=k*i-c*s-y*r-L*a,e}static rotateByQuatPrepend(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[0],y=n[1],L=n[2],k=n[3];return e[0]=s*k+i*c+r*L-a*y,e[1]=r*k+i*y+a*c-s*L,e[2]=a*k+i*L+s*y-r*c,e[3]=i*k-s*c-r*y-a*L,c=n[4],y=n[5],L=n[6],k=n[7],e[4]=s*k+i*c+r*L-a*y,e[5]=r*k+i*y+a*c-s*L,e[6]=a*k+i*L+s*y-r*c,e[7]=i*k-s*c-r*y-a*L,e}static rotateAroundAxis(e,t,n,s){if(Math.abs(s)<1e-6)return j.copy(e,t);let r=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);s*=.5;let a=Math.sin(s),i=a*n[0]/r,c=a*n[1]/r,y=a*n[2]/r,L=Math.cos(s),k=t[0],l=t[1],M=t[2],h=t[3];e[0]=k*L+h*i+l*y-M*c,e[1]=l*L+h*c+M*i-k*y,e[2]=M*L+h*y+k*c-l*i,e[3]=h*L-k*i-l*c-M*y;let b=t[4],d=t[5],m=t[6],o=t[7];return e[4]=b*L+o*i+d*y-m*c,e[5]=d*L+o*c+m*i-b*y,e[6]=m*L+o*y+b*c-d*i,e[7]=o*L-b*i-d*c-m*y,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e}static multiply(e,t,n){let s=t[0],r=t[1],a=t[2],i=t[3],c=n[4],y=n[5],L=n[6],k=n[7],l=t[4],M=t[5],h=t[6],b=t[7],d=n[0],m=n[1],o=n[2],V=n[3];return e[0]=s*V+i*d+r*o-a*m,e[1]=r*V+i*m+a*d-s*o,e[2]=a*V+i*o+s*m-r*d,e[3]=i*V-s*d-r*m-a*o,e[4]=s*k+i*c+r*L-a*y+l*V+b*d+M*o-h*m,e[5]=r*k+i*y+a*c-s*L+M*V+b*m+h*d-l*o,e[6]=a*k+i*L+s*y-r*c+h*V+b*o+l*m-M*d,e[7]=i*k-s*c-r*y-a*L+b*V-l*d-M*m-h*o,e}static mul(e,t,n){return e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e}static dot(e,t){return 0}static lerp(e,t,n,s){let r=1-s;return j.dot(t,n)<0&&(s=-s),e[0]=t[0]*r+n[0]*s,e[1]=t[1]*r+n[1]*s,e[2]=t[2]*r+n[2]*s,e[3]=t[3]*r+n[3]*s,e[4]=t[4]*r+n[4]*s,e[5]=t[5]*r+n[5]*s,e[6]=t[6]*r+n[6]*s,e[7]=t[7]*r+n[7]*s,e}static invert(e,t){let n=j.squaredLength(t);return e[0]=-t[0]/n,e[1]=-t[1]/n,e[2]=-t[2]/n,e[3]=t[3]/n,e[4]=-t[4]/n,e[5]=-t[5]/n,e[6]=-t[6]/n,e[7]=t[7]/n,e}static conjugate(e,t){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}static magnitude(e){return 0}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){return 0}static sqrLen(e){return 0}static normalize(e,t){let n=j.squaredLength(t);if(n>0){n=Math.sqrt(n);let s=t[0]/n,r=t[1]/n,a=t[2]/n,i=t[3]/n,c=t[4],y=t[5],L=t[6],k=t[7],l=s*c+r*y+a*L+i*k;e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=(c-s*l)/n,e[5]=(y-r*l)/n,e[6]=(L-a*l)/n,e[7]=(k-i*l)/n}return e}static str(e){return`Quat2(${e.join(\", \")})`}static exactEquals(e,t){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]}static equals(e,t){let n=e[0],s=e[1],r=e[2],a=e[3],i=e[4],c=e[5],y=e[6],L=e[7],k=t[0],l=t[1],M=t[2],h=t[3],b=t[4],d=t[5],m=t[6],o=t[7];return Math.abs(n-k)<=1e-6*Math.max(1,Math.abs(n),Math.abs(k))&&Math.abs(s-l)<=1e-6*Math.max(1,Math.abs(s),Math.abs(l))&&Math.abs(r-M)<=1e-6*Math.max(1,Math.abs(r),Math.abs(M))&&Math.abs(a-h)<=1e-6*Math.max(1,Math.abs(a),Math.abs(h))&&Math.abs(i-b)<=1e-6*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(c-d)<=1e-6*Math.max(1,Math.abs(c),Math.abs(d))&&Math.abs(y-m)<=1e-6*Math.max(1,Math.abs(y),Math.abs(m))&&Math.abs(L-o)<=1e-6*Math.max(1,Math.abs(L),Math.abs(o))}};ye=new WeakMap,Le=new WeakMap,Z(j,ye,new Float64Array(4)),Z(j,Le,new Float64Array(3));var J=j;J.dot=O.dot;J.squaredLength=O.squaredLength;J.sqrLen=O.squaredLength;J.mag=O.magnitude;J.length=O.magnitude;J.len=O.magnitude;J.mul=J.multiply;var N=class A extends Float64Array{constructor(...e){switch(e.length){case 2:{let t=e[0];typeof t==\"number\"?super([t,e[1]]):super(t,e[1],2);break}case 1:{let t=e[0];typeof t==\"number\"?super([t,t]):super(t,0,2);break}default:super(2);break}}get x(){return this[0]}set x(e){this[0]=e}get y(){return this[1]}set y(e){this[1]=e}get r(){return this[0]}set r(e){this[0]=e}get g(){return this[1]}set g(e){this[1]=e}get magnitude(){return Math.hypot(this[0],this[1])}get mag(){return this.magnitude}get squaredMagnitude(){let e=this[0],t=this[1];return e*e+t*t}get sqrMag(){return this.squaredMagnitude}get str(){return A.str(this)}copy(e){return this.set(e),this}add(e){return this[0]+=e[0],this[1]+=e[1],this}subtract(e){return this[0]-=e[0],this[1]-=e[1],this}sub(e){return this}multiply(e){return this[0]*=e[0],this[1]*=e[1],this}mul(e){return this}divide(e){return this[0]/=e[0],this[1]/=e[1],this}div(e){return this}scale(e){return this[0]*=e,this[1]*=e,this}scaleAndAdd(e,t){return this[0]+=e[0]*t,this[1]+=e[1]*t,this}distance(e){return A.distance(this,e)}dist(e){return 0}squaredDistance(e){return A.squaredDistance(this,e)}sqrDist(e){return 0}negate(){return this[0]*=-1,this[1]*=-1,this}invert(){return this[0]=1/this[0],this[1]=1/this[1],this}abs(){return this[0]=Math.abs(this[0]),this[1]=Math.abs(this[1]),this}dot(e){return this[0]*e[0]+this[1]*e[1]}normalize(){return A.normalize(this,this)}static get BYTE_LENGTH(){return 2*Float64Array.BYTES_PER_ELEMENT}static create(){return new A}static clone(e){return new A(e)}static fromValues(e,t){return new A(e,t)}static copy(e,t){return e[0]=t[0],e[1]=t[1],e}static set(e,t,n){return e[0]=t,e[1]=n,e}static add(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}static subtract(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}static sub(e,t,n){return[0,0]}static multiply(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e}static mul(e,t,n){return[0,0]}static divide(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e}static div(e,t,n){return[0,0]}static ceil(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}static floor(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}static min(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e}static max(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e}static round(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}static scale(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}static scaleAndAdd(e,t,n,s){return e[0]=t[0]+n[0]*s,e[1]=t[1]+n[1]*s,e}static distance(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1])}static dist(e,t){return 0}static squaredDistance(e,t){let n=t[0]-e[0],s=t[1]-e[1];return n*n+s*s}static sqrDist(e,t){return 0}static magnitude(e){let t=e[0],n=e[1];return Math.sqrt(t*t+n*n)}static mag(e){return 0}static length(e){return 0}static len(e){return 0}static squaredLength(e){let t=e[0],n=e[1];return t*t+n*n}static sqrLen(e,t){return 0}static negate(e,t){return e[0]=-t[0],e[1]=-t[1],e}static inverse(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}static abs(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e}static normalize(e,t){let n=t[0],s=t[1],r=n*n+s*s;return r>0&&(r=1/Math.sqrt(r)),e[0]=t[0]*r,e[1]=t[1]*r,e}static dot(e,t){return e[0]*t[0]+e[1]*t[1]}static cross(e,t,n){let s=t[0]*n[1]-t[1]*n[0];return e[0]=e[1]=0,e[2]=s,e}static lerp(e,t,n,s){let r=t[0],a=t[1];return e[0]=r+s*(n[0]-r),e[1]=a+s*(n[1]-a),e}static transformMat2(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[2]*r,e[1]=n[1]*s+n[3]*r,e}static transformMat2d(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[2]*r+n[4],e[1]=n[1]*s+n[3]*r+n[5],e}static transformMat3(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[3]*r+n[6],e[1]=n[1]*s+n[4]*r+n[7],e}static transformMat4(e,t,n){let s=t[0],r=t[1];return e[0]=n[0]*s+n[4]*r+n[12],e[1]=n[1]*s+n[5]*r+n[13],e}static rotate(e,t,n,s){let r=t[0]-n[0],a=t[1]-n[1],i=Math.sin(s),c=Math.cos(s);return e[0]=r*c-a*i+n[0],e[1]=r*i+a*c+n[1],e}static angle(e,t){let n=e[0],s=e[1],r=t[0],a=t[1],i=Math.sqrt(n*n+s*s)*Math.sqrt(r*r+a*a),c=i&&(n*r+s*a)/i;return Math.acos(Math.min(Math.max(c,-1),1))}static zero(e){return e[0]=0,e[1]=0,e}static exactEquals(e,t){return e[0]===t[0]&&e[1]===t[1]}static equals(e,t){let n=e[0],s=e[1],r=t[0],a=t[1];return Math.abs(n-r)<=1e-6*Math.max(1,Math.abs(n),Math.abs(r))&&Math.abs(s-a)<=1e-6*Math.max(1,Math.abs(s),Math.abs(a))}static str(e){return`Vec2(${e.join(\", \")})`}};N.prototype.sub=N.prototype.subtract;N.prototype.mul=N.prototype.multiply;N.prototype.div=N.prototype.divide;N.prototype.dist=N.prototype.distance;N.prototype.sqrDist=N.prototype.squaredDistance;N.sub=N.subtract;N.mul=N.multiply;N.div=N.divide;N.dist=N.distance;N.sqrDist=N.squaredDistance;N.sqrLen=N.squaredLength;N.mag=N.magnitude;N.length=N.magnitude;N.len=N.magnitude;var me=!1;function ve(){if(me)return;let A=[\"xx\",\"xy\",\"yx\",\"yy\",\"xxx\",\"xxy\",\"xyx\",\"xyy\",\"yxx\",\"yxy\",\"yyx\",\"yyy\",\"xxxx\",\"xxxy\",\"xxyx\",\"xxyy\",\"xyxx\",\"xyxy\",\"xyyx\",\"xyyy\",\"yxxx\",\"yxxy\",\"yxyx\",\"yxyy\",\"yyxx\",\"yyxy\",\"yyyx\",\"yyyy\",\"rr\",\"rg\",\"gr\",\"gg\",\"rrr\",\"rrg\",\"rgr\",\"rgg\",\"grr\",\"grg\",\"ggr\",\"ggg\",\"rrrr\",\"rrrg\",\"rrgr\",\"rrgg\",\"rgrr\",\"rgrg\",\"rggr\",\"rggg\",\"grrr\",\"grrg\",\"grgr\",\"grgg\",\"ggrr\",\"ggrg\",\"gggr\",\"gggg\"],e=[\"xz\",\"yz\",\"zx\",\"zy\",\"zz\",\"xxz\",\"xyz\",\"xzx\",\"xzy\",\"xzz\",\"yxz\",\"yyz\",\"yzx\",\"yzy\",\"yzz\",\"zxx\",\"zxy\",\"zxz\",\"zyx\",\"zyy\",\"zyz\",\"zzx\",\"zzy\",\"zzz\",\"xxxz\",\"xxyz\",\"xxzx\",\"xxzy\",\"xxzz\",\"xyxz\",\"xyyz\",\"xyzx\",\"xyzy\",\"xyzz\",\"xzxx\",\"xzxy\",\"xzxz\",\"xzyx\",\"xzyy\",\"xzyz\",\"xzzx\",\"xzzy\",\"xzzz\",\"yxxz\",\"yxyz\",\"yxzx\",\"yxzy\",\"yxzz\",\"yyxz\",\"yyyz\",\"yyzx\",\"yyzy\",\"yyzz\",\"yzxx\",\"yzxy\",\"yzxz\",\"yzyx\",\"yzyy\",\"yzyz\",\"yzzx\",\"yzzy\",\"yzzz\",\"zxxx\",\"zxxy\",\"zxxz\",\"zxyx\",\"zxyy\",\"zxyz\",\"zxzx\",\"zxzy\",\"zxzz\",\"zyxx\",\"zyxy\",\"zyxz\",\"zyyx\",\"zyyy\",\"zyyz\",\"zyzx\",\"zyzy\",\"zyzz\",\"zzxx\",\"zzxy\",\"zzxz\",\"zzyx\",\"zzyy\",\"zzyz\",\"zzzx\",\"zzzy\",\"zzzz\",\"rb\",\"gb\",\"br\",\"bg\",\"bb\",\"rrb\",\"rgb\",\"rbr\",\"rbg\",\"rbb\",\"grb\",\"ggb\",\"gbr\",\"gbg\",\"gbb\",\"brr\",\"brg\",\"brb\",\"bgr\",\"bgg\",\"bgb\",\"bbr\",\"bbg\",\"bbb\",\"rrrb\",\"rrgb\",\"rrbr\",\"rrbg\",\"rrbb\",\"rgrb\",\"rggb\",\"rgbr\",\"rgbg\",\"rgbb\",\"rbrr\",\"rbrg\",\"rbrb\",\"rbgr\",\"rbgg\",\"rbgb\",\"rbbr\",\"rbbg\",\"rbbb\",\"grrb\",\"grgb\",\"grbr\",\"grbg\",\"grbb\",\"ggrb\",\"gggb\",\"ggbr\",\"ggbg\",\"ggbb\",\"gbrr\",\"gbrg\",\"gbrb\",\"gbgr\",\"gbgg\",\"gbgb\",\"gbbr\",\"gbbg\",\"gbbb\",\"brrr\",\"brrg\",\"brrb\",\"brgr\",\"brgg\",\"brgb\",\"brbr\",\"brbg\",\"brbb\",\"bgrr\",\"bgrg\",\"bgrb\",\"bggr\",\"bggg\",\"bggb\",\"bgbr\",\"bgbg\",\"bgbb\",\"bbrr\",\"bbrg\",\"bbrb\",\"bbgr\",\"bbgg\",\"bbgb\",\"bbbr\",\"bbbg\",\"bbbb\"],t=[\"xw\",\"yw\",\"zw\",\"wx\",\"wy\",\"wz\",\"ww\",\"xxw\",\"xyw\",\"xzw\",\"xwx\",\"xwy\",\"xwz\",\"xww\",\"yxw\",\"yyw\",\"yzw\",\"ywx\",\"ywy\",\"ywz\",\"yww\",\"zxw\",\"zyw\",\"zzw\",\"zwx\",\"zwy\",\"zwz\",\"zww\",\"wxx\",\"wxy\",\"wxz\",\"wxw\",\"wyx\",\"wyy\",\"wyz\",\"wyw\",\"wzx\",\"wzy\",\"wzz\",\"wzw\",\"wwx\",\"wwy\",\"wwz\",\"www\",\"xxxw\",\"xxyw\",\"xxzw\",\"xxwx\",\"xxwy\",\"xxwz\",\"xxww\",\"xyxw\",\"xyyw\",\"xyzw\",\"xywx\",\"xywy\",\"xywz\",\"xyww\",\"xzxw\",\"xzyw\",\"xzzw\",\"xzwx\",\"xzwy\",\"xzwz\",\"xzww\",\"xwxx\",\"xwxy\",\"xwxz\",\"xwxw\",\"xwyx\",\"xwyy\",\"xwyz\",\"xwyw\",\"xwzx\",\"xwzy\",\"xwzz\",\"xwzw\",\"xwwx\",\"xwwy\",\"xwwz\",\"xwww\",\"yxxw\",\"yxyw\",\"yxzw\",\"yxwx\",\"yxwy\",\"yxwz\",\"yxww\",\"yyxw\",\"yyyw\",\"yyzw\",\"yywx\",\"yywy\",\"yywz\",\"yyww\",\"yzxw\",\"yzyw\",\"yzzw\",\"yzwx\",\"yzwy\",\"yzwz\",\"yzww\",\"ywxx\",\"ywxy\",\"ywxz\",\"ywxw\",\"ywyx\",\"ywyy\",\"ywyz\",\"ywyw\",\"ywzx\",\"ywzy\",\"ywzz\",\"ywzw\",\"ywwx\",\"ywwy\",\"ywwz\",\"ywww\",\"zxxw\",\"zxyw\",\"zxzw\",\"zxwx\",\"zxwy\",\"zxwz\",\"zxww\",\"zyxw\",\"zyyw\",\"zyzw\",\"zywx\",\"zywy\",\"zywz\",\"zyww\",\"zzxw\",\"zzyw\",\"zzzw\",\"zzwx\",\"zzwy\",\"zzwz\",\"zzww\",\"zwxx\",\"zwxy\",\"zwxz\",\"zwxw\",\"zwyx\",\"zwyy\",\"zwyz\",\"zwyw\",\"zwzx\",\"zwzy\",\"zwzz\",\"zwzw\",\"zwwx\",\"zwwy\",\"zwwz\",\"zwww\",\"wxxx\",\"wxxy\",\"wxxz\",\"wxxw\",\"wxyx\",\"wxyy\",\"wxyz\",\"wxyw\",\"wxzx\",\"wxzy\",\"wxzz\",\"wxzw\",\"wxwx\",\"wxwy\",\"wxwz\",\"wxww\",\"wyxx\",\"wyxy\",\"wyxz\",\"wyxw\",\"wyyx\",\"wyyy\",\"wyyz\",\"wyyw\",\"wyzx\",\"wyzy\",\"wyzz\",\"wyzw\",\"wywx\",\"wywy\",\"wywz\",\"wyww\",\"wzxx\",\"wzxy\",\"wzxz\",\"wzxw\",\"wzyx\",\"wzyy\",\"wzyz\",\"wzyw\",\"wzzx\",\"wzzy\",\"wzzz\",\"wzzw\",\"wzwx\",\"wzwy\",\"wzwz\",\"wzww\",\"wwxx\",\"wwxy\",\"wwxz\",\"wwxw\",\"wwyx\",\"wwyy\",\"wwyz\",\"wwyw\",\"wwzx\",\"wwzy\",\"wwzz\",\"wwzw\",\"wwwx\",\"wwwy\",\"wwwz\",\"wwww\",\"ra\",\"ga\",\"ba\",\"ar\",\"ag\",\"ab\",\"aa\",\"rra\",\"rga\",\"rba\",\"rar\",\"rag\",\"rab\",\"raa\",\"gra\",\"gga\",\"gba\",\"gar\",\"gag\",\"gab\",\"gaa\",\"bra\",\"bga\",\"bba\",\"bar\",\"bag\",\"bab\",\"baa\",\"arr\",\"arg\",\"arb\",\"ara\",\"agr\",\"agg\",\"agb\",\"aga\",\"abr\",\"abg\",\"abb\",\"aba\",\"aar\",\"aag\",\"aab\",\"aaa\",\"rrra\",\"rrga\",\"rrba\",\"rrar\",\"rrag\",\"rrab\",\"rraa\",\"rgra\",\"rgga\",\"rgba\",\"rgar\",\"rgag\",\"rgab\",\"rgaa\",\"rbra\",\"rbga\",\"rbba\",\"rbar\",\"rbag\",\"rbab\",\"rbaa\",\"rarr\",\"rarg\",\"rarb\",\"rara\",\"ragr\",\"ragg\",\"ragb\",\"raga\",\"rabr\",\"rabg\",\"rabb\",\"raba\",\"raar\",\"raag\",\"raab\",\"raaa\",\"grra\",\"grga\",\"grba\",\"grar\",\"grag\",\"grab\",\"graa\",\"ggra\",\"ggga\",\"ggba\",\"ggar\",\"ggag\",\"ggab\",\"ggaa\",\"gbra\",\"gbga\",\"gbba\",\"gbar\",\"gbag\",\"gbab\",\"gbaa\",\"garr\",\"garg\",\"garb\",\"gara\",\"gagr\",\"gagg\",\"gagb\",\"gaga\",\"gabr\",\"gabg\",\"gabb\",\"gaba\",\"gaar\",\"gaag\",\"gaab\",\"gaaa\",\"brra\",\"brga\",\"brba\",\"brar\",\"brag\",\"brab\",\"braa\",\"bgra\",\"bgga\",\"bgba\",\"bgar\",\"bgag\",\"bgab\",\"bgaa\",\"bbra\",\"bbga\",\"bbba\",\"bbar\",\"bbag\",\"bbab\",\"bbaa\",\"barr\",\"barg\",\"barb\",\"bara\",\"bagr\",\"bagg\",\"bagb\",\"baga\",\"babr\",\"babg\",\"babb\",\"baba\",\"baar\",\"baag\",\"baab\",\"baaa\",\"arrr\",\"arrg\",\"arrb\",\"arra\",\"argr\",\"argg\",\"argb\",\"arga\",\"arbr\",\"arbg\",\"arbb\",\"arba\",\"arar\",\"arag\",\"arab\",\"araa\",\"agrr\",\"agrg\",\"agrb\",\"agra\",\"aggr\",\"aggg\",\"aggb\",\"agga\",\"agbr\",\"agbg\",\"agbb\",\"agba\",\"agar\",\"agag\",\"agab\",\"agaa\",\"abrr\",\"abrg\",\"abrb\",\"abra\",\"abgr\",\"abgg\",\"abgb\",\"abga\",\"abbr\",\"abbg\",\"abbb\",\"abba\",\"abar\",\"abag\",\"abab\",\"abaa\",\"aarr\",\"aarg\",\"aarb\",\"aara\",\"aagr\",\"aagg\",\"aagb\",\"aaga\",\"aabr\",\"aabg\",\"aabb\",\"aaba\",\"aaar\",\"aaag\",\"aaab\",\"aaaa\"],n={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};function s(r){switch(r.length){case 2:return function(){return new N(this[n[r[0]]],this[n[r[1]]])};case 3:return function(){return new T(this[n[r[0]]],this[n[r[1]]],this[n[r[2]]])};case 4:return function(){return new q(this[n[r[0]]],this[n[r[1]]],this[n[r[2]]],this[n[r[3]]])}}throw new Error(\"Illegal swizzle length\")}for(let r of A){let a=s(r);Object.defineProperty(N.prototype,r,{get:a}),Object.defineProperty(T.prototype,r,{get:a}),Object.defineProperty(q.prototype,r,{get:a})}for(let r of e){let a=s(r);Object.defineProperty(T.prototype,r,{get:a}),Object.defineProperty(q.prototype,r,{get:a})}for(let r of t){let a=s(r);Object.defineProperty(q.prototype,r,{get:a})}me=!0}var xe=Math.PI/180,Re=180/Math.PI;function _e(A){return A*Re}function et(A){return A*xe}export{ve as EnableSwizzlesF64,v as Mat2,_ as Mat2d,u as Mat3,G as Mat4,O as Quat,J as Quat2,N as Vec2,T as Vec3,q as Vec4,_e as toDegree,et as toRadian};\n//# sourceMappingURL=gl-matrix-f64.min.js.map\n"],"names":["ne","C","_Float64Array","_this","_classCallCheck","_len","arguments","length","e","Array","_key","_callSuper","t","E","_assertThisInitialized","_inherits","_createClass","key","get","str","value","copy","set","identity","multiply","mul","transpose","invert","scale","rotate","Float64Array","BYTES_PER_ELEMENT","create","clone","fromValues","_len2","_key2","_construct","undefined","n","s","r","a","i","adjoint","determinant","add","subtract","sub","c","y","L","k","Math","sin","cos","fromRotation","fromScaling","frob","sqrt","multiplyScalar","multiplyScalarAndAdd","LDU","exactEquals","equals","abs","max","concat","join","_wrapNativeSuper","WeakMap","Z","v","prototype"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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-32-64-API.md new file mode 100644 index 00000000..d6e70847 --- /dev/null +++ b/docs-md/main/api-usage/1-Using-32-64-API.md @@ -0,0 +1,33 @@ +--- +title: 1. Float 32 / 64 Versions +category: API Usage +--- +## Using Float32Array + +The version 4 release offers a new class based API. + +```js +import { Vec3 } from 'gl-matrix'; + +const vec = new Vec3(0, 1, 2); +``` + +## Using Float64Array + +If your use case requires additional precision beyond 32-bit floats used by default you can instead use a +64-bit version of the library by importing from the `gl-matrix/f64` sub-path export. + +```js +import { Vec3 } from 'gl-matrix/f64'; + +const vec = new Vec3(0, 1, 2); +``` + +If you have a need to mix and match the 64-bit and 32-bit versions you can do so by importing them as different names. + +```js +import { Vec3 as Vec3F32 } from 'gl-matrix'; +import { Vec3 as Vec3F64 } from 'gl-matrix/f64'; +``` + +All API calls are identical between the two versions and the only difference is the type of TypedArray which the classes extend. diff --git a/docs-md/main/api-usage/2-Typescript.md b/docs-md/main/api-usage/2-Typescript.md new file mode 100644 index 00000000..43aaa9b4 --- /dev/null +++ b/docs-md/main/api-usage/2-Typescript.md @@ -0,0 +1,26 @@ +--- +title: 2. Using Typescript +category: API Usage +--- +## Using Typescript / Type Aliases + +All Typescript type aliases are shared across library variants and located in the `gl-matrix/types` sub-path export. + +For Typescript: +```ts +import type { Vec3Like } from 'gl-matrix/types'; +``` + +For JSDoc using the new Typescript 5.5 `@import` tag: +```js +/** + * @import { Vec3Like } from 'gl-matrix/types' + */ +``` + +For JSDoc using the older `import types` Typescript mechanism: +```js +/** + * @type {import('gl-matrix/types').Vec3Like} + */ +``` diff --git a/docs-md/main/api-usage/3-Enable-Swizzling.md b/docs-md/main/api-usage/3-Enable-Swizzling.md new file mode 100644 index 00000000..1a90edeb --- /dev/null +++ b/docs-md/main/api-usage/3-Enable-Swizzling.md @@ -0,0 +1,41 @@ +--- +title: 3. Enabling Swizzling +category: API Usage +--- +## Enabling Swizzling + +To enable additional swizzle accessors for vector classes invoke the `EnableSwizzles` function from +the `gl-matrix/swizzle` sub-path export. + +```ts +import { Vec3 } from 'gl-matrix'; +import { EnableSwizzles } from 'gl-matrix/swizzle'; + +EnableSwizzles(); + +const vec = new Vec3(0, 1, 2); +const vecSwizzled = vec.zyx; // Returns a new Vec3(2, 1, 0). +``` + +To enable the 64-bit swizzle accessors use the `gl-matrix/swizzle/f64` sub-path export and invoke `EnableSwizzlesF64`. + +```ts +import { Vec3 } from 'gl-matrix/f64'; +import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64'; + +EnableSwizzlesF64(); + +const vec = new Vec3(0, 1, 2); +const vecSwizzled = vec.zyx; // Returns a new Vec3(2, 1, 0). +``` + +Additionally, you may enable ambient module declarations for the respective 32-bit or 64-bit +vector classes when enabling swizzling. This is accomplished by using `side effect` imports as follows. + +```ts +// For `gl-matrix` / 32-bit vector classes. +import 'gl-matrix/types/swizzle'; + +// For `gl-matrix/f64` / 64-bit vector classes. +import 'gl-matrix/types/swizzle/f64'; +``` diff --git a/docs-md/main/api-usage/4-Classic-API.md b/docs-md/main/api-usage/4-Classic-API.md new file mode 100644 index 00000000..d184052e --- /dev/null +++ b/docs-md/main/api-usage/4-Classic-API.md @@ -0,0 +1,15 @@ +--- +title: 4. Classic API +category: API Usage +--- +## Classic API + +To facilitate easier adoption of version 4 of `gl-matrix` and maintain essential compatability with existing codebases the modern +API can be accessed via remapped exports matching the version 3 API from the `gl-matrix/classic` sub-path export. The +only change required is altering imports from `gl-matrix` to `gl-matrix/classic`. + +```js +import { vec3 } from 'gl-matrix/classic'; + +const vec = vec3.create(); +``` diff --git a/docs-md/main/api-usage/5-CommonJS.md b/docs-md/main/api-usage/5-CommonJS.md new file mode 100644 index 00000000..c53491db --- /dev/null +++ b/docs-md/main/api-usage/5-CommonJS.md @@ -0,0 +1,29 @@ +--- +title: 5. CommonJS +category: API Usage +--- +## CommonJS + +This package supports both ES Module and CommonJS formats. For CommonJS usage, replace `import` statements with +`require`. All functionality remains consistent across both module systems. + +## Using Float32Array + +The version 4 release offers a new class based API. + +```js +const { Vec3 } = require('gl-matrix'); + +const vec = new Vec3(0, 1, 2); +``` + +## Using Float64Array + +If your use case requires additional precision beyond 32-bit floats used by default you can instead use a +64-bit version of the library by importing from the `gl-matrix/f64` sub-path export. + +```js +const { Vec3 } = require('gl-matrix/f64'); + +const vec = new Vec3(0, 1, 2); +``` diff --git a/docs-md/main/notes/1-Matrix-Format.md b/docs-md/main/notes/1-Matrix-Format.md new file mode 100644 index 00000000..83edf1e8 --- /dev/null +++ b/docs-md/main/notes/1-Matrix-Format.md @@ -0,0 +1,30 @@ +--- +title: 1. Matrix Formatting +category: Notes +--- +## Matrix formatting +`gl-matrix` is modeled after the needs of WebGL, which in turn uses matrix conventions set by OpenGL. Specifically, a +4x4 matrix is an array of 16 contiguous floats with the 13th, 14th, and 15th elements representing the X, Y, and Z, +translation components. + +This may lead to some confusion when referencing OpenGL documentation, however, which represents out all matrices in +column-major format. This means that while in code a matrix may be typed out as: + +``` +[1, 0, 0, 0, +0, 1, 0, 0, +0, 0, 1, 0, +x, y, z, 0] +``` + +The same matrix in the OpenGL documentation is written as: + +``` +1 0 0 x +0 1 0 y +0 0 1 z +0 0 0 0 +``` + +Please rest assured, however, that they are the same thing! This is not unique to `gl-matrix`, either, as OpenGL +developers have long been confused by the apparent lack of consistency between the memory layout and the documentation. diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..ac866d32 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,81 @@ +import typescriptEslint from 'typescript-eslint'; + +/** @type {import('eslint').Linter.FlatConfig[]} */ +export default [ + { + ignores: ['coverage/*', 'dist/*', 'dist-cdn/*', 'docs/*'], + }, + ...typescriptEslint.config({ + files: ['src/**/*.ts', 'tests/**/*.ts'], + extends: [ + ...typescriptEslint.configs.recommendedTypeChecked, + ...typescriptEslint.configs.stylisticTypeChecked, + ], + languageOptions: { + parserOptions: { + allowAutomaticSingleRunInference: true, + projectService: true, + }, + }, + plugins: { + '@typescript-eslint': typescriptEslint.plugin, + }, + rules: { + // Styling + 'array-bracket-spacing': 'error', + 'block-spacing': 'error', + 'brace-style': ['error', '1tbs', { 'allowSingleLine': true }], + 'comma-spacing': 'error', + 'comma-style': 'error', + 'curly': 'error', + 'indent': ['error', 2, { 'SwitchCase': 1 }], + 'key-spacing': 'error', + 'keyword-spacing': 'error', + 'new-parens': 'error', + 'no-multiple-empty-lines': 'error', + 'no-spaced-func': 'error', + 'object-curly-spacing': ['error', 'always'], + 'operator-assignment': ['error', 'always'], + 'operator-linebreak': ['error', 'after'], + 'semi': 'error', + 'space-before-blocks': 'error', + 'space-before-function-paren': ['error', { + 'anonymous': 'never', + 'named': 'never', + 'asyncArrow': 'ignore' + }], + 'space-in-parens': 'error', + 'space-infix-ops': 'error', + 'space-unary-ops': ['error', { 'words': true, 'nonwords': false }], + 'spaced-comment': ['error', 'always'], + 'wrap-regex': 'error', + + 'max-len': ['error', { 'code': 120 }], + 'quotes': ['error', 'single', 'avoid-escape'], + 'quote-props': ['error', 'as-needed', { 'unnecessary': true }], + + // ESM + 'arrow-body-style': 'off', + 'arrow-parens': ['error', 'always'], + 'arrow-spacing': 'error', + 'constructor-super': 'error', + 'generator-star-spacing': ['error', { 'before': true, 'after': false }], + 'no-class-assign': 'error', + 'no-const-assign': 'error', + 'no-dupe-class-members': 'error', + 'no-this-before-super': 'error', + 'no-useless-constructor': 'error', + 'no-var': 'error', + 'object-shorthand': ['error', 'properties'], + 'prefer-arrow-callback': 'error', + 'prefer-const': 'error', + 'prefer-spread': 'error', + 'prefer-template': 'error', + 'require-yield': 'error', + + '@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }], + '@typescript-eslint/no-unused-vars': 'error', + '@typescript-eslint/restrict-template-expressions': 'off', + } + }) +]; diff --git a/esm-d-ts.config.js b/esm-d-ts.config.js new file mode 100644 index 00000000..1fea6fe2 --- /dev/null +++ b/esm-d-ts.config.js @@ -0,0 +1,41 @@ +/** + * Generates bundled type declaration for main and all sub-path exports: classic / common / f64 / swizzle, etc. + */ + +// When consuming `gl-matrix` from a Typescript project configured to output CJS Typescript explicitly requires a +// `.d.cts` declaration file to be present. This option simply emits a duplicate of `.d.mts` as `.d.cts` which is +// referenced in `package.json` for `require` export conditions. +const emitCTS = true; + +// Enables handling `imports` from `package.json` as local package paths transforming them and marking them external in +// bundling. +const importsLocal = true; + +// The ambient module declaration names need explicit replacement. This option performs a regex replacement on the +// final bundle. +const dtsReplace = { '#gl-matrix': 'gl-matrix' }; + +// The ambient module declarations are repurposed for the all-inclusive CDN bundles and the `declare module` wrapper +// needs to be removed. +const dtsReplaceCDN = { "declare module '[^']*' \\{([\\s\\S]*?)^\\}": '$1' }; + +/** @type {import('@typhonjs-build-test/esm-d-ts').GenerateConfig[]} */ +const configs = [ + // Bundles main and all sub-path export types configured in `package.json` exports. + { input: './src/index.ts', output: './dist/index.d.mts', emitCTS, importsLocal }, + { input: './src/classic/index.ts', output: './dist/classic/index.d.mts', emitCTS, importsLocal }, + { input: './src/common/index.ts', output: './dist/common/index.d.mts', emitCTS, importsLocal }, + { input: './src/f64/index.ts', output: './dist/f64/index.d.mts', emitCTS, importsLocal }, + { input: './src/swizzle/index.ts', output: './dist/swizzle/index.d.mts', emitCTS, importsLocal }, + { input: './src/swizzle/f64/index.ts', output: './dist/swizzle/f64/index.d.mts', emitCTS, importsLocal }, + { input: './src/types/index.ts', output: './dist/types/index.d.mts', emitCTS, importsLocal }, + { input: './src/types/swizzle/index.ts', output: './dist/types/swizzle/index.d.mts', emitCTS, importsLocal, dtsReplace }, + { input: './src/types/swizzle/f64/index.ts', output: './dist/types/swizzle/f64/index.d.mts', emitCTS, importsLocal, dtsReplace }, + { input: './src/util/index.ts', output: './dist/util/index.d.mts', emitCTS, importsLocal }, + + // Bundles CDN types. + { input: './src/cdn/index.ts', output: './dist-cdn/types/gl-matrix-f32.d.mts', emitCTS, dtsReplace: dtsReplaceCDN }, + { input: './src/cdn/f64/index.ts', output: './dist-cdn/types/gl-matrix-f64.d.mts', emitCTS, dtsReplace: dtsReplaceCDN } +]; + +export default configs; diff --git a/package-lock.json b/package-lock.json index 04e7fc48..27c4b0ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,1274 +1,6867 @@ { "name": "gl-matrix", - "version": "4.0.0-beta.1", - "lockfileVersion": 2, + "version": "4.0.0-beta.3", + "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "gl-matrix", - "version": "4.0.0-beta.1", + "version": "4.0.0-beta.3", "license": "MIT", "devDependencies": { - "esbuild": "^0.15.15", - "typedoc": "^0.23.21", - "typescript": "^5.0.0", - "vitest": "^0.25.8" + "@babel/core": "^7.26.0", + "@babel/preset-env": "^7.26.0", + "@rollup/plugin-babel": "^6.0.4", + "@typhonjs-build-test/esm-d-ts": "^0.3.0-next.9", + "@typhonjs-typedoc/typedoc-pkg": "^0.2.0", + "@vitest/coverage-v8": "^2.1.0", + "@vitest/ui": "^2.1.0", + "esbuild": "^0.24.0", + "eslint": "^9.16.0", + "rollup": "^4.28.0", + "typescript": "^5.7.0", + "typescript-eslint": "^8.17.0", + "vitest": "^2.1.0" } }, - "node_modules/@esbuild/android-arm": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.18.tgz", - "integrity": "sha512-5GT+kcs2WVGjVs7+boataCkO5Fg0y4kCjzkB5bAip7H4jfnOS3dA6KPiww9W1OEKTKeAcUVhdZGvgI65OXmUnw==", - "cpu": [ - "arm" - ], + "node_modules/@ampproject/remapping": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", "dev": true, - "optional": true, - "os": [ - "android" - ], + "license": "Apache-2.0", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + }, "engines": { - "node": ">=12" + "node": ">=6.0.0" } }, - "node_modules/@esbuild/android-arm64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.12.tgz", - "integrity": "sha512-WQ9p5oiXXYJ33F2EkE3r0FRDFVpEdcDiwNX3u7Xaibxfx6vQE0Sb8ytrfQsA5WO6kDn6mDfKLh6KrPBjvkk7xA==", - "cpu": [ - "arm64" - ], + "node_modules/@babel/code-frame": { + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", "dev": true, - "optional": true, - "os": [ - "android" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" } }, - "node_modules/@esbuild/android-x64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.12.tgz", - "integrity": "sha512-m4OsaCr5gT+se25rFPHKQXARMyAehHTQAz4XX1Vk3d27VtqiX0ALMBPoXZsGaB6JYryCLfgGwUslMqTfqeLU0w==", - "cpu": [ - "x64" - ], + "node_modules/@babel/compat-data": { + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.2.tgz", + "integrity": "sha512-Z0WgzSEa+aUcdiJuCIqgujCshpMWgUpgOxXotrYPSA53hA3qopNaqcJpyr0hVb1FeWdnqFA35/fUtXgBK8srQg==", "dev": true, - "optional": true, - "os": [ - "android" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=6.9.0" } }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.12.tgz", - "integrity": "sha512-O3GCZghRIx+RAN0NDPhyyhRgwa19MoKlzGonIb5hgTj78krqp9XZbYCvFr9N1eUxg0ZQEpiiZ4QvsOQwBpP+lg==", - "cpu": [ - "arm64" - ], + "node_modules/@babel/core": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.0.tgz", + "integrity": "sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "license": "MIT", + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.26.0", + "@babel/generator": "^7.26.0", + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helpers": "^7.26.0", + "@babel/parser": "^7.26.0", + "@babel/template": "^7.25.9", + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.26.0", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" } }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.12.tgz", - "integrity": "sha512-5D48jM3tW27h1qjaD9UNRuN+4v0zvksqZSPZqeSWggfMlsVdAhH3pwSfQIFJwcs9QJ9BRibPS4ViZgs3d2wsCA==", - "cpu": [ - "x64" - ], + "node_modules/@babel/generator": { + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.2.tgz", + "integrity": "sha512-zevQbhbau95nkoxSq3f/DC/SC+EEOUZd3DYqfSkMhY2/wfSeaHV1Ew4vk8e+x8lja31IbyuUa2uQ3JONqKbysw==", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.26.2", + "@babel/types": "^7.26.0", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^3.0.2" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" } }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.12.tgz", - "integrity": "sha512-OWvHzmLNTdF1erSvrfoEBGlN94IE6vCEaGEkEH29uo/VoONqPnoDFfShi41Ew+yKimx4vrmmAJEGNoyyP+OgOQ==", - "cpu": [ - "arm64" - ], + "node_modules/@babel/helper-annotate-as-pure": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.25.9.tgz", + "integrity": "sha512-gv7320KBUFJz1RnylIg5WWYPRXKZ884AGkYpgpWW02TH66Dl+HaC1t1CKd0z3R4b6hdYEcmrNZHUmfCP+1u3/g==", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], + "license": "MIT", + "dependencies": { + "@babel/types": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" } }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.12.tgz", - "integrity": "sha512-A0Xg5CZv8MU9xh4a+7NUpi5VHBKh1RaGJKqjxe4KG87X+mTjDE6ZvlJqpWoeJxgfXHT7IMP9tDFu7IZ03OtJAw==", - "cpu": [ - "x64" - ], + "node_modules/@babel/helper-builder-binary-assignment-operator-visitor": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.25.9.tgz", + "integrity": "sha512-C47lC7LIDCnz0h4vai/tpNOI95tCd5ZT3iBt/DBH5lXKHZsyNQv18yf1wIIg2ntiQNgmAvA+DgZ82iW8Qdym8g==", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" } }, - "node_modules/@esbuild/linux-arm": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.12.tgz", - "integrity": "sha512-WsHyJ7b7vzHdJ1fv67Yf++2dz3D726oO3QCu8iNYik4fb5YuuReOI9OtA+n7Mk0xyQivNTPbl181s+5oZ38gyA==", - "cpu": [ - "arm" - ], + "node_modules/@babel/helper-compilation-targets": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.9.tgz", + "integrity": "sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.25.9", + "@babel/helper-validator-option": "^7.25.9", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" } }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.12.tgz", - "integrity": "sha512-cK3AjkEc+8v8YG02hYLQIQlOznW+v9N+OI9BAFuyqkfQFR+DnDLhEM5N8QRxAUz99cJTo1rLNXqRrvY15gbQUg==", - "cpu": [ - "arm64" - ], + "node_modules/@babel/helper-create-class-features-plugin": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.25.9.tgz", + "integrity": "sha512-UTZQMvt0d/rSz6KI+qdu7GQze5TIajwTS++GUozlw8VBJDEOAqSXwm1WvmYEZwqdqSGQshRocPDqrt4HBZB3fQ==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-member-expression-to-functions": "^7.25.9", + "@babel/helper-optimise-call-expression": "^7.25.9", + "@babel/helper-replace-supers": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9", + "@babel/traverse": "^7.25.9", + "semver": "^6.3.1" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.12.tgz", - "integrity": "sha512-jdOBXJqcgHlah/nYHnj3Hrnl9l63RjtQ4vn9+bohjQPI2QafASB5MtHAoEv0JQHVb/xYQTFOeuHnNYE1zF7tYw==", - "cpu": [ - "ia32" - ], + "node_modules/@babel/helper-create-regexp-features-plugin": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.25.9.tgz", + "integrity": "sha512-ORPNZ3h6ZRkOyAa/SaHU+XsLZr0UQzRwuDQ0cczIA17nAzZ+85G5cVkOJIj7QavLZGSe8QXUmNFxSZzjcZF9bw==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.25.9", + "regexpu-core": "^6.1.1", + "semver": "^6.3.1" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.18.tgz", - "integrity": "sha512-L4jVKS82XVhw2nvzLg/19ClLWg0y27ulRwuP7lcyL6AbUWB5aPglXY3M21mauDQMDfRLs8cQmeT03r/+X3cZYQ==", - "cpu": [ - "loong64" - ], + "node_modules/@babel/helper-define-polyfill-provider": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.3.tgz", + "integrity": "sha512-HK7Bi+Hj6H+VTHA3ZvBis7V/6hu9QuTrnMXNybfUf2iiuU/N97I8VjB+KbhFF8Rld/Lx5MzoCwPCpPjfK+n8Cg==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-compilation-targets": "^7.22.6", + "@babel/helper-plugin-utils": "^7.22.5", + "debug": "^4.1.1", + "lodash.debounce": "^4.0.8", + "resolve": "^1.14.2" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/@babel/helper-member-expression-to-functions": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.25.9.tgz", + "integrity": "sha512-wbfdZ9w5vk0C0oyHqAJbc62+vet5prjj01jjJ8sKn3j9h3MQQlflEdXYvuqRWjHnM12coDEqiC1IRCi0U/EKwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" } }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.12.tgz", - "integrity": "sha512-o8CIhfBwKcxmEENOH9RwmUejs5jFiNoDw7YgS0EJTF6kgPgcqLFjgoc5kDey5cMHRVCIWc6kK2ShUePOcc7RbA==", - "cpu": [ - "mips64el" - ], + "node_modules/@babel/helper-module-imports": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", + "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" } }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.12.tgz", - "integrity": "sha512-biMLH6NR/GR4z+ap0oJYb877LdBpGac8KfZoEnDiBKd7MD/xt8eaw1SFfYRUeMVx519kVkAOL2GExdFmYnZx3A==", - "cpu": [ - "ppc64" - ], + "node_modules/@babel/helper-module-transforms": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", + "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.12.tgz", - "integrity": "sha512-jkphYUiO38wZGeWlfIBMB72auOllNA2sLfiZPGDtOBb1ELN8lmqBrlMiucgL8awBw1zBXN69PmZM6g4yTX84TA==", - "cpu": [ - "riscv64" - ], + "node_modules/@babel/helper-optimise-call-expression": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.25.9.tgz", + "integrity": "sha512-FIpuNaz5ow8VyrYcnXQTDRGvV6tTjkNtCK/RYNDXGSLlUD6cBuQTSw43CShGxjvfBTfcUA/r6UhUCbtYqkhcuQ==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "@babel/types": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" } }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.12.tgz", - "integrity": "sha512-j3ucLdeY9HBcvODhCY4b+Ds3hWGO8t+SAidtmWu/ukfLLG/oYDMaA+dnugTVAg5fnUOGNbIYL9TOjhWgQB8W5g==", - "cpu": [ - "s390x" - ], + "node_modules/@babel/helper-plugin-utils": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.9.tgz", + "integrity": "sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=6.9.0" } }, - "node_modules/@esbuild/linux-x64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.12.tgz", - "integrity": "sha512-uo5JL3cgaEGotaqSaJdRfFNSCUJOIliKLnDGWaVCgIKkHxwhYMm95pfMbWZ9l7GeW9kDg0tSxcy9NYdEtjwwmA==", - "cpu": [ - "x64" - ], + "node_modules/@babel/helper-remap-async-to-generator": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.25.9.tgz", + "integrity": "sha512-IZtukuUeBbhgOcaW2s06OXTzVNJR0ybm4W5xC1opWFFJMZbwRj5LCk+ByYH7WdZPZTt8KnFwA8pvjN2yqcPlgw==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-wrap-function": "^7.25.9", + "@babel/traverse": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.12.tgz", - "integrity": "sha512-DNdoRg8JX+gGsbqt2gPgkgb00mqOgOO27KnrWZtdABl6yWTST30aibGJ6geBq3WM2TIeW6COs5AScnC7GwtGPg==", - "cpu": [ - "x64" - ], + "node_modules/@babel/helper-replace-supers": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.25.9.tgz", + "integrity": "sha512-IiDqTOTBQy0sWyeXyGSC5TBJpGFXBkRynjBeXsvbhQFKj2viwJC76Epz35YLU1fpe/Am6Vppb7W7zM4fPQzLsQ==", "dev": true, - "optional": true, - "os": [ - "netbsd" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-member-expression-to-functions": "^7.25.9", + "@babel/helper-optimise-call-expression": "^7.25.9", + "@babel/traverse": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.12.tgz", - "integrity": "sha512-aVsENlr7B64w8I1lhHShND5o8cW6sB9n9MUtLumFlPhG3elhNWtE7M1TFpj3m7lT3sKQUMkGFjTQBrvDDO1YWA==", - "cpu": [ - "x64" - ], + "node_modules/@babel/helper-simple-access": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.25.9.tgz", + "integrity": "sha512-c6WHXuiaRsJTyHYLJV75t9IqsmTbItYfdj99PnzYGQZkYKvan5/2jKJ7gu31J3/BJ/A18grImSPModuyG/Eo0Q==", "dev": true, - "optional": true, - "os": [ - "openbsd" - ], + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" } }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.12.tgz", - "integrity": "sha512-qbHGVQdKSwi0JQJuZznS4SyY27tYXYF0mrgthbxXrZI3AHKuRvU+Eqbg/F0rmLDpW/jkIZBlCO1XfHUBMNJ1pg==", - "cpu": [ - "x64" - ], + "node_modules/@babel/helper-skip-transparent-expression-wrappers": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.25.9.tgz", + "integrity": "sha512-K4Du3BFa3gvyhzgPcntrkDgZzQaq6uozzcpGbOO1OEJaI+EJdqWIMTLgFgQf6lrfiDFo5FU+BxKepI9RmZqahA==", "dev": true, - "optional": true, - "os": [ - "sunos" - ], + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" } }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.12.tgz", - "integrity": "sha512-zsCp8Ql+96xXTVTmm6ffvoTSZSV2B/LzzkUXAY33F/76EajNw1m+jZ9zPfNJlJ3Rh4EzOszNDHsmG/fZOhtqDg==", - "cpu": [ - "arm64" - ], + "node_modules/@babel/helper-string-parser": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=6.9.0" } }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.12.tgz", - "integrity": "sha512-FfrFjR4id7wcFYOdqbDfDET3tjxCozUgbqdkOABsSFzoZGFC92UK7mg4JKRc/B3NNEf1s2WHxJ7VfTdVDPN3ng==", - "cpu": [ - "ia32" - ], + "node_modules/@babel/helper-validator-identifier": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=6.9.0" } }, - "node_modules/@esbuild/win32-x64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.12.tgz", - "integrity": "sha512-JOOxw49BVZx2/5tW3FqkdjSD/5gXYeVGPDcB0lvap0gLQshkh1Nyel1QazC+wNxus3xPlsYAgqU1BUmrmCvWtw==", - "cpu": [ - "x64" - ], + "node_modules/@babel/helper-validator-option": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", + "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=6.9.0" } }, - "node_modules/@types/chai": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.4.tgz", - "integrity": "sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw==", - "dev": true - }, - "node_modules/@types/chai-subset": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz", - "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==", + "node_modules/@babel/helper-wrap-function": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.25.9.tgz", + "integrity": "sha512-ETzz9UTjQSTmw39GboatdymDq4XIQbR8ySgVrylRhPOFpsd+JrKHIuF0de7GCWmem+T4uC5z7EZguod7Wj4A4g==", "dev": true, + "license": "MIT", "dependencies": { - "@types/chai": "*" + "@babel/template": "^7.25.9", + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" } }, - "node_modules/@types/node": { - "version": "18.15.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.3.tgz", - "integrity": "sha512-p6ua9zBxz5otCmbpb5D3U4B5Nanw6Pk3PPyX05xnxbB/fRv71N7CPmORg7uAD5P70T0xmx1pzAx/FUfa5X+3cw==", - "dev": true + "node_modules/@babel/helpers": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.0.tgz", + "integrity": "sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.25.9", + "@babel/types": "^7.26.0" + }, + "engines": { + "node": ">=6.9.0" + } }, - "node_modules/acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "node_modules/@babel/parser": { + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.2.tgz", + "integrity": "sha512-DWMCZH9WA4Maitz2q21SRKHo9QXZxkDsbNZoVD62gusNtNBBqDg9i7uOhASfTfIGNzW+O+r7+jAlM8dwphcJKQ==", "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.26.0" + }, "bin": { - "acorn": "bin/acorn" + "parser": "bin/babel-parser.js" }, "engines": { - "node": ">=0.4.0" + "node": ">=6.0.0" } }, - "node_modules/acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "node_modules/@babel/plugin-bugfix-firefox-class-in-computed-class-key": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.25.9.tgz", + "integrity": "sha512-ZkRyVkThtxQ/J6nv3JFYv1RYY+JT5BvU0y3k5bWrmuG4woXypRa4PXmm9RhOwodRkYFWqC0C0cqcJ4OqR7kW+g==", "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/traverse": "^7.25.9" + }, "engines": { - "node": ">=0.4.0" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, - "node_modules/ansi-sequence-parser": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.0.tgz", - "integrity": "sha512-lEm8mt52to2fT8GhciPCGeCXACSz2UwIN4X2e2LJSnZ5uAbn2/dsYdOmUXq0AtWS5cpAupysIneExOgH0Vd2TQ==", - "dev": true - }, - "node_modules/assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "node_modules/@babel/plugin-bugfix-safari-class-field-initializer-scope": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.25.9.tgz", + "integrity": "sha512-MrGRLZxLD/Zjj0gdU15dfs+HH/OXvnw/U4jJD8vpcP2CJQapPEv1IWwjc/qMg7ItBlPwSv1hRBbb7LeuANdcnw==", "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": "*" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.25.9.tgz", + "integrity": "sha512-2qUwwfAFpJLZqxd02YW9btUCZHl+RFvdDkNfZwaIJrvB8Tesjsk8pEQkTvGwZXLqXUx/2oyY3ySRhm6HOXuCug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } }, - "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.25.9.tgz", + "integrity": "sha512-6xWgLZTJXwilVjlnV7ospI3xi+sl8lN8rXXbBD6vYn3UYDlGsag8wrZkKcSI8G6KgqKP7vNFaDgeDnfAABq61g==", "dev": true, + "license": "MIT", "dependencies": { - "balanced-match": "^1.0.0" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9", + "@babel/plugin-transform-optional-chaining": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.13.0" } }, - "node_modules/chai": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", - "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", + "node_modules/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.25.9.tgz", + "integrity": "sha512-aLnMXYPnzwwqhYSCyXfKkIkYgJ8zv9RK+roo9DkTXz38ynIhd9XCbN08s3MGvqL2MYGVUGdRQLL/JqBIeJhJBg==", "dev": true, + "license": "MIT", "dependencies": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^4.1.2", - "get-func-name": "^2.0.0", - "loupe": "^2.3.1", - "pathval": "^1.1.1", - "type-detect": "^4.0.5" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { - "node": ">=4" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, - "node_modules/check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", + "node_modules/@babel/plugin-proposal-private-property-in-object": { + "version": "7.21.0-placeholder-for-preset-env.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", + "integrity": "sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==", "dev": true, + "license": "MIT", "engines": { - "node": "*" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "node_modules/@babel/plugin-syntax-import-assertions": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.26.0.tgz", + "integrity": "sha512-QCWT5Hh830hK5EQa7XzuqIkQU9tT/whqbDz7kuaZMHFl1inRRg7JnuAEOQ0Ur0QUl0NufCk1msK2BeY79Aj/eg==", "dev": true, + "license": "MIT", "dependencies": { - "ms": "2.1.2" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { - "node": ">=6.0" + "node": ">=6.9.0" }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/deep-eql": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", - "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "node_modules/@babel/plugin-syntax-import-attributes": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.26.0.tgz", + "integrity": "sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A==", "dev": true, + "license": "MIT", "dependencies": { - "type-detect": "^4.0.0" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { - "node": ">=6" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/esbuild": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.18.tgz", - "integrity": "sha512-x/R72SmW3sSFRm5zrrIjAhCeQSAWoni3CmHEqfQrZIQTM3lVCdehdwuIqaOtfC2slvpdlLa62GYoN8SxT23m6Q==", + "node_modules/@babel/plugin-syntax-unicode-sets-regex": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz", + "integrity": "sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg==", "dev": true, - "hasInstallScript": true, - "bin": { - "esbuild": "bin/esbuild" + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.18.6", + "@babel/helper-plugin-utils": "^7.18.6" }, "engines": { - "node": ">=12" + "node": ">=6.9.0" }, - "optionalDependencies": { - "@esbuild/android-arm": "0.15.18", - "@esbuild/linux-loong64": "0.15.18", - "esbuild-android-64": "0.15.18", - "esbuild-android-arm64": "0.15.18", - "esbuild-darwin-64": "0.15.18", - "esbuild-darwin-arm64": "0.15.18", - "esbuild-freebsd-64": "0.15.18", - "esbuild-freebsd-arm64": "0.15.18", - "esbuild-linux-32": "0.15.18", - "esbuild-linux-64": "0.15.18", - "esbuild-linux-arm": "0.15.18", - "esbuild-linux-arm64": "0.15.18", - "esbuild-linux-mips64le": "0.15.18", - "esbuild-linux-ppc64le": "0.15.18", - "esbuild-linux-riscv64": "0.15.18", - "esbuild-linux-s390x": "0.15.18", - "esbuild-netbsd-64": "0.15.18", - "esbuild-openbsd-64": "0.15.18", - "esbuild-sunos-64": "0.15.18", - "esbuild-windows-32": "0.15.18", - "esbuild-windows-64": "0.15.18", - "esbuild-windows-arm64": "0.15.18" - } - }, - "node_modules/esbuild-android-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.18.tgz", - "integrity": "sha512-wnpt3OXRhcjfIDSZu9bnzT4/TNTDsOUvip0foZOUBG7QbSt//w3QV4FInVJxNhKc/ErhUxc5z4QjHtMi7/TbgA==", - "cpu": [ - "x64" - ], + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-transform-arrow-functions": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.25.9.tgz", + "integrity": "sha512-6jmooXYIwn9ca5/RylZADJ+EnSxVUS5sjeJ9UPk6RWRzXCmOJCy6dqItPJFpw2cuCangPK4OYr5uhGKcmrm5Qg==", "dev": true, - "optional": true, - "os": [ - "android" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/esbuild-android-arm64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.18.tgz", - "integrity": "sha512-G4xu89B8FCzav9XU8EjsXacCKSG2FT7wW9J6hOc18soEHJdtWu03L3TQDGf0geNxfLTtxENKBzMSq9LlbjS8OQ==", - "cpu": [ - "arm64" - ], + "node_modules/@babel/plugin-transform-async-generator-functions": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.25.9.tgz", + "integrity": "sha512-RXV6QAzTBbhDMO9fWwOmwwTuYaiPbggWQ9INdZqAYeSHyG7FzQ+nOZaUUjNwKv9pV3aE4WFqFm1Hnbci5tBCAw==", "dev": true, - "optional": true, - "os": [ - "android" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-remap-async-to-generator": "^7.25.9", + "@babel/traverse": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/esbuild-darwin-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.18.tgz", - "integrity": "sha512-2WAvs95uPnVJPuYKP0Eqx+Dl/jaYseZEUUT1sjg97TJa4oBtbAKnPnl3b5M9l51/nbx7+QAEtuummJZW0sBEmg==", - "cpu": [ - "x64" - ], + "node_modules/@babel/plugin-transform-async-to-generator": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.25.9.tgz", + "integrity": "sha512-NT7Ejn7Z/LjUH0Gv5KsBCxh7BH3fbLTV0ptHvpeMvrt3cPThHfJfst9Wrb7S8EvJ7vRTFI7z+VAvFVEQn/m5zQ==", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-remap-async-to-generator": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/esbuild-darwin-arm64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.18.tgz", - "integrity": "sha512-tKPSxcTJ5OmNb1btVikATJ8NftlyNlc8BVNtyT/UAr62JFOhwHlnoPrhYWz09akBLHI9nElFVfWSTSRsrZiDUA==", - "cpu": [ - "arm64" - ], + "node_modules/@babel/plugin-transform-block-scoped-functions": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.25.9.tgz", + "integrity": "sha512-toHc9fzab0ZfenFpsyYinOX0J/5dgJVA2fm64xPewu7CoYHWEivIWKxkK2rMi4r3yQqLnVmheMXRdG+k239CgA==", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/esbuild-freebsd-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.18.tgz", - "integrity": "sha512-TT3uBUxkteAjR1QbsmvSsjpKjOX6UkCstr8nMr+q7zi3NuZ1oIpa8U41Y8I8dJH2fJgdC3Dj3CXO5biLQpfdZA==", - "cpu": [ - "x64" - ], + "node_modules/@babel/plugin-transform-block-scoping": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.25.9.tgz", + "integrity": "sha512-1F05O7AYjymAtqbsFETboN1NvBdcnzMerO+zlMyJBEz6WkMdejvGWw9p05iTSjC85RLlBseHHQpYaM4gzJkBGg==", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/esbuild-freebsd-arm64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.18.tgz", - "integrity": "sha512-R/oVr+X3Tkh+S0+tL41wRMbdWtpWB8hEAMsOXDumSSa6qJR89U0S/PpLXrGF7Wk/JykfpWNokERUpCeHDl47wA==", - "cpu": [ - "arm64" - ], + "node_modules/@babel/plugin-transform-class-properties": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.25.9.tgz", + "integrity": "sha512-bbMAII8GRSkcd0h0b4X+36GksxuheLFjP65ul9w6C3KgAamI3JqErNgSrosX6ZPj+Mpim5VvEbawXxJCyEUV3Q==", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/esbuild-linux-32": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.18.tgz", - "integrity": "sha512-lphF3HiCSYtaa9p1DtXndiQEeQDKPl9eN/XNoBf2amEghugNuqXNZA/ZovthNE2aa4EN43WroO0B85xVSjYkbg==", - "cpu": [ - "ia32" - ], + "node_modules/@babel/plugin-transform-class-static-block": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.26.0.tgz", + "integrity": "sha512-6J2APTs7BDDm+UMqP1useWqhcRAXo0WIoVj26N7kPFB6S73Lgvyka4KTZYIxtgYXiN5HTyRObA72N2iu628iTQ==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.12.0" } }, - "node_modules/esbuild-linux-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.18.tgz", - "integrity": "sha512-hNSeP97IviD7oxLKFuii5sDPJ+QHeiFTFLoLm7NZQligur8poNOWGIgpQ7Qf8Balb69hptMZzyOBIPtY09GZYw==", - "cpu": [ - "x64" - ], + "node_modules/@babel/plugin-transform-classes": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.25.9.tgz", + "integrity": "sha512-mD8APIXmseE7oZvZgGABDyM34GUmK45Um2TXiBUt7PnuAxrgoSVf123qUzPxEr/+/BHrRn5NMZCdE2m/1F8DGg==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-replace-supers": "^7.25.9", + "@babel/traverse": "^7.25.9", + "globals": "^11.1.0" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/esbuild-linux-arm": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.18.tgz", - "integrity": "sha512-UH779gstRblS4aoS2qpMl3wjg7U0j+ygu3GjIeTonCcN79ZvpPee12Qun3vcdxX+37O5LFxz39XeW2I9bybMVA==", - "cpu": [ - "arm" - ], + "node_modules/@babel/plugin-transform-computed-properties": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.25.9.tgz", + "integrity": "sha512-HnBegGqXZR12xbcTHlJ9HGxw1OniltT26J5YpfruGqtUHlz/xKf/G2ak9e+t0rVqrjXa9WOhvYPz1ERfMj23AA==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/template": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/esbuild-linux-arm64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.18.tgz", - "integrity": "sha512-54qr8kg/6ilcxd+0V3h9rjT4qmjc0CccMVWrjOEM/pEcUzt8X62HfBSeZfT2ECpM7104mk4yfQXkosY8Quptug==", - "cpu": [ - "arm64" - ], + "node_modules/@babel/plugin-transform-destructuring": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.25.9.tgz", + "integrity": "sha512-WkCGb/3ZxXepmMiX101nnGiU+1CAdut8oHyEOHxkKuS1qKpU2SMXE2uSvfz8PBuLd49V6LEsbtyPhWC7fnkgvQ==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/esbuild-linux-mips64le": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.18.tgz", - "integrity": "sha512-Mk6Ppwzzz3YbMl/ZZL2P0q1tnYqh/trYZ1VfNP47C31yT0K8t9s7Z077QrDA/guU60tGNp2GOwCQnp+DYv7bxQ==", - "cpu": [ - "mips64el" - ], + "node_modules/@babel/plugin-transform-dotall-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.25.9.tgz", + "integrity": "sha512-t7ZQ7g5trIgSRYhI9pIJtRl64KHotutUJsh4Eze5l7olJv+mRSg4/MmbZ0tv1eeqRbdvo/+trvJD/Oc5DmW2cA==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/esbuild-linux-ppc64le": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.18.tgz", - "integrity": "sha512-b0XkN4pL9WUulPTa/VKHx2wLCgvIAbgwABGnKMY19WhKZPT+8BxhZdqz6EgkqCLld7X5qiCY2F/bfpUUlnFZ9w==", - "cpu": [ - "ppc64" - ], + "node_modules/@babel/plugin-transform-duplicate-keys": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.25.9.tgz", + "integrity": "sha512-LZxhJ6dvBb/f3x8xwWIuyiAHy56nrRG3PeYTpBkkzkYRRQ6tJLu68lEF5VIqMUZiAV7a8+Tb78nEoMCMcqjXBw==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/esbuild-linux-riscv64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.18.tgz", - "integrity": "sha512-ba2COaoF5wL6VLZWn04k+ACZjZ6NYniMSQStodFKH/Pu6RxzQqzsmjR1t9QC89VYJxBeyVPTaHuBMCejl3O/xg==", - "cpu": [ - "riscv64" - ], + "node_modules/@babel/plugin-transform-duplicate-named-capturing-groups-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.25.9.tgz", + "integrity": "sha512-0UfuJS0EsXbRvKnwcLjFtJy/Sxc5J5jhLHnFhy7u4zih97Hz6tJkLU+O+FMMrNZrosUPxDi6sYxJ/EA8jDiAog==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, - "node_modules/esbuild-linux-s390x": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.18.tgz", - "integrity": "sha512-VbpGuXEl5FCs1wDVp93O8UIzl3ZrglgnSQ+Hu79g7hZu6te6/YHgVJxCM2SqfIila0J3k0csfnf8VD2W7u2kzQ==", - "cpu": [ - "s390x" - ], + "node_modules/@babel/plugin-transform-dynamic-import": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.25.9.tgz", + "integrity": "sha512-GCggjexbmSLaFhqsojeugBpeaRIgWNTcgKVq/0qIteFEqY2A+b9QidYadrWlnbWQUrW5fn+mCvf3tr7OeBFTyg==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/esbuild-netbsd-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.18.tgz", - "integrity": "sha512-98ukeCdvdX7wr1vUYQzKo4kQ0N2p27H7I11maINv73fVEXt2kyh4K4m9f35U1K43Xc2QGXlzAw0K9yoU7JUjOg==", - "cpu": [ - "x64" - ], + "node_modules/@babel/plugin-transform-exponentiation-operator": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.25.9.tgz", + "integrity": "sha512-KRhdhlVk2nObA5AYa7QMgTMTVJdfHprfpAk4DjZVtllqRg9qarilstTKEhpVjyt+Npi8ThRyiV8176Am3CodPA==", "dev": true, - "optional": true, - "os": [ - "netbsd" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-builder-binary-assignment-operator-visitor": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/esbuild-openbsd-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.18.tgz", - "integrity": "sha512-yK5NCcH31Uae076AyQAXeJzt/vxIo9+omZRKj1pauhk3ITuADzuOx5N2fdHrAKPxN+zH3w96uFKlY7yIn490xQ==", - "cpu": [ - "x64" - ], + "node_modules/@babel/plugin-transform-export-namespace-from": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.25.9.tgz", + "integrity": "sha512-2NsEz+CxzJIVOPx2o9UsW1rXLqtChtLoVnwYHHiB04wS5sgn7mrV45fWMBX0Kk+ub9uXytVYfNP2HjbVbCB3Ww==", "dev": true, - "optional": true, - "os": [ - "openbsd" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/esbuild-sunos-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.18.tgz", - "integrity": "sha512-On22LLFlBeLNj/YF3FT+cXcyKPEI263nflYlAhz5crxtp3yRG1Ugfr7ITyxmCmjm4vbN/dGrb/B7w7U8yJR9yw==", - "cpu": [ - "x64" - ], + "node_modules/@babel/plugin-transform-for-of": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.25.9.tgz", + "integrity": "sha512-LqHxduHoaGELJl2uhImHwRQudhCM50pT46rIBNvtT/Oql3nqiS3wOwP+5ten7NpYSXrrVLgtZU3DZmPtWZo16A==", "dev": true, - "optional": true, - "os": [ - "sunos" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/esbuild-windows-32": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.18.tgz", - "integrity": "sha512-o+eyLu2MjVny/nt+E0uPnBxYuJHBvho8vWsC2lV61A7wwTWC3jkN2w36jtA+yv1UgYkHRihPuQsL23hsCYGcOQ==", - "cpu": [ - "ia32" - ], + "node_modules/@babel/plugin-transform-function-name": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.25.9.tgz", + "integrity": "sha512-8lP+Yxjv14Vc5MuWBpJsoUCd3hD6V9DgBon2FVYL4jJgbnVQ9fTgYmonchzZJOVNgzEgbxp4OwAf6xz6M/14XA==", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/traverse": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/esbuild-windows-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.18.tgz", - "integrity": "sha512-qinug1iTTaIIrCorAUjR0fcBk24fjzEedFYhhispP8Oc7SFvs+XeW3YpAKiKp8dRpizl4YYAhxMjlftAMJiaUw==", - "cpu": [ - "x64" - ], + "node_modules/@babel/plugin-transform-json-strings": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.25.9.tgz", + "integrity": "sha512-xoTMk0WXceiiIvsaquQQUaLLXSW1KJ159KP87VilruQm0LNNGxWzahxSS6T6i4Zg3ezp4vA4zuwiNUR53qmQAw==", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/esbuild-windows-arm64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.18.tgz", - "integrity": "sha512-q9bsYzegpZcLziq0zgUi5KqGVtfhjxGbnksaBFYmWLxeV/S1fK4OLdq2DFYnXcLMjlZw2L0jLsk1eGoB522WXQ==", - "cpu": [ - "arm64" - ], + "node_modules/@babel/plugin-transform-literals": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.25.9.tgz", + "integrity": "sha512-9N7+2lFziW8W9pBl2TzaNht3+pgMIRP74zizeCSrtnSKVdUl8mAjjOP2OOVQAfZ881P2cNjDj1uAMEdeD50nuQ==", "dev": true, - "optional": true, - "os": [ - "win32" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": ">=12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "node_modules/@babel/plugin-transform-logical-assignment-operators": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.25.9.tgz", + "integrity": "sha512-wI4wRAzGko551Y8eVf6iOY9EouIDTtPb0ByZx+ktDGHwv6bHFimrgJM/2T021txPZ2s4c7bqvHbd+vXG6K948Q==", "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "node_modules/get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", + "node_modules/@babel/plugin-transform-member-expression-literals": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.25.9.tgz", + "integrity": "sha512-PYazBVfofCQkkMzh2P6IdIUaCEWni3iYEerAsRWuVd8+jlM1S9S9cz1dF9hIzyoZ8IA3+OwVYIp9v9e+GbgZhA==", "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": "*" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "node_modules/@babel/plugin-transform-modules-amd": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.25.9.tgz", + "integrity": "sha512-g5T11tnI36jVClQlMlt4qKDLlWnG5pP9CSM4GhdRciTNMRgkfpo5cR6b4rGIOYPgRRuFAvwjPQ/Yk+ql4dyhbw==", "dev": true, + "license": "MIT", "dependencies": { - "function-bind": "^1.1.1" + "@babel/helper-module-transforms": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { - "node": ">= 0.4.0" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/is-core-module": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "node_modules/@babel/plugin-transform-modules-commonjs": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.25.9.tgz", + "integrity": "sha512-dwh2Ol1jWwL2MgkCzUSOvfmKElqQcuswAZypBSUsScMXvgdT8Ekq5YA6TtqpTVWH+4903NmboMuH1o9i8Rxlyg==", "dev": true, + "license": "MIT", "dependencies": { - "has": "^1.0.3" + "@babel/helper-module-transforms": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-simple-access": "^7.25.9" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/jsonc-parser": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", - "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", - "dev": true - }, - "node_modules/local-pkg": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.3.tgz", - "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==", + "node_modules/@babel/plugin-transform-modules-systemjs": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.25.9.tgz", + "integrity": "sha512-hyss7iIlH/zLHaehT+xwiymtPOpsiwIIRlCAOwBB04ta5Tt+lNItADdlXw3jAWZ96VJ2jlhl/c+PNIQPKNfvcA==", "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-transforms": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" + }, "engines": { - "node": ">=14" + "node": ">=6.9.0" }, - "funding": { - "url": "https://github.com/sponsors/antfu" + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/loupe": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", - "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", + "node_modules/@babel/plugin-transform-modules-umd": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.25.9.tgz", + "integrity": "sha512-bS9MVObUgE7ww36HEfwe6g9WakQ0KF07mQF74uuXdkoziUPfKyu/nIm663kz//e5O1nPInPFx36z7WJmJ4yNEw==", "dev": true, + "license": "MIT", "dependencies": { - "get-func-name": "^2.0.0" + "@babel/helper-module-transforms": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/lunr": { - "version": "2.3.9", - "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", - "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", - "dev": true - }, - "node_modules/marked": { - "version": "4.2.12", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.2.12.tgz", - "integrity": "sha512-yr8hSKa3Fv4D3jdZmtMMPghgVt6TWbk86WQaWhDloQjRSQhMMYCAro7jP7VDJrjjdV8pxVxMssXS8B8Y5DZ5aw==", + "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.25.9.tgz", + "integrity": "sha512-oqB6WHdKTGl3q/ItQhpLSnWWOpjUJLsOCLVyeFgeTktkBSCiurvPOsyt93gibI9CmuKvTUEtWmG5VhZD+5T/KA==", "dev": true, - "bin": { - "marked": "bin/marked.js" + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { - "node": ">= 12" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, - "node_modules/minimatch": { - "version": "7.4.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-7.4.2.tgz", - "integrity": "sha512-xy4q7wou3vUoC9k1xGTXc+awNdGaGVHtFUaey8tiX4H1QRc04DZ/rmDFwNm2EBsuYEhAZ6SgMmYf3InGY6OauA==", + "node_modules/@babel/plugin-transform-new-target": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.25.9.tgz", + "integrity": "sha512-U/3p8X1yCSoKyUj2eOBIx3FOn6pElFOKvAAGf8HTtItuPyB+ZeOqfn+mvTtg9ZlOAjsPdK3ayQEjqHjU/yLeVQ==", "dev": true, + "license": "MIT", "dependencies": { - "brace-expansion": "^2.0.1" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { - "node": ">=10" + "node": ">=6.9.0" }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/nanoid": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", + "node_modules/@babel/plugin-transform-nullish-coalescing-operator": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.25.9.tgz", + "integrity": "sha512-ENfftpLZw5EItALAD4WsY/KUWvhUlZndm5GC7G3evUsVeSJB6p0pBeLQUnRnBCBx7zV0RKQjR9kCuwrsIrjWog==", "dev": true, - "bin": { - "nanoid": "bin/nanoid.cjs" + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "node_modules/pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "node_modules/@babel/plugin-transform-numeric-separator": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.25.9.tgz", + "integrity": "sha512-TlprrJ1GBZ3r6s96Yq8gEQv82s8/5HnCVHtEJScUj90thHQbwe+E5MLhi2bbNHBEJuzrvltXSru+BUxHDoog7Q==", "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": "*" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true - }, - "node_modules/postcss": { - "version": "8.4.21", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.21.tgz", - "integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==", + "node_modules/@babel/plugin-transform-object-rest-spread": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.25.9.tgz", + "integrity": "sha512-fSaXafEE9CVHPweLYw4J0emp1t8zYTXyzN3UuG+lylqkvYd7RMrsOQ8TYx5RF231be0vqtFC6jnx3UmpJmKBYg==", "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - } - ], + "license": "MIT", "dependencies": { - "nanoid": "^3.3.4", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/plugin-transform-parameters": "^7.25.9" }, "engines": { - "node": "^10 || ^12 || >=14" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "node_modules/@babel/plugin-transform-object-super": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.25.9.tgz", + "integrity": "sha512-Kj/Gh+Rw2RNLbCK1VAWj2U48yxxqL2x0k10nPtSdRa0O2xnHXalD0s+o1A6a0W43gJ00ANo38jxkQreckOzv5A==", "dev": true, + "license": "MIT", "dependencies": { - "is-core-module": "^2.9.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-replace-supers": "^7.25.9" }, - "bin": { - "resolve": "bin/resolve" + "engines": { + "node": ">=6.9.0" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/rollup": { - "version": "3.19.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.19.1.tgz", - "integrity": "sha512-lAbrdN7neYCg/8WaoWn/ckzCtz+jr70GFfYdlf50OF7387HTg+wiuiqJRFYawwSPpqfqDNYqK7smY/ks2iAudg==", + "node_modules/@babel/plugin-transform-optional-catch-binding": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.25.9.tgz", + "integrity": "sha512-qM/6m6hQZzDcZF3onzIhZeDHDO43bkNNlOX0i8n3lR6zLbu0GN2d8qfM/IERJZYauhAHSLHy39NF0Ctdvcid7g==", "dev": true, - "bin": { - "rollup": "dist/bin/rollup" + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { - "node": ">=14.18.0", - "npm": ">=8.0.0" + "node": ">=6.9.0" }, - "optionalDependencies": { - "fsevents": "~2.3.2" + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/shiki": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.1.tgz", - "integrity": "sha512-+Jz4nBkCBe0mEDqo1eKRcCdjRtrCjozmcbTUjbPTX7OOJfEbTZzlUWlZtGe3Gb5oV1/jnojhG//YZc3rs9zSEw==", + "node_modules/@babel/plugin-transform-optional-chaining": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.25.9.tgz", + "integrity": "sha512-6AvV0FsLULbpnXeBjrY4dmWF8F7gf8QnvTEoO/wX/5xm/xE1Xo8oPuD3MPS+KS9f9XBEAWN7X1aWr4z9HdOr7A==", "dev": true, + "license": "MIT", "dependencies": { - "ansi-sequence-parser": "^1.1.0", - "jsonc-parser": "^3.2.0", - "vscode-oniguruma": "^1.7.0", - "vscode-textmate": "^8.0.0" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "node_modules/@babel/plugin-transform-parameters": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.25.9.tgz", + "integrity": "sha512-wzz6MKwpnshBAiRmn4jR8LYz/g8Ksg0o80XmwZDlordjwEk9SxBzTWC7F5ef1jhbrbOW2DJ5J6ayRukrJmnr0g==", "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": ">=0.10.0" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "node_modules/@babel/plugin-transform-private-methods": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.25.9.tgz", + "integrity": "sha512-D/JUozNpQLAPUVusvqMxyvjzllRaF8/nSrP1s2YGQT/W4LHK4xxsMcHjhOGTS01mp9Hda8nswb+FblLdJornQw==", "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": ">=0.10.0" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/strip-literal": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.0.1.tgz", - "integrity": "sha512-QZTsipNpa2Ppr6v1AmJHESqJ3Uz247MUS0OjrnnZjFAvEoWqxuyFuXn2xLgMtRnijJShAa1HL0gtJyUs7u7n3Q==", + "node_modules/@babel/plugin-transform-private-property-in-object": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.25.9.tgz", + "integrity": "sha512-Evf3kcMqzXA3xfYJmZ9Pg1OvKdtqsDMSWBDzZOPLvHiTt36E75jLDQo5w1gtRU95Q4E5PDttrTf25Fw8d/uWLw==", "dev": true, + "license": "MIT", "dependencies": { - "acorn": "^8.8.2" + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, - "funding": { - "url": "https://github.com/sponsors/antfu" + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "node_modules/@babel/plugin-transform-property-literals": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.25.9.tgz", + "integrity": "sha512-IvIUeV5KrS/VPavfSM/Iu+RE6llrHrYIKY1yfCzyO/lMXHQ+p7uGhonmGVisv6tSBSVgWzMBohTcvkC9vQcQFA==", "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": ">= 0.4" + "node": ">=6.9.0" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/tinybench": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.4.0.tgz", - "integrity": "sha512-iyziEiyFxX4kyxSp+MtY1oCH/lvjH3PxFN8PGCDeqcZWAJ/i+9y+nL85w99PxVzrIvew/GSkSbDYtiGVa85Afg==", - "dev": true + "node_modules/@babel/plugin-transform-regenerator": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.25.9.tgz", + "integrity": "sha512-vwDcDNsgMPDGP0nMqzahDWE5/MLcX8sv96+wfX7as7LoF/kr97Bo/7fI00lXY4wUXYfVmwIIyG80fGZ1uvt2qg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9", + "regenerator-transform": "^0.15.2" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } }, - "node_modules/tinypool": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.3.1.tgz", - "integrity": "sha512-zLA1ZXlstbU2rlpA4CIeVaqvWq41MTWqLY3FfsAXgC8+f7Pk7zroaJQxDgxn1xNudKW6Kmj4808rPFShUlIRmQ==", + "node_modules/@babel/plugin-transform-regexp-modifiers": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regexp-modifiers/-/plugin-transform-regexp-modifiers-7.26.0.tgz", + "integrity": "sha512-vN6saax7lrA2yA/Pak3sCxuD6F5InBjn9IcrIKQPjpsLvuHYLVroTxjdlVRHjjBWxKOqIwpTXDkOssYT4BFdRw==", "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": ">=14.0.0" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, - "node_modules/tinyspy": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-1.1.1.tgz", - "integrity": "sha512-UVq5AXt/gQlti7oxoIg5oi/9r0WpF7DGEVwXgqWSMmyN16+e3tl5lIvTaOpJ3TAtu5xFzWccFRM4R5NaWHF+4g==", + "node_modules/@babel/plugin-transform-reserved-words": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.25.9.tgz", + "integrity": "sha512-7DL7DKYjn5Su++4RXu8puKZm2XBPHyjWLUidaPEkCUBbE7IPcsrkRHggAOOKydH1dASWdcUBxrkOGNxUv5P3Jg==", "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": ">=14.0.0" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "node_modules/@babel/plugin-transform-shorthand-properties": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.25.9.tgz", + "integrity": "sha512-MUv6t0FhO5qHnS/W8XCbHmiRWOphNufpE1IVxhK5kuN3Td9FT1x4rx4K42s3RYdMXCXpfWkGSbCSd0Z64xA7Ng==", "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, "engines": { - "node": ">=4" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/typedoc": { - "version": "0.23.28", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.23.28.tgz", - "integrity": "sha512-9x1+hZWTHEQcGoP7qFmlo4unUoVJLB0H/8vfO/7wqTnZxg4kPuji9y3uRzEu0ZKez63OJAUmiGhUrtukC6Uj3w==", + "node_modules/@babel/plugin-transform-spread": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.25.9.tgz", + "integrity": "sha512-oNknIB0TbURU5pqJFVbOOFspVlrpVwo2H1+HUIsVDvp5VauGGDP1ZEvO8Nn5xyMEs3dakajOxlmkNW7kNgSm6A==", "dev": true, + "license": "MIT", "dependencies": { - "lunr": "^2.3.9", - "marked": "^4.2.12", - "minimatch": "^7.1.3", - "shiki": "^0.14.1" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9" }, - "bin": { - "typedoc": "bin/typedoc" + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-sticky-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.25.9.tgz", + "integrity": "sha512-WqBUSgeVwucYDP9U/xNRQam7xV8W5Zf+6Eo7T2SRVUFlhRiMNFdFz58u0KZmCVVqs2i7SHgpRnAhzRNmKfi2uA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { - "node": ">= 14.14" + "node": ">=6.9.0" }, "peerDependencies": { - "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x" + "@babel/core": "^7.0.0-0" } }, - "node_modules/typescript": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", - "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "node_modules/@babel/plugin-transform-template-literals": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.25.9.tgz", + "integrity": "sha512-o97AE4syN71M/lxrCtQByzphAdlYluKPDBzDVzMmfCobUjjhAryZV0AIpRPrxN0eAkxXO6ZLEScmt+PNhj2OTw==", "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { - "node": ">=12.20" + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" } }, - "node_modules/vite": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.2.0.tgz", - "integrity": "sha512-AbDTyzzwuKoRtMIRLGNxhLRuv1FpRgdIw+1y6AQG73Q5+vtecmvzKo/yk8X/vrHDpETRTx01ABijqUHIzBXi0g==", + "node_modules/@babel/plugin-transform-typeof-symbol": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.25.9.tgz", + "integrity": "sha512-v61XqUMiueJROUv66BVIOi0Fv/CUuZuZMl5NkRoCVxLAnMexZ0A3kMe7vvZ0nulxMuMp0Mk6S5hNh48yki08ZA==", "dev": true, + "license": "MIT", "dependencies": { - "esbuild": "^0.17.5", - "postcss": "^8.4.21", - "resolve": "^1.22.1", - "rollup": "^3.18.0" + "@babel/helper-plugin-utils": "^7.25.9" }, - "bin": { - "vite": "bin/vite.js" + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-escapes": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.25.9.tgz", + "integrity": "sha512-s5EDrE6bW97LtxOcGj1Khcx5AaXwiMmi4toFWRDP9/y0Woo6pXC+iyPu/KuhKtfSrNFd7jJB+/fkOtZy6aIC6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { - "node": "^14.18.0 || >=16.0.0" + "node": ">=6.9.0" }, - "optionalDependencies": { - "fsevents": "~2.3.2" + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-property-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.25.9.tgz", + "integrity": "sha512-Jt2d8Ga+QwRluxRQ307Vlxa6dMrYEMZCgGxoPR8V52rxPyldHu3hdlHspxaqYmE7oID5+kB+UKUB/eWS+DkkWg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { - "@types/node": ">= 14", - "less": "*", - "sass": "*", - "stylus": "*", - "sugarss": "*", - "terser": "^5.4.0" + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.25.9.tgz", + "integrity": "sha512-yoxstj7Rg9dlNn9UQxzk4fcNivwv4nUYz7fYXBaKxvw/lnmPuOm/ikoELygbYq68Bls3D/D+NBPHiLwZdZZ4HA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "less": { - "optional": true - }, - "sass": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "terser": { - "optional": true - } + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-sets-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.25.9.tgz", + "integrity": "sha512-8BYqO3GeVNHtx69fdPshN3fnzUNLrWdHhk/icSwigksJGczKSizZ+Z6SBCxTs723Fr5VSNorTIK7a+R2tISvwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/preset-env": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.26.0.tgz", + "integrity": "sha512-H84Fxq0CQJNdPFT2DrfnylZ3cf5K43rGfWK4LJGPpjKHiZlk0/RzwEus3PDDZZg+/Er7lCA03MVacueUuXdzfw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.26.0", + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-validator-option": "^7.25.9", + "@babel/plugin-bugfix-firefox-class-in-computed-class-key": "^7.25.9", + "@babel/plugin-bugfix-safari-class-field-initializer-scope": "^7.25.9", + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.25.9", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.25.9", + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": "^7.25.9", + "@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2", + "@babel/plugin-syntax-import-assertions": "^7.26.0", + "@babel/plugin-syntax-import-attributes": "^7.26.0", + "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6", + "@babel/plugin-transform-arrow-functions": "^7.25.9", + "@babel/plugin-transform-async-generator-functions": "^7.25.9", + "@babel/plugin-transform-async-to-generator": "^7.25.9", + "@babel/plugin-transform-block-scoped-functions": "^7.25.9", + "@babel/plugin-transform-block-scoping": "^7.25.9", + "@babel/plugin-transform-class-properties": "^7.25.9", + "@babel/plugin-transform-class-static-block": "^7.26.0", + "@babel/plugin-transform-classes": "^7.25.9", + "@babel/plugin-transform-computed-properties": "^7.25.9", + "@babel/plugin-transform-destructuring": "^7.25.9", + "@babel/plugin-transform-dotall-regex": "^7.25.9", + "@babel/plugin-transform-duplicate-keys": "^7.25.9", + "@babel/plugin-transform-duplicate-named-capturing-groups-regex": "^7.25.9", + "@babel/plugin-transform-dynamic-import": "^7.25.9", + "@babel/plugin-transform-exponentiation-operator": "^7.25.9", + "@babel/plugin-transform-export-namespace-from": "^7.25.9", + "@babel/plugin-transform-for-of": "^7.25.9", + "@babel/plugin-transform-function-name": "^7.25.9", + "@babel/plugin-transform-json-strings": "^7.25.9", + "@babel/plugin-transform-literals": "^7.25.9", + "@babel/plugin-transform-logical-assignment-operators": "^7.25.9", + "@babel/plugin-transform-member-expression-literals": "^7.25.9", + "@babel/plugin-transform-modules-amd": "^7.25.9", + "@babel/plugin-transform-modules-commonjs": "^7.25.9", + "@babel/plugin-transform-modules-systemjs": "^7.25.9", + "@babel/plugin-transform-modules-umd": "^7.25.9", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.25.9", + "@babel/plugin-transform-new-target": "^7.25.9", + "@babel/plugin-transform-nullish-coalescing-operator": "^7.25.9", + "@babel/plugin-transform-numeric-separator": "^7.25.9", + "@babel/plugin-transform-object-rest-spread": "^7.25.9", + "@babel/plugin-transform-object-super": "^7.25.9", + "@babel/plugin-transform-optional-catch-binding": "^7.25.9", + "@babel/plugin-transform-optional-chaining": "^7.25.9", + "@babel/plugin-transform-parameters": "^7.25.9", + "@babel/plugin-transform-private-methods": "^7.25.9", + "@babel/plugin-transform-private-property-in-object": "^7.25.9", + "@babel/plugin-transform-property-literals": "^7.25.9", + "@babel/plugin-transform-regenerator": "^7.25.9", + "@babel/plugin-transform-regexp-modifiers": "^7.26.0", + "@babel/plugin-transform-reserved-words": "^7.25.9", + "@babel/plugin-transform-shorthand-properties": "^7.25.9", + "@babel/plugin-transform-spread": "^7.25.9", + "@babel/plugin-transform-sticky-regex": "^7.25.9", + "@babel/plugin-transform-template-literals": "^7.25.9", + "@babel/plugin-transform-typeof-symbol": "^7.25.9", + "@babel/plugin-transform-unicode-escapes": "^7.25.9", + "@babel/plugin-transform-unicode-property-regex": "^7.25.9", + "@babel/plugin-transform-unicode-regex": "^7.25.9", + "@babel/plugin-transform-unicode-sets-regex": "^7.25.9", + "@babel/preset-modules": "0.1.6-no-external-plugins", + "babel-plugin-polyfill-corejs2": "^0.4.10", + "babel-plugin-polyfill-corejs3": "^0.10.6", + "babel-plugin-polyfill-regenerator": "^0.6.1", + "core-js-compat": "^3.38.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/preset-modules": { + "version": "0.1.6-no-external-plugins", + "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz", + "integrity": "sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/types": "^7.4.4", + "esutils": "^2.0.2" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.0.tgz", + "integrity": "sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==", + "dev": true, + "license": "MIT", + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.9.tgz", + "integrity": "sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.25.9", + "@babel/parser": "^7.25.9", + "@babel/types": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.25.9.tgz", + "integrity": "sha512-ZCuvfwOwlz/bawvAuvcj8rrithP2/N55Tzz342AkTvq4qaWbGfmCk/tKhNaV2cthijKrPAA8SRJV5WWe7IBMJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.25.9", + "@babel/generator": "^7.25.9", + "@babel/parser": "^7.25.9", + "@babel/template": "^7.25.9", + "@babel/types": "^7.25.9", + "debug": "^4.3.1", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.0.tgz", + "integrity": "sha512-Z/yiTPj+lDVnF7lWeKCIJzaIkI0vYO87dMpZ4bg4TDrFe4XXLFWL1TbXU27gBP3QccxV9mZICCrnjnYlJjXHOA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@es-joy/jsdoccomment": { + "version": "0.49.0", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.49.0.tgz", + "integrity": "sha512-xjZTSFgECpb9Ohuk5yMX5RhUEbfeQcuOp8IF60e+wyzWEF0M5xeSgqsfLtvPEX8BIyOX9saZqzuGPmZ8oWc+5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "comment-parser": "1.4.1", + "esquery": "^1.6.0", + "jsdoc-type-pratt-parser": "~4.1.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.0.tgz", + "integrity": "sha512-WtKdFM7ls47zkKHFVzMz8opM7LkcsIp9amDUBIAWirg70RM71WRSjdILPsY5Uv1D42ZpUfaPILDlfactHgsRkw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.24.0.tgz", + "integrity": "sha512-arAtTPo76fJ/ICkXWetLCc9EwEHKaeya4vMrReVlEIUCAUncH7M4bhMQ+M9Vf+FFOZJdTNMXNBrWwW+OXWpSew==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.24.0.tgz", + "integrity": "sha512-Vsm497xFM7tTIPYK9bNTYJyF/lsP590Qc1WxJdlB6ljCbdZKU9SY8i7+Iin4kyhV/KV5J2rOKsBQbB77Ab7L/w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.24.0.tgz", + "integrity": "sha512-t8GrvnFkiIY7pa7mMgJd7p8p8qqYIz1NYiAoKc75Zyv73L3DZW++oYMSHPRarcotTKuSs6m3hTOa5CKHaS02TQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.0.tgz", + "integrity": "sha512-CKyDpRbK1hXwv79soeTJNHb5EiG6ct3efd/FTPdzOWdbZZfGhpbcqIpiD0+vwmpu0wTIL97ZRPZu8vUt46nBSw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.24.0.tgz", + "integrity": "sha512-rgtz6flkVkh58od4PwTRqxbKH9cOjaXCMZgWD905JOzjFKW+7EiUObfd/Kav+A6Gyud6WZk9w+xu6QLytdi2OA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.0.tgz", + "integrity": "sha512-6Mtdq5nHggwfDNLAHkPlyLBpE5L6hwsuXZX8XNmHno9JuL2+bg2BX5tRkwjyfn6sKbxZTq68suOjgWqCicvPXA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.24.0.tgz", + "integrity": "sha512-D3H+xh3/zphoX8ck4S2RxKR6gHlHDXXzOf6f/9dbFt/NRBDIE33+cVa49Kil4WUjxMGW0ZIYBYtaGCa2+OsQwQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.24.0.tgz", + "integrity": "sha512-gJKIi2IjRo5G6Glxb8d3DzYXlxdEj2NlkixPsqePSZMhLudqPhtZ4BUrpIuTjJYXxvF9njql+vRjB2oaC9XpBw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.0.tgz", + "integrity": "sha512-TDijPXTOeE3eaMkRYpcy3LarIg13dS9wWHRdwYRnzlwlA370rNdZqbcp0WTyyV/k2zSxfko52+C7jU5F9Tfj1g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.24.0.tgz", + "integrity": "sha512-K40ip1LAcA0byL05TbCQ4yJ4swvnbzHscRmUilrmP9Am7//0UjPreh4lpYzvThT2Quw66MhjG//20mrufm40mA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.24.0.tgz", + "integrity": "sha512-0mswrYP/9ai+CU0BzBfPMZ8RVm3RGAN/lmOMgW4aFUSOQBjA31UP8Mr6DDhWSuMwj7jaWOT0p0WoZ6jeHhrD7g==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.24.0.tgz", + "integrity": "sha512-hIKvXm0/3w/5+RDtCJeXqMZGkI2s4oMUGj3/jM0QzhgIASWrGO5/RlzAzm5nNh/awHE0A19h/CvHQe6FaBNrRA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.24.0.tgz", + "integrity": "sha512-HcZh5BNq0aC52UoocJxaKORfFODWXZxtBaaZNuN3PUX3MoDsChsZqopzi5UupRhPHSEHotoiptqikjN/B77mYQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.24.0.tgz", + "integrity": "sha512-bEh7dMn/h3QxeR2KTy1DUszQjUrIHPZKyO6aN1X4BCnhfYhuQqedHaa5MxSQA/06j3GpiIlFGSsy1c7Gf9padw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.24.0.tgz", + "integrity": "sha512-ZcQ6+qRkw1UcZGPyrCiHHkmBaj9SiCD8Oqd556HldP+QlpUIe2Wgn3ehQGVoPOvZvtHm8HPx+bH20c9pvbkX3g==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.0.tgz", + "integrity": "sha512-vbutsFqQ+foy3wSSbmjBXXIJ6PL3scghJoM8zCL142cGaZKAdCZHyf+Bpu/MmX9zT9Q0zFBVKb36Ma5Fzfa8xA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.24.0.tgz", + "integrity": "sha512-hjQ0R/ulkO8fCYFsG0FZoH+pWgTTDreqpqY7UnQntnaKv95uP5iW3+dChxnx7C3trQQU40S+OgWhUVwCjVFLvg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.0.tgz", + "integrity": "sha512-MD9uzzkPQbYehwcN583yx3Tu5M8EIoTD+tUgKF982WYL9Pf5rKy9ltgD0eUgs8pvKnmizxjXZyLt0z6DC3rRXg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.24.0.tgz", + "integrity": "sha512-4ir0aY1NGUhIC1hdoCzr1+5b43mw99uNwVzhIq1OY3QcEwPDO3B7WNXBzaKY5Nsf1+N11i1eOfFcq+D/gOS15Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.24.0.tgz", + "integrity": "sha512-jVzdzsbM5xrotH+W5f1s+JtUy1UWgjU0Cf4wMvffTB8m6wP5/kx0KiaLHlbJO+dMgtxKV8RQ/JvtlFcdZ1zCPA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.24.0.tgz", + "integrity": "sha512-iKc8GAslzRpBytO2/aN3d2yb2z8XTVfNV0PjGlCxKo5SgWmNXx82I/Q3aG1tFfS+A2igVCY97TJ8tnYwpUWLCA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.24.0.tgz", + "integrity": "sha512-vQW36KZolfIudCcTnaTpmLQ24Ha1RjygBo39/aLkM2kmjkWmZGEJ5Gn9l5/7tzXA42QGIoWbICfg6KLLkIw6yw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.0.tgz", + "integrity": "sha512-7IAFPrjSQIJrGsK6flwg7NFmwBoSTyF3rl7If0hNUFQU4ilTsEPL6GuMuU9BfIWVVGuRnuIidkSMC+c0Otu8IA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", + "integrity": "sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.0.tgz", + "integrity": "sha512-zdHg2FPIFNKPdcHWtiNT+jEFCHYVplAXRDlQDyqy0zGx/q2parwh7brGJSiTxRk/TSMkbM//zt/f5CHgyTyaSQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^2.1.4", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.9.0.tgz", + "integrity": "sha512-7ATR9F0e4W85D/0w7cU0SNj7qkAexMG+bAHEZOjo9akvGuhHE2m7umzWzfnpa0XAg5Kxc1BWmtPMV67jJ+9VUg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.2.0.tgz", + "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/js": { + "version": "9.16.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.16.0.tgz", + "integrity": "sha512-tw2HxzQkrbeuvyj1tG2Yqq+0H9wGoI2IMk4EOsQeX+vmd75FtJAzf+gTA69WF+baUKRYQ3x2kbLE08js5OsTVg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.4.tgz", + "integrity": "sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.3.tgz", + "integrity": "sha512-2b/g5hRmpbb1o4GnTZax9N9m0FXzz9OV42ZzI4rDDMDuHUqigAiQCEWChBWCY4ztAGVRjoWT19v0yMmc5/L5kA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@gerrit0/mini-shiki": { + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/@gerrit0/mini-shiki/-/mini-shiki-1.24.1.tgz", + "integrity": "sha512-PNP/Gjv3VqU7z7DjRgO3F9Ok5frTKqtpV+LJW1RzMcr2zpRk0ulhEWnbcNGXzPC7BZyWMIHrkfQX2GZRfxrn6Q==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@shikijs/engine-oniguruma": "^1.24.0", + "@shikijs/types": "^1.24.0", + "@shikijs/vscode-textmate": "^9.3.0" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", + "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.3.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", + "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.1.tgz", + "integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@polka/url": { + "version": "1.0.0-next.28", + "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.28.tgz", + "integrity": "sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rollup/plugin-alias": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-alias/-/plugin-alias-5.1.1.tgz", + "integrity": "sha512-PR9zDb+rOzkRb2VD+EuKB7UC41vU5DIwZ5qqCpk0KJudcWAyi8rvYOhS7+L5aZCspw1stTViLgN5v6FF1p5cgQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-babel": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-6.0.4.tgz", + "integrity": "sha512-YF7Y52kFdFT/xVSuVdjkV5ZdX/3YtmX0QulG+x0taQOtJdHYzVU61aSSkAgVJ7NOv6qPkIYiJSgSWWN/DM5sGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.18.6", + "@rollup/pluginutils": "^5.0.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0", + "@types/babel__core": "^7.1.9", + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "@types/babel__core": { + "optional": true + }, + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.3.tgz", + "integrity": "sha512-Pnsb6f32CD2W3uCaLZIzDmeFyQ2b8UWMFI7xtwUezpcGBDVDW6y9XgAWIlARiGAo6eNF5FK5aQTr0LFyNyqq5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.28.0.tgz", + "integrity": "sha512-wLJuPLT6grGZsy34g4N1yRfYeouklTgPhH1gWXCYspenKYD0s3cR99ZevOGw5BexMNywkbV3UkjADisozBmpPQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.28.0.tgz", + "integrity": "sha512-eiNkznlo0dLmVG/6wf+Ifi/v78G4d4QxRhuUl+s8EWZpDewgk7PX3ZyECUXU0Zq/Ca+8nU8cQpNC4Xgn2gFNDA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.28.0.tgz", + "integrity": "sha512-lmKx9yHsppblnLQZOGxdO66gT77bvdBtr/0P+TPOseowE7D9AJoBw8ZDULRasXRWf1Z86/gcOdpBrV6VDUY36Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.28.0.tgz", + "integrity": "sha512-8hxgfReVs7k9Js1uAIhS6zq3I+wKQETInnWQtgzt8JfGx51R1N6DRVy3F4o0lQwumbErRz52YqwjfvuwRxGv1w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.28.0.tgz", + "integrity": "sha512-lA1zZB3bFx5oxu9fYud4+g1mt+lYXCoch0M0V/xhqLoGatbzVse0wlSQ1UYOWKpuSu3gyN4qEc0Dxf/DII1bhQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.28.0.tgz", + "integrity": "sha512-aI2plavbUDjCQB/sRbeUZWX9qp12GfYkYSJOrdYTL/C5D53bsE2/nBPuoiJKoWp5SN78v2Vr8ZPnB+/VbQ2pFA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.28.0.tgz", + "integrity": "sha512-WXveUPKtfqtaNvpf0iOb0M6xC64GzUX/OowbqfiCSXTdi/jLlOmH0Ba94/OkiY2yTGTwteo4/dsHRfh5bDCZ+w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.28.0.tgz", + "integrity": "sha512-yLc3O2NtOQR67lI79zsSc7lk31xjwcaocvdD1twL64PK1yNaIqCeWI9L5B4MFPAVGEVjH5k1oWSGuYX1Wutxpg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.28.0.tgz", + "integrity": "sha512-+P9G9hjEpHucHRXqesY+3X9hD2wh0iNnJXX/QhS/J5vTdG6VhNYMxJ2rJkQOxRUd17u5mbMLHM7yWGZdAASfcg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.28.0.tgz", + "integrity": "sha512-1xsm2rCKSTpKzi5/ypT5wfc+4bOGa/9yI/eaOLW0oMs7qpC542APWhl4A37AENGZ6St6GBMWhCCMM6tXgTIplw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.28.0.tgz", + "integrity": "sha512-zgWxMq8neVQeXL+ouSf6S7DoNeo6EPgi1eeqHXVKQxqPy1B2NvTbaOUWPn/7CfMKL7xvhV0/+fq/Z/J69g1WAQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.28.0.tgz", + "integrity": "sha512-VEdVYacLniRxbRJLNtzwGt5vwS0ycYshofI7cWAfj7Vg5asqj+pt+Q6x4n+AONSZW/kVm+5nklde0qs2EUwU2g==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.28.0.tgz", + "integrity": "sha512-LQlP5t2hcDJh8HV8RELD9/xlYtEzJkm/aWGsauvdO2ulfl3QYRjqrKW+mGAIWP5kdNCBheqqqYIGElSRCaXfpw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.28.0.tgz", + "integrity": "sha512-Nl4KIzteVEKE9BdAvYoTkW19pa7LR/RBrT6F1dJCV/3pbjwDcaOq+edkP0LXuJ9kflW/xOK414X78r+K84+msw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.28.0.tgz", + "integrity": "sha512-eKpJr4vBDOi4goT75MvW+0dXcNUqisK4jvibY9vDdlgLx+yekxSm55StsHbxUsRxSTt3JEQvlr3cGDkzcSP8bw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.28.0.tgz", + "integrity": "sha512-Vi+WR62xWGsE/Oj+mD0FNAPY2MEox3cfyG0zLpotZdehPFXwz6lypkGs5y38Jd/NVSbOD02aVad6q6QYF7i8Bg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.28.0.tgz", + "integrity": "sha512-kN/Vpip8emMLn/eOza+4JwqDZBL6MPNpkdaEsgUtW1NYN3DZvZqSQrbKzJcTL6hd8YNmFTn7XGWMwccOcJBL0A==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.28.0.tgz", + "integrity": "sha512-Bvno2/aZT6usSa7lRDL2+hMjVAGjuqaymF1ApZm31JXzniR/hvr14jpU+/z4X6Gt5BPlzosscyJZGUvguXIqeQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@shikijs/engine-oniguruma": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.24.0.tgz", + "integrity": "sha512-Eua0qNOL73Y82lGA4GF5P+G2+VXX9XnuUxkiUuwcxQPH4wom+tE39kZpBFXfUuwNYxHSkrSxpB1p4kyRW0moSg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@shikijs/types": "1.24.0", + "@shikijs/vscode-textmate": "^9.3.0" + } + }, + "node_modules/@shikijs/types": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.24.0.tgz", + "integrity": "sha512-aptbEuq1Pk88DMlCe+FzXNnBZ17LCiLIGWAeCWhoFDzia5Q5Krx3DgnULLiouSdd6+LUM39XwXGppqYE0Ghtug==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@shikijs/vscode-textmate": "^9.3.0", + "@types/hast": "^3.0.4" + } + }, + "node_modules/@shikijs/vscode-textmate": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-9.3.0.tgz", + "integrity": "sha512-jn7/7ky30idSkd/O5yDBfAnVt+JJpepofP/POZ1iMOxK59cOfqIgg/Dj0eFsjOTMw+4ycJN0uhZH/Eb0bs/EUA==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/@ts-morph/common": { + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.25.0.tgz", + "integrity": "sha512-kMnZz+vGGHi4GoHnLmMhGNjm44kGtKUXGnOvrKmMwAuvNjM/PgKVGfUnL7IDvK7Jb2QQ82jq3Zmp04Gy+r3Dkg==", + "dev": true, + "license": "MIT", + "dependencies": { + "minimatch": "^9.0.4", + "path-browserify": "^1.0.1", + "tinyglobby": "^0.2.9" + } + }, + "node_modules/@ts-morph/common/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@ts-morph/common/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@types/cytoscape": { + "version": "3.21.8", + "resolved": "https://registry.npmjs.org/@types/cytoscape/-/cytoscape-3.21.8.tgz", + "integrity": "sha512-6Bo9ZDrv0vfwe8Sg/ERc5VL0yU0gYvP4dgZi0fAXYkKHfyHaNqWRMcwYm3mu4sLsXbB8ZuXE75sR7qnaOL5JgQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.17.0.tgz", + "integrity": "sha512-HU1KAdW3Tt8zQkdvNoIijfWDMvdSweFYm4hWh+KwhPstv+sCmWb89hCIP8msFm9N1R/ooh9honpSuvqKWlYy3w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.17.0", + "@typescript-eslint/type-utils": "8.17.0", + "@typescript-eslint/utils": "8.17.0", + "@typescript-eslint/visitor-keys": "8.17.0", + "graphemer": "^1.4.0", + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0", + "eslint": "^8.57.0 || ^9.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.17.0.tgz", + "integrity": "sha512-Drp39TXuUlD49F7ilHHCG7TTg8IkA+hxCuULdmzWYICxGXvDXmDmWEjJYZQYgf6l/TFfYNE167m7isnc3xlIEg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@typescript-eslint/scope-manager": "8.17.0", + "@typescript-eslint/types": "8.17.0", + "@typescript-eslint/typescript-estree": "8.17.0", + "@typescript-eslint/visitor-keys": "8.17.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.17.0.tgz", + "integrity": "sha512-/ewp4XjvnxaREtqsZjF4Mfn078RD/9GmiEAtTeLQ7yFdKnqwTOgRMSvFz4et9U5RiJQ15WTGXPLj89zGusvxBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.17.0", + "@typescript-eslint/visitor-keys": "8.17.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.17.0.tgz", + "integrity": "sha512-q38llWJYPd63rRnJ6wY/ZQqIzPrBCkPdpIsaCfkR3Q4t3p6sb422zougfad4TFW9+ElIFLVDzWGiGAfbb/v2qw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/typescript-estree": "8.17.0", + "@typescript-eslint/utils": "8.17.0", + "debug": "^4.3.4", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.17.0.tgz", + "integrity": "sha512-gY2TVzeve3z6crqh2Ic7Cr+CAv6pfb0Egee7J5UAVWCpVvDI/F71wNfolIim4FE6hT15EbpZFVUj9j5i38jYXA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.17.0.tgz", + "integrity": "sha512-JqkOopc1nRKZpX+opvKqnM3XUlM7LpFMD0lYxTqOTKQfCWAmxw45e3qlOCsEqEB2yuacujivudOFpCnqkBDNMw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@typescript-eslint/types": "8.17.0", + "@typescript-eslint/visitor-keys": "8.17.0", + "debug": "^4.3.4", + "fast-glob": "^3.3.2", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.17.0.tgz", + "integrity": "sha512-bQC8BnEkxqG8HBGKwG9wXlZqg37RKSMY7v/X8VEWD8JG2JuTHuNK0VFvMPMUKQcbk6B+tf05k+4AShAEtCtJ/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@typescript-eslint/scope-manager": "8.17.0", + "@typescript-eslint/types": "8.17.0", + "@typescript-eslint/typescript-estree": "8.17.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.17.0.tgz", + "integrity": "sha512-1Hm7THLpO6ww5QU6H/Qp+AusUUl+z/CAm3cNZZ0jQvon9yicgO7Rwd+/WWRpMKLYV6p2UvdbR27c86rzCPpreg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.17.0", + "eslint-visitor-keys": "^4.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typhonjs-build-test/esm-d-ts": { + "version": "0.3.0-next.9", + "resolved": "https://registry.npmjs.org/@typhonjs-build-test/esm-d-ts/-/esm-d-ts-0.3.0-next.9.tgz", + "integrity": "sha512-adxtMxsO7Bwk2BkgRDQjboFIers2IT1b55EWSow8lESlwq/KPsUhydXxTpoysRaUlp05WcstpztuJuCu45ZoVg==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "@es-joy/jsdoccomment": "^0.49.0", + "@rollup/plugin-alias": "^5.1.1", + "@types/cytoscape": "^3.21.8", + "@typhonjs-build-test/rollup-plugin-pkg-imports": "^0.5.0", + "@typhonjs-plugin/manager": "^0.1.2", + "@typhonjs-utils/file-util": "^0.1.0", + "@typhonjs-utils/logger-color": "^0.1.0", + "@typhonjs-utils/object": "^0.1.0", + "@typhonjs-utils/package-json": "^0.7.0", + "comment-parser": "^1.4.1", + "cytoscape": "^3.30.0", + "es-module-lexer": "^1.5.4", + "fs-extra": "^11.2.0", + "glob-to-regexp": "^0.4.1", + "import-meta-resolve": "^4.1.0", + "prettier": "^3.3.3", + "resolve.exports": "^2.0.2", + "rollup-plugin-dts": "^6.1.1", + "sade": "^1.8.1", + "ts-morph": "^24.0.0", + "type-fest": "^4.26.0", + "upath": "^2.0.0" + }, + "bin": { + "esm-d-ts": "src/cli/index.js" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "rollup": "3.3 - 4", + "typescript": ">=5.5" + } + }, + "node_modules/@typhonjs-build-test/rollup-plugin-pkg-imports": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@typhonjs-build-test/rollup-plugin-pkg-imports/-/rollup-plugin-pkg-imports-0.5.0.tgz", + "integrity": "sha512-YAcRIETyEw4zMuQsJNQrOFHo/lqml88lligtClSSAQXnGT6ez0jiluDhxjzkJAQ2NGdALh09CGNL/xZgtUecCQ==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "@typhonjs-utils/package-json": "^0.7.0", + "glob-to-regexp": "^0.4.1", + "import-meta-resolve": "^4.0.0", + "resolve.exports": "^2.0.2" + }, + "engines": { + "node": ">=18.0" + }, + "peerDependencies": { + "rollup": "3.3 - 4" + } + }, + "node_modules/@typhonjs-plugin/manager": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@typhonjs-plugin/manager/-/manager-0.1.2.tgz", + "integrity": "sha512-bMtnjVlqeiPjmW/U+rBm5Mb+ZoZs7uKyZYN3Rtq0DXzndyMrIDBOiQyssSwGxpFVDC7V9yArvt0EoGWDxAIYLQ==", + "dev": true, + "license": "MPL-2.0", + "engines": { + "node": ">=14.18" + } + }, + "node_modules/@typhonjs-typedoc/ts-lib-docs": { + "version": "2024.9.18", + "resolved": "https://registry.npmjs.org/@typhonjs-typedoc/ts-lib-docs/-/ts-lib-docs-2024.9.18.tgz", + "integrity": "sha512-LuyFXC9iC7DP0h5a3IbeLKMbRdD0Xl8CfdFA9zdUZXU5Rqp597CdCU42WwknXnX+MbNIkS6MK7+Om0L9Vn9Yxw==", + "dev": true, + "license": "MPL-2.0", + "peerDependencies": { + "typedoc": ">=0.25.0" + } + }, + "node_modules/@typhonjs-typedoc/typedoc-pkg": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@typhonjs-typedoc/typedoc-pkg/-/typedoc-pkg-0.2.0.tgz", + "integrity": "sha512-38kzFK85t7JUUI7iEGjMRco0mF2NSxvPxOCVssOWGL1UeK1APZh4FIP8JPyJycZ2hF3VlPJoi5G+t42bzneKUg==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "@typhonjs-typedoc/ts-lib-docs": "2024.9.18", + "@typhonjs-typedoc/typedoc-theme-dmt": "0.3.0", + "@typhonjs-utils/file-util": "^0.1.0", + "@typhonjs-utils/logger-color": "^0.1.0", + "@typhonjs-utils/object": "^0.1.0", + "@typhonjs-utils/package-json": "^0.7.0", + "glob": "^11.0.0", + "is-glob": "^4.0.3", + "resolve.exports": "^2.0.3", + "sade": "^1.8.1", + "upath": "^2" + }, + "bin": { + "typedoc-pkg": "src/cli/index.js" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "typedoc": ">=0.27.3 < 0.28", + "typescript": ">=5.1.0 <6" + } + }, + "node_modules/@typhonjs-typedoc/typedoc-pkg/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typhonjs-typedoc/typedoc-pkg/node_modules/glob": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.0.tgz", + "integrity": "sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^4.0.1", + "minimatch": "^10.0.0", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^2.0.0" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typhonjs-typedoc/typedoc-pkg/node_modules/jackspeak": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.2.tgz", + "integrity": "sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typhonjs-typedoc/typedoc-pkg/node_modules/lru-cache": { + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.2.tgz", + "integrity": "sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA==", + "dev": true, + "license": "ISC", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@typhonjs-typedoc/typedoc-pkg/node_modules/minimatch": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", + "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typhonjs-typedoc/typedoc-pkg/node_modules/path-scurry": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", + "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typhonjs-typedoc/typedoc-theme-dmt": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@typhonjs-typedoc/typedoc-theme-dmt/-/typedoc-theme-dmt-0.3.0.tgz", + "integrity": "sha512-jAMB06rTz4gYDiWjlSTtcsHvtIApGfAgmlBJvTM7KdeXibecX6Gao0J9dyij+dNdWyaLO2s0Of9EVn/ZTRDwpw==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "cheerio": "^1.0.0" + }, + "peerDependencies": { + "typedoc": ">=0.27.3 <0.28" + } + }, + "node_modules/@typhonjs-utils/file-util": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@typhonjs-utils/file-util/-/file-util-0.1.0.tgz", + "integrity": "sha512-4dhQrk6M+oa3aaOhhQxS48KWt0xD9KyBqXi9yaOx6rcAzBGv37KIS6bHxtYqp7xOqHGrCF8K8K4XC2XbYMUpeA==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "upath": "^2" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@typhonjs-utils/logger-color": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@typhonjs-utils/logger-color/-/logger-color-0.1.0.tgz", + "integrity": "sha512-BWXSwxs5ZDVs4vi/YxJLLN3287+i4Z/KXqQuKUN5o5qWc4ioYU+ws9svZSL1XzqkLpF+j2oALhE8l0pmPydWxg==", + "dev": true, + "license": "MPL-2.0", + "engines": { + "node": ">=14.18" + } + }, + "node_modules/@typhonjs-utils/object": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@typhonjs-utils/object/-/object-0.1.0.tgz", + "integrity": "sha512-XCG2Qae6FZzzm81q0ya3D/xBRKlXF8lELi5T2E+nNYjqzi9T+2LTCUKR84dpo856wXAFn3CdTvDQKn5OVVnLlQ==", + "dev": true, + "license": "MPL-2.0", + "engines": { + "node": ">=14.18" + } + }, + "node_modules/@typhonjs-utils/package-json": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@typhonjs-utils/package-json/-/package-json-0.7.0.tgz", + "integrity": "sha512-aFoXJuGJqUuPJ+00/voU/iIc1bPDx0nJBGHt0ntyc1XmQOZDuwq7mLpHGsdIXZlF1lMSX/B9AFtlLATSyVWrVQ==", + "dev": true, + "license": "MPL-2.0", + "engines": { + "node": ">=12" + } + }, + "node_modules/@vitest/coverage-v8": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-2.1.8.tgz", + "integrity": "sha512-2Y7BPlKH18mAZYAW1tYByudlCYrQyl5RGvnnDYJKW5tCiO5qg3KSAy3XAxcxKz900a0ZXxWtKrMuZLe3lKBpJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ampproject/remapping": "^2.3.0", + "@bcoe/v8-coverage": "^0.2.3", + "debug": "^4.3.7", + "istanbul-lib-coverage": "^3.2.2", + "istanbul-lib-report": "^3.0.1", + "istanbul-lib-source-maps": "^5.0.6", + "istanbul-reports": "^3.1.7", + "magic-string": "^0.30.12", + "magicast": "^0.3.5", + "std-env": "^3.8.0", + "test-exclude": "^7.0.1", + "tinyrainbow": "^1.2.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@vitest/browser": "2.1.8", + "vitest": "2.1.8" + }, + "peerDependenciesMeta": { + "@vitest/browser": { + "optional": true + } + } + }, + "node_modules/@vitest/expect": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.8.tgz", + "integrity": "sha512-8ytZ/fFHq2g4PJVAtDX57mayemKgDR6X3Oa2Foro+EygiOJHUXhCqBAAKQYYajZpFoIfvBCF1j6R6IYRSIUFuw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "2.1.8", + "@vitest/utils": "2.1.8", + "chai": "^5.1.2", + "tinyrainbow": "^1.2.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/mocker": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-2.1.8.tgz", + "integrity": "sha512-7guJ/47I6uqfttp33mgo6ga5Gr1VnL58rcqYKyShoRK9ebu8T5Rs6HN3s1NABiBeVTdWNrwUMcHH54uXZBN4zA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "2.1.8", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.12" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^5.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/mocker/node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/@vitest/pretty-format": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-2.1.8.tgz", + "integrity": "sha512-9HiSZ9zpqNLKlbIDRWOnAWqgcA7xu+8YxXSekhr0Ykab7PAYFkhkwoqVArPOtJhPmYeE2YHgKZlj3CP36z2AJQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^1.2.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-2.1.8.tgz", + "integrity": "sha512-17ub8vQstRnRlIU5k50bG+QOMLHRhYPAna5tw8tYbj+jzjcspnwnwtPtiOlkuKC4+ixDPTuLZiqiWWQ2PSXHVg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "2.1.8", + "pathe": "^1.1.2" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-2.1.8.tgz", + "integrity": "sha512-20T7xRFbmnkfcmgVEz+z3AU/3b0cEzZOt/zmnvZEctg64/QZbSDJEVm9fLnnlSi74KibmRsO9/Qabi+t0vCRPg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "2.1.8", + "magic-string": "^0.30.12", + "pathe": "^1.1.2" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-2.1.8.tgz", + "integrity": "sha512-5swjf2q95gXeYPevtW0BLk6H8+bPlMb4Vw/9Em4hFxDcaOxS+e0LOX4yqNxoHzMR2akEB2xfpnWUzkZokmgWDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyspy": "^3.0.2" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/ui": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/ui/-/ui-2.1.8.tgz", + "integrity": "sha512-5zPJ1fs0ixSVSs5+5V2XJjXLmNzjugHRyV11RqxYVR+oMcogZ9qTuSfKW+OcTV0JeFNznI83BNylzH6SSNJ1+w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "2.1.8", + "fflate": "^0.8.2", + "flatted": "^3.3.1", + "pathe": "^1.1.2", + "sirv": "^3.0.0", + "tinyglobby": "^0.2.10", + "tinyrainbow": "^1.2.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "vitest": "2.1.8" + } + }, + "node_modules/@vitest/utils": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-2.1.8.tgz", + "integrity": "sha512-dwSoui6djdwbfFmIgbIjX2ZhIoG7Ex/+xpxyiEgIGzjliY8xGkcpITKTlp6B4MgtGkF2ilvm97cPM96XZaAgcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "2.1.8", + "loupe": "^3.1.2", + "tinyrainbow": "^1.2.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/babel-plugin-polyfill-corejs2": { + "version": "0.4.12", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.12.tgz", + "integrity": "sha512-CPWT6BwvhrTO2d8QVorhTCQw9Y43zOu7G9HigcfxvepOU6b8o3tcWad6oVgZIsZCTt42FFv97aA7ZJsbM4+8og==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.22.6", + "@babel/helper-define-polyfill-provider": "^0.6.3", + "semver": "^6.3.1" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/babel-plugin-polyfill-corejs3": { + "version": "0.10.6", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.10.6.tgz", + "integrity": "sha512-b37+KR2i/khY5sKmWNVQAnitvquQbNdWy6lJdsr0kmquCKEEUgMKK4SboVM3HtfnZilfjr4MMQ7vY58FVWDtIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.6.2", + "core-js-compat": "^3.38.0" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/babel-plugin-polyfill-regenerator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.3.tgz", + "integrity": "sha512-LiWSbl4CRSIa5x/JAU6jZiG9eit9w6mz+yVMFwDE83LAWvt0AfGBoZ7HS/mkhrKuh2ZlzfVZYKoLjXdqw6Yt7Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.6.3" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", + "dev": true, + "license": "ISC" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.24.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.2.tgz", + "integrity": "sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "caniuse-lite": "^1.0.30001669", + "electron-to-chromium": "^1.5.41", + "node-releases": "^2.0.18", + "update-browserslist-db": "^1.1.1" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001686", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001686.tgz", + "integrity": "sha512-Y7deg0Aergpa24M3qLC5xjNklnKnhsmSyR/V89dLZ1n0ucJIFNs7PgR2Yfa/Zf6W79SbBicgtGxZr2juHkEUIA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/chai": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-5.1.2.tgz", + "integrity": "sha512-aGtmf24DW6MLHHG5gCx4zaI3uBq3KRtxeVs0DjFH6Z0rDNbsvTxFASFvdj79pxjxZ8/5u3PIiN3IwEIQkiiuPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "assertion-error": "^2.0.1", + "check-error": "^2.1.1", + "deep-eql": "^5.0.1", + "loupe": "^3.1.0", + "pathval": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/check-error": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", + "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 16" + } + }, + "node_modules/cheerio": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0.tgz", + "integrity": "sha512-quS9HgjQpdaXOvsZz82Oz7uxtXiy6UIsIQcpBj7HRw2M63Skasm9qlDocAM7jNuaxdhpPU7c4kJN+gA5MCu4ww==", + "dev": true, + "license": "MIT", + "dependencies": { + "cheerio-select": "^2.1.0", + "dom-serializer": "^2.0.0", + "domhandler": "^5.0.3", + "domutils": "^3.1.0", + "encoding-sniffer": "^0.2.0", + "htmlparser2": "^9.1.0", + "parse5": "^7.1.2", + "parse5-htmlparser2-tree-adapter": "^7.0.0", + "parse5-parser-stream": "^7.1.2", + "undici": "^6.19.5", + "whatwg-mimetype": "^4.0.0" + }, + "engines": { + "node": ">=18.17" + }, + "funding": { + "url": "https://github.com/cheeriojs/cheerio?sponsor=1" + } + }, + "node_modules/cheerio-select": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-2.1.0.tgz", + "integrity": "sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0", + "css-select": "^5.1.0", + "css-what": "^6.1.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/code-block-writer": { + "version": "13.0.3", + "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-13.0.3.tgz", + "integrity": "sha512-Oofo0pq3IKnsFtuHqSF7TqBfr71aeyZDVJ0HpmqB7FBM2qEigL0iPONSCZSO9pE9dZTAxANe5XHG9Uy0YMv8cg==", + "dev": true, + "license": "MIT" + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/comment-parser": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.1.tgz", + "integrity": "sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/core-js-compat": { + "version": "3.39.0", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.39.0.tgz", + "integrity": "sha512-VgEUx3VwlExr5no0tXlBt+silBvhTryPwCXRI2Id1PN8WTKu7MreethvddqOubrYxkFdv/RnYrqlv1sFNAUelw==", + "dev": true, + "license": "MIT", + "dependencies": { + "browserslist": "^4.24.2" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/css-select": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", + "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^6.1.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/css-what": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", + "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/cytoscape": { + "version": "3.30.4", + "resolved": "https://registry.npmjs.org/cytoscape/-/cytoscape-3.30.4.tgz", + "integrity": "sha512-OxtlZwQl1WbwMmLiyPSEBuzeTIQnwZhJYYWFzZ2PhEHVFwpeaqNIkUzSiso00D98qk60l8Gwon2RP304d3BJ1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-eql": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", + "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/dom-serializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "dev": true, + "license": "MIT", + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "BSD-2-Clause" + }, + "node_modules/domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "domelementtype": "^2.3.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/domutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", + "integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true, + "license": "MIT" + }, + "node_modules/electron-to-chromium": { + "version": "1.5.68", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.68.tgz", + "integrity": "sha512-FgMdJlma0OzUYlbrtZ4AeXjKxKPk6KT8WOP8BjcqxWtlg8qyJQjRzPJzUtUn5GBg1oQ26hFs7HOOHJMYiJRnvQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true, + "license": "MIT" + }, + "node_modules/encoding-sniffer": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/encoding-sniffer/-/encoding-sniffer-0.2.0.tgz", + "integrity": "sha512-ju7Wq1kg04I3HtiYIOrUrdfdDvkyO9s5XM8QAj/bN61Yo/Vb4vgJxy5vi4Yxk01gWHbrofpPtpxM8bKger9jhg==", + "dev": true, + "license": "MIT", + "dependencies": { + "iconv-lite": "^0.6.3", + "whatwg-encoding": "^3.1.1" + }, + "funding": { + "url": "https://github.com/fb55/encoding-sniffer?sponsor=1" + } + }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/es-module-lexer": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.5.4.tgz", + "integrity": "sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==", + "dev": true, + "license": "MIT" + }, + "node_modules/esbuild": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.0.tgz", + "integrity": "sha512-FuLPevChGDshgSicjisSooU0cemp/sGXR841D5LHMB7mTVOmsEHcAxaH3irL53+8YDIeVNQEySh4DaYU/iuPqQ==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.24.0", + "@esbuild/android-arm": "0.24.0", + "@esbuild/android-arm64": "0.24.0", + "@esbuild/android-x64": "0.24.0", + "@esbuild/darwin-arm64": "0.24.0", + "@esbuild/darwin-x64": "0.24.0", + "@esbuild/freebsd-arm64": "0.24.0", + "@esbuild/freebsd-x64": "0.24.0", + "@esbuild/linux-arm": "0.24.0", + "@esbuild/linux-arm64": "0.24.0", + "@esbuild/linux-ia32": "0.24.0", + "@esbuild/linux-loong64": "0.24.0", + "@esbuild/linux-mips64el": "0.24.0", + "@esbuild/linux-ppc64": "0.24.0", + "@esbuild/linux-riscv64": "0.24.0", + "@esbuild/linux-s390x": "0.24.0", + "@esbuild/linux-x64": "0.24.0", + "@esbuild/netbsd-x64": "0.24.0", + "@esbuild/openbsd-arm64": "0.24.0", + "@esbuild/openbsd-x64": "0.24.0", + "@esbuild/sunos-x64": "0.24.0", + "@esbuild/win32-arm64": "0.24.0", + "@esbuild/win32-ia32": "0.24.0", + "@esbuild/win32-x64": "0.24.0" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "9.16.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.16.0.tgz", + "integrity": "sha512-whp8mSQI4C8VXd+fLgSM0lh3UlmcFtVwUQjyKCFfsp+2ItAIYhlq/hqGahGqHE6cv9unM41VlqKk2VtKYR2TaA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.19.0", + "@eslint/core": "^0.9.0", + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "9.16.0", + "@eslint/plugin-kit": "^0.2.3", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.1", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.5", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.2.0", + "eslint-visitor-keys": "^4.2.0", + "espree": "^10.3.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-scope": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.2.0.tgz", + "integrity": "sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", + "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.14.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true, + "license": "MIT" + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/expect-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.1.0.tgz", + "integrity": "sha512-bFi65yM+xZgk+u/KRIpekdSYkTB5W1pEf0Lt8Q8Msh7b+eQ7LXVtIB1Bkm4fvclDEL1b2CZkMhv2mOeF8tMdkA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-glob": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fastq": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", + "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", + "dev": true, + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fdir": { + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.2.tgz", + "integrity": "sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fflate": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz", + "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==", + "dev": true, + "license": "MIT" + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.2.tgz", + "integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==", + "dev": true, + "license": "ISC" + }, + "node_modules/foreground-child": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", + "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", + "dev": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/fs-extra": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", + "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/glob": { + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true, + "license": "MIT" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true, + "license": "MIT" + }, + "node_modules/htmlparser2": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-9.1.0.tgz", + "integrity": "sha512-5zfg6mHUoaer/97TxnGpxmbR7zJtPwIYFMZ/H5ucTlPZhKvtum05yiPK3Mgai3a0DyVxv7qYqoweaEd2nrYQzQ==", + "dev": true, + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "MIT", + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.1.0", + "entities": "^4.5.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-meta-resolve": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.1.0.tgz", + "integrity": "sha512-I6fiaX09Xivtk+THaMfAwnA3MVA5Big1WHF1Dfx9hFuvNIWpXnorlkzhcQf6ehrqQiiZECRt1poOAkPmer3ruw==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/is-core-module": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz", + "integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-5.0.6.tgz", + "integrity": "sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.23", + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz", + "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsdoc-type-pratt-parser": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.1.0.tgz", + "integrity": "sha512-Hicd6JK5Njt2QB6XYFS7ok9e37O8AYk3jTcppG4YVQnYjOemymvTcmc7OWsmq/Qqj5TdRFO5/x/tIPmBeRtGHg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/jsesc": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.0.2.tgz", + "integrity": "sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "uc.micro": "^2.0.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/loupe": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.2.tgz", + "integrity": "sha512-23I4pFZHmAemUnz8WZXbYRSKYj801VDaNv9ETuMh7IrMc7VuVVSo+Z9iLE3ni30+U48iDWfi30d3twAXBYmnCg==", + "dev": true, + "license": "MIT" + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/lunr": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/magic-string": { + "version": "0.30.14", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.14.tgz", + "integrity": "sha512-5c99P1WKTed11ZC0HMJOj6CDIue6F8ySu+bJL+85q1zBEIY8IklrJ1eiKC2NDRh3Ct3FcvmJPyQHb9erXMTJNw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, + "node_modules/magicast": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.3.5.tgz", + "integrity": "sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.25.4", + "@babel/types": "^7.25.4", + "source-map-js": "^1.2.0" + } + }, + "node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/markdown-it": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", + "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "argparse": "^2.0.1", + "entities": "^4.4.0", + "linkify-it": "^5.0.0", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" + }, + "bin": { + "markdown-it": "bin/markdown-it.mjs" + } + }, + "node_modules/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/micromatch/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/mrmime": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.0.tgz", + "integrity": "sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-releases": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", + "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==", + "dev": true, + "license": "MIT" + }, + "node_modules/nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse5": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.2.1.tgz", + "integrity": "sha512-BuBYQYlv1ckiPdQi/ohiivi9Sagc9JG+Ozs0r7b/0iK3sKmrb0b9FdWdBbOdx6hBCM/F9Ir82ofnBhtZOjCRPQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "entities": "^4.5.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5-htmlparser2-tree-adapter": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.1.0.tgz", + "integrity": "sha512-ruw5xyKs6lrpo9x9rCZqZZnIUntICjQAd0Wsmp396Ul9lN/h+ifgVV1x1gZHi8euej6wTfpqX8j+BFQxF0NS/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "domhandler": "^5.0.3", + "parse5": "^7.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5-parser-stream": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5-parser-stream/-/parse5-parser-stream-7.1.2.tgz", + "integrity": "sha512-JyeQc9iwFLn5TbvvqACIF/VXG6abODeB3Fwmv/TGdLk2LfbWkaySGY72at4+Ty7EkPZj854u4CrICqNk2qIbow==", + "dev": true, + "license": "MIT", + "dependencies": { + "parse5": "^7.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", + "dev": true, + "license": "MIT" + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/pathe": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", + "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/pathval": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.0.tgz", + "integrity": "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.16" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.4.49", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz", + "integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.1.tgz", + "integrity": "sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/punycode.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/regenerate": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", + "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==", + "dev": true, + "license": "MIT" + }, + "node_modules/regenerate-unicode-properties": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.2.0.tgz", + "integrity": "sha512-DqHn3DwbmmPVzeKj9woBadqmXxLvQoQIwu7nopMc72ztvxVmVk2SBhSnx67zuye5TP+lJsb/TBQsjLKhnDf3MA==", + "dev": true, + "license": "MIT", + "dependencies": { + "regenerate": "^1.4.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", + "dev": true, + "license": "MIT" + }, + "node_modules/regenerator-transform": { + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.15.2.tgz", + "integrity": "sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.8.4" + } + }, + "node_modules/regexpu-core": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-6.2.0.tgz", + "integrity": "sha512-H66BPQMrv+V16t8xtmq+UC0CBpiTBA60V8ibS1QVReIp8T1z8hwFxqcGzm9K6lgsN7sB5edVH8a+ze6Fqm4weA==", + "dev": true, + "license": "MIT", + "dependencies": { + "regenerate": "^1.4.2", + "regenerate-unicode-properties": "^10.2.0", + "regjsgen": "^0.8.0", + "regjsparser": "^0.12.0", + "unicode-match-property-ecmascript": "^2.0.0", + "unicode-match-property-value-ecmascript": "^2.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regjsgen": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.8.0.tgz", + "integrity": "sha512-RvwtGe3d7LvWiDQXeQw8p5asZUmfU1G/l6WbUXeHta7Y2PEIvBTwH6E2EfmYUK8pxcxEdEmaomqyp0vZZ7C+3Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/regjsparser": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.12.0.tgz", + "integrity": "sha512-cnE+y8bz4NhMjISKbgeVJtqNbtf5QpjZP+Bslo+UqkIt9QPnX9q095eiRRASJG1/tz6dlNr6Z5NsBiWYokp6EQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "jsesc": "~3.0.2" + }, + "bin": { + "regjsparser": "bin/parser" + } + }, + "node_modules/resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/resolve.exports": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.3.tgz", + "integrity": "sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rollup": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.28.0.tgz", + "integrity": "sha512-G9GOrmgWHBma4YfCcX8PjH0qhXSdH8B4HDE2o4/jaxj93S4DPCIDoLcXz99eWMji4hB29UFCEd7B2gwGJDR9cQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.6" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.28.0", + "@rollup/rollup-android-arm64": "4.28.0", + "@rollup/rollup-darwin-arm64": "4.28.0", + "@rollup/rollup-darwin-x64": "4.28.0", + "@rollup/rollup-freebsd-arm64": "4.28.0", + "@rollup/rollup-freebsd-x64": "4.28.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.28.0", + "@rollup/rollup-linux-arm-musleabihf": "4.28.0", + "@rollup/rollup-linux-arm64-gnu": "4.28.0", + "@rollup/rollup-linux-arm64-musl": "4.28.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.28.0", + "@rollup/rollup-linux-riscv64-gnu": "4.28.0", + "@rollup/rollup-linux-s390x-gnu": "4.28.0", + "@rollup/rollup-linux-x64-gnu": "4.28.0", + "@rollup/rollup-linux-x64-musl": "4.28.0", + "@rollup/rollup-win32-arm64-msvc": "4.28.0", + "@rollup/rollup-win32-ia32-msvc": "4.28.0", + "@rollup/rollup-win32-x64-msvc": "4.28.0", + "fsevents": "~2.3.2" + } + }, + "node_modules/rollup-plugin-dts": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/rollup-plugin-dts/-/rollup-plugin-dts-6.1.1.tgz", + "integrity": "sha512-aSHRcJ6KG2IHIioYlvAOcEq6U99sVtqDDKVhnwt70rW6tsz3tv5OSjEiWcgzfsHdLyGXZ/3b/7b/+Za3Y6r1XA==", + "dev": true, + "license": "LGPL-3.0-only", + "dependencies": { + "magic-string": "^0.30.10" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/Swatinem" + }, + "optionalDependencies": { + "@babel/code-frame": "^7.24.2" + }, + "peerDependencies": { + "rollup": "^3.29.4 || ^4", + "typescript": "^4.5 || ^5.0" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/sade": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", + "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "mri": "^1.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true, + "license": "MIT" + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true, + "license": "ISC" + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/sirv": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/sirv/-/sirv-3.0.0.tgz", + "integrity": "sha512-BPwJGUeDaDCHihkORDchNyyTvWFhcusy1XMmhEVTQTwGeybFbp8YEmB+njbPnth1FibULBSBVwCQni25XlCUDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@polka/url": "^1.0.0-next.24", + "mrmime": "^2.0.0", + "totalist": "^3.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, + "node_modules/std-env": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.8.0.tgz", + "integrity": "sha512-Bc3YwwCB+OzldMxOXJIIvC6cPRWr/LxOp48CdQTOkPyk/t4JWWJbrilwBd7RJzKV8QW7tJkcgAmeuLLJugl5/w==", + "dev": true, + "license": "MIT" + }, + "node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/string-width-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/test-exclude": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-7.0.1.tgz", + "integrity": "sha512-pFYqmTw68LXVjeWJMST4+borgQP2AyMNbg1BpZh9LbyhUeNkeaPF9gzfPGUAnSMV3qPYdWUwDIjjCLiSDOl7vg==", + "dev": true, + "license": "ISC", + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^10.4.1", + "minimatch": "^9.0.4" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/test-exclude/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/test-exclude/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.1.tgz", + "integrity": "sha512-WiCJLEECkO18gwqIp6+hJg0//p23HXp4S+gGtAKu3mI2F2/sXC4FvHvXvB0zJVVaTPhx1/tOwdbRsa1sOBIKqQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyglobby": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.10.tgz", + "integrity": "sha512-Zc+8eJlFMvgatPZTl6A9L/yht8QqdmUNtURHaKZLmKBE12hNPSrqNkUp2cs3M/UKmNVVAMFQYSjYIVHDjW5zew==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.4.2", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/tinypool": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.0.2.tgz", + "integrity": "sha512-al6n+QEANGFOMf/dmUMsuS5/r9B06uwlyNjZZql/zv8J7ybHCgoihBNORZCY2mzUuAnomQa2JdhyHKzZxPCrFA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.0.0 || >=20.0.0" + } + }, + "node_modules/tinyrainbow": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-1.2.0.tgz", + "integrity": "sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-3.0.2.tgz", + "integrity": "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/totalist": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz", + "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/ts-api-utils": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.3.tgz", + "integrity": "sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "typescript": ">=4.2.0" + } + }, + "node_modules/ts-morph": { + "version": "24.0.0", + "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-24.0.0.tgz", + "integrity": "sha512-2OAOg/Ob5yx9Et7ZX4CvTCc0UFoZHwLEJ+dpDPSUi5TgwwlTlX47w+iFRrEwzUZwYACjq83cgjS/Da50Ga37uw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ts-morph/common": "~0.25.0", + "code-block-writer": "^13.0.3" + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-fest": { + "version": "4.30.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.30.0.tgz", + "integrity": "sha512-G6zXWS1dLj6eagy6sVhOMQiLtJdxQBHIA9Z6HFUNLOlr6MFOgzV8wvmidtPONfPtEUv0uZsy77XJNzTAfwPDaA==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typedoc": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.27.3.tgz", + "integrity": "sha512-oWT7zDS5oIaxYL5yOikBX4cL99CpNAZn6mI24JZQxsYuIHbtguSSwJ7zThuzNNwSE0wqhlfTSd99HgqKu2aQXQ==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "@gerrit0/mini-shiki": "^1.24.0", + "lunr": "^2.3.9", + "markdown-it": "^14.1.0", + "minimatch": "^9.0.5", + "yaml": "^2.6.1" + }, + "bin": { + "typedoc": "bin/typedoc" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "typescript": "5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x" + } + }, + "node_modules/typedoc/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/typedoc/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "peer": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/typescript": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", + "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/typescript-eslint": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.17.0.tgz", + "integrity": "sha512-409VXvFd/f1br1DCbuKNFqQpXICoTB+V51afcwG1pn1a3Cp92MqAUges3YjwEdQ0cMUoCIodjVDAYzyD8h3SYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.17.0", + "@typescript-eslint/parser": "8.17.0", + "@typescript-eslint/utils": "8.17.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/undici": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.21.0.tgz", + "integrity": "sha512-BUgJXc752Kou3oOIuU1i+yZZypyZRqNPW0vqoMPl8VaoalSfeR0D8/t4iAS3yirs79SSMTxTag+ZC86uswv+Cw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.17" + } + }, + "node_modules/unicode-canonical-property-names-ecmascript": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.1.tgz", + "integrity": "sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", + "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "unicode-canonical-property-names-ecmascript": "^2.0.0", + "unicode-property-aliases-ecmascript": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-value-ecmascript": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.2.0.tgz", + "integrity": "sha512-4IehN3V/+kkr5YeSSDDQG8QLqO26XpL2XP3GQtqwlT/QYSECAwFztxVHjlbh0+gjJ3XmNLS0zDsbgs9jWKExLg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-property-aliases-ecmascript": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz", + "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/upath": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/upath/-/upath-2.0.1.tgz", + "integrity": "sha512-1uEe95xksV1O0CYKXo8vQvN1JEbtJp7lb7C5U9HMsIp6IVwntkH/oNUzyVNQSd4S1sYk2FpSSW44FqMc8qee5w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4", + "yarn": "*" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", + "integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.0" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/vite": { + "version": "5.4.11", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.11.tgz", + "integrity": "sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.21.3", + "postcss": "^8.4.43", + "rollup": "^4.20.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, + "node_modules/vite-node": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.1.8.tgz", + "integrity": "sha512-uPAwSr57kYjAUux+8E2j0q0Fxpn8M9VoyfGiRI8Kfktz9NcYMCenwY5RnZxnF1WTu3TGiYipirIzacLL3VVGFg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.3.7", + "es-module-lexer": "^1.5.4", + "pathe": "^1.1.2", + "vite": "^5.0.0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/vite/node_modules/@esbuild/aix-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/android-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/android-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/android-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/darwin-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/darwin-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/freebsd-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/freebsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-loong64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-mips64el": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-riscv64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-s390x": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/netbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/openbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/sunos-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" } }, - "node_modules/vite/node_modules/@esbuild/android-arm": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.12.tgz", - "integrity": "sha512-E/sgkvwoIfj4aMAPL2e35VnUJspzVYl7+M1B2cqeubdBhADV4uPon0KCc8p2G+LqSJ6i8ocYPCqY3A4GGq0zkQ==", + "node_modules/vite/node_modules/@esbuild/win32-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", "cpu": [ - "arm" + "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ - "android" + "win32" ], "engines": { "node": ">=12" } }, - "node_modules/vite/node_modules/@esbuild/linux-loong64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.12.tgz", - "integrity": "sha512-GTOEtj8h9qPKXCyiBBnHconSCV9LwFyx/gv3Phw0pa25qPYjVuuGZ4Dk14bGCfGX3qKF0+ceeQvwmtI+aYBbVA==", + "node_modules/vite/node_modules/@esbuild/win32-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", "cpu": [ - "loong64" + "ia32" ], "dev": true, + "license": "MIT", "optional": true, "os": [ - "linux" + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/win32-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" ], "engines": { "node": ">=12" } }, "node_modules/vite/node_modules/esbuild": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.12.tgz", - "integrity": "sha512-bX/zHl7Gn2CpQwcMtRogTTBf9l1nl+H6R8nUbjk+RuKqAE3+8FDulLA+pHvX7aA7Xe07Iwa+CWvy9I8Y2qqPKQ==", + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", "dev": true, "hasInstallScript": true, + "license": "MIT", "bin": { "esbuild": "bin/esbuild" }, @@ -1276,64 +6869,73 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/android-arm": "0.17.12", - "@esbuild/android-arm64": "0.17.12", - "@esbuild/android-x64": "0.17.12", - "@esbuild/darwin-arm64": "0.17.12", - "@esbuild/darwin-x64": "0.17.12", - "@esbuild/freebsd-arm64": "0.17.12", - "@esbuild/freebsd-x64": "0.17.12", - "@esbuild/linux-arm": "0.17.12", - "@esbuild/linux-arm64": "0.17.12", - "@esbuild/linux-ia32": "0.17.12", - "@esbuild/linux-loong64": "0.17.12", - "@esbuild/linux-mips64el": "0.17.12", - "@esbuild/linux-ppc64": "0.17.12", - "@esbuild/linux-riscv64": "0.17.12", - "@esbuild/linux-s390x": "0.17.12", - "@esbuild/linux-x64": "0.17.12", - "@esbuild/netbsd-x64": "0.17.12", - "@esbuild/openbsd-x64": "0.17.12", - "@esbuild/sunos-x64": "0.17.12", - "@esbuild/win32-arm64": "0.17.12", - "@esbuild/win32-ia32": "0.17.12", - "@esbuild/win32-x64": "0.17.12" + "@esbuild/aix-ppc64": "0.21.5", + "@esbuild/android-arm": "0.21.5", + "@esbuild/android-arm64": "0.21.5", + "@esbuild/android-x64": "0.21.5", + "@esbuild/darwin-arm64": "0.21.5", + "@esbuild/darwin-x64": "0.21.5", + "@esbuild/freebsd-arm64": "0.21.5", + "@esbuild/freebsd-x64": "0.21.5", + "@esbuild/linux-arm": "0.21.5", + "@esbuild/linux-arm64": "0.21.5", + "@esbuild/linux-ia32": "0.21.5", + "@esbuild/linux-loong64": "0.21.5", + "@esbuild/linux-mips64el": "0.21.5", + "@esbuild/linux-ppc64": "0.21.5", + "@esbuild/linux-riscv64": "0.21.5", + "@esbuild/linux-s390x": "0.21.5", + "@esbuild/linux-x64": "0.21.5", + "@esbuild/netbsd-x64": "0.21.5", + "@esbuild/openbsd-x64": "0.21.5", + "@esbuild/sunos-x64": "0.21.5", + "@esbuild/win32-arm64": "0.21.5", + "@esbuild/win32-ia32": "0.21.5", + "@esbuild/win32-x64": "0.21.5" } }, "node_modules/vitest": { - "version": "0.25.8", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.25.8.tgz", - "integrity": "sha512-X75TApG2wZTJn299E/TIYevr4E9/nBo1sUtZzn0Ci5oK8qnpZAZyhwg0qCeMSakGIWtc6oRwcQFyFfW14aOFWg==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.1.8.tgz", + "integrity": "sha512-1vBKTZskHw/aosXqQUlVWWlGUxSJR8YtiyZDJAFeW2kPAeX6S3Sool0mjspO+kXLuxVWlEDDowBAeqeAQefqLQ==", "dev": true, + "license": "MIT", "dependencies": { - "@types/chai": "^4.3.4", - "@types/chai-subset": "^1.3.3", - "@types/node": "*", - "acorn": "^8.8.1", - "acorn-walk": "^8.2.0", - "chai": "^4.3.7", - "debug": "^4.3.4", - "local-pkg": "^0.4.2", - "source-map": "^0.6.1", - "strip-literal": "^1.0.0", - "tinybench": "^2.3.1", - "tinypool": "^0.3.0", - "tinyspy": "^1.0.2", - "vite": "^3.0.0 || ^4.0.0" + "@vitest/expect": "2.1.8", + "@vitest/mocker": "2.1.8", + "@vitest/pretty-format": "^2.1.8", + "@vitest/runner": "2.1.8", + "@vitest/snapshot": "2.1.8", + "@vitest/spy": "2.1.8", + "@vitest/utils": "2.1.8", + "chai": "^5.1.2", + "debug": "^4.3.7", + "expect-type": "^1.1.0", + "magic-string": "^0.30.12", + "pathe": "^1.1.2", + "std-env": "^3.8.0", + "tinybench": "^2.9.0", + "tinyexec": "^0.3.1", + "tinypool": "^1.0.1", + "tinyrainbow": "^1.2.0", + "vite": "^5.0.0", + "vite-node": "2.1.8", + "why-is-node-running": "^2.3.0" }, "bin": { "vitest": "vitest.mjs" }, "engines": { - "node": ">=v14.16.0" + "node": "^18.0.0 || >=20.0.0" }, "funding": { - "url": "https://github.com/sponsors/antfu" + "url": "https://opencollective.com/vitest" }, "peerDependencies": { "@edge-runtime/vm": "*", - "@vitest/browser": "*", - "@vitest/ui": "*", + "@types/node": "^18.0.0 || >=20.0.0", + "@vitest/browser": "2.1.8", + "@vitest/ui": "2.1.8", "happy-dom": "*", "jsdom": "*" }, @@ -1341,6 +6943,9 @@ "@edge-runtime/vm": { "optional": true }, + "@types/node": { + "optional": true + }, "@vitest/browser": { "optional": true }, @@ -1355,756 +6960,200 @@ } } }, - "node_modules/vscode-oniguruma": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", - "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", - "dev": true - }, - "node_modules/vscode-textmate": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", - "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==", - "dev": true - } - }, - "dependencies": { - "@esbuild/android-arm": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.18.tgz", - "integrity": "sha512-5GT+kcs2WVGjVs7+boataCkO5Fg0y4kCjzkB5bAip7H4jfnOS3dA6KPiww9W1OEKTKeAcUVhdZGvgI65OXmUnw==", - "dev": true, - "optional": true - }, - "@esbuild/android-arm64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.12.tgz", - "integrity": "sha512-WQ9p5oiXXYJ33F2EkE3r0FRDFVpEdcDiwNX3u7Xaibxfx6vQE0Sb8ytrfQsA5WO6kDn6mDfKLh6KrPBjvkk7xA==", - "dev": true, - "optional": true - }, - "@esbuild/android-x64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.12.tgz", - "integrity": "sha512-m4OsaCr5gT+se25rFPHKQXARMyAehHTQAz4XX1Vk3d27VtqiX0ALMBPoXZsGaB6JYryCLfgGwUslMqTfqeLU0w==", - "dev": true, - "optional": true - }, - "@esbuild/darwin-arm64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.12.tgz", - "integrity": "sha512-O3GCZghRIx+RAN0NDPhyyhRgwa19MoKlzGonIb5hgTj78krqp9XZbYCvFr9N1eUxg0ZQEpiiZ4QvsOQwBpP+lg==", - "dev": true, - "optional": true - }, - "@esbuild/darwin-x64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.12.tgz", - "integrity": "sha512-5D48jM3tW27h1qjaD9UNRuN+4v0zvksqZSPZqeSWggfMlsVdAhH3pwSfQIFJwcs9QJ9BRibPS4ViZgs3d2wsCA==", - "dev": true, - "optional": true - }, - "@esbuild/freebsd-arm64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.12.tgz", - "integrity": "sha512-OWvHzmLNTdF1erSvrfoEBGlN94IE6vCEaGEkEH29uo/VoONqPnoDFfShi41Ew+yKimx4vrmmAJEGNoyyP+OgOQ==", - "dev": true, - "optional": true - }, - "@esbuild/freebsd-x64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.12.tgz", - "integrity": "sha512-A0Xg5CZv8MU9xh4a+7NUpi5VHBKh1RaGJKqjxe4KG87X+mTjDE6ZvlJqpWoeJxgfXHT7IMP9tDFu7IZ03OtJAw==", - "dev": true, - "optional": true - }, - "@esbuild/linux-arm": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.12.tgz", - "integrity": "sha512-WsHyJ7b7vzHdJ1fv67Yf++2dz3D726oO3QCu8iNYik4fb5YuuReOI9OtA+n7Mk0xyQivNTPbl181s+5oZ38gyA==", - "dev": true, - "optional": true - }, - "@esbuild/linux-arm64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.12.tgz", - "integrity": "sha512-cK3AjkEc+8v8YG02hYLQIQlOznW+v9N+OI9BAFuyqkfQFR+DnDLhEM5N8QRxAUz99cJTo1rLNXqRrvY15gbQUg==", - "dev": true, - "optional": true - }, - "@esbuild/linux-ia32": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.12.tgz", - "integrity": "sha512-jdOBXJqcgHlah/nYHnj3Hrnl9l63RjtQ4vn9+bohjQPI2QafASB5MtHAoEv0JQHVb/xYQTFOeuHnNYE1zF7tYw==", - "dev": true, - "optional": true - }, - "@esbuild/linux-loong64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.18.tgz", - "integrity": "sha512-L4jVKS82XVhw2nvzLg/19ClLWg0y27ulRwuP7lcyL6AbUWB5aPglXY3M21mauDQMDfRLs8cQmeT03r/+X3cZYQ==", - "dev": true, - "optional": true - }, - "@esbuild/linux-mips64el": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.12.tgz", - "integrity": "sha512-o8CIhfBwKcxmEENOH9RwmUejs5jFiNoDw7YgS0EJTF6kgPgcqLFjgoc5kDey5cMHRVCIWc6kK2ShUePOcc7RbA==", - "dev": true, - "optional": true - }, - "@esbuild/linux-ppc64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.12.tgz", - "integrity": "sha512-biMLH6NR/GR4z+ap0oJYb877LdBpGac8KfZoEnDiBKd7MD/xt8eaw1SFfYRUeMVx519kVkAOL2GExdFmYnZx3A==", - "dev": true, - "optional": true - }, - "@esbuild/linux-riscv64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.12.tgz", - "integrity": "sha512-jkphYUiO38wZGeWlfIBMB72auOllNA2sLfiZPGDtOBb1ELN8lmqBrlMiucgL8awBw1zBXN69PmZM6g4yTX84TA==", - "dev": true, - "optional": true - }, - "@esbuild/linux-s390x": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.12.tgz", - "integrity": "sha512-j3ucLdeY9HBcvODhCY4b+Ds3hWGO8t+SAidtmWu/ukfLLG/oYDMaA+dnugTVAg5fnUOGNbIYL9TOjhWgQB8W5g==", - "dev": true, - "optional": true - }, - "@esbuild/linux-x64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.12.tgz", - "integrity": "sha512-uo5JL3cgaEGotaqSaJdRfFNSCUJOIliKLnDGWaVCgIKkHxwhYMm95pfMbWZ9l7GeW9kDg0tSxcy9NYdEtjwwmA==", + "node_modules/whatwg-encoding": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", + "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", "dev": true, - "optional": true - }, - "@esbuild/netbsd-x64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.12.tgz", - "integrity": "sha512-DNdoRg8JX+gGsbqt2gPgkgb00mqOgOO27KnrWZtdABl6yWTST30aibGJ6geBq3WM2TIeW6COs5AScnC7GwtGPg==", - "dev": true, - "optional": true - }, - "@esbuild/openbsd-x64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.12.tgz", - "integrity": "sha512-aVsENlr7B64w8I1lhHShND5o8cW6sB9n9MUtLumFlPhG3elhNWtE7M1TFpj3m7lT3sKQUMkGFjTQBrvDDO1YWA==", - "dev": true, - "optional": true - }, - "@esbuild/sunos-x64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.12.tgz", - "integrity": "sha512-qbHGVQdKSwi0JQJuZznS4SyY27tYXYF0mrgthbxXrZI3AHKuRvU+Eqbg/F0rmLDpW/jkIZBlCO1XfHUBMNJ1pg==", - "dev": true, - "optional": true - }, - "@esbuild/win32-arm64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.12.tgz", - "integrity": "sha512-zsCp8Ql+96xXTVTmm6ffvoTSZSV2B/LzzkUXAY33F/76EajNw1m+jZ9zPfNJlJ3Rh4EzOszNDHsmG/fZOhtqDg==", - "dev": true, - "optional": true - }, - "@esbuild/win32-ia32": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.12.tgz", - "integrity": "sha512-FfrFjR4id7wcFYOdqbDfDET3tjxCozUgbqdkOABsSFzoZGFC92UK7mg4JKRc/B3NNEf1s2WHxJ7VfTdVDPN3ng==", - "dev": true, - "optional": true - }, - "@esbuild/win32-x64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.12.tgz", - "integrity": "sha512-JOOxw49BVZx2/5tW3FqkdjSD/5gXYeVGPDcB0lvap0gLQshkh1Nyel1QazC+wNxus3xPlsYAgqU1BUmrmCvWtw==", - "dev": true, - "optional": true - }, - "@types/chai": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.4.tgz", - "integrity": "sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw==", - "dev": true - }, - "@types/chai-subset": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz", - "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==", - "dev": true, - "requires": { - "@types/chai": "*" + "license": "MIT", + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=18" } }, - "@types/node": { - "version": "18.15.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.3.tgz", - "integrity": "sha512-p6ua9zBxz5otCmbpb5D3U4B5Nanw6Pk3PPyX05xnxbB/fRv71N7CPmORg7uAD5P70T0xmx1pzAx/FUfa5X+3cw==", - "dev": true - }, - "acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", - "dev": true - }, - "acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true - }, - "ansi-sequence-parser": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.0.tgz", - "integrity": "sha512-lEm8mt52to2fT8GhciPCGeCXACSz2UwIN4X2e2LJSnZ5uAbn2/dsYdOmUXq0AtWS5cpAupysIneExOgH0Vd2TQ==", - "dev": true - }, - "assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true - }, - "balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "node_modules/whatwg-mimetype": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", + "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", "dev": true, - "requires": { - "balanced-match": "^1.0.0" + "license": "MIT", + "engines": { + "node": ">=18" } }, - "chai": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", - "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, - "requires": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^4.1.2", - "get-func-name": "^2.0.0", - "loupe": "^2.3.1", - "pathval": "^1.1.1", - "type-detect": "^4.0.5" - } - }, - "check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", - "dev": true - }, - "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "deep-eql": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", - "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", - "dev": true, - "requires": { - "type-detect": "^4.0.0" + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" } }, - "esbuild": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.18.tgz", - "integrity": "sha512-x/R72SmW3sSFRm5zrrIjAhCeQSAWoni3CmHEqfQrZIQTM3lVCdehdwuIqaOtfC2slvpdlLa62GYoN8SxT23m6Q==", + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", "dev": true, - "requires": { - "@esbuild/android-arm": "0.15.18", - "@esbuild/linux-loong64": "0.15.18", - "esbuild-android-64": "0.15.18", - "esbuild-android-arm64": "0.15.18", - "esbuild-darwin-64": "0.15.18", - "esbuild-darwin-arm64": "0.15.18", - "esbuild-freebsd-64": "0.15.18", - "esbuild-freebsd-arm64": "0.15.18", - "esbuild-linux-32": "0.15.18", - "esbuild-linux-64": "0.15.18", - "esbuild-linux-arm": "0.15.18", - "esbuild-linux-arm64": "0.15.18", - "esbuild-linux-mips64le": "0.15.18", - "esbuild-linux-ppc64le": "0.15.18", - "esbuild-linux-riscv64": "0.15.18", - "esbuild-linux-s390x": "0.15.18", - "esbuild-netbsd-64": "0.15.18", - "esbuild-openbsd-64": "0.15.18", - "esbuild-sunos-64": "0.15.18", - "esbuild-windows-32": "0.15.18", - "esbuild-windows-64": "0.15.18", - "esbuild-windows-arm64": "0.15.18" + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" } }, - "esbuild-android-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.18.tgz", - "integrity": "sha512-wnpt3OXRhcjfIDSZu9bnzT4/TNTDsOUvip0foZOUBG7QbSt//w3QV4FInVJxNhKc/ErhUxc5z4QjHtMi7/TbgA==", - "dev": true, - "optional": true - }, - "esbuild-android-arm64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.18.tgz", - "integrity": "sha512-G4xu89B8FCzav9XU8EjsXacCKSG2FT7wW9J6hOc18soEHJdtWu03L3TQDGf0geNxfLTtxENKBzMSq9LlbjS8OQ==", - "dev": true, - "optional": true - }, - "esbuild-darwin-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.18.tgz", - "integrity": "sha512-2WAvs95uPnVJPuYKP0Eqx+Dl/jaYseZEUUT1sjg97TJa4oBtbAKnPnl3b5M9l51/nbx7+QAEtuummJZW0sBEmg==", - "dev": true, - "optional": true - }, - "esbuild-darwin-arm64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.18.tgz", - "integrity": "sha512-tKPSxcTJ5OmNb1btVikATJ8NftlyNlc8BVNtyT/UAr62JFOhwHlnoPrhYWz09akBLHI9nElFVfWSTSRsrZiDUA==", - "dev": true, - "optional": true - }, - "esbuild-freebsd-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.18.tgz", - "integrity": "sha512-TT3uBUxkteAjR1QbsmvSsjpKjOX6UkCstr8nMr+q7zi3NuZ1oIpa8U41Y8I8dJH2fJgdC3Dj3CXO5biLQpfdZA==", - "dev": true, - "optional": true - }, - "esbuild-freebsd-arm64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.18.tgz", - "integrity": "sha512-R/oVr+X3Tkh+S0+tL41wRMbdWtpWB8hEAMsOXDumSSa6qJR89U0S/PpLXrGF7Wk/JykfpWNokERUpCeHDl47wA==", - "dev": true, - "optional": true - }, - "esbuild-linux-32": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.18.tgz", - "integrity": "sha512-lphF3HiCSYtaa9p1DtXndiQEeQDKPl9eN/XNoBf2amEghugNuqXNZA/ZovthNE2aa4EN43WroO0B85xVSjYkbg==", - "dev": true, - "optional": true - }, - "esbuild-linux-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.18.tgz", - "integrity": "sha512-hNSeP97IviD7oxLKFuii5sDPJ+QHeiFTFLoLm7NZQligur8poNOWGIgpQ7Qf8Balb69hptMZzyOBIPtY09GZYw==", - "dev": true, - "optional": true - }, - "esbuild-linux-arm": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.18.tgz", - "integrity": "sha512-UH779gstRblS4aoS2qpMl3wjg7U0j+ygu3GjIeTonCcN79ZvpPee12Qun3vcdxX+37O5LFxz39XeW2I9bybMVA==", - "dev": true, - "optional": true - }, - "esbuild-linux-arm64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.18.tgz", - "integrity": "sha512-54qr8kg/6ilcxd+0V3h9rjT4qmjc0CccMVWrjOEM/pEcUzt8X62HfBSeZfT2ECpM7104mk4yfQXkosY8Quptug==", - "dev": true, - "optional": true - }, - "esbuild-linux-mips64le": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.18.tgz", - "integrity": "sha512-Mk6Ppwzzz3YbMl/ZZL2P0q1tnYqh/trYZ1VfNP47C31yT0K8t9s7Z077QrDA/guU60tGNp2GOwCQnp+DYv7bxQ==", - "dev": true, - "optional": true - }, - "esbuild-linux-ppc64le": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.18.tgz", - "integrity": "sha512-b0XkN4pL9WUulPTa/VKHx2wLCgvIAbgwABGnKMY19WhKZPT+8BxhZdqz6EgkqCLld7X5qiCY2F/bfpUUlnFZ9w==", - "dev": true, - "optional": true - }, - "esbuild-linux-riscv64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.18.tgz", - "integrity": "sha512-ba2COaoF5wL6VLZWn04k+ACZjZ6NYniMSQStodFKH/Pu6RxzQqzsmjR1t9QC89VYJxBeyVPTaHuBMCejl3O/xg==", - "dev": true, - "optional": true - }, - "esbuild-linux-s390x": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.18.tgz", - "integrity": "sha512-VbpGuXEl5FCs1wDVp93O8UIzl3ZrglgnSQ+Hu79g7hZu6te6/YHgVJxCM2SqfIila0J3k0csfnf8VD2W7u2kzQ==", - "dev": true, - "optional": true - }, - "esbuild-netbsd-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.18.tgz", - "integrity": "sha512-98ukeCdvdX7wr1vUYQzKo4kQ0N2p27H7I11maINv73fVEXt2kyh4K4m9f35U1K43Xc2QGXlzAw0K9yoU7JUjOg==", - "dev": true, - "optional": true - }, - "esbuild-openbsd-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.18.tgz", - "integrity": "sha512-yK5NCcH31Uae076AyQAXeJzt/vxIo9+omZRKj1pauhk3ITuADzuOx5N2fdHrAKPxN+zH3w96uFKlY7yIn490xQ==", - "dev": true, - "optional": true - }, - "esbuild-sunos-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.18.tgz", - "integrity": "sha512-On22LLFlBeLNj/YF3FT+cXcyKPEI263nflYlAhz5crxtp3yRG1Ugfr7ITyxmCmjm4vbN/dGrb/B7w7U8yJR9yw==", - "dev": true, - "optional": true - }, - "esbuild-windows-32": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.18.tgz", - "integrity": "sha512-o+eyLu2MjVny/nt+E0uPnBxYuJHBvho8vWsC2lV61A7wwTWC3jkN2w36jtA+yv1UgYkHRihPuQsL23hsCYGcOQ==", - "dev": true, - "optional": true - }, - "esbuild-windows-64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.18.tgz", - "integrity": "sha512-qinug1iTTaIIrCorAUjR0fcBk24fjzEedFYhhispP8Oc7SFvs+XeW3YpAKiKp8dRpizl4YYAhxMjlftAMJiaUw==", - "dev": true, - "optional": true - }, - "esbuild-windows-arm64": { - "version": "0.15.18", - "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.18.tgz", - "integrity": "sha512-q9bsYzegpZcLziq0zgUi5KqGVtfhjxGbnksaBFYmWLxeV/S1fK4OLdq2DFYnXcLMjlZw2L0jLsk1eGoB522WXQ==", - "dev": true, - "optional": true - }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "optional": true - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", - "dev": true - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", "dev": true, - "requires": { - "function-bind": "^1.1.1" + "license": "MIT", + "engines": { + "node": ">=0.10.0" } }, - "is-core-module": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", "dev": true, - "requires": { - "has": "^1.0.3" + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "jsonc-parser": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", - "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", - "dev": true - }, - "local-pkg": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.3.tgz", - "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==", - "dev": true - }, - "loupe": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", - "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, - "requires": { - "get-func-name": "^2.0.0" + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "lunr": { - "version": "2.3.9", - "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", - "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", - "dev": true - }, - "marked": { - "version": "4.2.12", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.2.12.tgz", - "integrity": "sha512-yr8hSKa3Fv4D3jdZmtMMPghgVt6TWbk86WQaWhDloQjRSQhMMYCAro7jP7VDJrjjdV8pxVxMssXS8B8Y5DZ5aw==", - "dev": true - }, - "minimatch": { - "version": "7.4.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-7.4.2.tgz", - "integrity": "sha512-xy4q7wou3vUoC9k1xGTXc+awNdGaGVHtFUaey8tiX4H1QRc04DZ/rmDFwNm2EBsuYEhAZ6SgMmYf3InGY6OauA==", + "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, - "requires": { - "brace-expansion": "^2.0.1" + "license": "MIT", + "engines": { + "node": ">=8" } }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "nanoid": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", - "dev": true - }, - "path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", - "dev": true - }, - "picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true - }, - "postcss": { - "version": "8.4.21", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.21.tgz", - "integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==", + "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true, - "requires": { - "nanoid": "^3.3.4", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" - } + "license": "MIT" }, - "resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, - "requires": { - "is-core-module": "^2.9.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" } }, - "rollup": { - "version": "3.19.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.19.1.tgz", - "integrity": "sha512-lAbrdN7neYCg/8WaoWn/ckzCtz+jr70GFfYdlf50OF7387HTg+wiuiqJRFYawwSPpqfqDNYqK7smY/ks2iAudg==", + "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, - "requires": { - "fsevents": "~2.3.2" + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" } }, - "shiki": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.1.tgz", - "integrity": "sha512-+Jz4nBkCBe0mEDqo1eKRcCdjRtrCjozmcbTUjbPTX7OOJfEbTZzlUWlZtGe3Gb5oV1/jnojhG//YZc3rs9zSEw==", + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", "dev": true, - "requires": { - "ansi-sequence-parser": "^1.1.0", - "jsonc-parser": "^3.2.0", - "vscode-oniguruma": "^1.7.0", - "vscode-textmate": "^8.0.0" + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", - "dev": true - }, - "strip-literal": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-1.0.1.tgz", - "integrity": "sha512-QZTsipNpa2Ppr6v1AmJHESqJ3Uz247MUS0OjrnnZjFAvEoWqxuyFuXn2xLgMtRnijJShAa1HL0gtJyUs7u7n3Q==", + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "dev": true, - "requires": { - "acorn": "^8.8.2" - } + "license": "ISC" }, - "supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true - }, - "tinybench": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.4.0.tgz", - "integrity": "sha512-iyziEiyFxX4kyxSp+MtY1oCH/lvjH3PxFN8PGCDeqcZWAJ/i+9y+nL85w99PxVzrIvew/GSkSbDYtiGVa85Afg==", - "dev": true - }, - "tinypool": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.3.1.tgz", - "integrity": "sha512-zLA1ZXlstbU2rlpA4CIeVaqvWq41MTWqLY3FfsAXgC8+f7Pk7zroaJQxDgxn1xNudKW6Kmj4808rPFShUlIRmQ==", - "dev": true - }, - "tinyspy": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-1.1.1.tgz", - "integrity": "sha512-UVq5AXt/gQlti7oxoIg5oi/9r0WpF7DGEVwXgqWSMmyN16+e3tl5lIvTaOpJ3TAtu5xFzWccFRM4R5NaWHF+4g==", - "dev": true - }, - "type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true - }, - "typedoc": { - "version": "0.23.28", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.23.28.tgz", - "integrity": "sha512-9x1+hZWTHEQcGoP7qFmlo4unUoVJLB0H/8vfO/7wqTnZxg4kPuji9y3uRzEu0ZKez63OJAUmiGhUrtukC6Uj3w==", + "node_modules/yaml": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.1.tgz", + "integrity": "sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==", "dev": true, - "requires": { - "lunr": "^2.3.9", - "marked": "^4.2.12", - "minimatch": "^7.1.3", - "shiki": "^0.14.1" - } - }, - "typescript": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", - "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", - "dev": true - }, - "vite": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.2.0.tgz", - "integrity": "sha512-AbDTyzzwuKoRtMIRLGNxhLRuv1FpRgdIw+1y6AQG73Q5+vtecmvzKo/yk8X/vrHDpETRTx01ABijqUHIzBXi0g==", - "dev": true, - "requires": { - "esbuild": "^0.17.5", - "fsevents": "~2.3.2", - "postcss": "^8.4.21", - "resolve": "^1.22.1", - "rollup": "^3.18.0" - }, - "dependencies": { - "@esbuild/android-arm": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.12.tgz", - "integrity": "sha512-E/sgkvwoIfj4aMAPL2e35VnUJspzVYl7+M1B2cqeubdBhADV4uPon0KCc8p2G+LqSJ6i8ocYPCqY3A4GGq0zkQ==", - "dev": true, - "optional": true - }, - "@esbuild/linux-loong64": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.12.tgz", - "integrity": "sha512-GTOEtj8h9qPKXCyiBBnHconSCV9LwFyx/gv3Phw0pa25qPYjVuuGZ4Dk14bGCfGX3qKF0+ceeQvwmtI+aYBbVA==", - "dev": true, - "optional": true - }, - "esbuild": { - "version": "0.17.12", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.12.tgz", - "integrity": "sha512-bX/zHl7Gn2CpQwcMtRogTTBf9l1nl+H6R8nUbjk+RuKqAE3+8FDulLA+pHvX7aA7Xe07Iwa+CWvy9I8Y2qqPKQ==", - "dev": true, - "requires": { - "@esbuild/android-arm": "0.17.12", - "@esbuild/android-arm64": "0.17.12", - "@esbuild/android-x64": "0.17.12", - "@esbuild/darwin-arm64": "0.17.12", - "@esbuild/darwin-x64": "0.17.12", - "@esbuild/freebsd-arm64": "0.17.12", - "@esbuild/freebsd-x64": "0.17.12", - "@esbuild/linux-arm": "0.17.12", - "@esbuild/linux-arm64": "0.17.12", - "@esbuild/linux-ia32": "0.17.12", - "@esbuild/linux-loong64": "0.17.12", - "@esbuild/linux-mips64el": "0.17.12", - "@esbuild/linux-ppc64": "0.17.12", - "@esbuild/linux-riscv64": "0.17.12", - "@esbuild/linux-s390x": "0.17.12", - "@esbuild/linux-x64": "0.17.12", - "@esbuild/netbsd-x64": "0.17.12", - "@esbuild/openbsd-x64": "0.17.12", - "@esbuild/sunos-x64": "0.17.12", - "@esbuild/win32-arm64": "0.17.12", - "@esbuild/win32-ia32": "0.17.12", - "@esbuild/win32-x64": "0.17.12" - } - } + "license": "ISC", + "peer": true, + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14" } }, - "vitest": { - "version": "0.25.8", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.25.8.tgz", - "integrity": "sha512-X75TApG2wZTJn299E/TIYevr4E9/nBo1sUtZzn0Ci5oK8qnpZAZyhwg0qCeMSakGIWtc6oRwcQFyFfW14aOFWg==", + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true, - "requires": { - "@types/chai": "^4.3.4", - "@types/chai-subset": "^1.3.3", - "@types/node": "*", - "acorn": "^8.8.1", - "acorn-walk": "^8.2.0", - "chai": "^4.3.7", - "debug": "^4.3.4", - "local-pkg": "^0.4.2", - "source-map": "^0.6.1", - "strip-literal": "^1.0.0", - "tinybench": "^2.3.1", - "tinypool": "^0.3.0", - "tinyspy": "^1.0.2", - "vite": "^3.0.0 || ^4.0.0" - } - }, - "vscode-oniguruma": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", - "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", - "dev": true - }, - "vscode-textmate": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", - "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==", - "dev": true + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } } } diff --git a/package.json b/package.json index 1e7319fb..a50aecba 100644 --- a/package.json +++ b/package.json @@ -1,39 +1,174 @@ { - "version": "4.0.0-beta.2", + "version": "4.0.0-beta.3", "name": "gl-matrix", - "description": "Javascript Matrix and Vector library for High Performance 3D web apps", + "description": "Javascript Matrix and Vector library for High Performance 3D web apps.", "private": true, "sideEffects": false, "type": "module", - "main": "./dist/esm/index.js", - "module": "./dist/esm/index.js", + "license": "MIT", + "imports": { + "#gl-matrix": { + "types": "./dist/index.d.mts", + "default": "./src/index.ts" + }, + "#gl-matrix/classic": "./src/classic/index.ts", + "#gl-matrix/common": "./src/common/index.ts", + "#gl-matrix/f64": { + "types": "./dist/f64/index.d.mts", + "default": "./src/f64/index.ts" + }, + "#gl-matrix/swizzle": "./src/swizzle/index.ts", + "#gl-matrix/swizzle/f64": "./src/swizzle/f64/index.ts", + "#gl-matrix/types": "./src/types/index.ts", + "#gl-matrix/types/swizzle": "./src/types/swizzle/index.ts", + "#gl-matrix/types/swizzle/f64": "./src/types/swizzle/f64/index.ts", + "#gl-matrix/util": "./src/util/index.ts" + }, "exports": { - ".": "./dist/esm/index.js", - "./common": "./dist/esm/common.js", - "./mat2": "./dist/esm/mat2.js", - "./mat2d": "./dist/esm/mat2d.js", - "./mat3": "./dist/esm/mat3.js", - "./mat4": "./dist/esm/mat4.js", - "./quat": "./dist/esm/quat.js", - "./quat2": "./dist/esm/quat2.js", - "./vec2": "./dist/esm/vec2.js", - "./vec3": "./dist/esm/vec3.js", - "./vec4": "./dist/esm/vec4.js", - "./f64": "./dist/esm/f64/index.js", - "./f64/common": "./dist/esm/f64/common.js", - "./f64/mat2": "./dist/esm/f64/mat2.js", - "./f64/mat2d": "./dist/esm/f64/mat2d.js", - "./f64/mat3": "./dist/esm/f64/mat3.js", - "./f64/mat4": "./dist/esm/f64/mat4.js", - "./f64/quat": "./dist/esm/f64/quat.js", - "./f64/quat2": "./dist/esm/f64/quat2.js", - "./f64/vec2": "./dist/esm/f64/vec2.js", - "./f64/vec3": "./dist/esm/f64/vec3.js", - "./f64/vec4": "./dist/esm/f64/vec4.js" + ".": { + "import": { + "types": "./dist/index.d.mts", + "default": "./dist/index.js" + }, + "require": { + "types": "./dist/index.d.cts", + "default": "./dist/index.cjs" + } + }, + "./cdn": { + "import": { + "types": "./dist-cdn/types/gl-matrix-f32.d.mts", + "default": "./dist-cdn/esm/2022/gl-matrix-f32.js" + }, + "require": { + "types": "./dist-cdn/types/gl-matrix-f32.d.cts", + "default": "./dist-cdn/cjs/2022/gl-matrix-f32.cjs" + } + }, + "./cdn/f64": { + "import": { + "types": "./dist-cdn/types/gl-matrix-f64.d.mts", + "default": "./dist-cdn/esm/2022/gl-matrix-f64.js" + }, + "require": { + "types": "./dist-cdn/types/gl-matrix-f64.d.cts", + "default": "./dist-cdn/cjs/2022/gl-matrix-f64.cjs" + } + }, + "./classic": { + "import": { + "types": "./dist/classic/index.d.mts", + "default": "./dist/classic/index.js" + }, + "require": { + "types": "./dist/classic/index.d.cts", + "default": "./dist/classic/index.cjs" + } + }, + "./common": { + "import": { + "types": "./dist/common/index.d.mts", + "default": "./dist/common/index.js" + }, + "require": { + "types": "./dist/common/index.d.cts", + "default": "./dist/common/index.cjs" + } + }, + "./f64": { + "import": { + "types": "./dist/f64/index.d.mts", + "default": "./dist/f64/index.js" + }, + "require": { + "types": "./dist/f64/index.d.cts", + "default": "./dist/f64/index.cjs" + } + }, + "./swizzle": { + "import": { + "types": "./dist/swizzle/index.d.mts", + "default": "./dist/swizzle/index.js" + }, + "require": { + "types": "./dist/swizzle/index.d.cts", + "default": "./dist/swizzle/index.cjs" + } + }, + "./swizzle/f64": { + "import": { + "types": "./dist/swizzle/f64/index.d.mts", + "default": "./dist/swizzle/f64/index.js" + }, + "require": { + "types": "./dist/swizzle/f64/index.d.cts", + "default": "./dist/swizzle/f64/index.cjs" + } + }, + "./types": { + "import": { + "types": "./dist/types/index.d.mts", + "default": "./dist/types/index.js" + }, + "require": { + "types": "./dist/types/index.d.cts", + "default": "./dist/types/index.cjs" + } + }, + "./types/cdn/umd": { + "import": { + "types": "./dist-cdn/types/globals-f32.d.mts", + "default": "./dist-cdn/types/index.js" + }, + "require": { + "types": "./dist-cdn/types/globals-f32.d.cts", + "default": "./dist-cdn/types/index.cjs" + } + }, + "./types/cdn/umd/f64": { + "import": { + "types": "./dist-cdn/types/globals-f64.d.mts", + "default": "./dist-cdn/types/index.js" + }, + "require": { + "types": "./dist-cdn/types/globals-f64.d.cts", + "default": "./dist-cdn/types/index.cjs" + } + }, + "./types/swizzle": { + "import": { + "types": "./dist/types/swizzle/index.d.mts", + "default": "./dist/types/swizzle/index.js" + }, + "require": { + "types": "./dist/types/swizzle/index.d.cts", + "default": "./dist/types/swizzle/index.cjs" + } + }, + "./types/swizzle/f64": { + "import": { + "types": "./dist/types/swizzle/f64/index.d.mts", + "default": "./dist/types/swizzle/f64/index.js" + }, + "require": { + "types": "./dist/types/swizzle/f64/index.d.cts", + "default": "./dist/types/swizzle/f64/index.cjs" + } + }, + "./util": { + "import": { + "types": "./dist/util/index.d.mts", + "default": "./dist/util/index.js" + }, + "require": { + "types": "./dist/util/index.d.cts", + "default": "./dist/util/index.cjs" + } + } }, - "types": "./dist/esm/index.d.ts", - "homepage": "http://glmatrix.net", - "license": "MIT", + "main": "./dist-cdn/esm/2022/gl-matrix-f32.min.js", + "types": "./dist-cdn/types/gl-matrix-f32.d.mts", + "homepage": "https://glmatrix.net", "bugs": { "url": "https://github.com/toji/gl-matrix/issues" }, @@ -51,20 +186,41 @@ "email": "sinisterchipmunk@gmail.com" } ], + "files": [ + "/dist", + "/dist-cdn" + ], + "keywords": [ + "vector", + "matrix", + "library", + "webgl", + "webgpu" + ], "scripts": { - "build": "tsc", - "build-docs": "typedoc src/index.ts", - "gen64": "node scripts/gen-f64.mjs", - "build64": "npm run gen64 && tsc --project tsconfig64.json", - "bundle": "node scripts/bundle.mjs", - "build-all": "npm run build && npm run build64 && npm run build-docs && npm run bundle", - "watch": "tsc --watch", - "test": "npm run gen64 && vitest run" + "build": "node scripts/build.js", + "build-all": "npm run build && npm run types && npm run docs && npm run docs-cdn", + "docs": "typedoc-pkg --api-link es", + "docs-cdn": "typedoc-pkg --api-link es --output docs/cdn --typedoc typedoc-cdn.json", + "eslint": "eslint .", + "gen64": "node scripts/gen-f64.js", + "test": "vitest run", + "test-ui": "vitest --ui --coverage", + "types": "esm-d-ts gen -c" }, "devDependencies": { - "esbuild": "^0.15.15", - "typedoc": "^0.23.21", - "typescript": "^5.0.0", - "vitest": "^0.25.8" + "@babel/core": "^7.26.0", + "@babel/preset-env": "^7.26.0", + "@rollup/plugin-babel": "^6.0.4", + "@typhonjs-build-test/esm-d-ts": "^0.3.0-next.9", + "@typhonjs-typedoc/typedoc-pkg": "^0.2.0", + "@vitest/coverage-v8": "^2.1.0", + "@vitest/ui": "^2.1.0", + "esbuild": "^0.24.0", + "eslint": "^9.16.0", + "rollup": "^4.28.0", + "typescript": "^5.7.0", + "typescript-eslint": "^8.17.0", + "vitest": "^2.1.0" } } diff --git a/scripts/build.js b/scripts/build.js new file mode 100644 index 00000000..ace42625 --- /dev/null +++ b/scripts/build.js @@ -0,0 +1,230 @@ +import * as esbuild from 'esbuild'; +import * as fs from 'fs'; +import { rollup } from 'rollup'; +import { babel } from '@rollup/plugin-babel'; + +import { executeGenF64 } from './gen-f64.js'; + +// Generate 64-bit source -------------------------------------------------------------------------------------------- + +executeGenF64(); + +// ESBuild data ------------------------------------------------------------------------------------------------------ + +const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); + +const bannerText = `// gl-matrix - v${pkg.version} - A high performance matrix and vector library. +// @author Brandon Jones +// @author Colin MacKenzie IV +// @license MIT (https://github.com/toji/gl-matrix/blob/master/LICENSE.md)`; + +const banner = { js: bannerText }; + +// Add the `package.json` imports as alias mapping for ESBuild removing the leading `#`. +const alias = Object.assign({}, ...Object.keys(pkg.imports).map((key) => ({ [key]: key.slice(1) }))); + +// Add the `package.json` imports as external for ESBuild removing the leading `#`. +const external = Object.keys(pkg.imports).map((key) => key.slice(1)); + +// Bundling ---------------------------------------------------------------------------------------------------------- + +try { + const promises = []; + + // Main package / sub-path exports --------------------------------------------------------------------------------- + + const mainEsbuildOptions = { + logLevel: 'info', + entryPoints: [ + { in: 'src/index.ts', out: 'index' }, // gl-matrix + { in: 'src/classic/index.ts', out: 'classic/index' }, // gl-matrix/classic + { in: 'src/common/index.ts', out: 'common/index' }, // gl-matrix/common + { in: 'src/f64/index.ts', out: 'f64/index' }, // gl-matrix/f64 + { in: 'src/swizzle/index.ts', out: 'swizzle/index' }, // gl-matrix/swizzle + { in: 'src/swizzle/f64/index.ts', out: 'swizzle/f64/index' }, // gl-matrix/swizzle/f64 + { in: 'src/types/index.ts', out: 'types/index' }, // gl-matrix/types + { in: 'src/types/swizzle/index.ts', out: 'types/swizzle/index' }, // gl-matrix/types + { in: 'src/types/swizzle/f64/index.ts', out: 'types/swizzle/f64/index' }, // gl-matrix/types + { in: 'src/util/index.ts', out: 'util/index' }, // gl-matrix/util + ], + bundle: true, + minify: false, + sourcemap: true, + banner, + format: 'esm', + outdir: 'dist', + external, // Do not bundle across package paths. + alias + }; + + promises.push(esbuild.build(mainEsbuildOptions)); + + // Minified main ESM bundles ------ + + mainEsbuildOptions.minify = true; + mainEsbuildOptions.outExtension = { '.js': '.min.js' }; + + promises.push(esbuild.build(mainEsbuildOptions)); + + // CJS bundles -------------------- + + mainEsbuildOptions.minify = false; + mainEsbuildOptions.format = 'cjs'; + mainEsbuildOptions.outExtension = { '.js': '.cjs' }; + + promises.push(esbuild.build(mainEsbuildOptions)); + +// CDN ESM Bundles --------------------------------------------------------------------------------------------------- + + const cdnEsbuildOptions = { + logLevel: 'info', + entryPoints: [ + { in: 'src/cdn/index.ts', out: 'gl-matrix-f32' }, // 32-bit + { in: 'src/cdn/f64/index.ts', out: 'gl-matrix-f64' }, // 64-bit + ], + bundle: true, + minify: false, + sourcemap: true, + banner, + format: 'esm', + outdir: 'dist-cdn/esm/2022', + }; + + promises.push(esbuild.build(cdnEsbuildOptions)); + + // [ESM] Minified 2022 CDN bundles ------ + + cdnEsbuildOptions.minify = true; + cdnEsbuildOptions.outExtension = { '.js': '.min.js' }; + + promises.push(esbuild.build(cdnEsbuildOptions)); + + // [ESM] Minified 2016 CDN bundles ------ + + cdnEsbuildOptions.outdir = 'dist-cdn/esm/2016'; + cdnEsbuildOptions.target = 'es2016'; + + promises.push(esbuild.build(cdnEsbuildOptions)); + + // [ESM] 2016 CDN bundles --------------- + + cdnEsbuildOptions.minify = false; + cdnEsbuildOptions.outExtension = void 0; + + promises.push(esbuild.build(cdnEsbuildOptions)); + + // [CJS] 2022 CDN bundles --------------- + + cdnEsbuildOptions.format = 'cjs'; + cdnEsbuildOptions.outdir = 'dist-cdn/cjs/2022'; + cdnEsbuildOptions.outExtension = { '.js': '.cjs' }; + cdnEsbuildOptions.target = 'es2022'; + + promises.push(esbuild.build(cdnEsbuildOptions)); + + // [CJS] Minified 2022 CDN bundles ------ + + cdnEsbuildOptions.minify = true; + cdnEsbuildOptions.outExtension = { '.js': '.min.cjs' }; + + promises.push(esbuild.build(cdnEsbuildOptions)); + + // Await all ESBuild promises before continuing. + await Promise.allSettled(promises); + +// Generate UMD bundles with Rollup ---------------------------------------------------------------------------------- + + const rollupConfigs = [ + // ES5 / UMD CDN Release (32-bit) + { + input: { + input: 'dist-cdn/esm/2016/gl-matrix-f32.js', + plugins: [ + babel({ + babelHelpers: 'bundled', + presets: ['@babel/preset-env'] + }) + ] + }, + output: { + banner: bannerText, + file: 'dist-cdn/umd/gl-matrix-f32.js', + format: 'umd', + generatedCode: 'es5', + name: 'glMatrix', + sourcemap: true + } + }, + { + input: { + input: 'dist-cdn/esm/2016/gl-matrix-f32.min.js', + plugins: [ + babel({ + babelHelpers: 'bundled', + presets: ['@babel/preset-env'] + }) + ] + }, + output: { + banner: bannerText, + file: 'dist-cdn/umd/gl-matrix-f32.min.js', + format: 'umd', + generatedCode: 'es5', + name: 'glMatrix', + sourcemap: true + } + }, + + // ES5 / UMD CDN Release (64-bit) + { + input: { + input: 'dist-cdn/esm/2016/gl-matrix-f64.js', + plugins: [ + babel({ + babelHelpers: 'bundled', + presets: ['@babel/preset-env'] + }) + ] + }, + output: { + banner: bannerText, + file: 'dist-cdn/umd/gl-matrix-f64.js', + format: 'umd', + generatedCode: 'es5', + name: 'glMatrixF64', + sourcemap: true + } + }, + { + input: { + input: 'dist-cdn/esm/2016/gl-matrix-f64.min.js', + plugins: [ + babel({ + babelHelpers: 'bundled', + presets: ['@babel/preset-env'] + }) + ] + }, + output: { + banner: bannerText, + file: 'dist-cdn/umd/gl-matrix-f64.min.js', + format: 'umd', + generatedCode: 'es5', + name: 'glMatrixF64', + sourcemap: true + } + } + ]; + + for (const config of rollupConfigs) { + console.log(`Generating UMD bundle: ${config.input.input}`); + + const bundle = await rollup(config.input); + await bundle.write(config.output); + await bundle.close(); + } +} +catch(err) { + console.error(err); + process.exit(1); +} diff --git a/scripts/bundle.mjs b/scripts/bundle.mjs deleted file mode 100644 index 1d64f978..00000000 --- a/scripts/bundle.mjs +++ /dev/null @@ -1,70 +0,0 @@ -import * as esbuild from 'esbuild'; -import * as fs from 'fs'; - -const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); - -const copyFileSync = (source, dest) => { - const content = fs.readFileSync(source, 'utf-8'); - fs.writeFileSync(dest, content); -}; - -//const license = fs.readFileSync('LICENSE.md', 'utf8'); -const banner = { - js: `// glMatrix - v${pkg.version}` -} - -const banner64 = { - js: `// glMatrix (Float64) - v${pkg.version}` -} - -// Standard release (Float32) - -// ES Modules build -esbuild.build({ - logLevel: 'info', - entryPoints: ['src/index.ts'], - bundle: true, - minify: true, - sourcemap: true, - banner, - format: 'esm', - outfile: 'dist/esm/gl-matrix.js', -}).catch(() => process.exit(1)); - -// Common JS Build -esbuild.build({ - logLevel: 'info', - entryPoints: ['src/index.ts'], - bundle: true, - minify: true, - sourcemap: true, - banner, - format: 'cjs', - outfile: 'dist/cjs/gl-matrix.js', -}).catch(() => process.exit(1)); - -// Float64 release - -// ES Modules build -esbuild.build({ - logLevel: 'info', - entryPoints: ['f64/src/index.ts'], - bundle: true, - minify: true, - sourcemap: true, - banner: banner64, - format: 'esm', - outfile: 'dist/esm/f64/gl-matrix.js', -}).catch(() => process.exit(1)); - -// Common JS Build -esbuild.build({ - logLevel: 'info', - entryPoints: ['f64/src/index.ts'], - bundle: true, - minify: true, - sourcemap: true, - banner: banner64, - format: 'cjs', - outfile: 'dist/cjs/f64/gl-matrix.js', -}).catch(() => process.exit(1)); \ No newline at end of file diff --git a/scripts/gen-f64.js b/scripts/gen-f64.js new file mode 100644 index 00000000..2243e39d --- /dev/null +++ b/scripts/gen-f64.js @@ -0,0 +1,64 @@ +// This script file generates a copy of the library which uses Float64Array as +// the base class for each type for greater precision. + +import * as fs from 'fs'; +import * as path from 'path'; +import { fileURLToPath } from 'url'; + +const SRC_F32_PATH = './src/_lib/f32'; +const SRC_F64_PATH = './src/_lib/f64'; + +const TEST_F32_PATH = './tests/f32'; +const TEST_F64_PATH = './tests/f64'; + +/** + * @param {string} srcPath - Source path. + * @param {string} dstPath - Destination path. + * @param {[[RegExp, string]]} replacement - An array of replacement pairs. + */ +function copyFileWithSearchAndReplace(srcPath, dstPath, replacement) { + // Write out the typescript implementation to the src file. + let srcFile = fs.readFileSync(srcPath, 'utf8'); + + for (const replace of replacement) { + srcFile = srcFile.replace(replace[0], replace[1]); + } + + fs.writeFileSync(dstPath, srcFile); +} + +function copyDir(srcDir, outDir) { + const src_files = fs.readdirSync(srcDir); + fs.mkdirSync(outDir, { recursive: true }); + + for (const file of src_files) { + const srcPath = path.join(srcDir, file); + const outPath = path.join(outDir, file); + console.log(`Copying from ${srcPath} to ${outPath}`); + + copyFileWithSearchAndReplace(srcPath, outPath, [ + [/EnableSwizzles/g, 'EnableSwizzlesF64'], + [/Float32Array/g, 'Float64Array'], + [/['"]#gl-matrix['"]/g, '\'#gl-matrix/f64\''], + [/['"]#gl-matrix\/swizzle['"]/g, '\'#gl-matrix/swizzle/f64\''] + ]); + } +} + +// Export this function to be run in Vitest global setup. +export function executeGenF64() { + // Clean any existing files + fs.rmSync(SRC_F64_PATH, { recursive: true, force: true }); + fs.rmSync(TEST_F64_PATH, { recursive: true, force: true }); + + // Copy src + copyDir(SRC_F32_PATH, SRC_F64_PATH); + + // Copy tests + copyDir(TEST_F32_PATH, TEST_F64_PATH); +} + +// Execute immediately when run directly by NPM run as a script. +if (process.argv[1] === fileURLToPath(import.meta.url)) { + executeGenF64(); +} diff --git a/scripts/gen-f64.mjs b/scripts/gen-f64.mjs deleted file mode 100644 index 24270ca5..00000000 --- a/scripts/gen-f64.mjs +++ /dev/null @@ -1,48 +0,0 @@ -// This script file generates a copy of the library which uses Float64Array as -// the base class for each type for greater precision. - -import * as fs from 'fs'; -import * as path from 'path'; - -const SRC_PATH = './src'; -const TEST_PATH = './tests'; -const OUT_PATH = './f64'; - -let FILES_TO_COPY_WITHOUT_UPDATE = [ - 'common.ts', - 'index.ts', - 'swizzle.ts', -] - -function copyFileWithSearchAndReplace(srcPath, dstPath, searchValue, replaceValue) { - // Write out the typescript implementation to the src file - const srcFile = fs.readFileSync(srcPath, 'utf8'); - const updatedSrc = srcFile.replace(searchValue, replaceValue); - fs.writeFileSync(dstPath, updatedSrc); -} - -function copyDir(srcDir) { - const src_files = fs.readdirSync(srcDir); - fs.mkdirSync(path.join(OUT_PATH, srcDir), { recursive: true }); - - for (const file of src_files) { - const srcPath = path.join(srcDir, file); - const outPath = path.join(OUT_PATH, srcPath); - console.log(`Copying from ${srcPath} to ${outPath}`); - - if (FILES_TO_COPY_WITHOUT_UPDATE.includes(file)) { - fs.copyFileSync(srcPath, outPath); - } else { - copyFileWithSearchAndReplace(srcPath, outPath, /Float32Array/g, 'Float64Array'); - } - } -} - -// Clean any existing files -fs.rmSync(OUT_PATH, { recursive: true, force: true }); - -// Copy src -copyDir(SRC_PATH); - -// Copy tests -copyDir(TEST_PATH); diff --git a/scripts/gen-swizzle.js b/scripts/gen-swizzle.js new file mode 100644 index 00000000..a11785f8 --- /dev/null +++ b/scripts/gen-swizzle.js @@ -0,0 +1,159 @@ +// This script file generates implementation and test code for every vector +// swizzle variants, since there's a lot of them and making small tweaks to +// every one by hand any time you want to change things is a pain. + +import * as fs from 'fs'; + +const VEC_COMPONENT_COUNTS = [2, 3, 4]; +const VEC_COMPONENTS = ['x', 'y', 'z', 'w']; +const COLOR_COMPONENTS = ['r', 'g', 'b', 'a']; +const SRC_PATH = './src/swizzle/index.ts'; +const SRC_PATH_F64 = './src/swizzle/f64/index.ts'; +const TEST_PATH = './tests/f32'; +const TYPES_PATH = './src/types/swizzle/index.ts'; +const TYPES_PATH_F64 = './src/types/swizzle/f64/index.ts'; + +const AUTOGEN_REGEX = /\[Swizzle Autogen](.+?)\[\/Swizzle Autogen]/s + +function getComponentVariants(size, components) { + if (size === 0) { + return {'': []}; + } + + const thisLevel = {}; + const prevLevel = getComponentVariants(size - 1, components); + for (let i = 0; i < components.length; ++i) { + const component = components[i]; + for (const [prevComponent, indices] of Object.entries(prevLevel)) { + thisLevel[`${component}${prevComponent}`] = [i, ...indices]; + } + } + + return thisLevel; +} + +function updateFileAutogen(path, content) { + // Write out the typescript implementation to the src file + console.log(`Writing to ${path}`); + const srcFile = fs.readFileSync(path, 'utf8'); + let autogenSrc = `[Swizzle Autogen]\n${content}\n // [/Swizzle Autogen]`; + const updatedSrc = srcFile.replace(AUTOGEN_REGEX, autogenSrc); + fs.writeFileSync(path, updatedSrc); +} + +const prevSeenSwizzles = new Set(); +const uniqueSwizzlesByComponentCount = {}; + +for (const vecSize of VEC_COMPONENT_COUNTS) { + const vecType = `Vec${vecSize}`; + + // Generate all swizzle variants for this vector type. + let swizzles = {}; + const components = VEC_COMPONENTS.slice(0, vecSize); + for (const count of VEC_COMPONENT_COUNTS) { + swizzles = { ...swizzles, ...getComponentVariants(count, components) }; + } + + const colorComponents = COLOR_COMPONENTS.slice(0, vecSize); + for (const count of VEC_COMPONENT_COUNTS) { + swizzles = { ...swizzles, ...getComponentVariants(count, colorComponents) }; + } + + uniqueSwizzlesByComponentCount[vecSize] = Object.keys(swizzles).filter((key) => !prevSeenSwizzles.has(key)); + uniqueSwizzlesByComponentCount[vecSize].forEach((key) => { prevSeenSwizzles.add(key); }); + + // Update swizzle tests. + + let testSrc = ''; + for (const [name, indices] of Object.entries(swizzles)) { + const outType = `Vec${indices.length}`; + const argNames = name.split('').join(', '); + const args = indices.map((index) => `v[${index}]`).join(', '); + testSrc += ` + describe('${vecType}().${name}', () => { + it('should return ${outType}(${argNames})', () => expect(v.${name}).toBeVec(${args})); + it('should be return a copy', () => { + const sw = v.${name}; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + `; + } + + updateFileAutogen(`${TEST_PATH}/Vec${vecSize}-swizzle.spec.ts`, testSrc); +} + +// Update `src/swizzle/index.ts` and `src/swizzle/f64/index.ts`. ----------------------------------------------------- + +const swizzleArrays = ` + const VEC2_SWIZZLES = ['${uniqueSwizzlesByComponentCount[2].join("','")}']; + const VEC3_SWIZZLES = ['${uniqueSwizzlesByComponentCount[3].join("','")}']; + const VEC4_SWIZZLES = ['${uniqueSwizzlesByComponentCount[4].join("','")}']; +`; + +updateFileAutogen(SRC_PATH, swizzleArrays); +updateFileAutogen(SRC_PATH_F64, swizzleArrays); + +// Update `src/types/swizzle/index.ts` and `src/types/swizzle/f64/index.ts`. ----------------------------------------- + +const swizzleTypeAlias = { + 2: 'Vec2Alias', + 3: 'Vec3Alias', + 4: 'Vec4Alias' +} + +const accessorDocs = (length) => { + return ` /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec${length} + */`; +}; + +let swizzleTypes = ` + /** + * Vec2 swizzle extension accessors. + */ + interface Vec2 { +`; + +uniqueSwizzlesByComponentCount[2].forEach((key) => swizzleTypes += `${accessorDocs(key.length)} + get ${key}(): ${swizzleTypeAlias[key.length]};\n`) + +swizzleTypes += ` }\n`; + +swizzleTypes += ` + /** + * Vec3 swizzle extension accessors. + */ + interface Vec3 { +`; + +uniqueSwizzlesByComponentCount[2].forEach((key) => swizzleTypes += `${accessorDocs(key.length)} + get ${key}(): ${swizzleTypeAlias[key.length]};\n`) + +uniqueSwizzlesByComponentCount[3].forEach((key) => swizzleTypes += `${accessorDocs(key.length)} + get ${key}(): ${swizzleTypeAlias[key.length]};\n`) + +swizzleTypes += ` }\n`; + +swizzleTypes += ` + /** + * Vec4 swizzle extension accessors. + */ + interface Vec4 { +`; + +uniqueSwizzlesByComponentCount[2].forEach((key) => swizzleTypes += `${accessorDocs(key.length)} + get ${key}(): ${swizzleTypeAlias[key.length]};\n`) + +uniqueSwizzlesByComponentCount[3].forEach((key) => swizzleTypes += `${accessorDocs(key.length)} + get ${key}(): ${swizzleTypeAlias[key.length]};\n`) + +uniqueSwizzlesByComponentCount[4].forEach((key) => swizzleTypes += `${accessorDocs(key.length)} + get ${key}(): ${swizzleTypeAlias[key.length]};\n`) + +swizzleTypes += ` }\n`; + +updateFileAutogen(TYPES_PATH, swizzleTypes); +updateFileAutogen(TYPES_PATH_F64, swizzleTypes); diff --git a/scripts/gen-swizzle.mjs b/scripts/gen-swizzle.mjs deleted file mode 100644 index 139f8212..00000000 --- a/scripts/gen-swizzle.mjs +++ /dev/null @@ -1,95 +0,0 @@ -// This script file generates implementation and test code for every vector -// swizzle variants, since there's a lot of them and making small tweaks to -// evenry one by hand any time you want to change things is a pain. - -import * as fs from 'fs'; - -const VEC_COMPONENT_COUNTS = [2, 3, 4]; -const VEC_COMPONENTS = ['x', 'y', 'z', 'w']; -const COLOR_COMPONENTS = ['r', 'g', 'b', 'a']; -const SRC_PATH = './src'; -const TEST_PATH = './tests' - -const AUTOGEN_REGEX = /\[Swizzle Autogen\](.+?)\[\/Swizzle Autogen\]/s - -function getComponentVariants(size, components) { - if (size == 0) { - return {'': []}; - } - - const thisLevel = {}; - const prevLevel = getComponentVariants(size - 1, components); - for (let i = 0; i < components.length; ++i) { - const component = components[i]; - for (const [prevComponent, indices] of Object.entries(prevLevel)) { - thisLevel[`${component}${prevComponent}`] = [i, ...indices]; - } - } - - return thisLevel; -} - -function updateFileAutogen(path, content) { - // Write out the typescript implementation to the src file - console.log(`Writing to ${path}`); - const srcFile = fs.readFileSync(path, 'utf8'); - let autogenSrc = `[Swizzle Autogen]\n${content}\n // [/Swizzle Autogen]`; - const updatedSrc = srcFile.replace(AUTOGEN_REGEX, autogenSrc); - fs.writeFileSync(path, updatedSrc); -} - -function getSwizzleImpl(name, indices) { - const outType = `Vec${indices.length}`; - const args = indices.map((index) => `this[${index}]`).join(', '); - return `get ${name}(): ${outType} { return new ${outType}(${args}); }`; -} - -const prevSeenSwizzles = new Set(); -const uniqueSwizzlesByComponentCount = {}; - -for (const vecSize of VEC_COMPONENT_COUNTS) { - const vecType = `Vec${vecSize}`; - - // Generate all swizzle variants for this vector type. - let swizzles = {}; - const components = VEC_COMPONENTS.slice(0, vecSize); - for (const count of VEC_COMPONENT_COUNTS) { - swizzles = { ...swizzles, ...getComponentVariants(count, components) }; - } - - const colorComponents = COLOR_COMPONENTS.slice(0, vecSize); - for (const count of VEC_COMPONENT_COUNTS) { - swizzles = { ...swizzles, ...getComponentVariants(count, colorComponents) }; - } - - uniqueSwizzlesByComponentCount[vecSize] = Object.keys(swizzles).filter((key) => !prevSeenSwizzles.has(key)); - uniqueSwizzlesByComponentCount[vecSize].forEach((key) => { prevSeenSwizzles.add(key); }); - - let testSrc = ''; - for (const [name, indices] of Object.entries(swizzles)) { - const outType = `Vec${indices.length}`; - const argNames = name.split('').join(', '); - const args = indices.map((index) => `v[${index}]`).join(', '); - testSrc += ` - describe("${vecType}().${name}", () => { - it("should return ${outType}(${argNames})", () => { - expect(v.${name}).toBeVec(${args}); - }); - it("should be return a copy", () => { - let sw = v.${name}; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - `; - } - - updateFileAutogen(`${TEST_PATH}/vec${vecSize}-swizzle.spec.ts`, testSrc); -} - -let swizzleArrays = ` - const VEC2_SWIZZLES = ['${uniqueSwizzlesByComponentCount[2].join("','")}']; - const VEC3_SWIZZLES = ['${uniqueSwizzlesByComponentCount[3].join("','")}']; - const VEC4_SWIZZLES = ['${uniqueSwizzlesByComponentCount[4].join("','")}']; -`; -updateFileAutogen(`${SRC_PATH}/swizzle.ts`, swizzleArrays); diff --git a/src/mat2.ts b/src/_lib/f32/Mat2.ts similarity index 82% rename from src/mat2.ts rename to src/_lib/f32/Mat2.ts index efeb9034..71a25bff 100644 --- a/src/mat2.ts +++ b/src/_lib/f32/Mat2.ts @@ -1,34 +1,23 @@ -import { EPSILON, FloatArray } from './common.js'; -import { Vec2Like } from './vec2.js'; +import { GLM_EPSILON } from '#gl-matrix/common'; -/** - * A 2x2 Matrix given as a {@link Mat2}, a 4-element floating point TypedArray, - * or an array of 4 numbers. - */ -export type Mat2Like = [ - number, number, - number, number -] | FloatArray; - -const IDENTITY_2X2 = new Float32Array([ - 1, 0, - 0, 1 -]); +import type { Mat2Like, Vec2Like } from '#gl-matrix/types'; /** * A 2x2 Matrix */ export class Mat2 extends Float32Array { - /** - * The number of bytes in a {@link Mat2}. - */ - static readonly BYTE_LENGTH = 4 * Float32Array.BYTES_PER_ELEMENT; + static #IDENTITY_2X2 = new Float32Array([ + 1, 0, + 0, 1 + ]); /** * Create a {@link Mat2}. + * + * @category Constructor */ - constructor(...values: [Readonly | ArrayBufferLike, number?] | number[] ) { - switch(values.length) { + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { + switch (values.length) { case 4: super(values); break; case 2: @@ -44,33 +33,36 @@ export class Mat2 extends Float32Array { } break; default: - super(IDENTITY_2X2); break; + super(Mat2.#IDENTITY_2X2); break; } } - //============ - // Attributes - //============ + // ============ + // Accessors + // ============ /** * A string representation of `this` * Equivalent to `Mat2.str(this);` + * + * @category Accessors */ - get str(): string { + get str(): string { return Mat2.str(this); } - //=================== + // =================== // Instance methods - //=================== + // =================== /** * Copy the values from another {@link Mat2} into `this`. * * @param a the source vector * @returns `this` + * @category Methods */ - copy(a: Readonly): Mat2 { + copy(a: Readonly): this { this.set(a); return this; } @@ -80,9 +72,10 @@ export class Mat2 extends Float32Array { * Equivalent to Mat2.identity(this) * * @returns `this` + * @category Methods */ - identity(): Mat2 { - this.set(IDENTITY_2X2); + identity(): this { + this.set(Mat2.#IDENTITY_2X2); return this; } @@ -90,28 +83,29 @@ export class Mat2 extends Float32Array { * Multiplies this {@link Mat2} against another one * Equivalent to `Mat2.multiply(this, this, b);` * - * @param out - The receiving Matrix - * @param a - The first operand * @param b - The second operand * @returns `this` + * @category Methods */ - multiply(b: Readonly): Mat2 { - return Mat2.multiply(this, this, b) as Mat2; + multiply(b: Readonly): this { + return Mat2.multiply(this, this, b) as this; } /** * Alias for {@link Mat2.multiply} + * @category Methods */ - mul(b: Readonly): Mat2 { return this; } + mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Transpose this {@link Mat2} * Equivalent to `Mat2.transpose(this, this);` * * @returns `this` + * @category Methods */ - transpose(): Mat2 { - return Mat2.transpose(this, this) as Mat2; + transpose(): this { + return Mat2.transpose(this, this) as this; } /** @@ -119,9 +113,10 @@ export class Mat2 extends Float32Array { * Equivalent to `Mat4.invert(this, this);` * * @returns `this` + * @category Methods */ - invert(): Mat2 { - return Mat2.invert(this, this) as Mat2; + invert(): this { + return Mat2.invert(this, this) as this; } /** @@ -130,9 +125,10 @@ export class Mat2 extends Float32Array { * * @param v - The {@link Vec2} to scale the matrix by * @returns `this` + * @category Methods */ - scale(v: Readonly): Mat2 { - return Mat2.scale(this, this, v) as Mat2; + scale(v: Readonly): this { + return Mat2.scale(this, this, v) as this; } /** @@ -140,15 +136,29 @@ export class Mat2 extends Float32Array { * Equivalent to `Mat2.rotate(this, this, rad);` * * @param rad - the angle to rotate the matrix by - * @returns `out` + * @returns `this` + * @category Methods */ - rotate(rad: number): Mat2 { - return Mat2.rotate(this, this, rad) as Mat2; + rotate(rad: number): this { + return Mat2.rotate(this, this, rad) as this; } - //================ + // =================== + // Static accessors + // =================== + + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2}. + */ + static get BYTE_LENGTH(): number { + return 4 * Float32Array.BYTES_PER_ELEMENT; + } + + // =================== // Static methods - //================ + // =================== /** * Creates a new, identity {@link Mat2} @@ -241,7 +251,7 @@ export class Mat2 extends Float32Array { // If we are transposing ourselves we can skip a few steps but have to cache // some values if (out === a) { - let a1 = a[1]; + const a1 = a[1]; out[1] = a[2]; out[2] = a1; } else { @@ -260,7 +270,7 @@ export class Mat2 extends Float32Array { * * @param out - the receiving matrix * @param a - the source matrix - * @returns `out` or `null` if the matrix is not invertable + * @returns `out` or `null` if the matrix is not invertible */ static invert(out: Mat2Like, a: Mat2Like): Mat2Like | null { const a0 = a[0]; @@ -351,6 +361,7 @@ export class Mat2 extends Float32Array { * Alias for {@link Mat2.subtract} * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static sub(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; } /** @@ -377,11 +388,11 @@ export class Mat2 extends Float32Array { out[3] = a1 * b2 + a3 * b3; return out; } - /** * Alias for {@link Mat2.multiply} * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static mul(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; } /** @@ -433,9 +444,10 @@ export class Mat2 extends Float32Array { /** * Creates a {@link Mat2} from a given angle around a given axis * This is equivalent to (but much faster than): - * - * mat2.identity(dest); - * mat2.rotate(dest, dest, rad); + * ```js + * mat2.identity(dest); + * mat2.rotate(dest, dest, rad); + * ``` * @category Static * * @param out - {@link Mat2} receiving operation result @@ -455,9 +467,10 @@ export class Mat2 extends Float32Array { /** * Creates a {@link Mat2} from a vector scaling * This is equivalent to (but much faster than): - * - * mat2.identity(dest); - * mat2.scale(dest, dest, vec); + * ```js + * mat2.identity(dest); + * mat2.scale(dest, dest, vec); + * ``` * @category Static * * @param out - {@link Mat2} receiving operation result @@ -528,7 +541,8 @@ export class Mat2 extends Float32Array { * @param a - the input matrix to factorize */ - static LDU(L: Mat2Like, D: Readonly, U: Mat2Like, a: Readonly) { + static LDU(L: Mat2Like, D: Readonly, U: Mat2Like, a: Readonly): + [Mat2Like, Readonly, Mat2Like] { L[2] = a[2] / a[0]; U[0] = a[0]; U[1] = a[1]; @@ -537,7 +551,7 @@ export class Mat2 extends Float32Array { } /** - * Returns whether or not two {@link Mat2}s have exactly the same elements in the same position (when compared with ===) + * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===) * @category Static * * @param a - The first matrix. @@ -554,7 +568,7 @@ export class Mat2 extends Float32Array { } /** - * Returns whether or not two {@link Mat2}s have approximately the same elements in the same position. + * Returns whether two {@link Mat2}s have approximately the same elements in the same position. * @category Static * * @param a - The first matrix. @@ -573,10 +587,10 @@ export class Mat2 extends Float32Array { const b3 = b[3]; return ( - Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && - Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && - Math.abs(a2 - b2) <= EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && - Math.abs(a3 - b3) <= EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) + Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && + Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && + Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && + Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) ); } @@ -590,17 +604,11 @@ export class Mat2 extends Float32Array { static str(a: Readonly): string { return `Mat2(${a.join(', ')})`; } - } // Instance method alias assignments -Mat2.prototype.mul = Mat2.prototype.multiply; +Mat2.prototype.mul = Mat2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method // Static method alias assignments Mat2.mul = Mat2.multiply; Mat2.sub = Mat2.subtract; - -/** - * {@link Mat2} alias for backwards compatibility - */ -export const mat2 = Mat2; \ No newline at end of file diff --git a/src/mat2d.ts b/src/_lib/f32/Mat2d.ts similarity index 82% rename from src/mat2d.ts rename to src/_lib/f32/Mat2d.ts index be3a872b..937b99cf 100644 --- a/src/mat2d.ts +++ b/src/_lib/f32/Mat2d.ts @@ -1,36 +1,24 @@ -import { EPSILON, FloatArray } from './common.js'; -import { Vec2Like } from './vec2.js'; +import { GLM_EPSILON } from '#gl-matrix/common'; -/** - * A 2x3 Matrix given as a {@link Mat2d}, a 6-element floating point TypedArray, - * or an array of 6 numbers. - */ -export type Mat2dLike = [ - number, number, - number, number, - number, number -] | FloatArray; - -const IDENTITY_2X3 = new Float32Array([ - 1, 0, - 0, 1, - 0, 0, -]); +import type { Mat2dLike, Vec2Like } from '#gl-matrix/types'; /** * A 2x3 Matrix */ export class Mat2d extends Float32Array { - /** - * The number of bytes in a {@link Mat2d}. - */ - static readonly BYTE_LENGTH = 6 * Float32Array.BYTES_PER_ELEMENT; + static #IDENTITY_2X3 = new Float32Array([ + 1, 0, + 0, 1, + 0, 0, + ]); /** * Create a {@link Mat2}. + * + * @category Constructor */ - constructor(...values: [Readonly | ArrayBufferLike, number?] | number[] ) { - switch(values.length) { + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { + switch (values.length) { case 6: super(values); break; case 2: @@ -47,33 +35,36 @@ export class Mat2d extends Float32Array { } break; default: - super(IDENTITY_2X3); break; + super(Mat2d.#IDENTITY_2X3); break; } } - //============ - // Attributes - //============ + // ============ + // Accessors + // ============ /** * A string representation of `this` * Equivalent to `Mat2d.str(this);` + * + * @category Accessors */ - get str(): string { + get str(): string { return Mat2d.str(this); } - //=================== + // =================== // Instances methods - //=================== + // =================== /** * Copy the values from another {@link Mat2d} into `this`. + * @category Methods * * @param a the source vector * @returns `this` */ - copy(a: Readonly): Mat2d { + copy(a: Readonly): this { this.set(a); return this; } @@ -81,68 +72,87 @@ export class Mat2d extends Float32Array { /** * Set `this` to the identity matrix * Equivalent to Mat2d.identity(this) + * @category Methods * * @returns `this` */ - identity(): Mat2d { - this.set(IDENTITY_2X3); + identity(): this { + this.set(Mat2d.#IDENTITY_2X3); return this; } /** * Multiplies this {@link Mat2d} against another one * Equivalent to `Mat2d.multiply(this, this, b);` + * @category Methods * * @param out - The receiving Matrix * @param a - The first operand * @param b - The second operand * @returns `this` */ - multiply(b: Readonly): Mat2d { - return Mat2d.multiply(this, this, b) as Mat2d; + multiply(b: Readonly): this { + return Mat2d.multiply(this, this, b) as this; } /** * Alias for {@link Mat2d.multiply} + * @category Methods */ - mul(b: Readonly): Mat2d { return this; } + mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Translate this {@link Mat2d} by the given vector * Equivalent to `Mat2d.translate(this, this, v);` + * @category Methods * * @param v - The {@link Vec2} to translate by * @returns `this` */ - translate(v: Readonly): Mat2d { - return Mat2d.translate(this, this, v) as Mat2d; + translate(v: Readonly): this { + return Mat2d.translate(this, this, v) as this; } /** * Rotates this {@link Mat2d} by the given angle around the given axis * Equivalent to `Mat2d.rotate(this, this, rad);` + * @category Methods * * @param rad - the angle to rotate the matrix by - * @returns `out` + * @returns `this` */ - rotate(rad: number): Mat2d { - return Mat2d.rotate(this, this, rad) as Mat2d; + rotate(rad: number): this { + return Mat2d.rotate(this, this, rad) as this; } /** * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization * Equivalent to `Mat2d.scale(this, this, v);` + * @category Methods * * @param v - The {@link Vec2} to scale the matrix by * @returns `this` */ - scale(v: Readonly): Mat2d { - return Mat2d.scale(this, this, v) as Mat2d; + scale(v: Readonly): this { + return Mat2d.scale(this, this, v) as this; + } + + // =================== + // Static accessors + // =================== + + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2d}. + */ + static get BYTE_LENGTH(): number { + return 6 * Float32Array.BYTES_PER_ELEMENT; } - //================ + // =================== // Static methods - //================ + // =================== /** * Creates a new, identity {@link Mat2d} @@ -235,7 +245,7 @@ export class Mat2d extends Float32Array { * * @param out - the receiving matrix * @param a - the source matrix - * @returns `out` or `null` if the matrix is not invertable + * @returns `out` or `null` if the matrix is not invertible */ static invert(out: Mat2dLike, a: Mat2dLike): Mat2dLike | null { const aa = a[0]; @@ -313,6 +323,7 @@ export class Mat2d extends Float32Array { * Alias for {@link Mat2d.subtract} * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static sub(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; } /** @@ -350,6 +361,7 @@ export class Mat2d extends Float32Array { * Alias for {@link Mat2d.multiply} * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static mul(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; } /** @@ -438,9 +450,10 @@ export class Mat2d extends Float32Array { /** * Creates a {@link Mat2d} from a vector translation * This is equivalent to (but much faster than): - * - * Mat2d.identity(dest); - * Mat2d.translate(dest, dest, vec); + * ```js + * Mat2d.identity(dest); + * Mat2d.translate(dest, dest, vec); + * ``` * @category Static * * @param out - {@link Mat2d} receiving operation result @@ -460,9 +473,10 @@ export class Mat2d extends Float32Array { /** * Creates a {@link Mat2d} from a given angle around a given axis * This is equivalent to (but much faster than): - * - * Mat2d.identity(dest); - * Mat2d.rotate(dest, dest, rad); + * ```js + * Mat2d.identity(dest); + * Mat2d.rotate(dest, dest, rad); + * ``` * @category Static * * @param out - {@link Mat2d} receiving operation result @@ -484,9 +498,10 @@ export class Mat2d extends Float32Array { /** * Creates a {@link Mat2d} from a vector scaling * This is equivalent to (but much faster than): - * - * Mat2d.identity(dest); - * Mat2d.scale(dest, dest, vec); + * ```js + * Mat2d.identity(dest); + * Mat2d.scale(dest, dest, vec); + * ``` * @category Static * * @param out - {@link Mat2d} receiving operation result @@ -543,7 +558,8 @@ export class Mat2d extends Float32Array { * @param scale - the amount to scale b's elements by before adding * @returns `out` */ - static multiplyScalarAndAdd(out: Mat2dLike, a: Readonly, b: Readonly, scale: number): Mat2dLike { + static multiplyScalarAndAdd(out: Mat2dLike, a: Readonly, b: Readonly, scale: number): + Mat2dLike { out[0] = a[0] + b[0] * scale; out[1] = a[1] + b[1] * scale; out[2] = a[2] + b[2] * scale; @@ -554,7 +570,7 @@ export class Mat2d extends Float32Array { } /** - * Returns whether or not two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===) + * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===). * @category Static * * @param a - The first matrix. @@ -573,7 +589,7 @@ export class Mat2d extends Float32Array { } /** - * Returns whether or not two {@link Mat2d}s have approximately the same elements in the same position. + * Returns whether two {@link Mat2d}s have approximately the same elements in the same position. * @category Static * * @param a - The first matrix. @@ -596,12 +612,12 @@ export class Mat2d extends Float32Array { const b5 = b[5]; return ( - Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && - Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && - Math.abs(a2 - b2) <= EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && - Math.abs(a3 - b3) <= EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && - Math.abs(a4 - b4) <= EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && - Math.abs(a5 - b5) <= EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) + Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && + Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && + Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && + Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && + Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && + Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) ); } @@ -615,14 +631,8 @@ export class Mat2d extends Float32Array { static str(a: Readonly): string { return `Mat2d(${a.join(', ')})`; } - } // Static method alias assignments Mat2d.mul = Mat2d.multiply; Mat2d.sub = Mat2d.subtract; - -/** - * {@link Mat2d} alias for backwards compatibility - */ -export const mat2d = Mat2d; \ No newline at end of file diff --git a/src/mat3.ts b/src/_lib/f32/Mat3.ts similarity index 87% rename from src/mat3.ts rename to src/_lib/f32/Mat3.ts index 798f9a08..4f7ad7cf 100644 --- a/src/mat3.ts +++ b/src/_lib/f32/Mat3.ts @@ -1,39 +1,24 @@ -import { EPSILON, FloatArray } from './common.js'; -import { Mat2dLike } from './mat2d.js'; -import { Mat4Like } from './mat4.js'; -import { Vec2Like } from './vec2.js'; -import { QuatLike } from './quat.js'; +import { GLM_EPSILON } from '#gl-matrix/common'; -/** - * A 3x3 Matrix given as a {@link Mat3}, a 9-element floating point TypedArray, - * or an array of 9 numbers. - */ -export type Mat3Like = [ - number, number, number, - number, number, number, - number, number, number -] | FloatArray; - -const IDENTITY_3X3 = new Float32Array([ - 1, 0, 0, - 0, 1, 0, - 0, 0, 1, -]); +import type { Mat2dLike, Mat3Like, Mat4Like, Vec2Like, QuatLike } from '#gl-matrix/types'; /** * A 3x3 Matrix */ export class Mat3 extends Float32Array { - /** - * The number of bytes in a {@link Mat3}. - */ - static readonly BYTE_LENGTH = 9 * Float32Array.BYTES_PER_ELEMENT; + static #IDENTITY_3X3 = new Float32Array([ + 1, 0, 0, + 0, 1, 0, + 0, 0, 1, + ]); /** * Create a {@link Mat3}. + * + * @category Constructor */ - constructor(...values: [Readonly | ArrayBufferLike, number?] | number[] ) { - switch(values.length) { + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { + switch (values.length) { case 9: super(values); break; case 2: @@ -50,33 +35,36 @@ export class Mat3 extends Float32Array { } break; default: - super(IDENTITY_3X3); break; + super(Mat3.#IDENTITY_3X3); break; } } - //============ - // Attributes - //============ + // ============ + // Accessors + // ============ /** * A string representation of `this` * Equivalent to `Mat3.str(this);` + * + * @category Accessors */ - get str(): string { + get str(): string { return Mat3.str(this); } - //=================== + // =================== // Instance methods - //=================== + // =================== /** * Copy the values from another {@link Mat3} into `this`. + * @category Methods * * @param a the source vector * @returns `this` */ - copy(a: Readonly): Mat3 { + copy(a: Readonly): this { this.set(a); return this; } @@ -84,88 +72,109 @@ export class Mat3 extends Float32Array { /** * Set `this` to the identity matrix * Equivalent to Mat3.identity(this) + * @category Methods * * @returns `this` */ - identity(): Mat3 { - this.set(IDENTITY_3X3); + identity(): this { + this.set(Mat3.#IDENTITY_3X3); return this; } /** * Multiplies this {@link Mat3} against another one * Equivalent to `Mat3.multiply(this, this, b);` + * @category Methods * * @param out - The receiving Matrix * @param a - The first operand * @param b - The second operand * @returns `this` */ - multiply(b: Readonly): Mat3 { - return Mat3.multiply(this, this, b) as Mat3; + multiply(b: Readonly): this { + return Mat3.multiply(this, this, b) as this; } /** * Alias for {@link Mat3.multiply} + * @category Methods */ - mul(b: Readonly): Mat3 { return this; } + mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Transpose this {@link Mat3} * Equivalent to `Mat3.transpose(this, this);` + * @category Methods * * @returns `this` */ - transpose(): Mat3 { - return Mat3.transpose(this, this) as Mat3; + transpose(): this { + return Mat3.transpose(this, this) as this; } /** * Inverts this {@link Mat3} * Equivalent to `Mat4.invert(this, this);` + * @category Methods * * @returns `this` */ - invert(): Mat3 { - return Mat3.invert(this, this) as Mat3; + invert(): this { + return Mat3.invert(this, this) as this; } /** * Translate this {@link Mat3} by the given vector * Equivalent to `Mat3.translate(this, this, v);` + * @category Methods * * @param v - The {@link Vec2} to translate by * @returns `this` */ - translate(v: Readonly): Mat3 { - return Mat3.translate(this, this, v) as Mat3; + translate(v: Readonly): this { + return Mat3.translate(this, this, v) as this; } /** * Rotates this {@link Mat3} by the given angle around the given axis * Equivalent to `Mat3.rotate(this, this, rad);` + * @category Methods * * @param rad - the angle to rotate the matrix by - * @returns `out` + * @returns `this` */ - rotate(rad: number): Mat3 { - return Mat3.rotate(this, this, rad) as Mat3; + rotate(rad: number): this { + return Mat3.rotate(this, this, rad) as this; } /** * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization * Equivalent to `Mat3.scale(this, this, v);` + * @category Methods * * @param v - The {@link Vec2} to scale the matrix by * @returns `this` */ - scale(v: Readonly): Mat3 { - return Mat3.scale(this, this, v) as Mat3; + scale(v: Readonly): this { + return Mat3.scale(this, this, v) as this; } - //================ + // =================== + // Static accessors + // =================== + + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat3}. + */ + static get BYTE_LENGTH(): number { + return 9 * Float32Array.BYTES_PER_ELEMENT; + } + + // =================== // Static methods - //================ + // =================== /** * Creates a new, identity {@link Mat3} @@ -302,7 +311,7 @@ export class Mat3 extends Float32Array { * * @param out - the receiving matrix * @param a - the source matrix - * @returns `out` or `null` if the matrix is not invertable + * @returns `out` or `null` if the matrix is not invertible */ static invert(out: Mat3Like, a: Mat3Like): Mat3Like | null { const a00 = a[0], @@ -443,6 +452,7 @@ export class Mat3 extends Float32Array { * Alias for {@link Mat3.subtract} * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static sub(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; } /** @@ -492,6 +502,7 @@ export class Mat3 extends Float32Array { * Alias for {@link Mat3.multiply} * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static mul(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; } /** @@ -596,9 +607,10 @@ export class Mat3 extends Float32Array { /** * Creates a {@link Mat3} from a vector translation * This is equivalent to (but much faster than): - * - * mat3.identity(dest); - * mat3.translate(dest, dest, vec); + * ```js + * mat3.identity(dest); + * mat3.translate(dest, dest, vec); + * ``` * @category Static * * @param out - {@link Mat3} receiving operation result @@ -651,9 +663,10 @@ export class Mat3 extends Float32Array { /** * Creates a {@link Mat3} from a vector scaling * This is equivalent to (but much faster than): - * - * mat3.identity(dest); - * mat3.scale(dest, dest, vec); + * ```js + * mat3.identity(dest); + * mat3.scale(dest, dest, vec); + * ``` * @category Static * * @param out - {@link Mat3} receiving operation result @@ -701,6 +714,7 @@ export class Mat3 extends Float32Array { /** * Calculates a {@link Mat3} from the given quaternion + * @category Static * * @param out - {@link Mat3} receiving operation result * @param q - {@link Quat} to create matrix from @@ -768,7 +782,7 @@ export class Mat3 extends Float32Array { * * @param {mat3} out mat3 receiving operation result * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from - * @returns `out` or `null` if the matrix is not invertable + * @returns `out` or `null` if the matrix is not invertible */ static normalFromMat4(out: Mat3Like, a: Readonly): Mat3Like | null { const a00 = a[0]; @@ -953,7 +967,7 @@ export class Mat3 extends Float32Array { } /** - * Returns whether or not two {@link Mat3}s have exactly the same elements in the same position (when compared with ===) + * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===). * @category Static * * @param a - The first matrix. @@ -975,7 +989,7 @@ export class Mat3 extends Float32Array { } /** - * Returns whether or not two {@link Mat3}s have approximately the same elements in the same position. + * Returns whether two {@link Mat3}s have approximately the same elements in the same position. * @category Static * * @param a - The first matrix. @@ -1004,15 +1018,15 @@ export class Mat3 extends Float32Array { const b8 = b[8]; return ( - Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && - Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && - Math.abs(a2 - b2) <= EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && - Math.abs(a3 - b3) <= EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && - Math.abs(a4 - b4) <= EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && - Math.abs(a5 - b5) <= EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && - Math.abs(a6 - b6) <= EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && - Math.abs(a7 - b7) <= EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && - Math.abs(a8 - b8) <= EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) + Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && + Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && + Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && + Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && + Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && + Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && + Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && + Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && + Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) ); } @@ -1029,13 +1043,8 @@ export class Mat3 extends Float32Array { } // Instance method alias assignments -Mat3.prototype.mul = Mat3.prototype.multiply; +Mat3.prototype.mul = Mat3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method // Static method alias assignments Mat3.mul = Mat3.multiply; Mat3.sub = Mat3.subtract; - -/** - * {@link Mat3} alias for backwards compatibility - */ -export const mat3 = Mat3; \ No newline at end of file diff --git a/src/mat4.ts b/src/_lib/f32/Mat4.ts similarity index 86% rename from src/mat4.ts rename to src/_lib/f32/Mat4.ts index c813d622..7505375c 100644 --- a/src/mat4.ts +++ b/src/_lib/f32/Mat4.ts @@ -1,40 +1,31 @@ -import { EPSILON, FloatArray } from './common.js'; -import { Vec3Like } from './vec3.js'; -import { QuatLike } from './quat.js'; -import { Quat2Like } from './quat2.js'; +import { GLM_EPSILON } from '#gl-matrix/common'; -/** - * A 4x4 Matrix given as a {@link Mat4}, a 16-element floating point TypedArray, - * or an array of 16 numbers. - */ -export type Mat4Like = [ - number, number, number, number, - number, number, number, number, - number, number, number, number, - number, number, number, number -] | FloatArray; - -const IDENTITY_4X4 = new Float32Array([ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1, -]); +import type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types'; /** * A 4x4 Matrix */ export class Mat4 extends Float32Array { + static #IDENTITY_4X4 = new Float32Array([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + ]); + /** - * The number of bytes in a {@link Mat4}. + * Temporary variable to prevent repeated allocations in the algorithms within Mat4. + * These are declared as TypedArrays to aid in tree-shaking. */ - static readonly BYTE_LENGTH = 16 * Float32Array.BYTES_PER_ELEMENT; + static #TMP_VEC3 = new Float32Array(3); /** * Create a {@link Mat4}. + * + * @category Constructor */ - constructor(...values: [Readonly | ArrayBufferLike, number?] | number[] ) { - switch(values.length) { + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { + switch (values.length) { case 16: super(values); break; case 2: @@ -52,33 +43,36 @@ export class Mat4 extends Float32Array { } break; default: - super(IDENTITY_4X4); break; + super(Mat4.#IDENTITY_4X4); break; } } - //============ - // Attributes - //============ + // ============ + // Accessors + // ============ /** * A string representation of `this` * Equivalent to `Mat4.str(this);` + * + * @category Accessors */ - get str(): string { + get str(): string { return Mat4.str(this); } - //=================== + // =================== // Instance methods - //=================== + // =================== /** * Copy the values from another {@link Mat4} into `this`. + * @category Methods * * @param a the source vector * @returns `this` */ - copy(a: Readonly): Mat4 { + copy(a: Readonly): this { this.set(a); return this; } @@ -86,117 +80,126 @@ export class Mat4 extends Float32Array { /** * Set `this` to the identity matrix * Equivalent to Mat4.identity(this) + * @category Methods * * @returns `this` */ - identity(): Mat4 { - this.set(IDENTITY_4X4); + identity(): this { + this.set(Mat4.#IDENTITY_4X4); return this; } /** * Multiplies this {@link Mat4} against another one * Equivalent to `Mat4.multiply(this, this, b);` + * @category Methods * - * @param out - The receiving Matrix - * @param a - The first operand * @param b - The second operand * @returns `this` */ - multiply(b: Readonly): Mat4 { - return Mat4.multiply(this, this, b) as Mat4; + multiply(b: Readonly): this { + return Mat4.multiply(this, this, b) as this; } /** * Alias for {@link Mat4.multiply} + * @category Methods */ - mul(b: Readonly): Mat4 { return this; } + mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Transpose this {@link Mat4} * Equivalent to `Mat4.transpose(this, this);` + * @category Methods * * @returns `this` */ - transpose(): Mat4 { - return Mat4.transpose(this, this) as Mat4; + transpose(): this { + return Mat4.transpose(this, this) as this; } /** * Inverts this {@link Mat4} * Equivalent to `Mat4.invert(this, this);` + * @category Methods * * @returns `this` */ - invert(): Mat4 { - return Mat4.invert(this, this) as Mat4; + invert(): this { + return Mat4.invert(this, this) as this; } /** * Translate this {@link Mat4} by the given vector * Equivalent to `Mat4.translate(this, this, v);` + * @category Methods * * @param v - The {@link Vec3} to translate by * @returns `this` */ - translate(v: Readonly): Mat4 { - return Mat4.translate(this, this, v) as Mat4; + translate(v: Readonly): this { + return Mat4.translate(this, this, v) as this; } /** * Rotates this {@link Mat4} by the given angle around the given axis * Equivalent to `Mat4.rotate(this, this, rad, axis);` + * @category Methods * * @param rad - the angle to rotate the matrix by * @param axis - the axis to rotate around - * @returns `out` + * @returns `this` */ - rotate(rad: number, axis: Readonly): Mat4 { - return Mat4.rotate(this, this, rad, axis) as Mat4; + rotate(rad: number, axis: Readonly): this { + return Mat4.rotate(this, this, rad, axis) as this; } /** * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization * Equivalent to `Mat4.scale(this, this, v);` + * @category Methods * * @param v - The {@link Vec3} to scale the matrix by * @returns `this` */ - scale(v: Readonly): Mat4 { - return Mat4.scale(this, this, v) as Mat4; + scale(v: Readonly): this { + return Mat4.scale(this, this, v) as this; } /** * Rotates this {@link Mat4} by the given angle around the X axis * Equivalent to `Mat4.rotateX(this, this, rad);` + * @category Methods * * @param rad - the angle to rotate the matrix by * @returns `this` */ - rotateX(rad: number): Mat4 { - return Mat4.rotateX(this, this, rad) as Mat4; + rotateX(rad: number): this { + return Mat4.rotateX(this, this, rad) as this; } /** * Rotates this {@link Mat4} by the given angle around the Y axis * Equivalent to `Mat4.rotateY(this, this, rad);` + * @category Methods * * @param rad - the angle to rotate the matrix by * @returns `this` */ - rotateY(rad: number): Mat4 { - return Mat4.rotateY(this, this, rad) as Mat4; + rotateY(rad: number): this { + return Mat4.rotateY(this, this, rad) as this; } /** * Rotates this {@link Mat4} by the given angle around the Z axis * Equivalent to `Mat4.rotateZ(this, this, rad);` + * @category Methods * * @param rad - the angle to rotate the matrix by * @returns `this` */ - rotateZ(rad: number): Mat4 { - return Mat4.rotateZ(this, this, rad) as Mat4; + rotateZ(rad: number): this { + return Mat4.rotateZ(this, this, rad) as this; } /** @@ -205,6 +208,7 @@ export class Mat4 extends Float32Array { * which matches WebGL/OpenGL's clip volume. * Passing null/undefined/no value for far will generate infinite projection matrix. * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);` + * @category Methods * * @param fovy - Vertical field of view in radians * @param aspect - Aspect ratio. typically viewport width/height @@ -212,8 +216,8 @@ export class Mat4 extends Float32Array { * @param far - Far bound of the frustum, can be null or Infinity * @returns `this` */ - perspectiveNO(fovy: number, aspect: number, near: number, far: number): Mat4 { - return Mat4.perspectiveNO(this, fovy, aspect, near, far) as Mat4; + perspectiveNO(fovy: number, aspect: number, near: number, far: number): this { + return Mat4.perspectiveNO(this, fovy, aspect, near, far) as this; } /** @@ -222,6 +226,7 @@ export class Mat4 extends Float32Array { * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. * Passing null/undefined/no value for far will generate infinite projection matrix. * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);` + * @category Methods * * @param fovy - Vertical field of view in radians * @param aspect - Aspect ratio. typically viewport width/height @@ -229,8 +234,8 @@ export class Mat4 extends Float32Array { * @param far - Far bound of the frustum, can be null or Infinity * @returns `this` */ - perspectiveZO(fovy: number, aspect: number, near: number, far: number): Mat4 { - return Mat4.perspectiveZO(this, fovy, aspect, near, far) as Mat4; + perspectiveZO(fovy: number, aspect: number, near: number, far: number): this { + return Mat4.perspectiveZO(this, fovy, aspect, near, far) as this; } /** @@ -238,6 +243,7 @@ export class Mat4 extends Float32Array { * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], * which matches WebGL/OpenGL's clip volume. * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);` + * @category Methods * * @param left - Left bound of the frustum * @param right - Right bound of the frustum @@ -247,8 +253,8 @@ export class Mat4 extends Float32Array { * @param far - Far bound of the frustum * @returns `this` */ - orthoNO(left: number, right: number, bottom: number, top: number, near: number, far: number): Mat4 { - return Mat4.orthoNO(this, left, right, bottom, top, near, far) as Mat4; + orthoNO(left: number, right: number, bottom: number, top: number, near: number, far: number): this { + return Mat4.orthoNO(this, left, right, bottom, top, near, far) as this; } /** @@ -256,6 +262,7 @@ export class Mat4 extends Float32Array { * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);` + * @category Methods * * @param left - Left bound of the frustum * @param right - Right bound of the frustum @@ -265,13 +272,26 @@ export class Mat4 extends Float32Array { * @param far - Far bound of the frustum * @returns `this` */ - orthoZO(left: number, right: number, bottom: number, top: number, near: number, far: number): Mat4 { - return Mat4.orthoZO(this, left, right, bottom, top, near, far) as Mat4; + orthoZO(left: number, right: number, bottom: number, top: number, near: number, far: number): this { + return Mat4.orthoZO(this, left, right, bottom, top, near, far) as this; + } + + // =================== + // Static accessors + // =================== + + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat4}. + */ + static get BYTE_LENGTH(): number { + return 16 * Float32Array.BYTES_PER_ELEMENT; } - //================ + // =================== // Static methods - //================ + // =================== /** * Creates a new, identity {@link Mat4} @@ -368,7 +388,7 @@ export class Mat4 extends Float32Array { * @param out - The receiving Matrix * @returns `out` */ - static identity(out: Mat4Like): Mat4Like { + static identity(out: Mat4Like): Mat4Like { out[0] = 1; out[1] = 0; out[2] = 0; @@ -446,7 +466,7 @@ export class Mat4 extends Float32Array { * * @param out - the receiving matrix * @param a - the source matrix - * @returns `out` or `null` if the matrix is not invertable + * @returns `out` or `null` if the matrix is not invertible */ static invert(out: Mat4Like, a: Mat4Like): Mat4Like | null { const a00 = a[0], @@ -676,6 +696,7 @@ export class Mat4 extends Float32Array { * Alias for {@link Mat4.multiply} * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static mul(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; } /** @@ -782,7 +803,7 @@ export class Mat4 extends Float32Array { let z = axis[2]; let len = Math.sqrt(x * x + y * y + z * z); - if (len < EPSILON) { + if (len < GLM_EPSILON) { return null; } @@ -853,16 +874,16 @@ export class Mat4 extends Float32Array { * @returns `out` */ static rotateX(out: Mat4Like, a: Readonly, rad: number): Mat4Like { - let s = Math.sin(rad); - let c = Math.cos(rad); - let a10 = a[4]; - let a11 = a[5]; - let a12 = a[6]; - let a13 = a[7]; - let a20 = a[8]; - let a21 = a[9]; - let a22 = a[10]; - let a23 = a[11]; + const s = Math.sin(rad); + const c = Math.cos(rad); + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; if (a !== out) { // If the source and destination differ, copy the unchanged rows @@ -898,16 +919,16 @@ export class Mat4 extends Float32Array { * @returns `out` */ static rotateY(out: Mat4Like, a: Readonly, rad: number): Mat4Like { - let s = Math.sin(rad); - let c = Math.cos(rad); - let a00 = a[0]; - let a01 = a[1]; - let a02 = a[2]; - let a03 = a[3]; - let a20 = a[8]; - let a21 = a[9]; - let a22 = a[10]; - let a23 = a[11]; + const s = Math.sin(rad); + const c = Math.cos(rad); + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; if (a !== out) { // If the source and destination differ, copy the unchanged rows @@ -943,16 +964,16 @@ export class Mat4 extends Float32Array { * @returns `out` */ static rotateZ(out: Mat4Like, a: Readonly, rad: number): Mat4Like { - let s = Math.sin(rad); - let c = Math.cos(rad); - let a00 = a[0]; - let a01 = a[1]; - let a02 = a[2]; - let a03 = a[3]; - let a10 = a[4]; - let a11 = a[5]; - let a12 = a[6]; - let a13 = a[7]; + const s = Math.sin(rad); + const c = Math.cos(rad); + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; if (a !== out) { // If the source and destination differ, copy the unchanged last row @@ -981,9 +1002,10 @@ export class Mat4 extends Float32Array { /** * Creates a {@link Mat4} from a vector translation * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, dest, vec); + * ```js + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * ``` * @category Static * * @param out - {@link Mat4} receiving operation result @@ -1013,9 +1035,10 @@ export class Mat4 extends Float32Array { /** * Creates a {@link Mat4} from a vector scaling * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.scale(dest, dest, vec); + * ```js + * mat4.identity(dest); + * mat4.scale(dest, dest, vec); + * ``` * @category Static * * @param out - {@link Mat4} receiving operation result @@ -1045,9 +1068,10 @@ export class Mat4 extends Float32Array { /** * Creates a {@link Mat4} from a given angle around a given axis * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotate(dest, dest, rad, axis); + * ```js + * mat4.identity(dest); + * mat4.rotate(dest, dest, rad, axis); + * ``` * @category Static * * @param out - {@link Mat4} receiving operation result @@ -1061,7 +1085,7 @@ export class Mat4 extends Float32Array { let z = axis[2]; let len = Math.sqrt(x * x + y * y + z * z); - if (len < EPSILON) { + if (len < GLM_EPSILON) { return null; } @@ -1097,9 +1121,10 @@ export class Mat4 extends Float32Array { /** * Creates a matrix from the given angle around the X axis * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotateX(dest, dest, rad); + * ```js + * mat4.identity(dest); + * mat4.rotateX(dest, dest, rad); + * ``` * @category Static * * @param out - mat4 receiving operation result @@ -1107,8 +1132,8 @@ export class Mat4 extends Float32Array { * @returns `out` */ static fromXRotation(out: Mat4Like, rad: number): Mat4Like { - let s = Math.sin(rad); - let c = Math.cos(rad); + const s = Math.sin(rad); + const c = Math.cos(rad); // Perform axis-specific matrix multiplication out[0] = 1; @@ -1133,9 +1158,10 @@ export class Mat4 extends Float32Array { /** * Creates a matrix from the given angle around the Y axis * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotateY(dest, dest, rad); + * ```js + * mat4.identity(dest); + * mat4.rotateY(dest, dest, rad); + * ``` * @category Static * * @param out - mat4 receiving operation result @@ -1143,8 +1169,8 @@ export class Mat4 extends Float32Array { * @returns `out` */ static fromYRotation(out: Mat4Like, rad: number): Mat4Like { - let s = Math.sin(rad); - let c = Math.cos(rad); + const s = Math.sin(rad); + const c = Math.cos(rad); // Perform axis-specific matrix multiplication out[0] = c; @@ -1169,9 +1195,10 @@ export class Mat4 extends Float32Array { /** * Creates a matrix from the given angle around the Z axis * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotateZ(dest, dest, rad); + * ```js + * mat4.identity(dest); + * mat4.rotateZ(dest, dest, rad); + * ``` * @category Static * * @param out - mat4 receiving operation result @@ -1205,12 +1232,13 @@ export class Mat4 extends Float32Array { /** * Creates a matrix from a quaternion rotation and vector translation * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * let quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * ``` * @category Static * * @param out - mat4 receiving operation result @@ -1276,18 +1304,19 @@ export class Mat4 extends Float32Array { const az = a[6]; const aw = a[7]; - let magnitude = bx * bx + by * by + bz * bz + bw * bw; - //Only scale if it makes sense + const magnitude = bx * bx + by * by + bz * bz + bw * bw; + + // Only scale if it makes sense if (magnitude > 0) { - tmpVec3[0] = ((ax * bw + aw * bx + ay * bz - az * by) * 2) / magnitude; - tmpVec3[1] = ((ay * bw + aw * by + az * bx - ax * bz) * 2) / magnitude; - tmpVec3[2] = ((az * bw + aw * bz + ax * by - ay * bx) * 2) / magnitude; + Mat4.#TMP_VEC3[0] = ((ax * bw + aw * bx + ay * bz - az * by) * 2) / magnitude; + Mat4.#TMP_VEC3[1] = ((ay * bw + aw * by + az * bx - ax * bz) * 2) / magnitude; + Mat4.#TMP_VEC3[2] = ((az * bw + aw * bz + ax * by - ay * bx) * 2) / magnitude; } else { - tmpVec3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; - tmpVec3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; - tmpVec3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; + Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; + Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; } - Mat4.fromRotationTranslation(out, a as QuatLike, tmpVec3); + Mat4.fromRotationTranslation(out, a as QuatLike, Mat4.#TMP_VEC3); return out; } @@ -1297,7 +1326,7 @@ export class Mat4 extends Float32Array { * * @param out - Matrix receiving operation result * @param a - Mat4 to derive the normal matrix from - * @returns `out` or `null` if the matrix is not invertable + * @returns `out` or `null` if the matrix is not invertible */ static normalFromMat4(out: Mat4Like, a: Readonly): Mat4Like | null { const a00 = a[0]; @@ -1472,11 +1501,11 @@ export class Mat4 extends Float32Array { * @return `out` */ static getRotation(out: QuatLike, mat: Readonly): QuatLike { - Mat4.getScaling(tmpVec3, mat); + Mat4.getScaling(Mat4.#TMP_VEC3, mat); - const is1 = 1 / tmpVec3[0]; - const is2 = 1 / tmpVec3[1]; - const is3 = 1 / tmpVec3[2]; + const is1 = 1 / Mat4.#TMP_VEC3[0]; + const is2 = 1 / Mat4.#TMP_VEC3[1]; + const is3 = 1 / Mat4.#TMP_VEC3[2]; const sm11 = mat[0] * is1; const sm12 = mat[1] * is2; @@ -1599,13 +1628,14 @@ export class Mat4 extends Float32Array { /** * Creates a matrix from a quaternion rotation, vector translation and vector scale * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * let quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * mat4.scale(dest, scale); + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale); + * ``` * @category Static * * @param out - mat4 receiving operation result @@ -1614,7 +1644,8 @@ export class Mat4 extends Float32Array { * @param s - Scaling vector * @returns `out` */ - static fromRotationTranslationScale(out: Mat4Like, q: Readonly, v: Readonly, s: Readonly): Mat4Like { + static fromRotationTranslationScale(out: Mat4Like, q: Readonly, v: Readonly, + s: Readonly): Mat4Like { // Quaternion math const x = q[0]; const y = q[1]; @@ -1658,17 +1689,18 @@ export class Mat4 extends Float32Array { } /** - * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * mat4.translate(dest, origin); - * let quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * mat4.scale(dest, scale) - * mat4.translate(dest, negativeOrigin); + * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the + * given origin. This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * mat4.translate(dest, origin); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * mat4.translate(dest, negativeOrigin); + * ``` * @category Static * * @param out - mat4 receiving operation result @@ -1678,7 +1710,8 @@ export class Mat4 extends Float32Array { * @param o - The origin vector around which to scale and rotate * @returns `out` */ - static fromRotationTranslationScaleOrigin(out: Mat4Like, q: Readonly, v: Readonly, s: Readonly, o: Readonly): Mat4Like { + static fromRotationTranslationScaleOrigin(out: Mat4Like, q: Readonly, v: Readonly, + s: Readonly, o: Readonly): Mat4Like { // Quaternion math const x = q[0]; const y = q[1]; @@ -1802,7 +1835,8 @@ export class Mat4 extends Float32Array { * @param far - Far bound of the frustum, can be null or Infinity * @returns `out` */ - static frustumNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, far: number = Infinity): Mat4Like { + static frustumNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, + far = Infinity): Mat4Like { const rl = 1 / (right - left); const tb = 1 / (top - bottom); out[0] = near * 2 * rl; @@ -1836,7 +1870,8 @@ export class Mat4 extends Float32Array { * @category Static * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly */ - static frustum(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, far: number = Infinity): Mat4Like { return out; } + static frustum(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, + far = Infinity): Mat4Like { return out; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Generates a frustum matrix with the given bounds @@ -1854,7 +1889,8 @@ export class Mat4 extends Float32Array { * @param far - Far bound of the frustum, can be null or Infinity * @returns `out` */ - static frustumZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, far: number = Infinity): Mat4Like { + static frustumZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, + far = Infinity): Mat4Like { const rl = 1 / (right - left); const tb = 1 / (top - bottom); out[0] = near * 2 * rl; @@ -1897,7 +1933,7 @@ export class Mat4 extends Float32Array { * @param far - Far bound of the frustum, can be null or Infinity * @returns `out` */ - static perspectiveNO(out: Mat4Like, fovy: number, aspect: number, near: number, far: number = Infinity): Mat4Like { + static perspectiveNO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like { const f = 1.0 / Math.tan(fovy / 2); out[0] = f / aspect; out[1] = 0; @@ -1929,7 +1965,10 @@ export class Mat4 extends Float32Array { * @category Static * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly */ - static perspective(out: Mat4Like, fovy: number, aspect: number, near: number, far: number = Infinity): Mat4Like { return out; } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static perspective(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like { + return out; + } /** * Generates a perspective projection matrix suitable for WebGPU with the given bounds. @@ -1945,7 +1984,7 @@ export class Mat4 extends Float32Array { * @param far - Far bound of the frustum, can be null or Infinity * @returns `out` */ - static perspectiveZO(out: Mat4Like, fovy: number, aspect: number, near: number, far: number = Infinity): Mat4Like { + static perspectiveZO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like { const f = 1.0 / Math.tan(fovy / 2); out[0] = f / aspect; out[1] = 0; @@ -1973,9 +2012,8 @@ export class Mat4 extends Float32Array { } /** - * Generates a perspective projection matrix with the given field of view. - * This is primarily useful for generating projection matrices to be used - * with the still experiemental WebVR API. + * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating + * projection matrices to be used with the still experimental WebVR API. * @category Static * * @param out - mat4 frustum matrix will be written into @@ -1985,7 +2023,10 @@ export class Mat4 extends Float32Array { * @returns `out` * @deprecated */ - static perspectiveFromFieldOfView(out: Mat4Like, fov, near: number, far: number): Mat4Like { + static perspectiveFromFieldOfView(out: Mat4Like, + fov: { upDegrees: number, downDegrees: number, leftDegrees: number, rightDegrees: number }, near: number, + far: number): Mat4Like { + const upTan = Math.tan((fov.upDegrees * Math.PI) / 180.0); const downTan = Math.tan((fov.downDegrees * Math.PI) / 180.0); const leftTan = Math.tan((fov.leftDegrees * Math.PI) / 180.0); @@ -2013,9 +2054,8 @@ export class Mat4 extends Float32Array { } /** - * Generates a orthogonal projection matrix with the given bounds. - * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], - * which matches WebGL/OpenGL's clip volume. + * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume. * @category Static * * @param out - mat4 frustum matrix will be written into @@ -2027,7 +2067,8 @@ export class Mat4 extends Float32Array { * @param far - Far bound of the frustum * @returns `out` */ - static orthoNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, far: number): Mat4Like { + static orthoNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, + far: number): Mat4Like { const lr = 1 / (left - right); const bt = 1 / (bottom - top); const nf = 1 / (near - far); @@ -2055,12 +2096,15 @@ export class Mat4 extends Float32Array { * @category Static * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly */ - static ortho(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, far: number): Mat4Like { return out; } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static ortho(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, far: number): + Mat4Like { + return out; + } /** - * Generates a orthogonal projection matrix with the given bounds. - * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], - * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume. * @category Static * * @param out - mat4 frustum matrix will be written into @@ -2072,7 +2116,8 @@ export class Mat4 extends Float32Array { * @param far - Far bound of the frustum * @returns `out` */ - static orthoZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, far: number): Mat4Like { + static orthoZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, + far: number): Mat4Like { const lr = 1 / (left - right); const bt = 1 / (bottom - top); const nf = 1 / (near - far); @@ -2096,8 +2141,8 @@ export class Mat4 extends Float32Array { } /** - * Generates a look-at matrix with the given eye position, focal point, and up axis. - * If you want a matrix that actually makes an object look at another object, you should use targetTo instead. + * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that + * actually makes an object look at another object, you should use targetTo instead. * @category Static * * @param out - mat4 frustum matrix will be written into @@ -2118,9 +2163,9 @@ export class Mat4 extends Float32Array { const centerz = center[2]; if ( - Math.abs(eyex - centerx) < EPSILON && - Math.abs(eyey - centery) < EPSILON && - Math.abs(eyez - centerz) < EPSILON + Math.abs(eyex - centerx) < GLM_EPSILON && + Math.abs(eyey - centery) < GLM_EPSILON && + Math.abs(eyez - centerz) < GLM_EPSILON ) { return Mat4.identity(out); } @@ -2195,7 +2240,8 @@ export class Mat4 extends Float32Array { * @param up - vec3 pointing up * @returns `out` */ - static targetTo(out: Mat4Like, eye: Readonly, target: Readonly, up: Readonly): Mat4Like { + static targetTo(out: Mat4Like, eye: Readonly, target: Readonly, up: Readonly): + Mat4Like { const eyex = eye[0]; const eyey = eye[1]; const eyez = eye[2]; @@ -2331,10 +2377,12 @@ export class Mat4 extends Float32Array { out[15] = a[15] - b[15]; return out; } + /** * Alias for {@link Mat4.subtract} * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static sub(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; } /** @@ -2397,7 +2445,7 @@ export class Mat4 extends Float32Array { } /** - * Returns whether or not two {@link Mat4}s have exactly the same elements in the same position (when compared with ===) + * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===). * @category Static * * @param a - The first matrix. @@ -2426,7 +2474,7 @@ export class Mat4 extends Float32Array { } /** - * Returns whether or not two {@link Mat4}s have approximately the same elements in the same position. + * Returns whether two {@link Mat4}s have approximately the same elements in the same position. * @category Static * * @param a - The first matrix. @@ -2469,22 +2517,22 @@ export class Mat4 extends Float32Array { const b15 = b[15]; return ( - Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && - Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && - Math.abs(a2 - b2) <= EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && - Math.abs(a3 - b3) <= EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && - Math.abs(a4 - b4) <= EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && - Math.abs(a5 - b5) <= EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && - Math.abs(a6 - b6) <= EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && - Math.abs(a7 - b7) <= EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && - Math.abs(a8 - b8) <= EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) && - Math.abs(a9 - b9) <= EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) && - Math.abs(a10 - b10) <= EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) && - Math.abs(a11 - b11) <= EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) && - Math.abs(a12 - b12) <= EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) && - Math.abs(a13 - b13) <= EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) && - Math.abs(a14 - b14) <= EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) && - Math.abs(a15 - b15) <= EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15)) + Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && + Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && + Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && + Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && + Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && + Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && + Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && + Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && + Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) && + Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) && + Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) && + Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) && + Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) && + Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) && + Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) && + Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15)) ); } @@ -2500,12 +2548,8 @@ export class Mat4 extends Float32Array { } } -// Temporary variables to prevent repeated allocations in the algorithms above. -// These are declared as TypedArrays to aid in tree-shaking. -const tmpVec3 = new Float32Array(3); - // Instance method alias assignments -Mat4.prototype.mul = Mat4.prototype.multiply; +Mat4.prototype.mul = Mat4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method // Static method alias assignments Mat4.sub = Mat4.subtract; @@ -2513,8 +2557,3 @@ Mat4.mul = Mat4.multiply; Mat4.frustum = Mat4.frustumNO; Mat4.perspective = Mat4.perspectiveNO; Mat4.ortho = Mat4.orthoNO; - -/** - * Mat4 alias for backwards compatibility - */ -export const mat4 = Mat4; \ No newline at end of file diff --git a/src/quat.ts b/src/_lib/f32/Quat.ts similarity index 81% rename from src/quat.ts rename to src/_lib/f32/Quat.ts index 9efa0030..6bb53344 100644 --- a/src/quat.ts +++ b/src/_lib/f32/Quat.ts @@ -1,28 +1,33 @@ -import { EPSILON, ANGLE_ORDER } from './common.js'; -import { Mat3Like } from './mat3.js'; -import { Vec3, Vec3Like } from './vec3.js'; -import { Vec4, Vec4Like } from './vec4.js'; +import { Vec3 } from './Vec3.js'; +import { Vec4 } from './Vec4.js'; +import { GLM_EPSILON } from '#gl-matrix/common'; -/** - * A Quaternion given as a {@link Quat}, a 4-element floating point TypedArray, - * or an array of 4 numbers. - */ -export type QuatLike = Vec4Like; +import type { Mat3Like, QuatLike, Vec3Like } from '#gl-matrix/types'; /** * Quaternion */ export class Quat extends Float32Array { - /** - * The number of bytes in a {@link Quat}. - */ - static readonly BYTE_LENGTH = 4 * Float32Array.BYTES_PER_ELEMENT; + static #DEFAULT_ANGLE_ORDER = 'zyx'; + + // Temporary variables to prevent repeated allocations in the algorithms within Quat. + // These are declared as TypedArrays to aid in tree-shaking. + + static #TMP_QUAT1 = new Float32Array(4); + static #TMP_QUAT2 = new Float32Array(4); + static #TMP_MAT3 = new Float32Array(9); + + static #TMP_VEC3 = new Float32Array(3); + static #X_UNIT_VEC3 = new Float32Array([1, 0, 0]); + static #Y_UNIT_VEC3 = new Float32Array([0, 1, 0]); /** * Create a {@link Quat}. + * + * @category Constructor */ - constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { - switch(values.length) { + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { + switch (values.length) { case 4: super(values); break; case 2: @@ -43,37 +48,37 @@ export class Quat extends Float32Array { } } - //============ - // Attributes - //============ + // ============ + // Accessors + // ============ // Getters and setters to make component access read better. // These are likely to be a little bit slower than direct array access. /** * The x component of the quaternion. Equivalent to `this[0];` - * @category Quaternion components + * @category Quaternion Components */ get x(): number { return this[0]; } set x(value: number) { this[0] = value; } /** * The y component of the quaternion. Equivalent to `this[1];` - * @category Quaternion components + * @category Quaternion Components */ get y(): number { return this[1]; } set y(value: number) { this[1] = value; } /** * The z component of the quaternion. Equivalent to `this[2];` - * @category Quaternion components + * @category Quaternion Components */ get z(): number { return this[2]; } set z(value: number) { this[2] = value; } /** * The w component of the quaternion. Equivalent to `this[3];` - * @category Quaternion components + * @category Quaternion Components */ get w(): number { return this[3]; } set w(value: number) { this[3] = value; } @@ -84,6 +89,8 @@ export class Quat extends Float32Array { * * Magnitude is used because the `length` attribute is already defined by * TypedArrays to mean the number of elements in the array. + * + * @category Accessors */ get magnitude(): number { const x = this[0]; @@ -95,28 +102,33 @@ export class Quat extends Float32Array { /** * Alias for {@link Quat.magnitude} + * + * @category Accessors */ get mag(): number { return this.magnitude; } /** * A string representation of `this` * Equivalent to `Quat.str(this);` + * + * @category Accessors */ get str(): string { return Quat.str(this); } - //=================== + // =================== // Instances methods - //=================== + // =================== /** * Copy the values from another {@link Quat} into `this`. + * @category Methods * * @param a the source quaternion * @returns `this` */ - copy(a: Readonly): Quat { + copy(a: Readonly): this { super.set(a); return this; } @@ -124,10 +136,11 @@ export class Quat extends Float32Array { /** * Set `this` to the identity quaternion * Equivalent to Quat.identity(this) + * @category Methods * * @returns `this` */ - identity(): Quat { + identity(): this { this[0] = 0; this[1] = 0; this[2] = 0; @@ -138,68 +151,73 @@ export class Quat extends Float32Array { /** * Multiplies `this` by a {@link Quat}. * Equivalent to `Quat.multiply(this, this, b);` + * @category Methods * * @param b - The vector to multiply `this` by * @returns `this` */ - multiply(b: Readonly): Quat { - return Quat.multiply(this, this, b) as Quat; + multiply(b: Readonly): this { + return Quat.multiply(this, this, b) as this; } /** * Alias for {@link Quat.multiply} + * @category Methods */ - mul(b: Readonly): Quat { return this; } + mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Rotates `this` by the given angle about the X axis * Equivalent to `Quat.rotateX(this, this, rad);` + * @category Methods * * @param rad - angle (in radians) to rotate * @returns `this` */ - rotateX(rad: number): Quat { - return Quat.rotateX(this, this, rad) as Quat; + rotateX(rad: number): this { + return Quat.rotateX(this, this, rad) as this; } /** * Rotates `this` by the given angle about the Y axis * Equivalent to `Quat.rotateY(this, this, rad);` + * @category Methods * * @param rad - angle (in radians) to rotate * @returns `this` */ - rotateY(rad: number): Quat { - return Quat.rotateY(this, this, rad) as Quat; + rotateY(rad: number): this { + return Quat.rotateY(this, this, rad) as this; } /** * Rotates `this` by the given angle about the Z axis * Equivalent to `Quat.rotateZ(this, this, rad);` + * @category Methods * * @param rad - angle (in radians) to rotate * @returns `this` */ - rotateZ(rad: number): Quat { - return Quat.rotateZ(this, this, rad) as Quat; + rotateZ(rad: number): this { + return Quat.rotateZ(this, this, rad) as this; } /** * Inverts `this` * Equivalent to `Quat.invert(this, this);` + * @category Methods * * @returns `this` */ - invert(): Quat { - return Quat.invert(this, this) as Quat; + invert(): this { + return Quat.invert(this, this) as this; } /** * Scales `this` by a scalar number * Equivalent to `Quat.scale(this, this, scale);` + * @category Methods * - * @param out - the receiving vector - * @param a - the vector to scale * @param scale - amount to scale the vector by * @returns `this` */ @@ -214,6 +232,7 @@ export class Quat extends Float32Array { /** * Calculates the dot product of `this` and another {@link Quat} * Equivalent to `Quat.dot(this, b);` + * @category Methods * * @param b - the second operand * @returns dot product of `this` and b @@ -222,9 +241,22 @@ export class Quat extends Float32Array { return Quat.dot(this, b); } - //=================== + // =================== + // Static accessors + // =================== + + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat}. + */ + static get BYTE_LENGTH(): number { + return 4 * Float32Array.BYTES_PER_ELEMENT; + } + + // =================== // Static methods - //=================== + // =================== /** * Creates a new identity quat @@ -262,7 +294,7 @@ export class Quat extends Float32Array { * @returns `out` **/ static setAxisAngle(out: QuatLike, axis: Readonly, rad: number): QuatLike { - rad = rad * 0.5; + rad *= 0.5; const s = Math.sin(rad); out[0] = s * axis[0]; out[1] = s * axis[1]; @@ -275,7 +307,7 @@ export class Quat extends Float32Array { * Gets the rotation axis and angle for a given * quaternion. If a quaternion is created with * setAxisAngle, this method will return the same - * values as providied in the original parameter list + * values as provided in the original parameter list * OR functionally equivalent values. * Example: The quaternion formed by axis [0, 0, 1] and * angle -90 is the same as the quaternion formed by @@ -289,7 +321,7 @@ export class Quat extends Float32Array { static getAxisAngle(out_axis: Vec3Like, q: Readonly): number { const rad = Math.acos(q[3]) * 2.0; const s = Math.sin(rad / 2.0); - if (s > EPSILON) { + if (s > GLM_EPSILON) { out_axis[0] = q[0] / s; out_axis[1] = q[1] / s; out_axis[2] = q[2] / s; @@ -317,7 +349,7 @@ export class Quat extends Float32Array { } /** - * Multiplies two quat's + * Multiplies two quaternions. * @category Static * * @param out - the receiving quaternion @@ -545,7 +577,7 @@ export class Quat extends Float32Array { bw = -bw; } // calculate coefficients - if (1.0 - cosom > EPSILON) { + if (1.0 - cosom > GLM_EPSILON) { // standard case (slerp) const omega = Math.acos(cosom); const sinom = Math.sin(omega); @@ -573,7 +605,7 @@ export class Quat extends Float32Array { * @param out - the receiving quaternion * @returns `out` */ - /*static random(out: QuatLike): QuatLike { + /* static random(out: QuatLike): QuatLike { // Implementation of http://planning.cs.uiuc.edu/node198.html // TODO: Calling random 3 times is probably not the fastest solution let u1 = glMatrix.RANDOM(); @@ -617,7 +649,7 @@ export class Quat extends Float32Array { /** * Calculates the conjugate of a quat - * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result. + * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result. * @category Static * * @param out - the receiving quaternion @@ -636,7 +668,7 @@ export class Quat extends Float32Array { * Creates a quaternion from the given 3x3 rotation matrix. * * NOTE: The resultant quaternion is not normalized, so you should be sure - * to renormalize the quaternion yourself where necessary. + * to re-normalize the quaternion yourself where necessary. * @category Static * * @param out - the receiving quaternion @@ -660,10 +692,10 @@ export class Quat extends Float32Array { } else { // |w| <= 1/2 let i = 0; - if (m[4] > m[0]) i = 1; - if (m[8] > m[i * 3 + i]) i = 2; - let j = (i + 1) % 3; - let k = (i + 2) % 3; + if (m[4] > m[0]) { i = 1; } + if (m[8] > m[i * 3 + i]) { i = 2; } + const j = (i + 1) % 3; + const k = (i + 2) % 3; fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0); out[i] = 0.5 * fRoot; @@ -687,18 +719,18 @@ export class Quat extends Float32Array { * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx. * @returns `out` */ - static fromEuler(out: QuatLike, x: number, y: number, z: number, order = ANGLE_ORDER): QuatLike { - let halfToRad = (0.5 * Math.PI) / 180.0; + static fromEuler(out: QuatLike, x: number, y: number, z: number, order = Quat.#DEFAULT_ANGLE_ORDER): QuatLike { + const halfToRad = (0.5 * Math.PI) / 180.0; x *= halfToRad; y *= halfToRad; z *= halfToRad; - let sx = Math.sin(x); - let cx = Math.cos(x); - let sy = Math.sin(y); - let cy = Math.cos(y); - let sz = Math.sin(z); - let cz = Math.cos(z); + const sx = Math.sin(x); + const cx = Math.cos(x); + const sy = Math.sin(y); + const cy = Math.cos(y); + const sz = Math.sin(z); + const cz = Math.cos(z); switch (order) { case 'xyz': @@ -744,7 +776,7 @@ export class Quat extends Float32Array { break; default: - throw new Error('Unknown angle order ' + order); + throw new Error(`Unknown angle order ${order}`); } return out; @@ -813,6 +845,7 @@ export class Quat extends Float32Array { * @param w - W component * @returns `out` */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static set(out: QuatLike, x: number, y: number, z: number, w: number): QuatLike { return out; } /** @@ -824,12 +857,14 @@ export class Quat extends Float32Array { * @param b - the second operand * @returns `out` */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static add(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; } /** * Alias for {@link Quat.multiply} * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static mul(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; } /** @@ -871,7 +906,8 @@ export class Quat extends Float32Array { * @param t - interpolation amount, in the range [0-1], between the two inputs * @returns `out` */ - static lerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike { return out } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static lerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike { return out; } /** * Calculates the magnitude (length) of a {@link Quat} @@ -880,12 +916,14 @@ export class Quat extends Float32Array { * @param a - quaternion to calculate length of * @returns length of `a` */ - static magnitude(a: Readonly): number { return 0; } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static magnitude(a: Readonly): number { return 0; } /** * Alias for {@link Quat.magnitude} * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static mag(a: Readonly): number { return 0; } /** @@ -893,15 +931,15 @@ export class Quat extends Float32Array { * @category Static * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs */ - // @ts-ignore: Length conflicts with Function.length - static length(a: Readonly): number { return 0; } + // Length conflicts with Function.length + static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Alias for {@link Quat.magnitude} * @category Static * @deprecated Use {@link Quat.mag} */ - static len(a: Readonly): number { return 0; } + static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Calculates the squared length of a {@link Quat} @@ -910,13 +948,14 @@ export class Quat extends Float32Array { * @param a - quaternion to calculate squared length of * @returns squared length of a */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static squaredLength(a: Readonly): number { return 0; } /** * Alias for {@link Quat.squaredLength} * @category Static */ - static sqrLen(a: Readonly): number { return 0; } + static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Normalize a {@link Quat} @@ -926,26 +965,29 @@ export class Quat extends Float32Array { * @param a - quaternion to normalize * @returns `out` */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static normalize(out: QuatLike, a: Readonly): QuatLike { return out; } /** - * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===) + * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===) * @category Static * * @param a - The first quaternion. * @param b - The second quaternion. * @returns True if the vectors are equal, false otherwise. */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static exactEquals(a: Readonly, b: Readonly): boolean { return false; } /** - * Returns whether or not the quaternions have approximately the same elements in the same position. + * Returns whether the quaternions have approximately the same elements in the same position. * @category Static * * @param a - The first vector. * @param b - The second vector. * @returns True if the vectors are equal, false otherwise. */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static equals(a: Readonly, b: Readonly): boolean { return false; } /** @@ -961,12 +1003,13 @@ export class Quat extends Float32Array { * @returns `out` */ static rotationTo(out: QuatLike, a: Readonly, b: Readonly): QuatLike { - let dot = Vec3.dot(a, b); + const dot = Vec3.dot(a, b); + if (dot < -0.999999) { - Vec3.cross(tmpVec3, xUnitVec3, a); - if (Vec3.mag(tmpVec3) < 0.000001) Vec3.cross(tmpVec3, yUnitVec3, a); - Vec3.normalize(tmpVec3, tmpVec3); - Quat.setAxisAngle(out, tmpVec3, Math.PI); + Vec3.cross(Quat.#TMP_VEC3, Quat.#X_UNIT_VEC3, a); + if (Vec3.mag(Quat.#TMP_VEC3) < 0.000001) { Vec3.cross(Quat.#TMP_VEC3, Quat.#Y_UNIT_VEC3, a); } + Vec3.normalize(Quat.#TMP_VEC3, Quat.#TMP_VEC3); + Quat.setAxisAngle(out, Quat.#TMP_VEC3, Math.PI); return out; } else if (dot > 0.999999) { out[0] = 0; @@ -975,10 +1018,10 @@ export class Quat extends Float32Array { out[3] = 1; return out; } else { - Vec3.cross(tmpVec3, a, b); - out[0] = tmpVec3[0]; - out[1] = tmpVec3[1]; - out[2] = tmpVec3[2]; + Vec3.cross(Quat.#TMP_VEC3, a, b); + out[0] = Quat.#TMP_VEC3[0]; + out[1] = Quat.#TMP_VEC3[1]; + out[2] = Quat.#TMP_VEC3[2]; out[3] = 1 + dot; return Quat.normalize(out, out); } @@ -996,10 +1039,11 @@ export class Quat extends Float32Array { * @param t - interpolation amount, in the range [0-1], between the two inputs * @returns `out` */ - static sqlerp(out: QuatLike, a: Readonly, b: Readonly, c: Readonly, d: Readonly, t: number): QuatLike { - Quat.slerp(tmpQuat1, a, d, t); - Quat.slerp(tmpQuat2, b, c, t); - Quat.slerp(out, tmpQuat1, tmpQuat2, 2 * t * (1 - t)); + static sqlerp(out: QuatLike, a: Readonly, b: Readonly, c: Readonly, + d: Readonly, t: number): QuatLike { + Quat.slerp(Quat.#TMP_QUAT1, a, d, t); + Quat.slerp(Quat.#TMP_QUAT2, b, c, t); + Quat.slerp(out, Quat.#TMP_QUAT1, Quat.#TMP_QUAT2, 2 * t * (1 - t)); return out; } @@ -1012,37 +1056,27 @@ export class Quat extends Float32Array { * * @param out - The receiving quaternion * @param view - the vector representing the viewing direction - * @param right - the vector representing the local "right" direction - * @param up - the vector representing the local "up" direction + * @param right - the vector representing the local `right` direction + * @param up - the vector representing the local `up` direction * @returns `out` */ static setAxes(out: QuatLike, view: Readonly, right: Readonly, up: Readonly): QuatLike { - tmpMat3[0] = right[0]; - tmpMat3[3] = right[1]; - tmpMat3[6] = right[2]; + Quat.#TMP_MAT3[0] = right[0]; + Quat.#TMP_MAT3[3] = right[1]; + Quat.#TMP_MAT3[6] = right[2]; - tmpMat3[1] = up[0]; - tmpMat3[4] = up[1]; - tmpMat3[7] = up[2]; + Quat.#TMP_MAT3[1] = up[0]; + Quat.#TMP_MAT3[4] = up[1]; + Quat.#TMP_MAT3[7] = up[2]; - tmpMat3[2] = -view[0]; - tmpMat3[5] = -view[1]; - tmpMat3[8] = -view[2]; + Quat.#TMP_MAT3[2] = -view[0]; + Quat.#TMP_MAT3[5] = -view[1]; + Quat.#TMP_MAT3[8] = -view[2]; - return Quat.normalize(out, Quat.fromMat3(out, tmpMat3)); + return Quat.normalize(out, Quat.fromMat3(out, Quat.#TMP_MAT3)); } } -// Temporary variables to prevent repeated allocations in the algorithms above. -// These are declared as TypedArrays to aid in tree-shaking. -const tmpQuat1 = new Float32Array(4); -const tmpQuat2 = new Float32Array(4); -const tmpMat3 = new Float32Array(9); - -const tmpVec3 = new Float32Array(3); -const xUnitVec3 = new Float32Array([1, 0, 0]); -const yUnitVec3 = new Float32Array([0, 1, 0]); - // Methods which re-use the Vec4 implementation Quat.set = Vec4.set; Quat.add = Vec4.add; @@ -1055,15 +1089,10 @@ Quat.equals = Vec4.equals; Quat.magnitude = Vec4.magnitude; // Instance method alias assignments -Quat.prototype.mul = Quat.prototype.multiply; +Quat.prototype.mul = Quat.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method // Static method alias assignments Quat.mul = Quat.multiply; Quat.mag = Quat.magnitude; Quat.length = Quat.magnitude; Quat.len = Quat.magnitude; - -/** - * Quat alias for backwards compatibility - */ -export const quat = Quat; \ No newline at end of file diff --git a/src/quat2.ts b/src/_lib/f32/Quat2.ts similarity index 86% rename from src/quat2.ts rename to src/_lib/f32/Quat2.ts index 670ec4a2..f8706911 100644 --- a/src/quat2.ts +++ b/src/_lib/f32/Quat2.ts @@ -1,31 +1,26 @@ -import { EPSILON, FloatArray } from './common.js'; -import { Mat4, Mat4Like } from './mat4.js'; -import { Quat, QuatLike } from './quat.js'; -import { Vec3Like } from './vec3.js'; +import { Mat4 } from './Mat4.js'; +import { Quat } from './Quat.js'; +import { GLM_EPSILON } from '#gl-matrix/common'; -/** - * A Dual Quaternion given as a {@link Quat2}, an 8-element floating point - * TypedArray, or an array of 8 numbers. - */ -export type Quat2Like = [ - number, number, number, number, - number, number, number, number -] | FloatArray; +import type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types'; /** * Dual Quaternion */ export class Quat2 extends Float32Array { - /** - * The number of bytes in a {@link Quat}. - */ - static readonly BYTE_LENGTH = 8 * Float32Array.BYTES_PER_ELEMENT; + // Temporary variables to prevent repeated allocations in the algorithms within Quat2. + // These are declared as TypedArrays to aid in tree-shaking. + + static #TMP_QUAT = new Float32Array(4); + static #TMP_VEC3 = new Float32Array(3); /** * Create a {@link Quat2}. + * + * @category Constructor */ - constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { - switch(values.length) { + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { + switch (values.length) { case 8: super(values); break; case 2: @@ -46,37 +41,52 @@ export class Quat2 extends Float32Array { } } - //============ - // Attributes - //============ + // ============ + // Accessors + // ============ /** * A string representation of `this` * Equivalent to `Quat2.str(this);` + * + * @category Accessors */ get str(): string { return Quat2.str(this); } - //=================== + // =================== // Instances methods - //=================== + // =================== /** * Copy the values from another {@link Quat2} into `this`. + * @category Methods * * @param a the source dual quaternion * @returns `this` */ - copy(a: Readonly): Quat2 { + copy(a: Readonly): this { super.set(a); return this; } + // =================== + // Static accessors + // =================== - //=================== + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat2}. + */ + static get BYTE_LENGTH(): number { + return 8 * Float32Array.BYTES_PER_ELEMENT; + } + + // =================== // Static methods - //=================== + // =================== /** * Creates a new identity {@link Quat2} @@ -114,7 +124,7 @@ export class Quat2 extends Float32Array { * @returns a new dual quaternion */ static fromValues(x1: number, y1: number, z1: number, w1: number, - x2: number, y2: number, z2: number, w2: number): Quat2 { + x2: number, y2: number, z2: number, w2: number): Quat2 { return new Quat2(x1, y1, z1, w1, x2, y2, z2, w2); } @@ -132,7 +142,7 @@ export class Quat2 extends Float32Array { * @returns a new dual quaternion */ static fromRotationTranslationValues(x1: number, y1: number, z1: number, w1: number, - x2: number, y2: number, z2: number): Quat2 { + x2: number, y2: number, z2: number): Quat2 { const ax = x2 * 0.5; const ay = y2 * 0.5; const az = z2 * 0.5; @@ -141,7 +151,7 @@ export class Quat2 extends Float32Array { ax * w1 + ay * z1 - az * y1, ay * w1 + az * x1 - ax * z1, az * w1 + ax * y1 - ay * x1, - -ax * x1 - ay * y1 - az * z1); + -ax * x1 - ay * y1 - az * z1); } /** @@ -221,9 +231,9 @@ export class Quat2 extends Float32Array { * @returns `out` */ static fromMat4(out: Quat2Like, a: Readonly): Quat2Like { - Mat4.getRotation(tmpQuat, a); - Mat4.getTranslation(tmpVec3, a); - return Quat2.fromRotationTranslation(out, tmpQuat, tmpVec3); + Mat4.getRotation(Quat2.#TMP_QUAT, a); + Mat4.getTranslation(Quat2.#TMP_VEC3, a); + return Quat2.fromRotationTranslation(out, Quat2.#TMP_QUAT, Quat2.#TMP_VEC3); } /** @@ -281,7 +291,7 @@ export class Quat2 extends Float32Array { * @returns `out` */ static set(out: Quat2Like, x1: number, y1: number, z1: number, w1: number, - x2: number, y2: number, z2: number, w2: number): Quat2Like { + x2: number, y2: number, z2: number, w2: number): Quat2Like { out[0] = x1; out[1] = y1; out[2] = z1; @@ -593,13 +603,13 @@ export class Quat2 extends Float32Array { * @returns `out` */ static rotateAroundAxis(out: Quat2Like, a: Readonly, axis: Readonly, rad: number): Quat2Like { - //Special case for rad = 0 - if (Math.abs(rad) < EPSILON) { + // Special case for rad = 0 + if (Math.abs(rad) < GLM_EPSILON) { return Quat2.copy(out, a); } const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]); - rad = rad * 0.5; + rad *= 0.5; const s = Math.sin(rad); const bx = (s * axis[0]) / axisLength; const by = (s * axis[1]) / axisLength; @@ -721,6 +731,7 @@ export class Quat2 extends Float32Array { * Alias for {@link Quat2.multiply} * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static mul(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like { return out; } /** @@ -752,6 +763,7 @@ export class Quat2 extends Float32Array { * @param b - the second operand * @returns dot product of a and b */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static dot(a: Readonly, b: Readonly): number { return 0; } /** @@ -767,7 +779,7 @@ export class Quat2 extends Float32Array { */ static lerp(out: Quat2Like, a: Readonly, b: Readonly, t: number): Quat2Like { const mt = 1 - t; - if (Quat2.dot(a, b) < 0) t = -t; + if (Quat2.dot(a, b) < 0) { t = -t; } out[0] = a[0] * mt + b[0] * t; out[1] = a[1] * mt + b[1] * t; @@ -803,8 +815,8 @@ export class Quat2 extends Float32Array { } /** - * Calculates the conjugate of a {@link Quat2} - * If the dual quaternion is normalized, this function is faster than {@link Quat2.invert} and produces the same result. + * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than + * {@link Quat2.invert} and produces the same result. * @category Static * * @param out - the receiving dual quaternion @@ -830,28 +842,29 @@ export class Quat2 extends Float32Array { * @param a - dual quaternion to calculate length of * @returns length of `a` */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static magnitude(a: Readonly): number { return 0; } /** * Alias for {@link Quat2.magnitude} * @category Static */ - static mag(a: Readonly): number { return 0; } + static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Alias for {@link Quat2.magnitude} * @category Static * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs */ - // @ts-ignore: Length conflicts with Function.length - static length(a: Readonly): number { return 0; } + // Length conflicts with Function.length + static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Alias for {@link Quat2.magnitude} * @category Static * @deprecated Use {@link Quat2.mag} */ - static len(a: Readonly): number { return 0; } + static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Calculates the squared length of a {@link Quat2} @@ -860,13 +873,14 @@ export class Quat2 extends Float32Array { * @param a - dual quaternion to calculate squared length of * @returns squared length of a */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static squaredLength(a: Readonly): number { return 0; } /** * Alias for {@link Quat2.squaredLength} * @category Static */ - static sqrLen(a: Readonly): number { return 0; } + static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Normalize a {@link Quat2} @@ -918,7 +932,7 @@ export class Quat2 extends Float32Array { } /** - * Returns whether or not the {@link Quat2}s have exactly the same elements in the same position (when compared with ===) + * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===) * @category Static * * @param a - The first dual quaternion. @@ -939,7 +953,7 @@ export class Quat2 extends Float32Array { } /** - * Returns whether or not the {@link Quat2}s have approximately the same elements in the same position. + * Returns whether the {@link Quat2}s have approximately the same elements in the same position. * @category Static * * @param a - The first dual quaternion. @@ -964,41 +978,31 @@ export class Quat2 extends Float32Array { const b6 = b[6]; const b7 = b[7]; return ( - Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && - Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && - Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && - Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && - Math.abs(a4 - b4) <= EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && - Math.abs(a5 - b5) <= EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && - Math.abs(a6 - b6) <= EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && - Math.abs(a7 - b7) <= EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) + Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && + Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && + Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && + Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && + Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && + Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && + Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && + Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) ); } } -// Temporary variables to prevent repeated allocations in the algorithms above. -// These are declared as TypedArrays to aid in tree-shaking. -const tmpQuat = new Float32Array(4); -const tmpVec3 = new Float32Array(3); - // Methods which re-use the Quat implementation -// @ts-ignore +// @ts-expect-error: Ignore type error coercion. Quat2.dot = Quat.dot; -// @ts-ignore +// @ts-expect-error: Ignore type error coercion. Quat2.squaredLength = Quat.squaredLength; -// @ts-ignore +// @ts-expect-error: Ignore type error coercion. Quat2.sqrLen = Quat.squaredLength; -// @ts-ignore +// @ts-expect-error: Ignore type error coercion. Quat2.mag = Quat.magnitude; -// @ts-ignore +// @ts-expect-error: Ignore type error coercion. Quat2.length = Quat.magnitude; -// @ts-ignore +// @ts-expect-error: Ignore type error coercion. Quat2.len = Quat.magnitude; // Static method alias assignments Quat2.mul = Quat2.multiply; - -/** - * Quat2 alias for backwards compatibility - */ -export const quat2 = Quat2; \ No newline at end of file diff --git a/src/vec2.ts b/src/_lib/f32/Vec2.ts similarity index 81% rename from src/vec2.ts rename to src/_lib/f32/Vec2.ts index ea372bd9..1b445650 100644 --- a/src/vec2.ts +++ b/src/_lib/f32/Vec2.ts @@ -1,957 +1,1002 @@ -import { EPSILON, FloatArray } from './common.js'; -import { Mat2Like } from './mat2.js'; -import { Mat2dLike } from './mat2d.js'; -import { Mat3Like } from './mat3.js'; -import { Mat4Like } from './mat4.js'; - -/** - * A 2 dimensional vector given as a {@link Vec2}, a 2-element floating point - * TypedArray, or an array of 2 numbers. - */ -export type Vec2Like = [number, number] | FloatArray; - -/** - * 2 Dimensional Vector - */ -export class Vec2 extends Float32Array { - /** - * The number of bytes in a {@link Vec2}. - */ - static readonly BYTE_LENGTH = 2 * Float32Array.BYTES_PER_ELEMENT; - - /** - * Create a {@link Vec2}. - */ - constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { - switch(values.length) { - case 2:{ - const v = values[0]; - if (typeof v === 'number') { - super([v, values[1]]); - } else { - super(v as ArrayBufferLike, values[1], 2); - } - break; - } - case 1: { - const v = values[0]; - if (typeof v === 'number') { - super([v, v]); - } else { - super(v as ArrayBufferLike, 0, 2); - } - break; - } - default: - super(2); break; - } - } - - //============ - // Attributes - //============ - - // Getters and setters to make component access read better. - // These are likely to be a little bit slower than direct array access. - - /** - * The x component of the vector. Equivalent to `this[0];` - * @category Vector components - */ - get x(): number { return this[0]; } - set x(value: number) { this[0] = value; } - - /** - * The y component of the vector. Equivalent to `this[1];` - * @category Vector components - */ - get y(): number { return this[1]; } - set y(value: number) { this[1] = value; } - - // Alternate set of getters and setters in case this is being used to define - // a color. - - /** - * The r component of the vector. Equivalent to `this[0];` - * @category Color components - */ - get r(): number { return this[0]; } - set r(value: number) { this[0] = value; } - - /** - * The g component of the vector. Equivalent to `this[1];` - * @category Color components - */ - get g(): number { return this[1]; } - set g(value: number) { this[1] = value; } - - /** - * The magnitude (length) of this. - * Equivalent to `Vec2.magnitude(this);` - * - * Magnitude is used because the `length` attribute is already defined by - * TypedArrays to mean the number of elements in the array. - */ - get magnitude(): number { - return Math.hypot(this[0], this[1]); - } - /** - * Alias for {@link Vec2.magnitude} - */ - get mag(): number { return this.magnitude; } - - /** - * The squared magnitude (length) of `this`. - * Equivalent to `Vec2.squaredMagnitude(this);` - */ - get squaredMagnitude(): number { - const x = this[0]; - const y = this[1]; - return x * x + y * y; - } - /** - * Alias for {@link Vec2.squaredMagnitude} - */ - get sqrMag(): number { return this.squaredMagnitude; } - - /** - * A string representation of `this` - * Equivalent to `Vec2.str(this);` - */ - get str(): string { - return Vec2.str(this); - } - - //=================== - // Instances methods - //=================== - - /** - * Copy the values from another {@link Vec2} into `this`. - * - * @param a the source vector - * @returns `this` - */ - copy(a: Readonly): Vec2 { - this.set(a); - return this; - } - - // Instead of zero(), use a.fill(0) for instances; - - /** - * Adds a {@link Vec2} to `this`. - * Equivalent to `Vec2.add(this, this, b);` - * - * @param b - The vector to add to `this` - * @returns `this` - */ - add(b: Readonly): Vec2 { - this[0] += b[0]; - this[1] += b[1]; - return this; - } - - /** - * Subtracts a {@link Vec2} from `this`. - * Equivalent to `Vec2.subtract(this, this, b);` - * - * @param b - The vector to subtract from `this` - * @returns `this` - */ - subtract(b: Readonly): Vec2 { - this[0] -= b[0]; - this[1] -= b[1]; - return this; - } - - /** - * Alias for {@link Vec2.subtract} - */ - sub(b: Readonly): Vec2 { return this; } - - /** - * Multiplies `this` by a {@link Vec2}. - * Equivalent to `Vec2.multiply(this, this, b);` - * - * @param b - The vector to multiply `this` by - * @returns `this` - */ - multiply(b: Readonly): Vec2 { - this[0] *= b[0]; - this[1] *= b[1]; - return this; - } - /** - * Alias for {@link Vec2.multiply} - */ - mul(b: Readonly): Vec2 { return this; } - - /** - * Divides `this` by a {@link Vec2}. - * Equivalent to `Vec2.divide(this, this, b);` - * - * @param b - The vector to divide `this` by - * @returns {Vec2} `this` - */ - divide(b: Readonly): Vec2 { - this[0] /= b[0]; - this[1] /= b[1]; - return this; - } - /** - * Alias for {@link Vec2.divide} - */ - div(b: Readonly): Vec2 { return this; } - - /** - * Scales `this` by a scalar number. - * Equivalent to `Vec2.scale(this, this, b);` - * - * @param b - Amount to scale `this` by - * @returns `this` - */ - scale(b: number): Vec2 { - this[0] *= b; - this[1] *= b; - return this; - } - - /** - * Calculates `this` scaled by a scalar value then adds the result to `this`. - * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);` - * - * @param b - The vector to add to `this` - * @param scale - The amount to scale `b` by before adding - * @returns `this` - */ - scaleAndAdd(b: Readonly, scale: number): Vec2 { - this[0] += b[0] * scale; - this[1] += b[1] * scale; - return this; - } - - /** - * Calculates the euclidian distance between another {@link Vec2} and `this`. - * Equivalent to `Vec2.distance(this, b);` - * - * @param b - The vector to calculate the distance to - * @returns Distance between `this` and `b` - */ - distance(b: Readonly): number { - return Vec2.distance(this, b); - } - /** - * Alias for {@link Vec2.distance} - */ - dist(b: Readonly): number { return 0; } - - /** - * Calculates the squared euclidian distance between another {@link Vec2} and `this`. - * Equivalent to `Vec2.squaredDistance(this, b);` - * - * @param b The vector to calculate the squared distance to - * @returns Squared distance between `this` and `b` - */ - squaredDistance(b: Readonly): number { - return Vec2.squaredDistance(this, b); - } - /** - * Alias for {@link Vec2.squaredDistance} - */ - sqrDist(b: Readonly): number { return 0; } - - /** - * Negates the components of `this`. - * Equivalent to `Vec2.negate(this, this);` - * - * @returns `this` - */ - negate(): Vec2 { - this[0] *= -1; - this[1] *= -1; - return this; - } - - /** - * Inverts the components of `this`. - * Equivalent to `Vec2.inverse(this, this);` - * - * @returns `this` - */ - invert(): Vec2 { - this[0] = 1.0 / this[0]; - this[1] = 1.0 / this[1]; - return this; - } - - /** - * Sets each component of `this` to it's absolute value. - * Equivalent to `Vec2.abs(this, this);` - * - * @returns `this` - */ - abs(): Vec2 { - this[0] = Math.abs(this[0]); - this[1] = Math.abs(this[1]); - return this; - } - - /** - * Calculates the dot product of this and another {@link Vec2}. - * Equivalent to `Vec2.dot(this, b);` - * - * @param b - The second operand - * @returns Dot product of `this` and `b` - */ - dot(b: Readonly): number { - return this[0] * b[0] + this[1] * b[1]; - } - - /** - * Normalize `this`. - * Equivalent to `Vec2.normalize(this, this);` - * - * @returns `this` - */ - normalize(): Vec2 { - return Vec2.normalize(this, this) as Vec2; - } - - //================ - // Static methods - //================ - - /** - * Creates a new, empty {@link Vec2} - * @category Static - * - * @returns A new 2D vector - */ - static create(): Vec2 { - return new Vec2(); - } - - /** - * Creates a new {@link Vec2} initialized with values from an existing vector - * @category Static - * - * @param a - Vector to clone - * @returns A new 2D vector - */ - static clone(a: Readonly): Vec2 { - return new Vec2(a); - } - - /** - * Creates a new {@link Vec2} initialized with the given values - * @category Static - * - * @param x - X component - * @param y - Y component - * @returns A new 2D vector - */ - static fromValues(x: number, y: number): Vec2 { - return new Vec2(x, y); - } - - /** - * Copy the values from one {@link Vec2} to another - * @category Static - * - * @param out - the receiving vector - * @param a - The source vector - * @returns `out` - */ - static copy(out: Vec2Like, a: Readonly): Vec2Like { - out[0] = a[0]; - out[1] = a[1]; - return out; - } - - /** - * Set the components of a {@link Vec2} to the given values - * @category Static - * - * @param out - The receiving vector - * @param x - X component - * @param y - Y component - * @returns `out` - */ - static set(out: Vec2Like, x: number, y: number): Vec2Like { - out[0] = x; - out[1] = y; - return out; - } - - /** - * Adds two {@link Vec2}s - * @category Static - * - * @param out - The receiving vector - * @param a - The first operand - * @param b - The second operand - * @returns `out` - */ - static add(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - return out; - } - - /** - * Subtracts vector b from vector a - * @category Static - * - * @param out - The receiving vector - * @param a - The first operand - * @param b - The second operand - * @returns `out` - */ - static subtract(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - return out; - } - - /** - * Alias for {@link Vec2.subtract} - * @category Static - */ - static sub(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; } - - /** - * Multiplies two {@link Vec2}s - * @category Static - * - * @param out - The receiving vector - * @param a - The first operand - * @param b - The second operand - * @returns `out` - */ - static multiply(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { - out[0] = a[0] * b[0]; - out[1] = a[1] * b[1]; - return out; - } - - /** - * Alias for {@link Vec2.multiply} - * @category Static - */ - static mul(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; } - - /** - * Divides two {@link Vec2}s - * @category Static - * - * @param out - The receiving vector - * @param a - The first operand - * @param b - The second operand - * @returns `out` - */ - static divide(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { - out[0] = a[0] / b[0]; - out[1] = a[1] / b[1]; - return out; - } - - /** - * Alias for {@link Vec2.divide} - * @category Static - */ - static div(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; } - - /** - * Math.ceil the components of a {@link Vec2} - * @category Static - * - * @param out - The receiving vector - * @param a - Vector to ceil - * @returns `out` - */ - static ceil(out: Vec2Like, a: Readonly): Vec2Like { - out[0] = Math.ceil(a[0]); - out[1] = Math.ceil(a[1]); - return out; - } - - /** - * Math.floor the components of a {@link Vec2} - * @category Static - * - * @param out - The receiving vector - * @param a - Vector to floor - * @returns `out` - */ - static floor(out: Vec2Like, a: Readonly): Vec2Like { - out[0] = Math.floor(a[0]); - out[1] = Math.floor(a[1]); - return out; - } - - /** - * Returns the minimum of two {@link Vec2}s - * @category Static - * - * @param out - The receiving vector - * @param a - The first operand - * @param b - The second operand - * @returns `out` - */ - static min(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { - out[0] = Math.min(a[0], b[0]); - out[1] = Math.min(a[1], b[1]); - return out; - } - - /** - * Returns the maximum of two {@link Vec2}s - * @category Static - * - * @param out - The receiving vector - * @param a - The first operand - * @param b - The second operand - * @returns `out` - */ - static max(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { - out[0] = Math.max(a[0], b[0]); - out[1] = Math.max(a[1], b[1]); - return out; - } - - /** - * Math.round the components of a {@link Vec2} - * @category Static - * - * @param out - The receiving vector - * @param a - Vector to round - * @returns `out` - */ - static round(out: Vec2Like, a: Readonly): Vec2Like { - out[0] = Math.round(a[0]); - out[1] = Math.round(a[1]); - return out; - } - - /** - * Scales a {@link Vec2} by a scalar number - * @category Static - * - * @param out - The receiving vector - * @param a - The vector to scale - * @param b - Amount to scale the vector by - * @returns `out` - */ - static scale(out: Vec2Like, a: Readonly, b: number): Vec2Like { - out[0] = a[0] * b; - out[1] = a[1] * b; - return out; - } - - /** - * Adds two Vec2's after scaling the second operand by a scalar value - * @category Static - * - * @param out - The receiving vector - * @param a - The first operand - * @param b - The second operand - * @param scale - The amount to scale b by before adding - * @returns `out` - */ - static scaleAndAdd(out: Vec2Like, a: Readonly, b: Readonly, scale: number): Vec2Like { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - return out; - } - - /** - * Calculates the euclidian distance between two {@link Vec2}s - * @category Static - * - * @param a - The first operand - * @param b - The second operand - * @returns distance between `a` and `b` - */ - static distance(a: Readonly, b: Readonly): number { - return Math.hypot(b[0] - a[0], b[1] - a[1]); - } - - /** - * Alias for {@link Vec2.distance} - * @category Static - */ - static dist(a: Readonly, b: Readonly): number { return 0; } - - /** - * Calculates the squared euclidian distance between two {@link Vec2}s - * @category Static - * - * @param a - The first operand - * @param b - The second operand - * @returns Squared distance between `a` and `b` - */ - static squaredDistance(a: Readonly, b: Readonly): number { - const x = b[0] - a[0]; - const y = b[1] - a[1]; - return x * x + y * y; - } - - /** - * Alias for {@link Vec2.distance} - * @category Static - */ - static sqrDist(a: Readonly, b: Readonly): number { return 0; } - - /** - * Calculates the magnitude (length) of a {@link Vec2} - * @category Static - * - * @param a - Vector to calculate magnitude of - * @returns Magnitude of a - */ - static magnitude(a: Readonly): number { - let x = a[0]; - let y = a[1]; - return Math.sqrt(x * x + y * y); - } - /** - * Alias for {@link Vec2.magnitude} - * @category Static - */ - static mag(a: Readonly): number { return 0; } - /** - * Alias for {@link Vec2.magnitude} - * @category Static - * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs - * - * @param a - vector to calculate length of - * @returns length of a - */ - // @ts-ignore: Length conflicts with Function.length - static length(a: Readonly): number { return 0; } - /** - * Alias for {@link Vec2.magnitude} - * @category Static - * @deprecated Use {@link Vec2.mag} - */ - static len(a: Readonly): number { return 0; } - - /** - * Calculates the squared length of a {@link Vec2} - * @category Static - * - * @param a - Vector to calculate squared length of - * @returns Squared length of a - */ - static squaredLength(a: Readonly): number { - const x = a[0]; - const y = a[1]; - return x * x + y * y; - } - /** - * Alias for {@link Vec2.squaredLength} - */ - static sqrLen(a: Readonly, b: Readonly): number { return 0; } - - /** - * Negates the components of a {@link Vec2} - * @category Static - * - * @param out - The receiving vector - * @param a - Vector to negate - * @returns `out` - */ - static negate(out: Vec2Like, a: Readonly) { - out[0] = -a[0]; - out[1] = -a[1]; - return out; - } - - /** - * Returns the inverse of the components of a {@link Vec2} - * @category Static - * - * @param out - The receiving vector - * @param a - Vector to invert - * @returns `out` - */ - static inverse(out: Vec2Like, a: Readonly): Vec2Like { - out[0] = 1.0 / a[0]; - out[1] = 1.0 / a[1]; - return out; - } - - /** - * Returns the absolute value of the components of a {@link Vec2} - * @category Static - * - * @param out - The receiving vector - * @param a - Vector to compute the absolute values of - * @returns `out` - */ - static abs(out: Vec2Like, a: Readonly): Vec2Like { - out[0] = Math.abs(a[0]); - out[1] = Math.abs(a[1]); - return out; - } - - /** - * Normalize a {@link Vec2} - * @category Static - * - * @param out - The receiving vector - * @param a - Vector to normalize - * @returns `out` - */ - static normalize(out: Vec2Like, a: Readonly): Vec2Like { - const x = a[0]; - const y = a[1]; - let len = x * x + y * y; - if (len > 0) { - //TODO: evaluate use of glm_invsqrt here? - len = 1 / Math.sqrt(len); - } - out[0] = a[0] * len; - out[1] = a[1] * len; - return out; - } - - /** - * Calculates the dot product of two {@link Vec2}s - * @category Static - * - * @param a - The first operand - * @param b - The second operand - * @returns Dot product of `a` and `b` - */ - static dot(a: Readonly, b: Readonly): number { - return a[0] * b[0] + a[1] * b[1]; - } - - /** - * Computes the cross product of two {@link Vec2}s - * Note that the cross product must by definition produce a 3D vector. - * For this reason there is also not instance equivalent for this function. - * @category Static - * - * @param out - The receiving vector - * @param a - The first operand - * @param b - The second operand - * @returns `out` - */ - static cross(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { - const z = a[0] * b[1] - a[1] * b[0]; - out[0] = out[1] = 0; - out[2] = z; - return out; - } - - /** - * Performs a linear interpolation between two {@link Vec2}s - * @category Static - * - * @param out - The receiving vector - * @param a - The first operand - * @param b - The second operand - * @param t - Interpolation amount, in the range [0-1], between the two inputs - * @returns `out` - */ - static lerp(out: Vec2Like, a: Readonly, b: Readonly, t: number): Vec2Like { - const ax = a[0]; - const ay = a[1]; - out[0] = ax + t * (b[0] - ax); - out[1] = ay + t * (b[1] - ay); - return out; - } - - /** - * Transforms the {@link Vec2} with a {@link Mat2} - * - * @param out - The receiving vector - * @param a - The vector to transform - * @param m - Matrix to transform with - * @returns `out` - */ - static transformMat2(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like { - const x = a[0]; - const y = a[1]; - out[0] = m[0] * x + m[2] * y; - out[1] = m[1] * x + m[3] * y; - return out; - } - - /** - * Transforms the {@link Vec2} with a {@link Mat2d} - * - * @param out - The receiving vector - * @param a - The vector to transform - * @param m - Matrix to transform with - * @returns `out` - */ - static transformMat2d(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like { - const x = a[0]; - const y = a[1]; - out[0] = m[0] * x + m[2] * y + m[4]; - out[1] = m[1] * x + m[3] * y + m[5]; - return out; - } - - /** - * Transforms the {@link Vec2} with a {@link Mat3} - * 3rd vector component is implicitly '1' - * - * @param out - The receiving vector - * @param a - The vector to transform - * @param m - Matrix to transform with - * @returns `out` - */ - static transformMat3(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like { - const x = a[0]; - const y = a[1]; - out[0] = m[0] * x + m[3] * y + m[6]; - out[1] = m[1] * x + m[4] * y + m[7]; - return out; - } - - /** - * Transforms the {@link Vec2} with a {@link Mat4} - * 3rd vector component is implicitly '0' - * 4th vector component is implicitly '1' - * - * @param out - The receiving vector - * @param a - The vector to transform - * @param m - Matrix to transform with - * @returns `out` - */ - static transformMat4(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like { - const x = a[0]; - const y = a[1]; - out[0] = m[0] * x + m[4] * y + m[12]; - out[1] = m[1] * x + m[5] * y + m[13]; - return out; - } - - /** - * Rotate a 2D vector - * @category Static - * - * @param out - The receiving {@link Vec2} - * @param a - The {@link Vec2} point to rotate - * @param b - The origin of the rotation - * @param rad - The angle of rotation in radians - * @returns `out` - */ - static rotate(out: Vec2Like, a: Readonly, b: Readonly, rad: number): Vec2Like { - //Translate point to the origin - const p0 = a[0] - b[0]; - const p1 = a[1] - b[1]; - const sinC = Math.sin(rad); - const cosC = Math.cos(rad); - - //perform rotation and translate to correct position - out[0] = p0 * cosC - p1 * sinC + b[0]; - out[1] = p0 * sinC + p1 * cosC + b[1]; - - return out; - } - - /** - * Get the angle between two 2D vectors - * @category Static - * - * @param a - The first operand - * @param b - The second operand - * @returns The angle in radians - */ - static angle(a: Readonly, b: Readonly): number { - const x1 = a[0]; - const y1 = a[1]; - const x2 = b[0]; - const y2 = b[1]; - // mag is the product of the magnitudes of a and b - const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2); - // mag &&.. short circuits if mag == 0 - const cosine = mag && (x1 * x2 + y1 * y2) / mag; - // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1 - return Math.acos(Math.min(Math.max(cosine, -1), 1)); - } - - /** - * Set the components of a {@link Vec2} to zero - * @category Static - * - * @param out - The receiving vector - * @returns `out` - */ - static zero(out: Vec2Like): Vec2Like { - out[0] = 0.0; - out[1] = 0.0; - return out; - } - - /** - * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) - * @category Static - * - * @param a - The first vector. - * @param b - The second vector. - * @returns `true` if the vectors components are ===, `false` otherwise. - */ - static exactEquals(a: Readonly, b: Readonly): boolean { - return a[0] === b[0] && a[1] === b[1]; - } - - /** - * Returns whether or not the vectors have approximately the same elements in the same position. - * @category Static - * - * @param a - The first vector. - * @param b - The second vector. - * @returns `true` if the vectors are approximately equal, `false` otherwise. - */ - static equals(a: Readonly, b: Readonly): boolean { - const a0 = a[0]; - const a1 = a[1]; - const b0 = b[0]; - const b1 = b[1]; - return ( - Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && - Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) - ); - } - - /** - * Returns a string representation of a vector - * @category Static - * - * @param a - Vector to represent as a string - * @returns String representation of the vector - */ - static str(a: Readonly): string { - return `Vec2(${a.join(', ')})`; - } -} - -// Instance method alias assignments -Vec2.prototype.sub = Vec2.prototype.subtract; -Vec2.prototype.mul = Vec2.prototype.multiply; -Vec2.prototype.div = Vec2.prototype.divide; -Vec2.prototype.dist = Vec2.prototype.distance; -Vec2.prototype.sqrDist = Vec2.prototype.squaredDistance; - -// Static method alias assignments -Vec2.sub = Vec2.subtract; -Vec2.mul = Vec2.multiply; -Vec2.div = Vec2.divide; -Vec2.dist = Vec2.distance; -Vec2.sqrDist = Vec2.squaredDistance; -Vec2.sqrLen = Vec2.squaredLength; -Vec2.mag = Vec2.magnitude; -Vec2.length = Vec2.magnitude; -Vec2.len = Vec2.magnitude; - -/** - * Vec2 alias for backwards compatibility - */ -export const vec2 = Vec2; +import { GLM_EPSILON } from '#gl-matrix/common'; + +import type { Mat2Like, Mat2dLike, Mat3Like, Mat4Like, Vec2Like } from '#gl-matrix/types'; + +/** + * 2 Dimensional Vector + */ +export class Vec2 extends Float32Array { + /** + * Create a {@link Vec2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { + switch (values.length) { + case 2:{ + const v = values[0]; + if (typeof v === 'number') { + super([v, values[1]!]); + } else { + super(v as ArrayBufferLike, values[1], 2); + } + break; + } + case 1: { + const v = values[0]; + if (typeof v === 'number') { + super([v, v]); + } else { + super(v as ArrayBufferLike, 0, 2); + } + break; + } + default: + super(2); break; + } + } + + // ============ + // Accessors + // ============ + + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x(): number { return this[0]; } + set x(value: number) { this[0] = value; } + + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y(): number { return this[1]; } + set y(value: number) { this[1] = value; } + + // Alternate set of getters and setters in case this is being used to define + // a color. + + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r(): number { return this[0]; } + set r(value: number) { this[0] = value; } + + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g(): number { return this[1]; } + set g(value: number) { this[1] = value; } + + /** + * The magnitude (length) of this. + * Equivalent to `Vec2.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number { + return Math.hypot(this[0], this[1]); + } + + /** + * Alias for {@link Vec2.magnitude} + * + * @category Accessors + */ + get mag(): number { return this.magnitude; } + + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec2.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude(): number { + const x = this[0]; + const y = this[1]; + return x * x + y * y; + } + + /** + * Alias for {@link Vec2.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag(): number { return this.squaredMagnitude; } + + /** + * A string representation of `this` + * Equivalent to `Vec2.str(this);` + * + * @category Accessors + */ + get str(): string { + return Vec2.str(this); + } + + // =================== + // Instances methods + // =================== + + /** + * Copy the values from another {@link Vec2} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this { + this.set(a); + return this; + } + + // Instead of zero(), use a.fill(0) for instances; + + /** + * Adds a {@link Vec2} to `this`. + * Equivalent to `Vec2.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b: Readonly): this { + this[0] += b[0]; + this[1] += b[1]; + return this; + } + + /** + * Subtracts a {@link Vec2} from `this`. + * Equivalent to `Vec2.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b: Readonly): this { + this[0] -= b[0]; + this[1] -= b[1]; + return this; + } + + /** + * Alias for {@link Vec2.subtract} + * @category Methods + */ + sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Multiplies `this` by a {@link Vec2}. + * Equivalent to `Vec2.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this { + this[0] *= b[0]; + this[1] *= b[1]; + return this; + } + + /** + * Alias for {@link Vec2.multiply} + * @category Methods + */ + mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Divides `this` by a {@link Vec2}. + * Equivalent to `Vec2.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b: Readonly): this { + this[0] /= b[0]; + this[1] /= b[1]; + return this; + } + + /** + * Alias for {@link Vec2.divide} + * @category Methods + */ + div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec2.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b: number): this { + this[0] *= b; + this[1] *= b; + return this; + } + + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b: Readonly, scale: number): this { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + return this; + } + + /** + * Calculates the Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b: Readonly): number { + return Vec2.distance(this, b); + } + /** + * Alias for {@link Vec2.distance} + * @category Methods + */ + dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Calculates the squared Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b: Readonly): number { + return Vec2.squaredDistance(this, b); + } + /** + * Alias for {@link Vec2.squaredDistance} + * @category Methods + */ + sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Negates the components of `this`. + * Equivalent to `Vec2.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate(): this { + this[0] *= -1; + this[1] *= -1; + return this; + } + + /** + * Inverts the components of `this`. + * Equivalent to `Vec2.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this { + this[0] = 1.0 / this[0]; + this[1] = 1.0 / this[1]; + return this; + } + + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec2.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs(): this { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + return this; + } + + /** + * Calculates the dot product of this and another {@link Vec2}. + * Equivalent to `Vec2.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b: Readonly): number { + return this[0] * b[0] + this[1] * b[1]; + } + + /** + * Normalize `this`. + * Equivalent to `Vec2.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize(): this { + return Vec2.normalize(this, this) as this; + } + + // =================== + // Static accessors + // =================== + + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec2}. + */ + static get BYTE_LENGTH(): number { + return 2 * Float32Array.BYTES_PER_ELEMENT; + } + + // =================== + // Static methods + // =================== + + /** + * Creates a new, empty {@link Vec2} + * @category Static + * + * @returns A new 2D vector + */ + static create(): Vec2 { + return new Vec2(); + } + + /** + * Creates a new {@link Vec2} initialized with values from an existing vector + * @category Static + * + * @param a - Vector to clone + * @returns A new 2D vector + */ + static clone(a: Readonly): Vec2 { + return new Vec2(a); + } + + /** + * Creates a new {@link Vec2} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @returns A new 2D vector + */ + static fromValues(x: number, y: number): Vec2 { + return new Vec2(x, y); + } + + /** + * Copy the values from one {@link Vec2} to another + * @category Static + * + * @param out - the receiving vector + * @param a - The source vector + * @returns `out` + */ + static copy(out: Vec2Like, a: Readonly): Vec2Like { + out[0] = a[0]; + out[1] = a[1]; + return out; + } + + /** + * Set the components of a {@link Vec2} to the given values + * @category Static + * + * @param out - The receiving vector + * @param x - X component + * @param y - Y component + * @returns `out` + */ + static set(out: Vec2Like, x: number, y: number): Vec2Like { + out[0] = x; + out[1] = y; + return out; + } + + /** + * Adds two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + return out; + } + + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static subtract(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + return out; + } + + /** + * Alias for {@link Vec2.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; } + + /** + * Multiplies two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + return out; + } + + /** + * Alias for {@link Vec2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; } + + /** + * Divides two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static divide(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + return out; + } + + /** + * Alias for {@link Vec2.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; } + + /** + * Math.ceil the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to ceil + * @returns `out` + */ + static ceil(out: Vec2Like, a: Readonly): Vec2Like { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + return out; + } + + /** + * Math.floor the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to floor + * @returns `out` + */ + static floor(out: Vec2Like, a: Readonly): Vec2Like { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + return out; + } + + /** + * Returns the minimum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static min(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + return out; + } + + /** + * Returns the maximum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static max(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + return out; + } + + /** + * Math.round the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to round + * @returns `out` + */ + static round(out: Vec2Like, a: Readonly): Vec2Like { + out[0] = Math.round(a[0]); + out[1] = Math.round(a[1]); + return out; + } + + /** + * Scales a {@link Vec2} by a scalar number + * @category Static + * + * @param out - The receiving vector + * @param a - The vector to scale + * @param b - Amount to scale the vector by + * @returns `out` + */ + static scale(out: Vec2Like, a: Readonly, b: number): Vec2Like { + out[0] = a[0] * b; + out[1] = a[1] * b; + return out; + } + + /** + * Adds two Vec2's after scaling the second operand by a scalar value + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param scale - The amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out: Vec2Like, a: Readonly, b: Readonly, scale: number): Vec2Like { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + return out; + } + + /** + * Calculates the Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns distance between `a` and `b` + */ + static distance(a: Readonly, b: Readonly): number { + return Math.hypot(b[0] - a[0], b[1] - a[1]); + } + + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a: Readonly, b: Readonly): number { return 0; } + + /** + * Calculates the squared Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Squared distance between `a` and `b` + */ + static squaredDistance(a: Readonly, b: Readonly): number { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + return x * x + y * y; + } + + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a: Readonly, b: Readonly): number { return 0; } + + /** + * Calculates the magnitude (length) of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a: Readonly): number { + const x = a[0]; + const y = a[1]; + return Math.sqrt(x * x + y * y); + } + + /** + * Alias for {@link Vec2.magnitude} + * @category Static + */ + static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + // Length conflicts with Function.length + static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.mag} + */ + static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Calculates the squared length of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate squared length of + * @returns Squared length of a + */ + static squaredLength(a: Readonly): number { + const x = a[0]; + const y = a[1]; + return x * x + y * y; + } + + /** + * Alias for {@link Vec2.squaredLength} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrLen(a: Readonly, b: Readonly): number { return 0; } + + /** + * Negates the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to negate + * @returns `out` + */ + static negate(out: Vec2Like, a: Readonly) { + out[0] = -a[0]; + out[1] = -a[1]; + return out; + } + + /** + * Returns the inverse of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to invert + * @returns `out` + */ + static inverse(out: Vec2Like, a: Readonly): Vec2Like { + out[0] = 1.0 / a[0]; + out[1] = 1.0 / a[1]; + return out; + } + + /** + * Returns the absolute value of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out: Vec2Like, a: Readonly): Vec2Like { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + return out; + } + + /** + * Normalize a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to normalize + * @returns `out` + */ + static normalize(out: Vec2Like, a: Readonly): Vec2Like { + const x = a[0]; + const y = a[1]; + let len = x * x + y * y; + if (len > 0) { + // TODO: evaluate use of glm_invsqrt here? + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + return out; + } + + /** + * Calculates the dot product of two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Dot product of `a` and `b` + */ + static dot(a: Readonly, b: Readonly): number { + return a[0] * b[0] + a[1] * b[1]; + } + + /** + * Computes the cross product of two {@link Vec2}s + * Note that the cross product must by definition produce a 3D vector. + * For this reason there is also not instance equivalent for this function. + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static cross(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { + const z = a[0] * b[1] - a[1] * b[0]; + out[0] = out[1] = 0; + out[2] = z; + return out; + } + + /** + * Performs a linear interpolation between two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param t - Interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Vec2Like, a: Readonly, b: Readonly, t: number): Vec2Like { + const ax = a[0]; + const ay = a[1]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + return out; + } + + /** + * Transforms the {@link Vec2} with a {@link Mat2} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[2] * y; + out[1] = m[1] * x + m[3] * y; + return out; + } + + /** + * Transforms the {@link Vec2} with a {@link Mat2d} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2d(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[2] * y + m[4]; + out[1] = m[1] * x + m[3] * y + m[5]; + return out; + } + + /** + * Transforms the {@link Vec2} with a {@link Mat3} + * 3rd vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat3(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[3] * y + m[6]; + out[1] = m[1] * x + m[4] * y + m[7]; + return out; + } + + /** + * Transforms the {@link Vec2} with a {@link Mat4} + * 3rd vector component is implicitly '0' + * 4th vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat4(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[4] * y + m[12]; + out[1] = m[1] * x + m[5] * y + m[13]; + return out; + } + + /** + * Rotate a 2D vector + * @category Static + * + * @param out - The receiving {@link Vec2} + * @param a - The {@link Vec2} point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotate(out: Vec2Like, a: Readonly, b: Readonly, rad: number): Vec2Like { + // Translate point to the origin + const p0 = a[0] - b[0]; + const p1 = a[1] - b[1]; + const sinC = Math.sin(rad); + const cosC = Math.cos(rad); + + // perform rotation and translate to correct position + out[0] = p0 * cosC - p1 * sinC + b[0]; + out[1] = p0 * sinC + p1 * cosC + b[1]; + + return out; + } + + /** + * Get the angle between two 2D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static angle(a: Readonly, b: Readonly): number { + const x1 = a[0]; + const y1 = a[1]; + const x2 = b[0]; + const y2 = b[1]; + // mag is the product of the magnitudes of a and b + const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2); + // mag &&.. short circuits if mag == 0 + const cosine = mag && (x1 * x2 + y1 * y2) / mag; + // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1 + return Math.acos(Math.min(Math.max(cosine, -1), 1)); + } + + /** + * Set the components of a {@link Vec2} to zero + * @category Static + * + * @param out - The receiving vector + * @returns `out` + */ + static zero(out: Vec2Like): Vec2Like { + out[0] = 0.0; + out[1] = 0.0; + return out; + } + + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors components are ===, `false` otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean { + return a[0] === b[0] && a[1] === b[1]; + } + + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors are approximately equal, `false` otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean { + const a0 = a[0]; + const a1 = a[1]; + const b0 = b[0]; + const b1 = b[1]; + return ( + Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && + Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) + ); + } + + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - Vector to represent as a string + * @returns String representation of the vector + */ + static str(a: Readonly): string { + return `Vec2(${a.join(', ')})`; + } +} + +// Instance method alias assignments +Vec2.prototype.sub = Vec2.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method +Vec2.prototype.mul = Vec2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method +Vec2.prototype.div = Vec2.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method +Vec2.prototype.dist = Vec2.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method +Vec2.prototype.sqrDist = Vec2.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method + +// Static method alias assignments +Vec2.sub = Vec2.subtract; +Vec2.mul = Vec2.multiply; +Vec2.div = Vec2.divide; +Vec2.dist = Vec2.distance; +Vec2.sqrDist = Vec2.squaredDistance; +Vec2.sqrLen = Vec2.squaredLength; +Vec2.mag = Vec2.magnitude; +Vec2.length = Vec2.magnitude; +Vec2.len = Vec2.magnitude; diff --git a/src/vec3.ts b/src/_lib/f32/Vec3.ts similarity index 82% rename from src/vec3.ts rename to src/_lib/f32/Vec3.ts index 2a0b68f3..89dfb525 100644 --- a/src/vec3.ts +++ b/src/_lib/f32/Vec3.ts @@ -1,28 +1,18 @@ -import { EPSILON, FloatArray } from './common.js'; -import { Mat4Like } from './mat4.js'; -import { Mat3Like } from './mat3.js'; -import { QuatLike } from './quat.js'; +import { GLM_EPSILON } from '#gl-matrix/common'; + +import type { Mat3Like, Mat4Like, QuatLike, Vec3Like } from '#gl-matrix/types'; /** - * A 3 dimensional vector given as a {@link Vec3}, a 3-element floating point - * TypedArray, or an array of 3 numbers. + * 3 Dimensional Vector */ -export type Vec3Like = [number, number, number] | FloatArray; - - /** - * 3 Dimensional Vector - */ export class Vec3 extends Float32Array { /** - * The number of bytes in a {@link Vec3}. - */ - static readonly BYTE_LENGTH = 3 * Float32Array.BYTES_PER_ELEMENT; - - /** - * Create a {@link Vec3}. - */ + * Create a {@link Vec3}. + * + * @category Constructor + */ constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { - switch(values.length) { + switch (values.length) { case 3: super(values); break; case 2: @@ -41,30 +31,30 @@ export class Vec3 extends Float32Array { } } - //============ - // Attributes - //============ + // ============ + // Accessors + // ============ // Getters and setters to make component access read better. // These are likely to be a little bit slower than direct array access. /** * The x component of the vector. Equivalent to `this[0];` - * @category Vector components + * @category Vector Components */ get x(): number { return this[0]; } set x(value: number) { this[0] = value; } /** * The y component of the vector. Equivalent to `this[1];` - * @category Vector components + * @category Vector Components */ get y(): number { return this[1]; } set y(value: number) { this[1] = value; } /** * The z component of the vector. Equivalent to `this[2];` - * @category Vector components + * @category Vector Components */ get z(): number { return this[2]; } set z(value: number) { this[2] = value; } @@ -74,21 +64,21 @@ export class Vec3 extends Float32Array { /** * The r component of the vector. Equivalent to `this[0];` - * @category Color components + * @category Color Components */ get r(): number { return this[0]; } set r(value: number) { this[0] = value; } /** * The g component of the vector. Equivalent to `this[1];` - * @category Color components + * @category Color Components */ get g(): number { return this[1]; } set g(value: number) { this[1] = value; } /** * The b component of the vector. Equivalent to `this[2];` - * @category Color components + * @category Color Components */ get b(): number { return this[2]; } set b(value: number) { this[2] = value; } @@ -99,6 +89,8 @@ export class Vec3 extends Float32Array { * * Magnitude is used because the `length` attribute is already defined by * TypedArrays to mean the number of elements in the array. + * + * @category Accessors */ get magnitude(): number { const x = this[0]; @@ -106,14 +98,19 @@ export class Vec3 extends Float32Array { const z = this[2]; return Math.sqrt(x * x + y * y + z * z); } + /** * Alias for {@link Vec3.magnitude} + * + * @category Accessors */ get mag(): number { return this.magnitude; } /** * The squared magnitude (length) of `this`. * Equivalent to `Vec3.squaredMagnitude(this);` + * + * @category Accessors */ get squaredMagnitude(): number { const x = this[0]; @@ -121,30 +118,36 @@ export class Vec3 extends Float32Array { const z = this[2]; return x * x + y * y + z * z; } + /** * Alias for {@link Vec3.squaredMagnitude} + * + * @category Accessors */ get sqrMag(): number { return this.squaredMagnitude; } /** * A string representation of `this` * Equivalent to `Vec3.str(this);` + * + * @category Accessors */ get str(): string { return Vec3.str(this); } - //=================== + // =================== // Instances methods - //=================== + // =================== /** * Copy the values from another {@link Vec3} into `this`. + * @category Methods * * @param a the source vector * @returns `this` */ - copy(a: Readonly): Vec3 { + copy(a: Readonly): this { this.set(a); return this; } @@ -152,11 +155,12 @@ export class Vec3 extends Float32Array { /** * Adds a {@link Vec3} to `this`. * Equivalent to `Vec3.add(this, this, b);` + * @category Methods * * @param b - The vector to add to `this` * @returns `this` */ - add(b: Readonly): Vec3 { + add(b: Readonly): this { this[0] += b[0]; this[1] += b[1]; this[2] += b[2]; @@ -166,11 +170,12 @@ export class Vec3 extends Float32Array { /** * Subtracts a {@link Vec3} from `this`. * Equivalent to `Vec3.subtract(this, this, b);` + * @category Methods * * @param b - The vector to subtract from `this` * @returns `this` */ - subtract(b: Readonly): Vec3 { + subtract(b: Readonly): this { this[0] -= b[0]; this[1] -= b[1]; this[2] -= b[2]; @@ -179,17 +184,19 @@ export class Vec3 extends Float32Array { /** * Alias for {@link Vec3.subtract} + * @category Methods */ - sub(b: Readonly): Vec3 { return this; } + sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Multiplies `this` by a {@link Vec3}. * Equivalent to `Vec3.multiply(this, this, b);` + * @category Methods * * @param b - The vector to multiply `this` by * @returns `this` */ - multiply(b: Readonly): Vec3 { + multiply(b: Readonly): this { this[0] *= b[0]; this[1] *= b[1]; this[2] *= b[2]; @@ -198,17 +205,19 @@ export class Vec3 extends Float32Array { /** * Alias for {@link Vec3.multiply} + * @category Methods */ - mul(b: Readonly): Vec3 { return this; } + mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Divides `this` by a {@link Vec3}. * Equivalent to `Vec3.divide(this, this, b);` + * @category Methods * * @param b - The vector to divide `this` by * @returns `this` */ - divide(b: Readonly): Vec3 { + divide(b: Readonly): this { this[0] /= b[0]; this[1] /= b[1]; this[2] /= b[2]; @@ -217,17 +226,19 @@ export class Vec3 extends Float32Array { /** * Alias for {@link Vec3.divide} + * @category Methods */ - div(b: Readonly): Vec3 { return this; } + div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Scales `this` by a scalar number. * Equivalent to `Vec3.scale(this, this, b);` + * @category Methods * * @param b - Amount to scale `this` by * @returns `this` */ - scale(b: number): Vec3 { + scale(b: number): this { this[0] *= b; this[1] *= b; this[2] *= b; @@ -237,12 +248,13 @@ export class Vec3 extends Float32Array { /** * Calculates `this` scaled by a scalar value then adds the result to `this`. * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);` + * @category Methods * * @param b - The vector to add to `this` * @param scale - The amount to scale `b` by before adding * @returns `this` */ - scaleAndAdd(b: Readonly, scale: number): Vec3 { + scaleAndAdd(b: Readonly, scale: number): this { this[0] += b[0] * scale; this[1] += b[1] * scale; this[2] += b[2] * scale; @@ -250,8 +262,9 @@ export class Vec3 extends Float32Array { } /** - * Calculates the euclidian distance between another {@link Vec3} and `this`. + * Calculates the Euclidean distance between another {@link Vec3} and `this`. * Equivalent to `Vec3.distance(this, b);` + * @category Methods * * @param b - The vector to calculate the distance to * @returns Distance between `this` and `b` @@ -261,12 +274,14 @@ export class Vec3 extends Float32Array { } /** * Alias for {@link Vec3.distance} + * @category Methods */ - dist(b: Readonly): number { return 0; } + dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars /** - * Calculates the squared euclidian distance between another {@link Vec3} and `this`. + * Calculates the squared Euclidean distance between another {@link Vec3} and `this`. * Equivalent to `Vec3.squaredDistance(this, b);` + * @category Methods * * @param b The vector to calculate the squared distance to * @returns Squared distance between `this` and `b` @@ -274,18 +289,21 @@ export class Vec3 extends Float32Array { squaredDistance(b: Readonly): number { return Vec3.squaredDistance(this, b); } + /** * Alias for {@link Vec3.squaredDistance} + * @category Methods */ - sqrDist(b: Readonly): number { return 0; } + sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Negates the components of `this`. * Equivalent to `Vec3.negate(this, this);` + * @category Methods * * @returns `this` */ - negate(): Vec3 { + negate(): this { this[0] *= -1; this[1] *= -1; this[2] *= -1; @@ -295,10 +313,11 @@ export class Vec3 extends Float32Array { /** * Inverts the components of `this`. * Equivalent to `Vec3.inverse(this, this);` + * @category Methods * * @returns `this` */ - invert(): Vec3 { + invert(): this { this[0] = 1.0 / this[0]; this[1] = 1.0 / this[1]; this[2] = 1.0 / this[2]; @@ -306,12 +325,13 @@ export class Vec3 extends Float32Array { } /** - * Sets each component of `this` to it's absolute value. + * Sets each component of `this` to its absolute value. * Equivalent to `Vec3.abs(this, this);` + * @category Methods * * @returns `this` */ - abs(): Vec3 { + abs(): this { this[0] = Math.abs(this[0]); this[1] = Math.abs(this[1]); this[2] = Math.abs(this[2]); @@ -321,6 +341,7 @@ export class Vec3 extends Float32Array { /** * Calculates the dot product of this and another {@link Vec3}. * Equivalent to `Vec3.dot(this, b);` + * @category Methods * * @param b - The second operand * @returns Dot product of `this` and `b` @@ -332,16 +353,30 @@ export class Vec3 extends Float32Array { /** * Normalize `this`. * Equivalent to `Vec3.normalize(this, this);` + * @category Methods * * @returns `this` */ - normalize(): Vec3 { - return Vec3.normalize(this, this) as Vec3; + normalize(): this { + return Vec3.normalize(this, this) as this; + } + + // =================== + // Static accessors + // =================== + + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec3}. + */ + static get BYTE_LENGTH(): number { + return 3 * Float32Array.BYTES_PER_ELEMENT; } - //================ + // =================== // Static methods - //================ + // =================== /** * Creates a new, empty vec3 @@ -372,16 +407,16 @@ export class Vec3 extends Float32Array { * @returns Magnitude of a */ static magnitude(a: Readonly): number { - let x = a[0]; - let y = a[1]; - let z = a[2]; + const x = a[0]; + const y = a[1]; + const z = a[2]; return Math.sqrt(x * x + y * y + z * z); } /** * Alias for {@link Vec3.magnitude} * @category Static */ - static mag(a: Readonly): number { return 0; } + static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Alias for {@link Vec3.magnitude} * @category Static @@ -390,14 +425,14 @@ export class Vec3 extends Float32Array { * @param a - vector to calculate length of * @returns length of a */ - // @ts-ignore: Length conflicts with Function.length - static length(a: Readonly): number { return 0; } + // Length conflicts with Function.length + static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Alias for {@link Vec3.magnitude} * @category Static * @deprecated Use {@link Vec3.mag} */ - static len(a: Readonly): number { return 0; } + static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Creates a new vec3 initialized with the given values @@ -480,6 +515,7 @@ export class Vec3 extends Float32Array { * Alias for {@link Vec3.subtract} * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static sub(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; }; /** @@ -502,6 +538,7 @@ export class Vec3 extends Float32Array { * Alias for {@link Vec3.multiply} * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static mul(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; } /** @@ -524,7 +561,8 @@ export class Vec3 extends Float32Array { * Alias for {@link Vec3.divide} * @category Static */ - static div(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; }; + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; }; /** * Math.ceil the components of a vec3 @@ -596,7 +634,8 @@ export class Vec3 extends Float32Array { * @param a - vector to round * @returns `out` */ - /*static round(out: Vec3Like, a: Readonly): Vec3Like { + /* + static round(out: Vec3Like, a: Readonly): Vec3Like { out[0] = glMatrix.round(a[0]); out[1] = glMatrix.round(a[1]); out[2] = glMatrix.round(a[2]); @@ -637,7 +676,7 @@ export class Vec3 extends Float32Array { } /** - * Calculates the euclidian distance between two vec3's + * Calculates the Euclidean distance between two vec3's * @category Static * * @param a - the first operand @@ -652,11 +691,13 @@ export class Vec3 extends Float32Array { } /** * Alias for {@link Vec3.distance} + * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static dist(a: Readonly, b: Readonly): number { return 0; } /** - * Calculates the squared euclidian distance between two vec3's + * Calculates the squared Euclidean distance between two vec3's * @category Static * * @param a - the first operand @@ -669,9 +710,12 @@ export class Vec3 extends Float32Array { const z = b[2] - a[2]; return x * x + y * y + z * z; } + /** * Alias for {@link Vec3.squaredDistance} + * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static sqrDist(a: Readonly, b: Readonly): number { return 0; } /** @@ -687,9 +731,12 @@ export class Vec3 extends Float32Array { const z = a[2]; return x * x + y * y + z * z; } + /** * Alias for {@link Vec3.squaredLength} + * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static sqrLen(a: Readonly, b: Readonly): number { return 0; } /** @@ -751,7 +798,7 @@ export class Vec3 extends Float32Array { const z = a[2]; let len = x * x + y * y + z * z; if (len > 0) { - //TODO: evaluate use of glm_invsqrt here? + // TODO: evaluate use of glm_invsqrt here? len = 1 / Math.sqrt(len); } out[0] = a[0] * len; @@ -850,7 +897,8 @@ export class Vec3 extends Float32Array { * @param t - interpolation amount, in the range [0-1], between the two inputs * @returns `out` */ - static hermite(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly, d: Readonly, t: number): Vec3Like { + static hermite(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly, + d: Readonly, t: number): Vec3Like { const factorTimes2 = t * t; const factor1 = factorTimes2 * (2 * t - 3) + 1; const factor2 = factorTimes2 * (t - 2) + t; @@ -876,7 +924,8 @@ export class Vec3 extends Float32Array { * @param t - interpolation amount, in the range [0-1], between the two inputs * @returns `out` */ - static bezier(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly, d: Readonly, t: number): Vec3Like { + static bezier(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly, + d: Readonly, t: number): Vec3Like { const inverseFactor = 1 - t; const inverseFactorTimesTwo = inverseFactor * inverseFactor; const factorTimes2 = t * t; @@ -900,7 +949,8 @@ export class Vec3 extends Float32Array { * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned * @returns `out` */ - /*static random(out: Vec3Like, scale) { + /* + static random(out: Vec3Like, scale) { scale = scale === undefined ? 1.0 : scale; let r = glMatrix.RANDOM() * 2.0 * Math.PI; @@ -944,7 +994,7 @@ export class Vec3 extends Float32Array { * @returns `out` */ static transformMat3(out: Vec3Like, a: Vec3Like, m: Mat3Like): Vec3Like { - let x = a[0], + const x = a[0], y = a[1], z = a[2]; out[0] = x * m[0] + y * m[3] + z * m[6]; @@ -984,14 +1034,16 @@ export class Vec3 extends Float32Array { const uuvz = (qx * uvy - qy * uvx) * 2; // vec3.scale(uv, uv, 2 * w); // return vec3.add(out, a, vec3.add(out, uv, uuv)); - out[0] = x + (uvx*w2) + uuvx; - out[1] = y + (uvy*w2) + uuvy; - out[2] = z + (uvz*w2) + uuvz; + out[0] = x + (uvx * w2) + uuvx; + out[1] = y + (uvy * w2) + uuvy; + out[2] = z + (uvz * w2) + uuvz; return out; } /** * Rotate a 3D vector around the x-axis + * @category Static + * * @param out - The receiving vec3 * @param a - The vec3 point to rotate * @param b - The origin of the rotation @@ -1002,12 +1054,12 @@ export class Vec3 extends Float32Array { const by = b[1]; const bz = b[2]; - //Translate point to the origin + // Translate point to the origin const py = a[1] - by; const pz = a[2] - bz; - //perform rotation - //translate to correct position + // perform rotation + // translate to correct position out[0] = a[0]; out[1] = (py * Math.cos(rad) - pz * Math.sin(rad)) + by; out[2] = (py * Math.sin(rad) + pz * Math.cos(rad)) + bz; @@ -1017,6 +1069,8 @@ export class Vec3 extends Float32Array { /** * Rotate a 3D vector around the y-axis + * @category Static + * * @param out - The receiving vec3 * @param a - The vec3 point to rotate * @param b - The origin of the rotation @@ -1027,12 +1081,12 @@ export class Vec3 extends Float32Array { const bx = b[0]; const bz = b[2]; - //Translate point to the origin + // Translate point to the origin const px = a[0] - bx; const pz = a[2] - bz; - //perform rotation - //translate to correct position + // perform rotation + // translate to correct position out[0] = (pz * Math.sin(rad) + px * Math.cos(rad)) + bx; out[1] = a[1]; out[2] = (pz * Math.cos(rad) - px * Math.sin(rad)) + bz; @@ -1042,6 +1096,8 @@ export class Vec3 extends Float32Array { /** * Rotate a 3D vector around the z-axis + * @category Static + * * @param out - The receiving vec3 * @param a - The vec3 point to rotate * @param b - The origin of the rotation @@ -1052,12 +1108,12 @@ export class Vec3 extends Float32Array { const bx = b[0]; const by = b[1]; - //Translate point to the origin + // Translate point to the origin const px = a[0] - bx; const py = a[1] - by; - //perform rotation - //translate to correct position + // perform rotation + // translate to correct position out[0] = (px * Math.cos(rad) - py * Math.sin(rad)) + bx; out[1] = (px * Math.sin(rad) + py * Math.cos(rad)) + by; out[2] = b[2]; @@ -1067,6 +1123,8 @@ export class Vec3 extends Float32Array { /** * Get the angle between two 3D vectors + * @category Static + * * @param a - The first operand * @param b - The second operand * @returns The angle in radians @@ -1109,7 +1167,7 @@ export class Vec3 extends Float32Array { } /** - * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) * @category Static * * @param a - The first vector. @@ -1121,7 +1179,7 @@ export class Vec3 extends Float32Array { } /** - * Returns whether or not the vectors have approximately the same elements in the same position. + * Returns whether the vectors have approximately the same elements in the same position. * @category Static * * @param a - The first vector. @@ -1136,19 +1194,19 @@ export class Vec3 extends Float32Array { const b1 = b[1]; const b2 = b[2]; return ( - Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && - Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && - Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) + Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && + Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && + Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) ); } } // Instance method alias assignments -Vec3.prototype.sub = Vec3.prototype.subtract; -Vec3.prototype.mul = Vec3.prototype.multiply; -Vec3.prototype.div = Vec3.prototype.divide; -Vec3.prototype.dist = Vec3.prototype.distance; -Vec3.prototype.sqrDist = Vec3.prototype.squaredDistance; +Vec3.prototype.sub = Vec3.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method +Vec3.prototype.mul = Vec3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method +Vec3.prototype.div = Vec3.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method +Vec3.prototype.dist = Vec3.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method +Vec3.prototype.sqrDist = Vec3.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method // Static method alias assignments Vec3.sub = Vec3.subtract; @@ -1160,8 +1218,3 @@ Vec3.sqrLen = Vec3.squaredLength; Vec3.mag = Vec3.magnitude; Vec3.length = Vec3.magnitude; Vec3.len = Vec3.magnitude; - -/** - * Vec3 alias for backwards compatibility - */ -export const vec3 = Vec3; \ No newline at end of file diff --git a/src/vec4.ts b/src/_lib/f32/Vec4.ts similarity index 83% rename from src/vec4.ts rename to src/_lib/f32/Vec4.ts index 753c3347..1c38b204 100644 --- a/src/vec4.ts +++ b/src/_lib/f32/Vec4.ts @@ -1,27 +1,18 @@ -import { EPSILON, FloatArray } from './common.js'; -import { Mat4Like } from './mat4.js'; -import { QuatLike } from './quat.js'; +import { GLM_EPSILON } from '#gl-matrix/common'; -/** - * A 4 dimensional vector given as a {@link Vec4}, a 4-element floating point - * TypedArray, or an array of 4 numbers. - */ -export type Vec4Like = [number, number, number, number] | FloatArray; +import type { Mat4Like, QuatLike, Vec4Like } from '#gl-matrix/types'; /** * 4 Dimensional Vector */ export class Vec4 extends Float32Array { - /** - * The number of bytes in a {@link Vec4}. - */ - static readonly BYTE_LENGTH = 4 * Float32Array.BYTES_PER_ELEMENT; - /** * Create a {@link Vec4}. + * + * @category Constructor */ constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { - switch(values.length) { + switch (values.length) { case 4: super(values); break; case 2: @@ -40,37 +31,37 @@ export class Vec4 extends Float32Array { } } - //============ - // Attributes - //============ + // ============ + // Accessors + // ============ // Getters and setters to make component access read better. // These are likely to be a little bit slower than direct array access. /** * The x component of the vector. Equivalent to `this[0];` - * @category Vector components + * @category Vector Components */ get x(): number { return this[0]; } set x(value: number) { this[0] = value; } /** * The y component of the vector. Equivalent to `this[1];` - * @category Vector components + * @category Vector Components */ get y(): number { return this[1]; } set y(value: number) { this[1] = value; } /** * The z component of the vector. Equivalent to `this[2];` - * @category Vector components + * @category Vector Components */ get z(): number { return this[2]; } set z(value: number) { this[2] = value; } /** * The w component of the vector. Equivalent to `this[3];` - * @category Vector components + * @category Vector Components */ get w(): number { return this[3]; } set w(value: number) { this[3] = value; } @@ -80,28 +71,28 @@ export class Vec4 extends Float32Array { /** * The r component of the vector. Equivalent to `this[0];` - * @category Color components + * @category Color Components */ get r(): number { return this[0]; } set r(value: number) { this[0] = value; } /** * The g component of the vector. Equivalent to `this[1];` - * @category Color components + * @category Color Components */ get g(): number { return this[1]; } set g(value: number) { this[1] = value; } /** * The b component of the vector. Equivalent to `this[2];` - * @category Color components + * @category Color Components */ get b(): number { return this[2]; } set b(value: number) { this[2] = value; } /** * The a component of the vector. Equivalent to `this[3];` - * @category Color components + * @category Color Components */ get a(): number { return this[3]; } set a(value: number) { this[3] = value; } @@ -112,6 +103,8 @@ export class Vec4 extends Float32Array { * * Magnitude is used because the `length` attribute is already defined by * TypedArrays to mean the number of elements in the array. + * + * @category Accessors */ get magnitude(): number { const x = this[0]; @@ -123,28 +116,33 @@ export class Vec4 extends Float32Array { /** * Alias for {@link Vec4.magnitude} + * + * @category Accessors */ get mag(): number { return this.magnitude; } /** * A string representation of `this` * Equivalent to `Vec4.str(this);` + * + * @category Accessors */ get str(): string { return Vec4.str(this); } - //=================== + // =================== // Instances methods - //=================== + // =================== /** * Copy the values from another {@link Vec4} into `this`. + * @category Methods * * @param a the source vector * @returns `this` */ - copy(a: Readonly): Vec4 { + copy(a: Readonly): this { super.set(a); return this; } @@ -152,11 +150,12 @@ export class Vec4 extends Float32Array { /** * Adds a {@link Vec4} to `this`. * Equivalent to `Vec4.add(this, this, b);` + * @category Methods * * @param b - The vector to add to `this` * @returns `this` */ - add(b: Readonly): Vec4 { + add(b: Readonly): this { this[0] += b[0]; this[1] += b[1]; this[2] += b[2]; @@ -167,11 +166,12 @@ export class Vec4 extends Float32Array { /** * Subtracts a {@link Vec4} from `this`. * Equivalent to `Vec4.subtract(this, this, b);` + * @category Methods * * @param b - The vector to subtract from `this` * @returns `this` */ - subtract(b: Readonly): Vec4 { + subtract(b: Readonly): this { this[0] -= b[0]; this[1] -= b[1]; this[2] -= b[2]; @@ -181,17 +181,19 @@ export class Vec4 extends Float32Array { /** * Alias for {@link Vec4.subtract} + * @category Methods */ - sub(b: Readonly): Vec4 { return this; } + sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Multiplies `this` by a {@link Vec4}. * Equivalent to `Vec4.multiply(this, this, b);` + * @category Methods * * @param b - The vector to multiply `this` by * @returns `this` */ - multiply(b: Readonly): Vec4 { + multiply(b: Readonly): this { this[0] *= b[0]; this[1] *= b[1]; this[2] *= b[2]; @@ -201,17 +203,19 @@ export class Vec4 extends Float32Array { /** * Alias for {@link Vec4.multiply} + * @category Methods */ - mul(b: Readonly): Vec4 { return this; } + mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Divides `this` by a {@link Vec4}. * Equivalent to `Vec4.divide(this, this, b);` + * @category Methods * * @param b - The vector to divide `this` by * @returns `this` */ - divide(b: Readonly): Vec4 { + divide(b: Readonly): this { this[0] /= b[0]; this[1] /= b[1]; this[2] /= b[2]; @@ -221,17 +225,19 @@ export class Vec4 extends Float32Array { /** * Alias for {@link Vec4.divide} + * @category Methods */ - div(b: Readonly): Vec4 { return this; } + div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Scales `this` by a scalar number. * Equivalent to `Vec4.scale(this, this, b);` + * @category Methods * * @param b - Amount to scale `this` by * @returns `this` */ - scale(b: number): Vec4 { + scale(b: number): this { this[0] *= b; this[1] *= b; this[2] *= b; @@ -242,12 +248,13 @@ export class Vec4 extends Float32Array { /** * Calculates `this` scaled by a scalar value then adds the result to `this`. * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);` + * @category Methods * * @param b - The vector to add to `this` * @param scale - The amount to scale `b` by before adding * @returns `this` */ - scaleAndAdd(b: Readonly, scale: number): Vec4 { + scaleAndAdd(b: Readonly, scale: number): this { this[0] += b[0] * scale; this[1] += b[1] * scale; this[2] += b[2] * scale; @@ -256,8 +263,9 @@ export class Vec4 extends Float32Array { } /** - * Calculates the euclidian distance between another {@link Vec4} and `this`. + * Calculates the Euclidean distance between another {@link Vec4} and `this`. * Equivalent to `Vec4.distance(this, b);` + * @category Methods * * @param b - The vector to calculate the distance to * @returns Distance between `this` and `b` @@ -265,14 +273,17 @@ export class Vec4 extends Float32Array { distance(b: Readonly): number { return Vec4.distance(this, b); } + /** * Alias for {@link Vec4.distance} + * @category Methods */ - dist(b: Readonly): number { return 0; } + dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars /** - * Calculates the squared euclidian distance between another {@link Vec4} and `this`. + * Calculates the squared Euclidean distance between another {@link Vec4} and `this`. * Equivalent to `Vec4.squaredDistance(this, b);` + * @category Methods * * @param b The vector to calculate the squared distance to * @returns Squared distance between `this` and `b` @@ -280,18 +291,21 @@ export class Vec4 extends Float32Array { squaredDistance(b: Readonly): number { return Vec4.squaredDistance(this, b); } + /** * Alias for {@link Vec4.squaredDistance} + * @category Methods */ - sqrDist(b: Readonly): number { return 0; } + sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Negates the components of `this`. * Equivalent to `Vec4.negate(this, this);` + * @category Methods * * @returns `this` */ - negate(): Vec4 { + negate(): this { this[0] *= -1; this[1] *= -1; this[2] *= -1; @@ -302,10 +316,11 @@ export class Vec4 extends Float32Array { /** * Inverts the components of `this`. * Equivalent to `Vec4.inverse(this, this);` + * @category Methods * * @returns `this` */ - invert(): Vec4 { + invert(): this { this[0] = 1.0 / this[0]; this[1] = 1.0 / this[1]; this[2] = 1.0 / this[2]; @@ -316,10 +331,11 @@ export class Vec4 extends Float32Array { /** * Sets each component of `this` to it's absolute value. * Equivalent to `Vec4.abs(this, this);` + * @category Methods * * @returns `this` */ - abs(): Vec4 { + abs(): this { this[0] = Math.abs(this[0]); this[1] = Math.abs(this[1]); this[2] = Math.abs(this[2]); @@ -330,6 +346,7 @@ export class Vec4 extends Float32Array { /** * Calculates the dot product of this and another {@link Vec4}. * Equivalent to `Vec4.dot(this, b);` + * @category Methods * * @param b - The second operand * @returns Dot product of `this` and `b` @@ -341,16 +358,30 @@ export class Vec4 extends Float32Array { /** * Normalize `this`. * Equivalent to `Vec4.normalize(this, this);` + * @category Methods * * @returns `this` */ - normalize(): Vec4 { - return Vec4.normalize(this, this) as Vec4; + normalize(): this { + return Vec4.normalize(this, this) as this; } - //=================== + // =================== + // Static accessors + // =================== + + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec4}. + */ + static get BYTE_LENGTH(): number { + return 4 * Float32Array.BYTES_PER_ELEMENT; + } + + // =================== // Static methods - //=================== + // =================== /** * Creates a new, empty {@link Vec4} @@ -460,6 +491,7 @@ export class Vec4 extends Float32Array { * Alias for {@link Vec4.subtract} * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static sub(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; } /** @@ -483,6 +515,7 @@ export class Vec4 extends Float32Array { * Alias for {@link Vec4.multiply} * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static mul(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; } /** @@ -506,6 +539,7 @@ export class Vec4 extends Float32Array { * Alias for {@link Vec4.divide} * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static div(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; } /** @@ -626,7 +660,7 @@ export class Vec4 extends Float32Array { } /** - * Calculates the euclidian distance between two {@link Vec4}'s + * Calculates the Euclidean distance between two {@link Vec4}'s * @category Static * * @param a - the first operand @@ -644,10 +678,11 @@ export class Vec4 extends Float32Array { * Alias for {@link Vec4.distance} * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static dist(a: Readonly, b: Readonly): number { return 0; } /** - * Calculates the squared euclidian distance between two {@link Vec4}'s + * Calculates the squared Euclidean distance between two {@link Vec4}'s * @category Static * * @param a - the first operand @@ -665,6 +700,7 @@ export class Vec4 extends Float32Array { * Alias for {@link Vec4.squaredDistance} * @category Static */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars static sqrDist(a: Readonly, b: Readonly): number { return 0; } /** @@ -685,22 +721,22 @@ export class Vec4 extends Float32Array { * Alias for {@link Vec4.magnitude} * @category Static */ - static mag(a: Readonly): number { return 0; } + static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Alias for {@link Vec4.magnitude} * @category Static * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs */ - // @ts-ignore: Length conflicts with Function.length - static length(a: Readonly): number { return 0; } + // Length conflicts with Function.length + static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Alias for {@link Vec4.magnitude} * @category Static * @deprecated Use {@link Vec4.mag} */ - static len(a: Readonly): number { return 0; } + static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Calculates the squared length of a {@link Vec4} @@ -721,7 +757,7 @@ export class Vec4 extends Float32Array { * Alias for {@link Vec4.squaredLength} * @category Static */ - static sqrLen(a: Readonly): number { return 0; } + static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars /** * Negates the components of a {@link Vec4} @@ -867,7 +903,8 @@ export class Vec4 extends Float32Array { * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned * @returns `out` */ - /*static random(out: Vec4Like, scale): Vec4Like { + /* + static random(out: Vec4Like, scale): Vec4Like { scale = scale || 1.0; // Marsaglia, George. Choosing a Point from the Surface of a @@ -974,7 +1011,7 @@ export class Vec4 extends Float32Array { } /** - * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) * @category Static * * @param a - The first vector. @@ -986,7 +1023,7 @@ export class Vec4 extends Float32Array { } /** - * Returns whether or not the vectors have approximately the same elements in the same position. + * Returns whether the vectors have approximately the same elements in the same position. * @category Static * * @param a - The first vector. @@ -1003,20 +1040,20 @@ export class Vec4 extends Float32Array { const b2 = b[2]; const b3 = b[3]; return ( - Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && - Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && - Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && - Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) + Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && + Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && + Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && + Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) ); } } // Instance method alias assignments -Vec4.prototype.sub = Vec4.prototype.subtract; -Vec4.prototype.mul = Vec4.prototype.multiply; -Vec4.prototype.div = Vec4.prototype.divide; -Vec4.prototype.dist = Vec4.prototype.distance; -Vec4.prototype.sqrDist = Vec4.prototype.squaredDistance; +Vec4.prototype.sub = Vec4.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method +Vec4.prototype.mul = Vec4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method +Vec4.prototype.div = Vec4.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method +Vec4.prototype.dist = Vec4.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method +Vec4.prototype.sqrDist = Vec4.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method // Static method alias assignments Vec4.sub = Vec4.subtract; @@ -1028,8 +1065,3 @@ Vec4.sqrLen = Vec4.squaredLength; Vec4.mag = Vec4.magnitude; Vec4.length = Vec4.magnitude; Vec4.len = Vec4.magnitude; - -/** - * Vec4 alias for backwards compatibility - */ -export const vec4 = Vec4; \ No newline at end of file diff --git a/src/_lib/f32/index.ts b/src/_lib/f32/index.ts new file mode 100644 index 00000000..d7e65584 --- /dev/null +++ b/src/_lib/f32/index.ts @@ -0,0 +1,9 @@ +export { Mat2 } from './Mat2.js'; +export { Mat2d } from './Mat2d.js'; +export { Mat3 } from './Mat3.js'; +export { Mat4 } from './Mat4.js'; +export { Quat } from './Quat.js'; +export { Quat2 } from './Quat2.js'; +export { Vec2 } from './Vec2.js'; +export { Vec3 } from './Vec3.js'; +export { Vec4 } from './Vec4.js'; diff --git a/src/_lib/f64/Mat2.ts b/src/_lib/f64/Mat2.ts new file mode 100644 index 00000000..854f8e0a --- /dev/null +++ b/src/_lib/f64/Mat2.ts @@ -0,0 +1,614 @@ +import { GLM_EPSILON } from '#gl-matrix/common'; + +import type { Mat2Like, Vec2Like } from '#gl-matrix/types'; + +/** + * A 2x2 Matrix + */ +export class Mat2 extends Float64Array { + static #IDENTITY_2X2 = new Float64Array([ + 1, 0, + 0, 1 + ]); + + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { + switch (values.length) { + case 4: + super(values); break; + case 2: + super(values[0] as ArrayBufferLike, values[1], 4); break; + case 1: + const v = values[0]; + if (typeof v === 'number') { + super([ + v, v, + v, v]); + } else { + super(v as ArrayBufferLike, 0, 4); + } + break; + default: + super(Mat2.#IDENTITY_2X2); break; + } + } + + // ============ + // Accessors + // ============ + + /** + * A string representation of `this` + * Equivalent to `Mat2.str(this);` + * + * @category Accessors + */ + get str(): string { + return Mat2.str(this); + } + + // =================== + // Instance methods + // =================== + + /** + * Copy the values from another {@link Mat2} into `this`. + * + * @param a the source vector + * @returns `this` + * @category Methods + */ + copy(a: Readonly): this { + this.set(a); + return this; + } + + /** + * Set `this` to the identity matrix + * Equivalent to Mat2.identity(this) + * + * @returns `this` + * @category Methods + */ + identity(): this { + this.set(Mat2.#IDENTITY_2X2); + return this; + } + + /** + * Multiplies this {@link Mat2} against another one + * Equivalent to `Mat2.multiply(this, this, b);` + * + * @param b - The second operand + * @returns `this` + * @category Methods + */ + multiply(b: Readonly): this { + return Mat2.multiply(this, this, b) as this; + } + + /** + * Alias for {@link Mat2.multiply} + * @category Methods + */ + mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Transpose this {@link Mat2} + * Equivalent to `Mat2.transpose(this, this);` + * + * @returns `this` + * @category Methods + */ + transpose(): this { + return Mat2.transpose(this, this) as this; + } + + /** + * Inverts this {@link Mat2} + * Equivalent to `Mat4.invert(this, this);` + * + * @returns `this` + * @category Methods + */ + invert(): this { + return Mat2.invert(this, this) as this; + } + + /** + * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2.scale(this, this, v);` + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + * @category Methods + */ + scale(v: Readonly): this { + return Mat2.scale(this, this, v) as this; + } + + /** + * Rotates this {@link Mat2} by the given angle around the given axis + * Equivalent to `Mat2.rotate(this, this, rad);` + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + * @category Methods + */ + rotate(rad: number): this { + return Mat2.rotate(this, this, rad) as this; + } + + // =================== + // Static accessors + // =================== + + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2}. + */ + static get BYTE_LENGTH(): number { + return 4 * Float64Array.BYTES_PER_ELEMENT; + } + + // =================== + // Static methods + // =================== + + /** + * Creates a new, identity {@link Mat2} + * @category Static + * + * @returns A new {@link Mat2} + */ + static create(): Mat2 { + return new Mat2(); + } + + /** + * Creates a new {@link Mat2} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2} + */ + static clone(a: Readonly): Mat2 { + return new Mat2(a); + } + + /** + * Copy the values from one {@link Mat2} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out: Mat2Like, a: Readonly): Mat2Like { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + + /** + * Create a new {@link Mat2} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2} + */ + static fromValues(...values: number[]): Mat2 { + return new Mat2(...values); + } + + /** + * Set the components of a {@link Mat2} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out: Mat2Like, ...values: number[]): Mat2Like { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + return out; + } + + /** + * Set a {@link Mat2} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out: Mat2Like): Mat2Like { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } + + /** + * Transpose the values of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out: Mat2Like, a: Readonly): Mat2Like { + // If we are transposing ourselves we can skip a few steps but have to cache + // some values + if (out === a) { + const a1 = a[1]; + out[1] = a[2]; + out[2] = a1; + } else { + out[0] = a[0]; + out[1] = a[2]; + out[2] = a[1]; + out[3] = a[3]; + } + + return out; + } + + /** + * Inverts a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out: Mat2Like, a: Mat2Like): Mat2Like | null { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + + // Calculate the determinant + let det = a0 * a3 - a2 * a1; + + if (!det) { + return null; + } + det = 1.0 / det; + + out[0] = a3 * det; + out[1] = -a1 * det; + out[2] = -a2 * det; + out[3] = a0 * det; + + return out; + } + + /** + * Calculates the adjugate of a {@link Mat2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out: Mat2Like, a: Mat2Like): Mat2Like { + // Caching this value is necessary if out == a + const a0 = a[0]; + out[0] = a[3]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a0; + return out; + } + + /** + * Calculates the determinant of a {@link Mat2} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a: Readonly): number { + return a[0] * a[3] - a[2] * a[1]; + } + + /** + * Adds two {@link Mat2}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + return out; + } + + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + return out; + } + + /** + * Alias for {@link Mat2.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; } + + /** + * Multiplies two {@link Mat2}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + out[0] = a0 * b0 + a2 * b1; + out[1] = a1 * b0 + a3 * b1; + out[2] = a0 * b2 + a2 * b3; + out[3] = a1 * b2 + a3 * b3; + return out; + } + /** + * Alias for {@link Mat2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out: Mat2Like, a: Readonly, b: Readonly): Mat2Like { return out; } + + /** + * Rotates a {@link Mat2} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out: Mat2Like, a: Readonly, rad: number): Mat2Like { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = a0 * c + a2 * s; + out[1] = a1 * c + a3 * s; + out[2] = a0 * -s + a2 * c; + out[3] = a1 * -s + a3 * c; + return out; + } + + /** + * Scales the {@link Mat2} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out: Mat2Like, a: Readonly, v: Readonly): Mat2Like { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0 * v0; + out[1] = a1 * v0; + out[2] = a2 * v1; + out[3] = a3 * v1; + return out; + } + + /** + * Creates a {@link Mat2} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out: Mat2Like, rad: number): Mat2Like { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = -s; + out[3] = c; + return out; + } + + /** + * Creates a {@link Mat2} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat2.identity(dest); + * mat2.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out: Mat2Like, v: Readonly): Mat2Like { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = v[1]; + return out; + } + + /** + * Returns Frobenius norm of a {@link Mat2} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a: Readonly): number { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]); + } + + /** + * Multiply each element of a {@link Mat2} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out: Mat2Like, a: Readonly, b: number): Mat2Like { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + return out; + } + + /** + * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out: Mat2Like, a: Readonly, b: Readonly, scale: number): Mat2Like { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + return out; + } + + /** + * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix + * @category Static + * + * @param L - the lower triangular matrix + * @param D - the diagonal matrix + * @param U - the upper triangular matrix + * @param a - the input matrix to factorize + */ + + static LDU(L: Mat2Like, D: Readonly, U: Mat2Like, a: Readonly): + [Mat2Like, Readonly, Mat2Like] { + L[2] = a[2] / a[0]; + U[0] = a[0]; + U[1] = a[1]; + U[3] = a[3] - L[2] * U[1]; + return [L, D, U]; + } + + /** + * Returns whether two {@link Mat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean { + return ( + a[0] === b[0] && + a[1] === b[1] && + a[2] === b[2] && + a[3] === b[3] + ); + } + + /** + * Returns whether two {@link Mat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + + return ( + Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && + Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && + Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && + Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) + ); + } + + /** + * Returns a string representation of a {@link Mat2} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a: Readonly): string { + return `Mat2(${a.join(', ')})`; + } +} + +// Instance method alias assignments +Mat2.prototype.mul = Mat2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method + +// Static method alias assignments +Mat2.mul = Mat2.multiply; +Mat2.sub = Mat2.subtract; diff --git a/src/_lib/f64/Mat2d.ts b/src/_lib/f64/Mat2d.ts new file mode 100644 index 00000000..22c60cfc --- /dev/null +++ b/src/_lib/f64/Mat2d.ts @@ -0,0 +1,638 @@ +import { GLM_EPSILON } from '#gl-matrix/common'; + +import type { Mat2dLike, Vec2Like } from '#gl-matrix/types'; + +/** + * A 2x3 Matrix + */ +export class Mat2d extends Float64Array { + static #IDENTITY_2X3 = new Float64Array([ + 1, 0, + 0, 1, + 0, 0, + ]); + + /** + * Create a {@link Mat2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { + switch (values.length) { + case 6: + super(values); break; + case 2: + super(values[0] as ArrayBufferLike, values[1], 6); break; + case 1: + const v = values[0]; + if (typeof v === 'number') { + super([ + v, v, + v, v, + v, v]); + } else { + super(v as ArrayBufferLike, 0, 6); + } + break; + default: + super(Mat2d.#IDENTITY_2X3); break; + } + } + + // ============ + // Accessors + // ============ + + /** + * A string representation of `this` + * Equivalent to `Mat2d.str(this);` + * + * @category Accessors + */ + get str(): string { + return Mat2d.str(this); + } + + // =================== + // Instances methods + // =================== + + /** + * Copy the values from another {@link Mat2d} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this { + this.set(a); + return this; + } + + /** + * Set `this` to the identity matrix + * Equivalent to Mat2d.identity(this) + * @category Methods + * + * @returns `this` + */ + identity(): this { + this.set(Mat2d.#IDENTITY_2X3); + return this; + } + + /** + * Multiplies this {@link Mat2d} against another one + * Equivalent to `Mat2d.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b: Readonly): this { + return Mat2d.multiply(this, this, b) as this; + } + + /** + * Alias for {@link Mat2d.multiply} + * @category Methods + */ + mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Translate this {@link Mat2d} by the given vector + * Equivalent to `Mat2d.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v: Readonly): this { + return Mat2d.translate(this, this, v) as this; + } + + /** + * Rotates this {@link Mat2d} by the given angle around the given axis + * Equivalent to `Mat2d.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad: number): this { + return Mat2d.rotate(this, this, rad) as this; + } + + /** + * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat2d.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v: Readonly): this { + return Mat2d.scale(this, this, v) as this; + } + + // =================== + // Static accessors + // =================== + + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat2d}. + */ + static get BYTE_LENGTH(): number { + return 6 * Float64Array.BYTES_PER_ELEMENT; + } + + // =================== + // Static methods + // =================== + + /** + * Creates a new, identity {@link Mat2d} + * @category Static + * + * @returns A new {@link Mat2d} + */ + static create(): Mat2d { + return new Mat2d(); + } + + /** + * Creates a new {@link Mat2d} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat2d} + */ + static clone(a: Readonly): Mat2d { + return new Mat2d(a); + } + + /** + * Copy the values from one {@link Mat2d} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out: Mat2dLike, a: Readonly): Mat2dLike { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + return out; + } + + /** + * Create a new {@link Mat2d} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat2d} + */ + static fromValues(...values: number[]): Mat2d { + return new Mat2d(...values); + } + + /** + * Set the components of a {@link Mat2d} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out: Mat2dLike, ...values: number[]): Mat2dLike { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + return out; + } + + /** + * Set a {@link Mat2d} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out: Mat2dLike): Mat2dLike { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = 0; + out[5] = 0; + return out; + } + + /** + * Inverts a {@link Mat2d} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out: Mat2dLike, a: Mat2dLike): Mat2dLike | null { + const aa = a[0]; + const ab = a[1]; + const ac = a[2]; + const ad = a[3]; + const atx = a[4]; + const aty = a[5]; + + let det = aa * ad - ab * ac; + if (!det) { + return null; + } + det = 1.0 / det; + + out[0] = ad * det; + out[1] = -ab * det; + out[2] = -ac * det; + out[3] = aa * det; + out[4] = (ac * aty - ad * atx) * det; + out[5] = (ab * atx - aa * aty) * det; + return out; + } + + /** + * Calculates the determinant of a {@link Mat2d} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a: Readonly): number { + return a[0] * a[3] - a[1] * a[2]; + } + + /** + * Adds two {@link Mat2d}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + return out; + } + + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + return out; + } + + /** + * Alias for {@link Mat2d.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; } + + /** + * Multiplies two {@link Mat2d}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + out[0] = a0 * b0 + a2 * b1; + out[1] = a1 * b0 + a3 * b1; + out[2] = a0 * b2 + a2 * b3; + out[3] = a1 * b2 + a3 * b3; + out[4] = a0 * b4 + a2 * b5 + a4; + out[5] = a1 * b4 + a3 * b5 + a5; + return out; + } + + /** + * Alias for {@link Mat2d.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out: Mat2dLike, a: Readonly, b: Readonly): Mat2dLike { return out; } + + /** + * Translate a {@link Mat2d} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0; + out[1] = a1; + out[2] = a2; + out[3] = a3; + out[4] = a0 * v0 + a2 * v1 + a4; + out[5] = a1 * v0 + a3 * v1 + a5; + return out; + } + + /** + * Rotates a {@link Mat2d} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out: Mat2dLike, a: Readonly, rad: number): Mat2dLike { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = a0 * c + a2 * s; + out[1] = a1 * c + a3 * s; + out[2] = a0 * -s + a2 * c; + out[3] = a1 * -s + a3 * c; + out[4] = a4; + out[5] = a5; + return out; + } + + /** + * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out: Mat2dLike, a: Readonly, v: Readonly): Mat2dLike { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const v0 = v[0]; + const v1 = v[1]; + out[0] = a0 * v0; + out[1] = a1 * v0; + out[2] = a2 * v1; + out[3] = a3 * v1; + out[4] = a4; + out[5] = a5; + return out; + } + + // TODO: Got to fromRotation + + /** + * Creates a {@link Mat2d} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out: Mat2dLike, v: Readonly): Mat2dLike { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = v[0]; + out[5] = v[1]; + return out; + } + + /** + * Creates a {@link Mat2d} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.rotate(dest, dest, rad); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out: Mat2dLike, rad: number): Mat2dLike { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = -s; + out[3] = c; + out[4] = 0; + out[5] = 0; + return out; + } + + /** + * Creates a {@link Mat2d} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * Mat2d.identity(dest); + * Mat2d.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat2d} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out: Mat2dLike, v: Readonly): Mat2dLike { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = v[1]; + out[4] = 0; + out[5] = 0; + return out; + } + + /** + * Returns Frobenius norm of a {@link Mat2d} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a: Readonly): number { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1); + } + + /** + * Multiply each element of a {@link Mat2d} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out: Mat2dLike, a: Readonly, b: number): Mat2dLike { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + return out; + } + + /** + * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out: Mat2dLike, a: Readonly, b: Readonly, scale: number): + Mat2dLike { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + return out; + } + + /** + * Returns whether two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean { + return ( + a[0] === b[0] && + a[1] === b[1] && + a[2] === b[2] && + a[3] === b[3] && + a[4] === b[4] && + a[5] === b[5] + ); + } + + /** + * Returns whether two {@link Mat2d}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + + return ( + Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && + Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && + Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && + Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && + Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && + Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) + ); + } + + /** + * Returns a string representation of a {@link Mat2d} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a: Readonly): string { + return `Mat2d(${a.join(', ')})`; + } +} + +// Static method alias assignments +Mat2d.mul = Mat2d.multiply; +Mat2d.sub = Mat2d.subtract; diff --git a/src/_lib/f64/Mat3.ts b/src/_lib/f64/Mat3.ts new file mode 100644 index 00000000..41ba759e --- /dev/null +++ b/src/_lib/f64/Mat3.ts @@ -0,0 +1,1050 @@ +import { GLM_EPSILON } from '#gl-matrix/common'; + +import type { Mat2dLike, Mat3Like, Mat4Like, Vec2Like, QuatLike } from '#gl-matrix/types'; + +/** + * A 3x3 Matrix + */ +export class Mat3 extends Float64Array { + static #IDENTITY_3X3 = new Float64Array([ + 1, 0, 0, + 0, 1, 0, + 0, 0, 1, + ]); + + /** + * Create a {@link Mat3}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { + switch (values.length) { + case 9: + super(values); break; + case 2: + super(values[0] as ArrayBufferLike, values[1], 9); break; + case 1: + const v = values[0]; + if (typeof v === 'number') { + super([ + v, v, v, + v, v, v, + v, v, v]); + } else { + super(v as ArrayBufferLike, 0, 9); + } + break; + default: + super(Mat3.#IDENTITY_3X3); break; + } + } + + // ============ + // Accessors + // ============ + + /** + * A string representation of `this` + * Equivalent to `Mat3.str(this);` + * + * @category Accessors + */ + get str(): string { + return Mat3.str(this); + } + + // =================== + // Instance methods + // =================== + + /** + * Copy the values from another {@link Mat3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this { + this.set(a); + return this; + } + + /** + * Set `this` to the identity matrix + * Equivalent to Mat3.identity(this) + * @category Methods + * + * @returns `this` + */ + identity(): this { + this.set(Mat3.#IDENTITY_3X3); + return this; + } + + /** + * Multiplies this {@link Mat3} against another one + * Equivalent to `Mat3.multiply(this, this, b);` + * @category Methods + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b: Readonly): this { + return Mat3.multiply(this, this, b) as this; + } + + /** + * Alias for {@link Mat3.multiply} + * @category Methods + */ + mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Transpose this {@link Mat3} + * Equivalent to `Mat3.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose(): this { + return Mat3.transpose(this, this) as this; + } + + /** + * Inverts this {@link Mat3} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this { + return Mat3.invert(this, this) as this; + } + + /** + * Translate this {@link Mat3} by the given vector + * Equivalent to `Mat3.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to translate by + * @returns `this` + */ + translate(v: Readonly): this { + return Mat3.translate(this, this, v) as this; + } + + /** + * Rotates this {@link Mat3} by the given angle around the given axis + * Equivalent to `Mat3.rotate(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotate(rad: number): this { + return Mat3.rotate(this, this, rad) as this; + } + + /** + * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat3.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec2} to scale the matrix by + * @returns `this` + */ + scale(v: Readonly): this { + return Mat3.scale(this, this, v) as this; + } + + // =================== + // Static accessors + // =================== + + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat3}. + */ + static get BYTE_LENGTH(): number { + return 9 * Float64Array.BYTES_PER_ELEMENT; + } + + // =================== + // Static methods + // =================== + + /** + * Creates a new, identity {@link Mat3} + * @category Static + * + * @returns A new {@link Mat3} + */ + static create(): Mat3 { + return new Mat3(); + } + + /** + * Creates a new {@link Mat3} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat3} + */ + static clone(a: Readonly): Mat3 { + return new Mat3(a); + } + + /** + * Copy the values from one {@link Mat3} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out: Mat3Like, a: Readonly): Mat3Like { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + return out; + } + + /** + * Create a new {@link Mat3} with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat3} + */ + static fromValues(...values: number[]): Mat3 { + return new Mat3(...values); + } + + /** + * Set the components of a {@link Mat3} to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out: Mat3Like, ...values: number[]): Mat3Like { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + out[6] = values[6]; + out[7] = values[7]; + out[8] = values[8]; + return out; + } + + /** + * Set a {@link Mat3} to the identity matrix + * @category Static + * + * @param out - The receiving matrix + * @returns `out` + */ + static identity(out: Mat3Like): Mat3Like { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + + /** + * Transpose the values of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out: Mat3Like, a: Readonly): Mat3Like { + // If we are transposing ourselves we can skip a few steps but have to cache some values + if (out === a) { + const a01 = a[1], + a02 = a[2], + a12 = a[5]; + out[1] = a[3]; + out[2] = a[6]; + out[3] = a01; + out[5] = a[7]; + out[6] = a02; + out[7] = a12; + } else { + out[0] = a[0]; + out[1] = a[3]; + out[2] = a[6]; + out[3] = a[1]; + out[4] = a[4]; + out[5] = a[7]; + out[6] = a[2]; + out[7] = a[5]; + out[8] = a[8]; + } + + return out; + } + + /** + * Inverts a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out: Mat3Like, a: Mat3Like): Mat3Like | null { + const a00 = a[0], + a01 = a[1], + a02 = a[2]; + const a10 = a[3], + a11 = a[4], + a12 = a[5]; + const a20 = a[6], + a21 = a[7], + a22 = a[8]; + + const b01 = a22 * a11 - a12 * a21; + const b11 = -a22 * a10 + a12 * a20; + const b21 = a21 * a10 - a11 * a20; + + // Calculate the determinant + let det = a00 * b01 + a01 * b11 + a02 * b21; + + if (!det) { + return null; + } + det = 1.0 / det; + + out[0] = b01 * det; + out[1] = (-a22 * a01 + a02 * a21) * det; + out[2] = (a12 * a01 - a02 * a11) * det; + out[3] = b11 * det; + out[4] = (a22 * a00 - a02 * a20) * det; + out[5] = (-a12 * a00 + a02 * a10) * det; + out[6] = b21 * det; + out[7] = (-a21 * a00 + a01 * a20) * det; + out[8] = (a11 * a00 - a01 * a10) * det; + return out; + } + + /** + * Calculates the adjugate of a {@link Mat3} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out: Mat3Like, a: Mat3Like): Mat3Like { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + + out[0] = a11 * a22 - a12 * a21; + out[1] = a02 * a21 - a01 * a22; + out[2] = a01 * a12 - a02 * a11; + out[3] = a12 * a20 - a10 * a22; + out[4] = a00 * a22 - a02 * a20; + out[5] = a02 * a10 - a00 * a12; + out[6] = a10 * a21 - a11 * a20; + out[7] = a01 * a20 - a00 * a21; + out[8] = a00 * a11 - a01 * a10; + return out; + } + + /** + * Calculates the determinant of a {@link Mat3} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a: Readonly): number { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + + return ( + a00 * (a22 * a11 - a12 * a21) + + a01 * (-a22 * a10 + a12 * a20) + + a02 * (a21 * a10 - a11 * a20) + ); + } + + /** + * Adds two {@link Mat3}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + out[8] = a[8] + b[8]; + return out; + } + + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + out[6] = a[6] - b[6]; + out[7] = a[7] - b[7]; + out[8] = a[8] - b[8]; + return out; + } + + /** + * Alias for {@link Mat3.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; } + + /** + * Multiplies two {@link Mat3}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + + let b0 = b[0]; + let b1 = b[1]; + let b2 = b[2]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20; + out[1] = b0 * a01 + b1 * a11 + b2 * a21; + out[2] = b0 * a02 + b1 * a12 + b2 * a22; + + b0 = b[3]; + b1 = b[4]; + b2 = b[5]; + out[3] = b0 * a00 + b1 * a10 + b2 * a20; + out[4] = b0 * a01 + b1 * a11 + b2 * a21; + out[5] = b0 * a02 + b1 * a12 + b2 * a22; + + b0 = b[6]; + b1 = b[7]; + b2 = b[8]; + out[6] = b0 * a00 + b1 * a10 + b2 * a20; + out[7] = b0 * a01 + b1 * a11 + b2 * a21; + out[8] = b0 * a02 + b1 * a12 + b2 * a22; + return out; + } + + /** + * Alias for {@link Mat3.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out: Mat3Like, a: Readonly, b: Readonly): Mat3Like { return out; } + + /** + * Translate a {@link Mat3} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + const x = v[0]; + const y = v[1]; + + out[0] = a00; + out[1] = a01; + out[2] = a02; + + out[3] = a10; + out[4] = a11; + out[5] = a12; + + out[6] = x * a00 + y * a10 + a20; + out[7] = x * a01 + y * a11 + a21; + out[8] = x * a02 + y * a12 + a22; + return out; + } + + /** + * Rotates a {@link Mat3} by the given angle + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotate(out: Mat3Like, a: Readonly, rad: number): Mat3Like { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[3]; + const a11 = a[4]; + const a12 = a[5]; + const a20 = a[6]; + const a21 = a[7]; + const a22 = a[8]; + const s = Math.sin(rad); + const c = Math.cos(rad); + + out[0] = c * a00 + s * a10; + out[1] = c * a01 + s * a11; + out[2] = c * a02 + s * a12; + + out[3] = c * a10 - s * a00; + out[4] = c * a11 - s * a01; + out[5] = c * a12 - s * a02; + + out[6] = a20; + out[7] = a21; + out[8] = a22; + return out; + } + + /** + * Scales the {@link Mat3} by the dimensions in the given {@link Vec2} + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec2} to scale the matrix by + * @returns `out` + **/ + static scale(out: Mat3Like, a: Readonly, v: Readonly): Mat3Like { + const x = v[0]; + const y = v[1]; + + out[0] = x * a[0]; + out[1] = x * a[1]; + out[2] = x * a[2]; + + out[3] = y * a[3]; + out[4] = y * a[4]; + out[5] = y * a[5]; + + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + return out; + } + + /** + * Creates a {@link Mat3} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out: Mat3Like, v: Readonly): Mat3Like { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = v[0]; + out[7] = v[1]; + out[8] = 1; + return out; + } + + /** + * Creates a {@link Mat3} from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat3.identity(dest); + * mat3.rotate(dest, dest, rad); + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromRotation(out: Mat3Like, rad: number): Mat3Like { + const s = Math.sin(rad); + const c = Math.cos(rad); + + out[0] = c; + out[1] = s; + out[2] = 0; + + out[3] = -s; + out[4] = c; + out[5] = 0; + + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + + /** + * Creates a {@link Mat3} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat3.identity(dest); + * mat3.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out: Mat3Like, v: Readonly): Mat3Like { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + + out[3] = 0; + out[4] = v[1]; + out[5] = 0; + + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + + /** + * Copies the upper-left 3x3 values of a {@link Mat2d} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 2x3 matrix + * @returns `out` + */ + static fromMat2d(out: Mat3Like, a: Readonly): Mat3Like { + out[0] = a[0]; + out[1] = a[1]; + out[2] = 0; + + out[3] = a[2]; + out[4] = a[3]; + out[5] = 0; + + out[6] = a[4]; + out[7] = a[5]; + out[8] = 1; + return out; + } + + /** + * Calculates a {@link Mat3} from the given quaternion + * @category Static + * + * @param out - {@link Mat3} receiving operation result + * @param q - {@link Quat} to create matrix from + * @returns `out` + */ + static fromQuat(out: Mat3Like, q: Readonly): Mat3Like { + 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; + + out[0] = 1 - yy - zz; + out[3] = yx - wz; + out[6] = zx + wy; + + out[1] = yx + wz; + out[4] = 1 - xx - zz; + out[7] = zy - wx; + + out[2] = zx - wy; + out[5] = zy + wx; + out[8] = 1 - xx - yy; + + return out; + } + + /** + * Copies the upper-left 3x3 values of a {@link Mat4} into the given + * {@link Mat3}. + * @category Static + * + * @param out - the receiving 3x3 matrix + * @param a - the source 4x4 matrix + * @returns `out` + */ + static fromMat4(out: Mat3Like, a: Readonly): Mat3Like { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[4]; + out[4] = a[5]; + out[5] = a[6]; + out[6] = a[8]; + out[7] = a[9]; + out[8] = a[10]; + return out; + } + + /** + * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix + * @category Static + * + * @param {mat3} out mat3 receiving operation result + * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out: Mat3Like, a: Readonly): Mat3Like | null { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + + // Calculate the determinant + let det = + b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + + if (!det) { + return null; + } + det = 1.0 / det; + + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + + out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + + out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + + return out; + } + + /** + * Calculates a {@link Mat3} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out: Mat3Like, a: Readonly): Mat3Like { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + + const bx = a[4]; + const by = a[5]; + const bz = a[6]; + + const cx = a[8]; + const cy = a[9]; + const cz = a[10]; + + out[0] = by * cz - cz * cy; + out[1] = bz * cx - cx * cz; + out[2] = bx * cy - cy * cx; + + out[3] = cy * az - cz * ay; + out[4] = cz * ax - cx * az; + out[5] = cx * ay - cy * ax; + + out[6] = ay * bz - az * by; + out[7] = az * bx - ax * bz; + out[8] = ax * by - ay * bx; + + return out; + } + + /** + * Generates a 2D projection matrix with the given bounds + * @category Static + * + * @param out mat3 frustum matrix will be written into + * @param width Width of your gl context + * @param height Height of gl context + * @returns `out` + */ + static projection(out: Mat3Like, width: number, height: number): Mat3Like { + out[0] = 2 / width; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = -2 / height; + out[5] = 0; + out[6] = -1; + out[7] = 1; + out[8] = 1; + return out; + } + + /** + * Returns Frobenius norm of a {@link Mat3} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a: Readonly): number { + return Math.sqrt( + a[0] * a[0] + + a[1] * a[1] + + a[2] * a[2] + + a[3] * a[3] + + a[4] * a[4] + + a[5] * a[5] + + a[6] * a[6] + + a[7] * a[7] + + a[8] * a[8] + ); + } + + /** + * Multiply each element of a {@link Mat3} by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out: Mat3Like, a: Readonly, b: number): Mat3Like { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + out[8] = a[8] * b; + return out; + } + + /** + * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out: Mat3Like, a: Readonly, b: Readonly, scale: number): Mat3Like { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + out[6] = a[6] + b[6] * scale; + out[7] = a[7] + b[7] * scale; + out[8] = a[8] + b[8] * scale; + return out; + } + + /** + * Returns whether two {@link Mat3}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean { + return ( + a[0] === b[0] && + a[1] === b[1] && + a[2] === b[2] && + a[3] === b[3] && + a[4] === b[4] && + a[5] === b[5] && + a[6] === b[6] && + a[7] === b[7] && + a[8] === b[8] + ); + } + + /** + * Returns whether two {@link Mat3}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const a8 = a[8]; + + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + const b8 = b[8]; + + return ( + Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && + Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && + Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && + Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && + Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && + Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && + Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && + Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && + Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) + ); + } + + /** + * Returns a string representation of a {@link Mat3} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a: Readonly): string { + return `Mat3(${a.join(', ')})`; + } +} + +// Instance method alias assignments +Mat3.prototype.mul = Mat3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method + +// Static method alias assignments +Mat3.mul = Mat3.multiply; +Mat3.sub = Mat3.subtract; diff --git a/src/_lib/f64/Mat4.ts b/src/_lib/f64/Mat4.ts new file mode 100644 index 00000000..917f2c42 --- /dev/null +++ b/src/_lib/f64/Mat4.ts @@ -0,0 +1,2559 @@ +import { GLM_EPSILON } from '#gl-matrix/common'; + +import type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types'; + +/** + * A 4x4 Matrix + */ +export class Mat4 extends Float64Array { + static #IDENTITY_4X4 = new Float64Array([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, + ]); + + /** + * Temporary variable to prevent repeated allocations in the algorithms within Mat4. + * These are declared as TypedArrays to aid in tree-shaking. + */ + static #TMP_VEC3 = new Float64Array(3); + + /** + * Create a {@link Mat4}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { + switch (values.length) { + case 16: + super(values); break; + case 2: + super(values[0] as ArrayBufferLike, values[1], 16); break; + case 1: + const v = values[0]; + if (typeof v === 'number') { + super([ + v, v, v, v, + v, v, v, v, + v, v, v, v, + v, v, v, v]); + } else { + super(v as ArrayBufferLike, 0, 16); + } + break; + default: + super(Mat4.#IDENTITY_4X4); break; + } + } + + // ============ + // Accessors + // ============ + + /** + * A string representation of `this` + * Equivalent to `Mat4.str(this);` + * + * @category Accessors + */ + get str(): string { + return Mat4.str(this); + } + + // =================== + // Instance methods + // =================== + + /** + * Copy the values from another {@link Mat4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this { + this.set(a); + return this; + } + + /** + * Set `this` to the identity matrix + * Equivalent to Mat4.identity(this) + * @category Methods + * + * @returns `this` + */ + identity(): this { + this.set(Mat4.#IDENTITY_4X4); + return this; + } + + /** + * Multiplies this {@link Mat4} against another one + * Equivalent to `Mat4.multiply(this, this, b);` + * @category Methods + * + * @param b - The second operand + * @returns `this` + */ + multiply(b: Readonly): this { + return Mat4.multiply(this, this, b) as this; + } + + /** + * Alias for {@link Mat4.multiply} + * @category Methods + */ + mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Transpose this {@link Mat4} + * Equivalent to `Mat4.transpose(this, this);` + * @category Methods + * + * @returns `this` + */ + transpose(): this { + return Mat4.transpose(this, this) as this; + } + + /** + * Inverts this {@link Mat4} + * Equivalent to `Mat4.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this { + return Mat4.invert(this, this) as this; + } + + /** + * Translate this {@link Mat4} by the given vector + * Equivalent to `Mat4.translate(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to translate by + * @returns `this` + */ + translate(v: Readonly): this { + return Mat4.translate(this, this, v) as this; + } + + /** + * Rotates this {@link Mat4} by the given angle around the given axis + * Equivalent to `Mat4.rotate(this, this, rad, axis);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `this` + */ + rotate(rad: number, axis: Readonly): this { + return Mat4.rotate(this, this, rad, axis) as this; + } + + /** + * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat4.scale(this, this, v);` + * @category Methods + * + * @param v - The {@link Vec3} to scale the matrix by + * @returns `this` + */ + scale(v: Readonly): this { + return Mat4.scale(this, this, v) as this; + } + + /** + * Rotates this {@link Mat4} by the given angle around the X axis + * Equivalent to `Mat4.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateX(rad: number): this { + return Mat4.rotateX(this, this, rad) as this; + } + + /** + * Rotates this {@link Mat4} by the given angle around the Y axis + * Equivalent to `Mat4.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateY(rad: number): this { + return Mat4.rotateY(this, this, rad) as this; + } + + /** + * Rotates this {@link Mat4} by the given angle around the Z axis + * Equivalent to `Mat4.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateZ(rad: number): this { + return Mat4.rotateZ(this, this, rad) as this; + } + + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveNO(fovy: number, aspect: number, near: number, far: number): this { + return Mat4.perspectiveNO(this, fovy, aspect, near, far) as this; + } + + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);` + * @category Methods + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveZO(fovy: number, aspect: number, near: number, far: number): this { + return Mat4.perspectiveZO(this, fovy, aspect, near, far) as this; + } + + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoNO(left: number, right: number, bottom: number, top: number, near: number, far: number): this { + return Mat4.orthoNO(this, left, right, bottom, top, near, far) as this; + } + + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);` + * @category Methods + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoZO(left: number, right: number, bottom: number, top: number, near: number, far: number): this { + return Mat4.orthoZO(this, left, right, bottom, top, near, far) as this; + } + + // =================== + // Static accessors + // =================== + + /** + * @category Static + * + * @returns The number of bytes in a {@link Mat4}. + */ + static get BYTE_LENGTH(): number { + return 16 * Float64Array.BYTES_PER_ELEMENT; + } + + // =================== + // Static methods + // =================== + + /** + * Creates a new, identity {@link Mat4} + * @category Static + * + * @returns A new {@link Mat4} + */ + static create(): Mat4 { + return new Mat4(); + } + + /** + * Creates a new {@link Mat4} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat4} + */ + static clone(a: Readonly): Mat4 { + return new Mat4(a); + } + + /** + * Copy the values from one {@link Mat4} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out: Mat4Like, a: Readonly): Mat4Like { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + + /** + * Create a new mat4 with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat4} + */ + static fromValues(...values: number[]): Mat4 { + return new Mat4(...values); + } + + /** + * Set the components of a mat4 to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out: Mat4Like, ...values: number[]): Mat4Like { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + out[6] = values[6]; + out[7] = values[7]; + out[8] = values[8]; + out[9] = values[9]; + out[10] = values[10]; + out[11] = values[11]; + out[12] = values[12]; + out[13] = values[13]; + out[14] = values[14]; + out[15] = values[15]; + return out; + } + + /** + * Set a {@link Mat4} to the identity matrix + * @category Static + * + * @param out - The receiving Matrix + * @returns `out` + */ + static identity(out: Mat4Like): Mat4Like { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + + /** + * Transpose the values of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out: Mat4Like, a: Readonly): Mat4Like { + // If we are transposing ourselves we can skip a few steps but have to cache some values + if (out === a) { + const a01 = a[1], + a02 = a[2], + a03 = a[3]; + const a12 = a[6], + a13 = a[7]; + const a23 = a[11]; + + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a01; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a02; + out[9] = a12; + out[11] = a[14]; + out[12] = a03; + out[13] = a13; + out[14] = a23; + } else { + out[0] = a[0]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a[1]; + out[5] = a[5]; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a[2]; + out[9] = a[6]; + out[10] = a[10]; + out[11] = a[14]; + out[12] = a[3]; + out[13] = a[7]; + out[14] = a[11]; + out[15] = a[15]; + } + + return out; + } + + /** + * Inverts a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` or `null` if the matrix is not invertible + */ + static invert(out: Mat4Like, a: Mat4Like): Mat4Like | null { + const a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3]; + const a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7]; + const a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + const a30 = a[12], + a31 = a[13], + a32 = a[14], + a33 = a[15]; + + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + + // Calculate the determinant + let det = + b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + + if (!det) { + return null; + } + det = 1.0 / det; + + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + + return out; + } + + /** + * Calculates the adjugate of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out: Mat4Like, a: Mat4Like): Mat4Like { + const a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3]; + const a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7]; + const a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + const a30 = a[12], + a31 = a[13], + a32 = a[14], + a33 = a[15]; + + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + + out[0] = a11 * b11 - a12 * b10 + a13 * b09; + out[1] = a02 * b10 - a01 * b11 - a03 * b09; + out[2] = a31 * b05 - a32 * b04 + a33 * b03; + out[3] = a22 * b04 - a21 * b05 - a23 * b03; + out[4] = a12 * b08 - a10 * b11 - a13 * b07; + out[5] = a00 * b11 - a02 * b08 + a03 * b07; + out[6] = a32 * b02 - a30 * b05 - a33 * b01; + out[7] = a20 * b05 - a22 * b02 + a23 * b01; + out[8] = a10 * b10 - a11 * b08 + a13 * b06; + out[9] = a01 * b08 - a00 * b10 - a03 * b06; + out[10] = a30 * b04 - a31 * b02 + a33 * b00; + out[11] = a21 * b02 - a20 * b04 - a23 * b00; + out[12] = a11 * b07 - a10 * b09 - a12 * b06; + out[13] = a00 * b09 - a01 * b07 + a02 * b06; + out[14] = a31 * b01 - a30 * b03 - a32 * b00; + out[15] = a20 * b03 - a21 * b01 + a22 * b00; + return out; + } + + /** + * Calculates the determinant of a {@link Mat4} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a: Readonly): number { + const a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3]; + const a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7]; + const a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + const a30 = a[12], + a31 = a[13], + a32 = a[14], + a33 = a[15]; + + const b0 = a00 * a11 - a01 * a10; + const b1 = a00 * a12 - a02 * a10; + const b2 = a01 * a12 - a02 * a11; + const b3 = a20 * a31 - a21 * a30; + const b4 = a20 * a32 - a22 * a30; + const b5 = a21 * a32 - a22 * a31; + const b6 = a00 * b5 - a01 * b4 + a02 * b3; + const b7 = a10 * b5 - a11 * b4 + a12 * b3; + const b8 = a20 * b2 - a21 * b1 + a22 * b0; + const b9 = a30 * b2 - a31 * b1 + a32 * b0; + + // Calculate the determinant + return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9; + } + + /** + * Multiplies two {@link Mat4}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + + // Cache only the current line of the second matrix + let b0 = b[0]; + let b1 = b[1]; + let b2 = b[2]; + let b3 = b[3]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + + b0 = b[4]; + b1 = b[5]; + b2 = b[6]; + b3 = b[7]; + out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + + b0 = b[8]; + b1 = b[9]; + b2 = b[10]; + b3 = b[11]; + out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + + b0 = b[12]; + b1 = b[13]; + b2 = b[14]; + b3 = b[15]; + out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + return out; + } + + /** + * Alias for {@link Mat4.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; } + + /** + * Translate a {@link Mat4} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like { + const x = v[0]; + const y = v[1]; + const z = v[2]; + + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a03; + out[4] = a10; + out[5] = a11; + out[6] = a12; + out[7] = a13; + out[8] = a20; + out[9] = a21; + out[10] = a22; + out[11] = a23; + + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + + return out; + } + + /** + * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec3} to scale the matrix by + * @returns `out` + **/ + static scale(out: Mat4Like, a: Readonly, v: Readonly): Mat4Like { + const x = v[0]; + const y = v[1]; + const z = v[2]; + + out[0] = a[0] * x; + out[1] = a[1] * x; + out[2] = a[2] * x; + out[3] = a[3] * x; + out[4] = a[4] * y; + out[5] = a[5] * y; + out[6] = a[6] * y; + out[7] = a[7] * y; + out[8] = a[8] * z; + out[9] = a[9] * z; + out[10] = a[10] * z; + out[11] = a[11] * z; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + + /** + * Rotates a {@link Mat4} by the given angle around the given axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if axis has a length of 0 + */ + static rotate(out: Mat4Like, a: Readonly, rad: number, axis: Readonly): Mat4Like | null { + let x = axis[0]; + let y = axis[1]; + let z = axis[2]; + let len = Math.sqrt(x * x + y * y + z * z); + + if (len < GLM_EPSILON) { + return null; + } + + len = 1 / len; + x *= len; + y *= len; + z *= len; + + const s = Math.sin(rad); + const c = Math.cos(rad); + const t = 1 - c; + + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + + // Construct the elements of the rotation matrix + const b00 = x * x * t + c; + const b01 = y * x * t + z * s; + const b02 = z * x * t - y * s; + const b10 = x * y * t - z * s; + const b11 = y * y * t + c; + const b12 = z * y * t + x * s; + const b20 = x * z * t + y * s; + const b21 = y * z * t - x * s; + const b22 = z * z * t + c; + + // Perform rotation-specific matrix multiplication + out[0] = a00 * b00 + a10 * b01 + a20 * b02; + out[1] = a01 * b00 + a11 * b01 + a21 * b02; + out[2] = a02 * b00 + a12 * b01 + a22 * b02; + out[3] = a03 * b00 + a13 * b01 + a23 * b02; + out[4] = a00 * b10 + a10 * b11 + a20 * b12; + out[5] = a01 * b10 + a11 * b11 + a21 * b12; + out[6] = a02 * b10 + a12 * b11 + a22 * b12; + out[7] = a03 * b10 + a13 * b11 + a23 * b12; + out[8] = a00 * b20 + a10 * b21 + a20 * b22; + out[9] = a01 * b20 + a11 * b21 + a21 * b22; + out[10] = a02 * b20 + a12 * b21 + a22 * b22; + out[11] = a03 * b20 + a13 * b21 + a23 * b22; + + if (a !== out) { + // If the source and destination differ, copy the unchanged last row + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + return out; + } + + /** + * Rotates a matrix by the given angle around the X axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateX(out: Mat4Like, a: Readonly, rad: number): Mat4Like { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + + if (a !== out) { + // If the source and destination differ, copy the unchanged rows + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[4] = a10 * c + a20 * s; + out[5] = a11 * c + a21 * s; + out[6] = a12 * c + a22 * s; + out[7] = a13 * c + a23 * s; + out[8] = a20 * c - a10 * s; + out[9] = a21 * c - a11 * s; + out[10] = a22 * c - a12 * s; + out[11] = a23 * c - a13 * s; + return out; + } + + /** + * Rotates a matrix by the given angle around the Y axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateY(out: Mat4Like, a: Readonly, rad: number): Mat4Like { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + + if (a !== out) { + // If the source and destination differ, copy the unchanged rows + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[0] = a00 * c - a20 * s; + out[1] = a01 * c - a21 * s; + out[2] = a02 * c - a22 * s; + out[3] = a03 * c - a23 * s; + out[8] = a00 * s + a20 * c; + out[9] = a01 * s + a21 * c; + out[10] = a02 * s + a22 * c; + out[11] = a03 * s + a23 * c; + return out; + } + + /** + * Rotates a matrix by the given angle around the Z axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateZ(out: Mat4Like, a: Readonly, rad: number): Mat4Like { + const s = Math.sin(rad); + const c = Math.cos(rad); + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + + if (a !== out) { + // If the source and destination differ, copy the unchanged last row + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + + // Perform axis-specific matrix multiplication + out[0] = a00 * c + a10 * s; + out[1] = a01 * c + a11 * s; + out[2] = a02 * c + a12 * s; + out[3] = a03 * c + a13 * s; + out[4] = a10 * c - a00 * s; + out[5] = a11 * c - a01 * s; + out[6] = a12 * c - a02 * s; + out[7] = a13 * c - a03 * s; + return out; + } + + /** + * Creates a {@link Mat4} from a vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out: Mat4Like, v: Readonly): Mat4Like { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + + /** + * Creates a {@link Mat4} from a vector scaling + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.scale(dest, dest, vec); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out: Mat4Like, v: Readonly): Mat4Like { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = v[1]; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = v[2]; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + + /** + * Creates a {@link Mat4} from a given angle around a given axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotate(dest, dest, rad, axis); + * ``` + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` or `null` if `axis` has a length of 0 + */ + static fromRotation(out: Mat4Like, rad: number, axis: Readonly): Mat4Like | null { + let x = axis[0]; + let y = axis[1]; + let z = axis[2]; + let len = Math.sqrt(x * x + y * y + z * z); + + if (len < GLM_EPSILON) { + return null; + } + + len = 1 / len; + x *= len; + y *= len; + z *= len; + + const s = Math.sin(rad); + const c = Math.cos(rad); + const t = 1 - c; + + // Perform rotation-specific matrix multiplication + out[0] = x * x * t + c; + out[1] = y * x * t + z * s; + out[2] = z * x * t - y * s; + out[3] = 0; + out[4] = x * y * t - z * s; + out[5] = y * y * t + c; + out[6] = z * y * t + x * s; + out[7] = 0; + out[8] = x * z * t + y * s; + out[9] = y * z * t - x * s; + out[10] = z * z * t + c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + + /** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateX(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromXRotation(out: Mat4Like, rad: number): Mat4Like { + const s = Math.sin(rad); + const c = Math.cos(rad); + + // Perform axis-specific matrix multiplication + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = c; + out[6] = s; + out[7] = 0; + out[8] = 0; + out[9] = -s; + out[10] = c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + + /** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateY(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromYRotation(out: Mat4Like, rad: number): Mat4Like { + const s = Math.sin(rad); + const c = Math.cos(rad); + + // Perform axis-specific matrix multiplication + out[0] = c; + out[1] = 0; + out[2] = -s; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = s; + out[9] = 0; + out[10] = c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + + /** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.rotateZ(dest, dest, rad); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromZRotation(out: Mat4Like, rad: number): Mat4Like { + const s = Math.sin(rad); + const c = Math.cos(rad); + + // Perform axis-specific matrix multiplication + out[0] = c; + out[1] = s; + out[2] = 0; + out[3] = 0; + out[4] = -s; + out[5] = c; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + + /** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @returns `out` + */ + static fromRotationTranslation(out: Mat4Like, q: Readonly, v: Readonly): Mat4Like { + // Quaternion math + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + + return out; + } + + /** + * Sets a {@link Mat4} from a {@link Quat2}. + * @category Static + * + * @param out - Matrix + * @param a - Dual Quaternion + * @returns `out` + */ + static fromQuat2(out: Mat4Like, a: Quat2Like): Mat4Like { + const bx = -a[0]; + const by = -a[1]; + const bz = -a[2]; + const bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + + const magnitude = bx * bx + by * by + bz * bz + bw * bw; + + // Only scale if it makes sense + if (magnitude > 0) { + Mat4.#TMP_VEC3[0] = ((ax * bw + aw * bx + ay * bz - az * by) * 2) / magnitude; + Mat4.#TMP_VEC3[1] = ((ay * bw + aw * by + az * bx - ax * bz) * 2) / magnitude; + Mat4.#TMP_VEC3[2] = ((az * bw + aw * bz + ax * by - ay * bx) * 2) / magnitude; + } else { + Mat4.#TMP_VEC3[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; + Mat4.#TMP_VEC3[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; + Mat4.#TMP_VEC3[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + } + Mat4.fromRotationTranslation(out, a as QuatLike, Mat4.#TMP_VEC3); + return out; + } + + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` or `null` if the matrix is not invertible + */ + static normalFromMat4(out: Mat4Like, a: Readonly): Mat4Like | null { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + + // Calculate the determinant + let det = + b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + + if (!det) { + return null; + } + det = 1.0 / det; + + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[3] = 0; + + out[4] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[7] = 0; + + out[8] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[9] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = 0; + + // No translation + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + + return out; + } + + /** + * Calculates a {@link Mat4} normal matrix (transpose inverse) from a {@link Mat4} + * This version omits the calculation of the constant factor (1/determinant), so + * any normals transformed with it will need to be renormalized. + * From https://stackoverflow.com/a/27616419/25968 + * @category Static + * + * @param out - Matrix receiving operation result + * @param a - Mat4 to derive the normal matrix from + * @returns `out` + */ + static normalFromMat4Fast(out: Mat4Like, a: Readonly): Mat4Like { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + + const bx = a[4]; + const by = a[5]; + const bz = a[6]; + + const cx = a[8]; + const cy = a[9]; + const cz = a[10]; + + out[0] = by * cz - cz * cy; + out[1] = bz * cx - cx * cz; + out[2] = bx * cy - cy * cx; + out[3] = 0; + + out[4] = cy * az - cz * ay; + out[5] = cz * ax - cx * az; + out[6] = cx * ay - cy * ax; + out[7] = 0; + + out[8] = ay * bz - az * by; + out[9] = az * bx - ax * bz; + out[10] = ax * by - ay * bx; + out[11] = 0; + + // No translation + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + + return out; + } + + /** + * Returns the translation vector component of a transformation + * matrix. If a matrix is built with fromRotationTranslation, + * the returned vector will be the same as the translation vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive translation component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getTranslation(out: Vec3Like, mat: Readonly): Vec3Like { + out[0] = mat[12]; + out[1] = mat[13]; + out[2] = mat[14]; + + return out; + } + + /** + * Returns the scaling factor component of a transformation + * matrix. If a matrix is built with fromRotationTranslationScale + * with a normalized Quaternion parameter, the returned vector will be + * the same as the scaling vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive scaling factor component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getScaling(out: Vec3Like, mat: Readonly): Vec3Like { + const m11 = mat[0]; + const m12 = mat[1]; + const m13 = mat[2]; + const m21 = mat[4]; + const m22 = mat[5]; + const m23 = mat[6]; + const m31 = mat[8]; + const m32 = mat[9]; + const m33 = mat[10]; + + out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + + return out; + } + + /** + * Returns a quaternion representing the rotational component + * of a transformation matrix. If a matrix is built with + * fromRotationTranslation, the returned quaternion will be the + * same as the quaternion originally supplied. + * @category Static + * + * @param out - Quaternion to receive the rotation component + * @param mat - Matrix to be decomposed (input) + * @return `out` + */ + static getRotation(out: QuatLike, mat: Readonly): QuatLike { + Mat4.getScaling(Mat4.#TMP_VEC3, mat); + + const is1 = 1 / Mat4.#TMP_VEC3[0]; + const is2 = 1 / Mat4.#TMP_VEC3[1]; + const is3 = 1 / Mat4.#TMP_VEC3[2]; + + const sm11 = mat[0] * is1; + const sm12 = mat[1] * is2; + const sm13 = mat[2] * is3; + const sm21 = mat[4] * is1; + const sm22 = mat[5] * is2; + const sm23 = mat[6] * is3; + const sm31 = mat[8] * is1; + const sm32 = mat[9] * is2; + const sm33 = mat[10] * is3; + + const trace = sm11 + sm22 + sm33; + let S = 0; + + if (trace > 0) { + S = Math.sqrt(trace + 1.0) * 2; + out[3] = 0.25 * S; + out[0] = (sm23 - sm32) / S; + out[1] = (sm31 - sm13) / S; + out[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2; + out[3] = (sm23 - sm32) / S; + out[0] = 0.25 * S; + out[1] = (sm12 + sm21) / S; + out[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2; + out[3] = (sm31 - sm13) / S; + out[0] = (sm12 + sm21) / S; + out[1] = 0.25 * S; + out[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2; + out[3] = (sm12 - sm21) / S; + out[0] = (sm31 + sm13) / S; + out[1] = (sm23 + sm32) / S; + out[2] = 0.25 * S; + } + + return out; + } + + /** + * Decomposes a transformation matrix into its rotation, translation + * and scale components. Returns only the rotation component + * @category Static + * + * @param out_r - Quaternion to receive the rotation component + * @param out_t - Vector to receive the translation vector + * @param out_s - Vector to receive the scaling factor + * @param mat - Matrix to be decomposed (input) + * @returns `out_r` + */ + static decompose(out_r: QuatLike, out_t: Vec3Like, out_s: Vec3Like, mat: Readonly): QuatLike { + out_t[0] = mat[12]; + out_t[1] = mat[13]; + out_t[2] = mat[14]; + + const m11 = mat[0]; + const m12 = mat[1]; + const m13 = mat[2]; + const m21 = mat[4]; + const m22 = mat[5]; + const m23 = mat[6]; + const m31 = mat[8]; + const m32 = mat[9]; + const m33 = mat[10]; + + out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + + const is1 = 1 / out_s[0]; + const is2 = 1 / out_s[1]; + const is3 = 1 / out_s[2]; + + const sm11 = m11 * is1; + const sm12 = m12 * is2; + const sm13 = m13 * is3; + const sm21 = m21 * is1; + const sm22 = m22 * is2; + const sm23 = m23 * is3; + const sm31 = m31 * is1; + const sm32 = m32 * is2; + const sm33 = m33 * is3; + + const trace = sm11 + sm22 + sm33; + let S = 0; + + if (trace > 0) { + S = Math.sqrt(trace + 1.0) * 2; + out_r[3] = 0.25 * S; + out_r[0] = (sm23 - sm32) / S; + out_r[1] = (sm31 - sm13) / S; + out_r[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2; + out_r[3] = (sm23 - sm32) / S; + out_r[0] = 0.25 * S; + out_r[1] = (sm12 + sm21) / S; + out_r[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2; + out_r[3] = (sm31 - sm13) / S; + out_r[0] = (sm12 + sm21) / S; + out_r[1] = 0.25 * S; + out_r[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2; + out_r[3] = (sm12 - sm21) / S; + out_r[0] = (sm31 + sm13) / S; + out_r[1] = (sm23 + sm32) / S; + out_r[2] = 0.25 * S; + } + + return out_r; + } + + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale + * This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @returns `out` + */ + static fromRotationTranslationScale(out: Mat4Like, q: Readonly, v: Readonly, + s: Readonly): Mat4Like { + // Quaternion math + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + const sx = s[0]; + const sy = s[1]; + const sz = s[2]; + + out[0] = (1 - (yy + zz)) * sx; + out[1] = (xy + wz) * sx; + out[2] = (xz - wy) * sx; + out[3] = 0; + out[4] = (xy - wz) * sy; + out[5] = (1 - (xx + zz)) * sy; + out[6] = (yz + wx) * sy; + out[7] = 0; + out[8] = (xz + wy) * sz; + out[9] = (yz - wx) * sz; + out[10] = (1 - (xx + yy)) * sz; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + + return out; + } + + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the + * given origin. This is equivalent to (but much faster than): + * ```js + * mat4.identity(dest); + * mat4.translate(dest, vec); + * mat4.translate(dest, origin); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * mat4.translate(dest, negativeOrigin); + * ``` + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @param o - The origin vector around which to scale and rotate + * @returns `out` + */ + static fromRotationTranslationScaleOrigin(out: Mat4Like, q: Readonly, v: Readonly, + s: Readonly, o: Readonly): Mat4Like { + // Quaternion math + 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 xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + + const sx = s[0]; + const sy = s[1]; + const sz = s[2]; + + const ox = o[0]; + const oy = o[1]; + const oz = o[2]; + + const out0 = (1 - (yy + zz)) * sx; + const out1 = (xy + wz) * sx; + const out2 = (xz - wy) * sx; + const out4 = (xy - wz) * sy; + const out5 = (1 - (xx + zz)) * sy; + const out6 = (yz + wx) * sy; + const out8 = (xz + wy) * sz; + const out9 = (yz - wx) * sz; + const out10 = (1 - (xx + yy)) * sz; + + out[0] = out0; + out[1] = out1; + out[2] = out2; + out[3] = 0; + out[4] = out4; + out[5] = out5; + out[6] = out6; + out[7] = 0; + out[8] = out8; + out[9] = out9; + out[10] = out10; + out[11] = 0; + out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz); + out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz); + out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); + out[15] = 1; + + return out; + } + + /** + * Calculates a 4x4 matrix from the given quaternion + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Quaternion to create matrix from + * @returns `out` + */ + static fromQuat(out: Mat4Like, q: Readonly): Mat4Like { + 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; + + out[0] = 1 - yy - zz; + out[1] = yx + wz; + out[2] = zx - wy; + out[3] = 0; + + out[4] = yx - wz; + out[5] = 1 - xx - zz; + out[6] = zy + wx; + out[7] = 0; + + out[8] = zx + wy; + out[9] = zy - wx; + out[10] = 1 - xx - yy; + out[11] = 0; + + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + + return out; + } + + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, + far = Infinity): Mat4Like { + const rl = 1 / (right - left); + const tb = 1 / (top - bottom); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + + /** + * Alias for {@link Mat4.frustumNO} + * @category Static + * @deprecated Use {@link Mat4.frustumNO} or {@link Mat4.frustumZO} explicitly + */ + static frustum(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, + far = Infinity): Mat4Like { return out; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Generates a frustum matrix with the given bounds + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static frustumZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, + far = Infinity): Mat4Like { + const rl = 1 / (right - left); + const tb = 1 / (top - bottom); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = far * nf; + out[14] = far * near * nf; + } else { + out[10] = -1; + out[14] = -near; + } + return out; + } + + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveNO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like { + const f = 1.0 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + + /** + * Alias for {@link Mat4.perspectiveNO} + * @category Static + * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static perspective(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like { + return out; + } + + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveZO(out: Mat4Like, fovy: number, aspect: number, near: number, far = Infinity): Mat4Like { + const f = 1.0 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = far * nf; + out[14] = far * near * nf; + } else { + out[10] = -1; + out[14] = -near; + } + return out; + } + + /** + * Generates a perspective projection matrix with the given field of view. This is primarily useful for generating + * projection matrices to be used with the still experimental WebVR API. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + * @deprecated + */ + static perspectiveFromFieldOfView(out: Mat4Like, + fov: { upDegrees: number, downDegrees: number, leftDegrees: number, rightDegrees: number }, near: number, + far: number): Mat4Like { + + const upTan = Math.tan((fov.upDegrees * Math.PI) / 180.0); + const downTan = Math.tan((fov.downDegrees * Math.PI) / 180.0); + const leftTan = Math.tan((fov.leftDegrees * Math.PI) / 180.0); + const rightTan = Math.tan((fov.rightDegrees * Math.PI) / 180.0); + const xScale = 2.0 / (leftTan + rightTan); + const yScale = 2.0 / (upTan + downTan); + + out[0] = xScale; + out[1] = 0.0; + out[2] = 0.0; + out[3] = 0.0; + out[4] = 0.0; + out[5] = yScale; + out[6] = 0.0; + out[7] = 0.0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = (upTan - downTan) * yScale * 0.5; + out[10] = far / (near - far); + out[11] = -1.0; + out[12] = 0.0; + out[13] = 0.0; + out[14] = (far * near) / (near - far); + out[15] = 0.0; + return out; + } + + /** + * Generates an orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [-1, 1], which matches WebGL / OpenGLs clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoNO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, + far: number): Mat4Like { + const lr = 1 / (left - right); + const bt = 1 / (bottom - top); + const nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; + } + + /** + * Alias for {@link Mat4.orthoNO} + * @category Static + * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static ortho(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, far: number): + Mat4Like { + return out; + } + + /** + * Generates a orthogonal projection matrix with the given bounds. The near / far clip planes correspond to a + * normalized device coordinate Z range of [0, 1], which matches WebGPU / Vulkan / DirectX / Metal's clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoZO(out: Mat4Like, left: number, right: number, bottom: number, top: number, near: number, + far: number): Mat4Like { + const lr = 1 / (left - right); + const bt = 1 / (bottom - top); + const nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = near * nf; + out[15] = 1; + return out; + } + + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis. If you want a matrix that + * actually makes an object look at another object, you should use targetTo instead. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param center - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static lookAt(out: Mat4Like, eye: Readonly, center: Readonly, up: Readonly): Mat4Like { + const eyex = eye[0]; + const eyey = eye[1]; + const eyez = eye[2]; + const upx = up[0]; + const upy = up[1]; + const upz = up[2]; + const centerx = center[0]; + const centery = center[1]; + const centerz = center[2]; + + if ( + Math.abs(eyex - centerx) < GLM_EPSILON && + Math.abs(eyey - centery) < GLM_EPSILON && + Math.abs(eyez - centerz) < GLM_EPSILON + ) { + return Mat4.identity(out); + } + + let z0 = eyex - centerx; + let z1 = eyey - centery; + let z2 = eyez - centerz; + + let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + z0 *= len; + z1 *= len; + z2 *= len; + + let x0 = upy * z2 - upz * z1; + let x1 = upz * z0 - upx * z2; + let x2 = upx * z1 - upy * z0; + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + if (!len) { + x0 = 0; + x1 = 0; + x2 = 0; + } else { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + + let y0 = z1 * x2 - z2 * x1; + let y1 = z2 * x0 - z0 * x2; + let y2 = z0 * x1 - z1 * x0; + + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + if (!len) { + y0 = 0; + y1 = 0; + y2 = 0; + } else { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + + out[0] = x0; + out[1] = y0; + out[2] = z0; + out[3] = 0; + out[4] = x1; + out[5] = y1; + out[6] = z1; + out[7] = 0; + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); + out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); + out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + + return out; + } + + /** + * Generates a matrix that makes something look at something else. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param target - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static targetTo(out: Mat4Like, eye: Readonly, target: Readonly, up: Readonly): + Mat4Like { + const eyex = eye[0]; + const eyey = eye[1]; + const eyez = eye[2]; + const upx = up[0]; + const upy = up[1]; + const upz = up[2]; + + let z0 = eyex - target[0]; + let z1 = eyey - target[1]; + let z2 = eyez - target[2]; + + let len = z0 * z0 + z1 * z1 + z2 * z2; + if (len > 0) { + len = 1 / Math.sqrt(len); + z0 *= len; + z1 *= len; + z2 *= len; + } + + let x0 = upy * z2 - upz * z1; + let x1 = upz * z0 - upx * z2; + let x2 = upx * z1 - upy * z0; + + len = x0 * x0 + x1 * x1 + x2 * x2; + if (len > 0) { + len = 1 / Math.sqrt(len); + x0 *= len; + x1 *= len; + x2 *= len; + } + + out[0] = x0; + out[1] = x1; + out[2] = x2; + out[3] = 0; + out[4] = z1 * x2 - z2 * x1; + out[5] = z2 * x0 - z0 * x2; + out[6] = z0 * x1 - z1 * x0; + out[7] = 0; + out[8] = z0; + out[9] = z1; + out[10] = z2; + out[11] = 0; + out[12] = eyex; + out[13] = eyey; + out[14] = eyez; + out[15] = 1; + return out; + } + + /** + * Returns Frobenius norm of a {@link Mat4} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a: Readonly): number { + return Math.sqrt( + a[0] * a[0] + + a[1] * a[1] + + a[2] * a[2] + + a[3] * a[3] + + a[4] * a[4] + + a[5] * a[5] + + a[6] * a[6] + + a[7] * a[7] + + a[8] * a[8] + + a[9] * a[9] + + a[10] * a[10] + + a[11] * a[11] + + a[12] * a[12] + + a[13] * a[13] + + a[14] * a[14] + + a[15] * a[15] + ); + } + + /** + * Adds two {@link Mat4}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + out[8] = a[8] + b[8]; + out[9] = a[9] + b[9]; + out[10] = a[10] + b[10]; + out[11] = a[11] + b[11]; + out[12] = a[12] + b[12]; + out[13] = a[13] + b[13]; + out[14] = a[14] + b[14]; + out[15] = a[15] + b[15]; + return out; + } + + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + out[6] = a[6] - b[6]; + out[7] = a[7] - b[7]; + out[8] = a[8] - b[8]; + out[9] = a[9] - b[9]; + out[10] = a[10] - b[10]; + out[11] = a[11] - b[11]; + out[12] = a[12] - b[12]; + out[13] = a[13] - b[13]; + out[14] = a[14] - b[14]; + out[15] = a[15] - b[15]; + return out; + } + + /** + * Alias for {@link Mat4.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out: Mat4Like, a: Readonly, b: Readonly): Mat4Like { return out; } + + /** + * Multiply each element of the matrix by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out: Mat4Like, a: Readonly, b: number): Mat4Like { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + out[8] = a[8] * b; + out[9] = a[9] * b; + out[10] = a[10] * b; + out[11] = a[11] * b; + out[12] = a[12] * b; + out[13] = a[13] * b; + out[14] = a[14] * b; + out[15] = a[15] * b; + return out; + } + + /** + * Adds two mat4's after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out: Mat4Like, a: Readonly, b: Readonly, scale: number): Mat4Like { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + out[6] = a[6] + b[6] * scale; + out[7] = a[7] + b[7] * scale; + out[8] = a[8] + b[8] * scale; + out[9] = a[9] + b[9] * scale; + out[10] = a[10] + b[10] * scale; + out[11] = a[11] + b[11] * scale; + out[12] = a[12] + b[12] * scale; + out[13] = a[13] + b[13] * scale; + out[14] = a[14] + b[14] * scale; + out[15] = a[15] + b[15] * scale; + return out; + } + + /** + * Returns whether two {@link Mat4}s have exactly the same elements in the same position (when compared with ===). + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean { + return ( + a[0] === b[0] && + a[1] === b[1] && + a[2] === b[2] && + a[3] === b[3] && + a[4] === b[4] && + a[5] === b[5] && + a[6] === b[6] && + a[7] === b[7] && + a[8] === b[8] && + a[9] === b[9] && + a[10] === b[10] && + a[11] === b[11] && + a[12] === b[12] && + a[13] === b[13] && + a[14] === b[14] && + a[15] === b[15] + ); + } + + /** + * Returns whether two {@link Mat4}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const a8 = a[8]; + const a9 = a[9]; + const a10 = a[10]; + const a11 = a[11]; + const a12 = a[12]; + const a13 = a[13]; + const a14 = a[14]; + const a15 = a[15]; + + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + const b8 = b[8]; + const b9 = b[9]; + const b10 = b[10]; + const b11 = b[11]; + const b12 = b[12]; + const b13 = b[13]; + const b14 = b[14]; + const b15 = b[15]; + + return ( + Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && + Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && + Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && + Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && + Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && + Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && + Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && + Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && + Math.abs(a8 - b8) <= GLM_EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) && + Math.abs(a9 - b9) <= GLM_EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) && + Math.abs(a10 - b10) <= GLM_EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) && + Math.abs(a11 - b11) <= GLM_EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) && + Math.abs(a12 - b12) <= GLM_EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) && + Math.abs(a13 - b13) <= GLM_EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) && + Math.abs(a14 - b14) <= GLM_EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) && + Math.abs(a15 - b15) <= GLM_EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15)) + ); + } + + /** + * Returns a string representation of a {@link Mat4} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a: Readonly): string { + return `Mat4(${a.join(', ')})`; + } +} + +// Instance method alias assignments +Mat4.prototype.mul = Mat4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method + +// Static method alias assignments +Mat4.sub = Mat4.subtract; +Mat4.mul = Mat4.multiply; +Mat4.frustum = Mat4.frustumNO; +Mat4.perspective = Mat4.perspectiveNO; +Mat4.ortho = Mat4.orthoNO; diff --git a/src/_lib/f64/Quat.ts b/src/_lib/f64/Quat.ts new file mode 100644 index 00000000..d0a734d6 --- /dev/null +++ b/src/_lib/f64/Quat.ts @@ -0,0 +1,1098 @@ +import { Vec3 } from './Vec3.js'; +import { Vec4 } from './Vec4.js'; +import { GLM_EPSILON } from '#gl-matrix/common'; + +import type { Mat3Like, QuatLike, Vec3Like } from '#gl-matrix/types'; + +/** + * Quaternion + */ +export class Quat extends Float64Array { + static #DEFAULT_ANGLE_ORDER = 'zyx'; + + // Temporary variables to prevent repeated allocations in the algorithms within Quat. + // These are declared as TypedArrays to aid in tree-shaking. + + static #TMP_QUAT1 = new Float64Array(4); + static #TMP_QUAT2 = new Float64Array(4); + static #TMP_MAT3 = new Float64Array(9); + + static #TMP_VEC3 = new Float64Array(3); + static #X_UNIT_VEC3 = new Float64Array([1, 0, 0]); + static #Y_UNIT_VEC3 = new Float64Array([0, 1, 0]); + + /** + * Create a {@link Quat}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { + switch (values.length) { + case 4: + super(values); break; + case 2: + super(values[0] as ArrayBufferLike, values[1], 4); break; + case 1: { + const v = values[0]; + if (typeof v === 'number') { + super([v, v, v, v]); + } else { + super(v as ArrayBufferLike, 0, 4); + } + break; + } + default: + super(4); + this[3] = 1; + break; + } + } + + // ============ + // Accessors + // ============ + + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + + /** + * The x component of the quaternion. Equivalent to `this[0];` + * @category Quaternion Components + */ + get x(): number { return this[0]; } + set x(value: number) { this[0] = value; } + + /** + * The y component of the quaternion. Equivalent to `this[1];` + * @category Quaternion Components + */ + get y(): number { return this[1]; } + set y(value: number) { this[1] = value; } + + /** + * The z component of the quaternion. Equivalent to `this[2];` + * @category Quaternion Components + */ + get z(): number { return this[2]; } + set z(value: number) { this[2] = value; } + + /** + * The w component of the quaternion. Equivalent to `this[3];` + * @category Quaternion Components + */ + get w(): number { return this[3]; } + set w(value: number) { this[3] = value; } + + /** + * The magnitude (length) of this. + * Equivalent to `Quat.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number { + const x = this[0]; + const y = this[1]; + const z = this[2]; + const w = this[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + + /** + * Alias for {@link Quat.magnitude} + * + * @category Accessors + */ + get mag(): number { return this.magnitude; } + + /** + * A string representation of `this` + * Equivalent to `Quat.str(this);` + * + * @category Accessors + */ + get str(): string { + return Quat.str(this); + } + + // =================== + // Instances methods + // =================== + + /** + * Copy the values from another {@link Quat} into `this`. + * @category Methods + * + * @param a the source quaternion + * @returns `this` + */ + copy(a: Readonly): this { + super.set(a); + return this; + } + + /** + * Set `this` to the identity quaternion + * Equivalent to Quat.identity(this) + * @category Methods + * + * @returns `this` + */ + identity(): this { + this[0] = 0; + this[1] = 0; + this[2] = 0; + this[3] = 1; + return this; + } + + /** + * Multiplies `this` by a {@link Quat}. + * Equivalent to `Quat.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this { + return Quat.multiply(this, this, b) as this; + } + + /** + * Alias for {@link Quat.multiply} + * @category Methods + */ + mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Rotates `this` by the given angle about the X axis + * Equivalent to `Quat.rotateX(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateX(rad: number): this { + return Quat.rotateX(this, this, rad) as this; + } + + /** + * Rotates `this` by the given angle about the Y axis + * Equivalent to `Quat.rotateY(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateY(rad: number): this { + return Quat.rotateY(this, this, rad) as this; + } + + /** + * Rotates `this` by the given angle about the Z axis + * Equivalent to `Quat.rotateZ(this, this, rad);` + * @category Methods + * + * @param rad - angle (in radians) to rotate + * @returns `this` + */ + rotateZ(rad: number): this { + return Quat.rotateZ(this, this, rad) as this; + } + + /** + * Inverts `this` + * Equivalent to `Quat.invert(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this { + return Quat.invert(this, this) as this; + } + + /** + * Scales `this` by a scalar number + * Equivalent to `Quat.scale(this, this, scale);` + * @category Methods + * + * @param scale - amount to scale the vector by + * @returns `this` + */ + scale(scale: number): QuatLike { + this[0] *= scale; + this[1] *= scale; + this[2] *= scale; + this[3] *= scale; + return this; + } + + /** + * Calculates the dot product of `this` and another {@link Quat} + * Equivalent to `Quat.dot(this, b);` + * @category Methods + * + * @param b - the second operand + * @returns dot product of `this` and b + */ + dot(b: Readonly): number { + return Quat.dot(this, b); + } + + // =================== + // Static accessors + // =================== + + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat}. + */ + static get BYTE_LENGTH(): number { + return 4 * Float64Array.BYTES_PER_ELEMENT; + } + + // =================== + // Static methods + // =================== + + /** + * Creates a new identity quat + * @category Static + * + * @returns a new quaternion + */ + static create(): Quat { + return new Quat(); + } + + /** + * Set a quat to the identity quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + static identity(out: QuatLike): QuatLike { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } + + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * @category Static + * + * @param out - the receiving quaternion + * @param axis - the axis around which to rotate + * @param rad - the angle in radians + * @returns `out` + **/ + static setAxisAngle(out: QuatLike, axis: Readonly, rad: number): QuatLike { + rad *= 0.5; + const s = Math.sin(rad); + out[0] = s * axis[0]; + out[1] = s * axis[1]; + out[2] = s * axis[2]; + out[3] = Math.cos(rad); + return out; + } + + /** + * Gets the rotation axis and angle for a given + * quaternion. If a quaternion is created with + * setAxisAngle, this method will return the same + * values as provided in the original parameter list + * OR functionally equivalent values. + * Example: The quaternion formed by axis [0, 0, 1] and + * angle -90 is the same as the quaternion formed by + * [0, 0, 1] and 270. This method favors the latter. + * @category Static + * + * @param out_axis - Vector receiving the axis of rotation + * @param q - Quaternion to be decomposed + * @return Angle, in radians, of the rotation + */ + static getAxisAngle(out_axis: Vec3Like, q: Readonly): number { + const rad = Math.acos(q[3]) * 2.0; + const s = Math.sin(rad / 2.0); + if (s > GLM_EPSILON) { + out_axis[0] = q[0] / s; + out_axis[1] = q[1] / s; + out_axis[2] = q[2] / s; + } else { + // If s is zero, return any axis (no rotation - axis does not matter) + out_axis[0] = 1; + out_axis[1] = 0; + out_axis[2] = 0; + } + return rad; + } + + /** + * Gets the angular distance between two unit quaternions + * @category Static + * + * @param {ReadonlyQuat} a Origin unit quaternion + * @param {ReadonlyQuat} b Destination unit quaternion + * @return {Number} Angle, in radians, between the two quaternions + */ + static getAngle(a: Readonly, b: Readonly): number { + const dotproduct = Quat.dot(a, b); + + return Math.acos(2 * dotproduct * dotproduct - 1); + } + + /** + * Multiplies two quaternions. + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out: QuatLike, a: Readonly, b: Readonly): QuatLike { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bx = b[0]; + const by = b[1]; + const bz = b[2]; + const bw = b[3]; + + out[0] = ax * bw + aw * bx + ay * bz - az * by; + out[1] = ay * bw + aw * by + az * bx - ax * bz; + out[2] = az * bw + aw * bz + ax * by - ay * bx; + out[3] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + + /** + * Rotates a quaternion by the given angle about the X axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out: QuatLike, a: Readonly, rad: number): QuatLike { + rad *= 0.5; + + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bx = Math.sin(rad); + const bw = Math.cos(rad); + + out[0] = ax * bw + aw * bx; + out[1] = ay * bw + az * bx; + out[2] = az * bw - ay * bx; + out[3] = aw * bw - ax * bx; + return out; + } + + /** + * Rotates a quaternion by the given angle about the Y axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out: QuatLike, a: Readonly, rad: number): QuatLike { + rad *= 0.5; + + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const by = Math.sin(rad); + const bw = Math.cos(rad); + + out[0] = ax * bw - az * by; + out[1] = ay * bw + aw * by; + out[2] = az * bw + ax * by; + out[3] = aw * bw - ay * by; + return out; + } + + /** + * Rotates a quaternion by the given angle about the Z axis + * @category Static + * + * @param out - quat receiving operation result + * @param a - quat to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out: QuatLike, a: Readonly, rad: number): QuatLike { + rad *= 0.5; + + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bz = Math.sin(rad); + const bw = Math.cos(rad); + + out[0] = ax * bw + ay * bz; + out[1] = ay * bw - ax * bz; + out[2] = az * bw + aw * bz; + out[3] = aw * bw - az * bz; + return out; + } + + /** + * Calculates the W component of a quat from the X, Y, and Z components. + * Assumes that quaternion is 1 unit in length. + * Any existing W component will be ignored. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate W component of + * @returns `out` + */ + static calculateW(out: QuatLike, a: Readonly): QuatLike { + const x = a[0], + y = a[1], + z = a[2]; + + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z)); + return out; + } + + /** + * Calculate the exponential of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static exp(out: QuatLike, a: Readonly): QuatLike { + const x = a[0], + y = a[1], + z = a[2], + w = a[3]; + + const r = Math.sqrt(x * x + y * y + z * z); + const et = Math.exp(w); + const s = r > 0 ? (et * Math.sin(r)) / r : 0; + + out[0] = x * s; + out[1] = y * s; + out[2] = z * s; + out[3] = et * Math.cos(r); + + return out; + } + + /** + * Calculate the natural logarithm of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @returns `out` + */ + static ln(out: QuatLike, a: Readonly): QuatLike { + const x = a[0], + y = a[1], + z = a[2], + w = a[3]; + + const r = Math.sqrt(x * x + y * y + z * z); + const t = r > 0 ? Math.atan2(r, w) / r : 0; + + out[0] = x * t; + out[1] = y * t; + out[2] = z * t; + out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w); + + return out; + } + + /** + * Calculate the scalar power of a unit quaternion. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate the exponential of + * @param b - amount to scale the quaternion by + * @returns `out` + */ + static pow(out: QuatLike, a: Readonly, b: number): QuatLike { + Quat.ln(out, a); + Quat.scale(out, out, b); + Quat.exp(out, out); + return out; + } + + /** + * Performs a spherical linear interpolation between two quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike { + // benchmarks: + // http://jsperf.com/quaternion-slerp-implementations + const ax = a[0], + ay = a[1], + az = a[2], + aw = a[3]; + let bx = b[0], + by = b[1], + bz = b[2], + bw = b[3]; + + let scale0: number; + let scale1: number; + + // calc cosine + let cosom = ax * bx + ay * by + az * bz + aw * bw; + // adjust signs (if necessary) + if (cosom < 0.0) { + cosom = -cosom; + bx = -bx; + by = -by; + bz = -bz; + bw = -bw; + } + // calculate coefficients + if (1.0 - cosom > GLM_EPSILON) { + // standard case (slerp) + const omega = Math.acos(cosom); + const sinom = Math.sin(omega); + scale0 = Math.sin((1.0 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; + } else { + // "from" and "to" quaternions are very close + // ... so we can do a linear interpolation + scale0 = 1.0 - t; + scale1 = t; + } + // calculate final values + out[0] = scale0 * ax + scale1 * bx; + out[1] = scale0 * ay + scale1 * by; + out[2] = scale0 * az + scale1 * bz; + out[3] = scale0 * aw + scale1 * bw; + + return out; + } + + /** + * Generates a random unit quaternion + * @category Static + * + * @param out - the receiving quaternion + * @returns `out` + */ + /* static random(out: QuatLike): QuatLike { + // Implementation of http://planning.cs.uiuc.edu/node198.html + // TODO: Calling random 3 times is probably not the fastest solution + let u1 = glMatrix.RANDOM(); + let u2 = glMatrix.RANDOM(); + let u3 = glMatrix.RANDOM(); + + let sqrt1MinusU1 = Math.sqrt(1 - u1); + let sqrtU1 = Math.sqrt(u1); + + out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2); + out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2); + out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3); + out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3); + return out; + }*/ + + /** + * Calculates the inverse of a quat + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate inverse of + * @returns `out` + */ + static invert(out: QuatLike, a: Readonly): QuatLike { + const a0 = a[0], + a1 = a[1], + a2 = a[2], + a3 = a[3]; + const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; + const invDot = dot ? 1.0 / dot : 0; + + // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0 + + out[0] = -a0 * invDot; + out[1] = -a1 * invDot; + out[2] = -a2 * invDot; + out[3] = a3 * invDot; + return out; + } + + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than `quat.inverse` and produces the same result. + * @category Static + * + * @param out - the receiving quaternion + * @param a - quat to calculate conjugate of + * @returns `out` + */ + static conjugate(out: QuatLike, a: Readonly): QuatLike { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + return out; + } + + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to re-normalize the quaternion yourself where necessary. + * @category Static + * + * @param out - the receiving quaternion + * @param m - rotation matrix + * @returns `out` + */ + static fromMat3(out: QuatLike, m: Readonly): QuatLike { + // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes + // article "Quaternion Calculus and Fast Animation". + const fTrace = m[0] + m[4] + m[8]; + let fRoot: number; + + if (fTrace > 0.0) { + // |w| > 1/2, may as well choose w > 1/2 + fRoot = Math.sqrt(fTrace + 1.0); // 2w + out[3] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; // 1/(4w) + out[0] = (m[5] - m[7]) * fRoot; + out[1] = (m[6] - m[2]) * fRoot; + out[2] = (m[1] - m[3]) * fRoot; + } else { + // |w| <= 1/2 + let i = 0; + if (m[4] > m[0]) { i = 1; } + if (m[8] > m[i * 3 + i]) { i = 2; } + const j = (i + 1) % 3; + const k = (i + 2) % 3; + + fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0); + out[i] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot; + out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; + out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + } + + return out; + } + + /** + * Creates a quaternion from the given euler angle x, y, z. + * @category Static + * + * @param out - the receiving quaternion + * @param x - Angle to rotate around X axis in degrees. + * @param y - Angle to rotate around Y axis in degrees. + * @param z - Angle to rotate around Z axis in degrees. + * @param {'xyz'|'xzy'|'yxz'|'yzx'|'zxy'|'zyx'} order - Intrinsic order for conversion, default is zyx. + * @returns `out` + */ + static fromEuler(out: QuatLike, x: number, y: number, z: number, order = Quat.#DEFAULT_ANGLE_ORDER): QuatLike { + const halfToRad = (0.5 * Math.PI) / 180.0; + x *= halfToRad; + y *= halfToRad; + z *= halfToRad; + + const sx = Math.sin(x); + const cx = Math.cos(x); + const sy = Math.sin(y); + const cy = Math.cos(y); + const sz = Math.sin(z); + const cz = Math.cos(z); + + switch (order) { + case 'xyz': + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + + case 'xzy': + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + + case 'yxz': + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + + case 'yzx': + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + + case 'zxy': + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + + case 'zyx': + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + + default: + throw new Error(`Unknown angle order ${order}`); + } + + return out; + } + + /** + * Returns a string representation of a quatenion + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a: Readonly): string { + return `Quat(${a.join(', ')})`; + } + + /** + * Creates a new quat initialized with values from an existing quaternion + * @category Static + * + * @param a - quaternion to clone + * @returns a new quaternion + */ + static clone(a: Readonly): Quat { + return new Quat(a); + } + + /** + * Creates a new quat initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new quaternion + */ + static fromValues(x: number, y: number, z: number, w: number): Quat { + return new Quat(x, y, z, w); + } + + /** + * Copy the values from one quat to another + * @category Static + * + * @param out - the receiving quaternion + * @param a - the source quaternion + * @returns `out` + */ + static copy(out: QuatLike, a: Readonly): QuatLike { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + + /** + * Set the components of a {@link Quat} to the given values + * @category Static + * + * @param out - the receiving quaternion + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static set(out: QuatLike, x: number, y: number, z: number, w: number): QuatLike { return out; } + + /** + * Adds two {@link Quat}'s + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static add(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; } + + /** + * Alias for {@link Quat.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out: QuatLike, a: Readonly, b: Readonly): QuatLike { return out; } + + /** + * Scales a quat by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param b - amount to scale the vector by + * @returns `out` + */ + static scale(out: QuatLike, a: Readonly, scale: number): QuatLike { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + out[3] = a[3] * scale; + return out; + } + + /** + * Calculates the dot product of two quat's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a: Readonly, b: Readonly): number { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + + /** + * Performs a linear interpolation between two quat's + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static lerp(out: QuatLike, a: Readonly, b: Readonly, t: number): QuatLike { return out; } + + /** + * Calculates the magnitude (length) of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate length of + * @returns length of `a` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static magnitude(a: Readonly): number { return 0; } + + /** + * Alias for {@link Quat.magnitude} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mag(a: Readonly): number { return 0; } + + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Alias for {@link Quat.magnitude} + * @category Static + * @deprecated Use {@link Quat.mag} + */ + static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Calculates the squared length of a {@link Quat} + * @category Static + * + * @param a - quaternion to calculate squared length of + * @returns squared length of a + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static squaredLength(a: Readonly): number { return 0; } + + /** + * Alias for {@link Quat.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Normalize a {@link Quat} + * @category Static + * + * @param out - the receiving quaternion + * @param a - quaternion to normalize + * @returns `out` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static normalize(out: QuatLike, a: Readonly): QuatLike { return out; } + + /** + * Returns whether the quaternions have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first quaternion. + * @param b - The second quaternion. + * @returns True if the vectors are equal, false otherwise. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static exactEquals(a: Readonly, b: Readonly): boolean { return false; } + + /** + * Returns whether the quaternions have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static equals(a: Readonly, b: Readonly): boolean { return false; } + + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * @category Static + * + * @param out - the receiving quaternion. + * @param a - the initial vector + * @param b - the destination vector + * @returns `out` + */ + static rotationTo(out: QuatLike, a: Readonly, b: Readonly): QuatLike { + const dot = Vec3.dot(a, b); + + if (dot < -0.999999) { + Vec3.cross(Quat.#TMP_VEC3, Quat.#X_UNIT_VEC3, a); + if (Vec3.mag(Quat.#TMP_VEC3) < 0.000001) { Vec3.cross(Quat.#TMP_VEC3, Quat.#Y_UNIT_VEC3, a); } + Vec3.normalize(Quat.#TMP_VEC3, Quat.#TMP_VEC3); + Quat.setAxisAngle(out, Quat.#TMP_VEC3, Math.PI); + return out; + } else if (dot > 0.999999) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } else { + Vec3.cross(Quat.#TMP_VEC3, a, b); + out[0] = Quat.#TMP_VEC3[0]; + out[1] = Quat.#TMP_VEC3[1]; + out[2] = Quat.#TMP_VEC3[2]; + out[3] = 1 + dot; + return Quat.normalize(out, out); + } + } + + /** + * Performs a spherical linear interpolation with two control points + * @category Static + * + * @param out - the receiving quaternion + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static sqlerp(out: QuatLike, a: Readonly, b: Readonly, c: Readonly, + d: Readonly, t: number): QuatLike { + Quat.slerp(Quat.#TMP_QUAT1, a, d, t); + Quat.slerp(Quat.#TMP_QUAT2, b, c, t); + Quat.slerp(out, Quat.#TMP_QUAT1, Quat.#TMP_QUAT2, 2 * t * (1 - t)); + + return out; + } + + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * @category Static + * + * @param out - The receiving quaternion + * @param view - the vector representing the viewing direction + * @param right - the vector representing the local `right` direction + * @param up - the vector representing the local `up` direction + * @returns `out` + */ + static setAxes(out: QuatLike, view: Readonly, right: Readonly, up: Readonly): QuatLike { + Quat.#TMP_MAT3[0] = right[0]; + Quat.#TMP_MAT3[3] = right[1]; + Quat.#TMP_MAT3[6] = right[2]; + + Quat.#TMP_MAT3[1] = up[0]; + Quat.#TMP_MAT3[4] = up[1]; + Quat.#TMP_MAT3[7] = up[2]; + + Quat.#TMP_MAT3[2] = -view[0]; + Quat.#TMP_MAT3[5] = -view[1]; + Quat.#TMP_MAT3[8] = -view[2]; + + return Quat.normalize(out, Quat.fromMat3(out, Quat.#TMP_MAT3)); + } +} + +// Methods which re-use the Vec4 implementation +Quat.set = Vec4.set; +Quat.add = Vec4.add; +Quat.lerp = Vec4.lerp; +Quat.normalize = Vec4.normalize; +Quat.squaredLength = Vec4.squaredLength; +Quat.sqrLen = Vec4.squaredLength; +Quat.exactEquals = Vec4.exactEquals; +Quat.equals = Vec4.equals; +Quat.magnitude = Vec4.magnitude; + +// Instance method alias assignments +Quat.prototype.mul = Quat.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method + +// Static method alias assignments +Quat.mul = Quat.multiply; +Quat.mag = Quat.magnitude; +Quat.length = Quat.magnitude; +Quat.len = Quat.magnitude; diff --git a/src/_lib/f64/Quat2.ts b/src/_lib/f64/Quat2.ts new file mode 100644 index 00000000..7c1003b9 --- /dev/null +++ b/src/_lib/f64/Quat2.ts @@ -0,0 +1,1008 @@ +import { Mat4 } from './Mat4.js'; +import { Quat } from './Quat.js'; +import { GLM_EPSILON } from '#gl-matrix/common'; + +import type { Mat4Like, QuatLike, Quat2Like, Vec3Like } from '#gl-matrix/types'; + +/** + * Dual Quaternion + */ +export class Quat2 extends Float64Array { + // Temporary variables to prevent repeated allocations in the algorithms within Quat2. + // These are declared as TypedArrays to aid in tree-shaking. + + static #TMP_QUAT = new Float64Array(4); + static #TMP_VEC3 = new Float64Array(3); + + /** + * Create a {@link Quat2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { + switch (values.length) { + case 8: + super(values); break; + case 2: + super(values[0] as ArrayBufferLike, values[1], 8); break; + case 1: { + const v = values[0]; + if (typeof v === 'number') { + super([v, v, v, v, v, v, v, v]); + } else { + super(v as ArrayBufferLike, 0, 8); + } + break; + } + default: + super(8); + this[3] = 1; + break; + } + } + + // ============ + // Accessors + // ============ + + /** + * A string representation of `this` + * Equivalent to `Quat2.str(this);` + * + * @category Accessors + */ + get str(): string { + return Quat2.str(this); + } + + // =================== + // Instances methods + // =================== + + /** + * Copy the values from another {@link Quat2} into `this`. + * @category Methods + * + * @param a the source dual quaternion + * @returns `this` + */ + copy(a: Readonly): this { + super.set(a); + return this; + } + + // =================== + // Static accessors + // =================== + + /** + * @category Static + * + * @returns The number of bytes in a {@link Quat2}. + */ + static get BYTE_LENGTH(): number { + return 8 * Float64Array.BYTES_PER_ELEMENT; + } + + // =================== + // Static methods + // =================== + + /** + * Creates a new identity {@link Quat2} + * @category Static + * + * @returns a new dual quaternion [real -> rotation, dual -> translation] + */ + static create(): Quat2 { + return new Quat2(); + } + + /** + * Creates a {@link Quat2} quat initialized with values from an existing quaternion + * @category Static + * + * @param a - dual quaternion to clone + * @returns a new dual quaternion + */ + static clone(a: Quat2Like): Quat2 { + return new Quat2(a); + } + + /** + * Creates a new {@link Quat2} initialized with the given values + * @category Static + * + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns a new dual quaternion + */ + static fromValues(x1: number, y1: number, z1: number, w1: number, + x2: number, y2: number, z2: number, w2: number): Quat2 { + return new Quat2(x1, y1, z1, w1, x2, y2, z2, w2); + } + + /** + * Creates a new {@link Quat2} from the given values (quat and translation) + * @category Static + * + * @param x1 - X component (rotation) + * @param y1 - Y component (rotation) + * @param z1 - Z component (rotation) + * @param w1 - W component (rotation) + * @param x2 - X component (translation) + * @param y2 - Y component (translation) + * @param z2 - Z component (translation) + * @returns a new dual quaternion + */ + static fromRotationTranslationValues(x1: number, y1: number, z1: number, w1: number, + x2: number, y2: number, z2: number): Quat2 { + const ax = x2 * 0.5; + const ay = y2 * 0.5; + const az = z2 * 0.5; + + return new Quat2(x1, y1, z1, w1, + ax * w1 + ay * z1 - az * y1, + ay * w1 + az * x1 - ax * z1, + az * w1 + ax * y1 - ay * x1, + -ax * x1 - ay * y1 - az * z1); + } + + /** + * Sets a {@link Quat2} from a quaternion and a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @param t - translation vector + * @returns `out` + */ + static fromRotationTranslation(out: Quat2Like, q: Readonly, t: Readonly): Quat2Like { + const ax = t[0] * 0.5; + const ay = t[1] * 0.5; + const az = t[2] * 0.5; + const bx = q[0]; + const by = q[1]; + const bz = q[2]; + const bw = q[3]; + out[0] = bx; + out[1] = by; + out[2] = bz; + out[3] = bw; + out[4] = ax * bw + ay * bz - az * by; + out[5] = ay * bw + az * bx - ax * bz; + out[6] = az * bw + ax * by - ay * bx; + out[7] = -ax * bx - ay * by - az * bz; + return out; + } + + /** + * Sets a {@link Quat2} from a translation + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param t - translation vector + * @returns `out` + */ + static fromTranslation(out: Quat2Like, t: Readonly): Quat2Like { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = t[0] * 0.5; + out[5] = t[1] * 0.5; + out[6] = t[2] * 0.5; + out[7] = 0; + return out; + } + + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param q - a normalized quaternion + * @returns `out` + */ + static fromRotation(out: Quat2Like, q: Readonly): Quat2Like { + out[0] = q[0]; + out[1] = q[1]; + out[2] = q[2]; + out[3] = q[3]; + out[4] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + return out; + } + + /** + * Sets a {@link Quat2} from a quaternion + * @category Static + * + * @param out - dual quaternion receiving operation result + * @param a - the matrix + * @returns `out` + */ + static fromMat4(out: Quat2Like, a: Readonly): Quat2Like { + Mat4.getRotation(Quat2.#TMP_QUAT, a); + Mat4.getTranslation(Quat2.#TMP_VEC3, a); + return Quat2.fromRotationTranslation(out, Quat2.#TMP_QUAT, Quat2.#TMP_VEC3); + } + + /** + * Copy the values from one {@link Quat2} to another + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the source dual quaternion + * @returns `out` + */ + static copy(out: Quat2Like, a: Readonly): Quat2Like { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + return out; + } + + /** + * Set a {@link Quat2} to the identity dual quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @returns `out` + */ + static identity(out: QuatLike): QuatLike { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + out[4] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + return out; + } + + /** + * Set the components of a {@link Quat2} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x1 - 1st X component + * @param y1 - 1st Y component + * @param z1 - 1st Z component + * @param w1 - 1st W component + * @param x2 - 2nd X component + * @param y2 - 2nd Y component + * @param z2 - 2nd Z component + * @param w2 - 2nd W component + * @returns `out` + */ + static set(out: Quat2Like, x1: number, y1: number, z1: number, w1: number, + x2: number, y2: number, z2: number, w2: number): Quat2Like { + out[0] = x1; + out[1] = y1; + out[2] = z1; + out[3] = w1; + out[4] = x2; + out[5] = y2; + out[6] = z2; + out[7] = w2; + return out; + } + + /** + * Gets the real part of a dual quat + * @category Static + * + * @param out - real part + * @param a - Dual Quaternion + * @return `out` + */ + static getReal(out: QuatLike, a: Readonly): QuatLike { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + }; + + /** + * Gets the dual part of a dual quat + * @category Static + * + * @param out - dual part + * @param a - Dual Quaternion + * @return `out` + */ + static getDual(out: QuatLike, a: Readonly): QuatLike { + out[0] = a[4]; + out[1] = a[5]; + out[2] = a[6]; + out[3] = a[7]; + return out; + } + + /** + * Set the real component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the real part + * @return `out` + */ + static setReal(out: Quat2Like, a: Readonly): Quat2Like { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + }; + + /** + * Set the dual component of a {@link Quat2} to the given quaternion + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - a quaternion representing the dual part + * @return `out` + */ + static setDual(out: Quat2Like, a: Readonly): Quat2Like { + out[4] = a[0]; + out[5] = a[1]; + out[6] = a[2]; + out[7] = a[3]; + return out; + } + + /** + * Gets the translation of a normalized {@link Quat2} + * @category Static + * + * @param out - the receiving translation vector + * @param a - Dual Quaternion to be decomposed + * @return `out` + */ + static getTranslation(out: Vec3Like, a: Readonly): Vec3Like { + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const bx = -a[0]; + const by = -a[1]; + const bz = -a[2]; + const bw = a[3]; + out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; + out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; + out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + return out; + } + + /** + * Translates a {@link Quat2} by the given vector + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out: Quat2Like, a: Readonly, v: Readonly): Quat2Like { + const ax1 = a[0]; + const ay1 = a[1]; + const az1 = a[2]; + const aw1 = a[3]; + const bx1 = v[0] * 0.5; + const by1 = v[1] * 0.5; + const bz1 = v[2] * 0.5; + const ax2 = a[4]; + const ay2 = a[5]; + const az2 = a[6]; + const aw2 = a[7]; + out[0] = ax1; + out[1] = ay1; + out[2] = az1; + out[3] = aw1; + out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2; + out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2; + out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2; + out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2; + return out; + } + + /** + * Rotates a {@link Quat2} around the X axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateX(out: Quat2Like, a: Readonly, rad: number): Quat2Like { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateX(out as QuatLike, a as QuatLike, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + + /** + * Rotates a {@link Quat2} around the Y axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateY(out: Quat2Like, a: Readonly, rad: number): Quat2Like { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateY(out as QuatLike, a as QuatLike, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + + /** + * Rotates a {@link Quat2} around the Z axis + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param rad - angle (in radians) to rotate + * @returns `out` + */ + static rotateZ(out: Quat2Like, a: Readonly, rad: number): Quat2Like { + let bx = -a[0]; + let by = -a[1]; + let bz = -a[2]; + let bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + const ax1 = ax * bw + aw * bx + ay * bz - az * by; + const ay1 = ay * bw + aw * by + az * bx - ax * bz; + const az1 = az * bw + aw * bz + ax * by - ay * bx; + const aw1 = aw * bw - ax * bx - ay * by - az * bz; + Quat.rotateZ(out as QuatLike, a as QuatLike, rad); + bx = out[0]; + by = out[1]; + bz = out[2]; + bw = out[3]; + out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + return out; + } + + /** + * Rotates a {@link Quat2} by a given quaternion (a * q) + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param q - quaternion to rotate by + * @returns `out` + */ + static rotateByQuatAppend(out: Quat2Like, a: Readonly, q: Readonly): Quat2Like { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + let ax = a[0]; + let ay = a[1]; + let az = a[2]; + let aw = a[3]; + + out[0] = ax * qw + aw * qx + ay * qz - az * qy; + out[1] = ay * qw + aw * qy + az * qx - ax * qz; + out[2] = az * qw + aw * qz + ax * qy - ay * qx; + out[3] = aw * qw - ax * qx - ay * qy - az * qz; + ax = a[4]; + ay = a[5]; + az = a[6]; + aw = a[7]; + out[4] = ax * qw + aw * qx + ay * qz - az * qy; + out[5] = ay * qw + aw * qy + az * qx - ax * qz; + out[6] = az * qw + aw * qz + ax * qy - ay * qx; + out[7] = aw * qw - ax * qx - ay * qy - az * qz; + return out; + } + + /** + * Rotates a {@link Quat2} by a given quaternion (q * a) + * @category Static + * + * @param out - the receiving dual quaternion + * @param q - quaternion to rotate by + * @param a - the dual quaternion to rotate + * @returns `out` + */ + static rotateByQuatPrepend(out: Quat2Like, q: Readonly, a: Readonly): Quat2Like { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + let bx = a[0]; + let by = a[1]; + let bz = a[2]; + let bw = a[3]; + + out[0] = qx * bw + qw * bx + qy * bz - qz * by; + out[1] = qy * bw + qw * by + qz * bx - qx * bz; + out[2] = qz * bw + qw * bz + qx * by - qy * bx; + out[3] = qw * bw - qx * bx - qy * by - qz * bz; + bx = a[4]; + by = a[5]; + bz = a[6]; + bw = a[7]; + out[4] = qx * bw + qw * bx + qy * bz - qz * by; + out[5] = qy * bw + qw * by + qz * bx - qx * bz; + out[6] = qz * bw + qw * bz + qx * by - qy * bx; + out[7] = qw * bw - qx * bx - qy * by - qz * bz; + return out; + } + + /** + * Rotates a {@link Quat2} around a given axis. Does the normalization automatically + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the dual quaternion to rotate + * @param axis - the axis to rotate around + * @param rad - how far the rotation should be + * @returns `out` + */ + static rotateAroundAxis(out: Quat2Like, a: Readonly, axis: Readonly, rad: number): Quat2Like { + // Special case for rad = 0 + if (Math.abs(rad) < GLM_EPSILON) { + return Quat2.copy(out, a); + } + const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]); + + rad *= 0.5; + const s = Math.sin(rad); + const bx = (s * axis[0]) / axisLength; + const by = (s * axis[1]) / axisLength; + const bz = (s * axis[2]) / axisLength; + const bw = Math.cos(rad); + + const ax1 = a[0]; + const ay1 = a[1]; + const az1 = a[2]; + const aw1 = a[3]; + out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by; + out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz; + out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx; + out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz; + + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + out[4] = ax * bw + aw * bx + ay * bz - az * by; + out[5] = ay * bw + aw * by + az * bx - ax * bz; + out[6] = az * bw + aw * bz + ax * by - ay * bx; + out[7] = aw * bw - ax * bx - ay * by - az * bz; + + return out; + } + + /** + * Adds two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + return out; + } + + /** + * Multiplies two {@link Quat2}s + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - the first operand + * @param b - the second operand + * @returns {quat2} out + */ + static multiply(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like { + const ax0 = a[0]; + const ay0 = a[1]; + const az0 = a[2]; + const aw0 = a[3]; + const bx1 = b[4]; + const by1 = b[5]; + const bz1 = b[6]; + const bw1 = b[7]; + const ax1 = a[4]; + const ay1 = a[5]; + const az1 = a[6]; + const aw1 = a[7]; + const bx0 = b[0]; + const by0 = b[1]; + const bz0 = b[2]; + const bw0 = b[3]; + out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0; + out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0; + out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0; + out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0; + out[4] = + ax0 * bw1 + + aw0 * bx1 + + ay0 * bz1 - + az0 * by1 + + ax1 * bw0 + + aw1 * bx0 + + ay1 * bz0 - + az1 * by0; + out[5] = + ay0 * bw1 + + aw0 * by1 + + az0 * bx1 - + ax0 * bz1 + + ay1 * bw0 + + aw1 * by0 + + az1 * bx0 - + ax1 * bz0; + out[6] = + az0 * bw1 + + aw0 * bz1 + + ax0 * by1 - + ay0 * bx1 + + az1 * bw0 + + aw1 * bz0 + + ax1 * by0 - + ay1 * bx0; + out[7] = + aw0 * bw1 - + ax0 * bx1 - + ay0 * by1 - + az0 * bz1 + + aw1 * bw0 - + ax1 * bx0 - + ay1 * by0 - + az1 * bz0; + return out; + } + + /** + * Alias for {@link Quat2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out: Quat2Like, a: Readonly, b: Readonly): Quat2Like { return out; } + + /** + * Scales a {@link Quat2} by a scalar value + * @category Static + * + * @param out - the receiving dual quaterion + * @param a - the dual quaternion to scale + * @param b - scalar value to scale the dual quaterion by + * @returns `out` + */ + static scale(out: Quat2Like, a: Readonly, b: number): Quat2Like { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + return out; + } + + /** + * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts) + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dot(a: Readonly, b: Readonly): number { return 0; } + + /** + * Performs a linear interpolation between two {@link Quat2}s + * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`) + * @category Static + * + * @param out - the receiving dual quat + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Quat2Like, a: Readonly, b: Readonly, t: number): Quat2Like { + const mt = 1 - t; + if (Quat2.dot(a, b) < 0) { t = -t; } + + out[0] = a[0] * mt + b[0] * t; + out[1] = a[1] * mt + b[1] * t; + out[2] = a[2] * mt + b[2] * t; + out[3] = a[3] * mt + b[3] * t; + out[4] = a[4] * mt + b[4] * t; + out[5] = a[5] * mt + b[5] * t; + out[6] = a[6] * mt + b[6] * t; + out[7] = a[7] * mt + b[7] * t; + + return out; + } + + /** + * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quat to calculate inverse of + * @returns `out` + */ + static invert(out: Quat2Like, a: Readonly): Quat2Like { + const sqlen = Quat2.squaredLength(a); + out[0] = -a[0] / sqlen; + out[1] = -a[1] / sqlen; + out[2] = -a[2] / sqlen; + out[3] = a[3] / sqlen; + out[4] = -a[4] / sqlen; + out[5] = -a[5] / sqlen; + out[6] = -a[6] / sqlen; + out[7] = a[7] / sqlen; + return out; + } + + /** + * Calculates the conjugate of a {@link Quat2}. If the dual quaternion is normalized, this function is faster than + * {@link Quat2.invert} and produces the same result. + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to calculate conjugate of + * @returns `out` + */ + static conjugate(out: Quat2Like, a: Readonly): Quat2Like { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + out[4] = -a[4]; + out[5] = -a[5]; + out[6] = -a[6]; + out[7] = a[7]; + return out; + } + + /** + * Calculates the magnitude (length) of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate length of + * @returns length of `a` + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static magnitude(a: Readonly): number { return 0; } + + /** + * Alias for {@link Quat2.magnitude} + * @category Static + */ + static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Alias for {@link Quat2.magnitude} + * @category Static + * @deprecated Use {@link Quat2.mag} + */ + static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Calculates the squared length of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to calculate squared length of + * @returns squared length of a + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static squaredLength(a: Readonly): number { return 0; } + + /** + * Alias for {@link Quat2.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Normalize a {@link Quat2} + * @category Static + * + * @param out - the receiving dual quaternion + * @param a - dual quaternion to normalize + * @returns `out` + */ + static normalize(out: Quat2Like, a: Readonly): Quat2Like { + let magnitude = Quat2.squaredLength(a); + if (magnitude > 0) { + magnitude = Math.sqrt(magnitude); + + const a0 = a[0] / magnitude; + const a1 = a[1] / magnitude; + const a2 = a[2] / magnitude; + const a3 = a[3] / magnitude; + + const b0 = a[4]; + const b1 = a[5]; + const b2 = a[6]; + const b3 = a[7]; + + const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3; + + out[0] = a0; + out[1] = a1; + out[2] = a2; + out[3] = a3; + + out[4] = (b0 - a0 * a_dot_b) / magnitude; + out[5] = (b1 - a1 * a_dot_b) / magnitude; + out[6] = (b2 - a2 * a_dot_b) / magnitude; + out[7] = (b3 - a3 * a_dot_b) / magnitude; + } + return out; + } + + /** + * Returns a string representation of a {@link Quat2} + * @category Static + * + * @param a - dual quaternion to represent as a string + * @returns string representation of the vector + */ + static str(a: Readonly): string { + return `Quat2(${a.join(', ')})`; + } + + /** + * Returns whether the {@link Quat2}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean { + return ( + a[0] === b[0] && + a[1] === b[1] && + a[2] === b[2] && + a[3] === b[3] && + a[4] === b[4] && + a[5] === b[5] && + a[6] === b[6] && + a[7] === b[7] + ); + } + + /** + * Returns whether the {@link Quat2}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first dual quaternion. + * @param b - The second dual quaternion. + * @returns True if the dual quaternions are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + return ( + Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && + Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && + Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && + Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && + Math.abs(a4 - b4) <= GLM_EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && + Math.abs(a5 - b5) <= GLM_EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && + Math.abs(a6 - b6) <= GLM_EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && + Math.abs(a7 - b7) <= GLM_EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) + ); + } +} + +// Methods which re-use the Quat implementation +// @ts-expect-error: Ignore type error coercion. +Quat2.dot = Quat.dot; +// @ts-expect-error: Ignore type error coercion. +Quat2.squaredLength = Quat.squaredLength; +// @ts-expect-error: Ignore type error coercion. +Quat2.sqrLen = Quat.squaredLength; +// @ts-expect-error: Ignore type error coercion. +Quat2.mag = Quat.magnitude; +// @ts-expect-error: Ignore type error coercion. +Quat2.length = Quat.magnitude; +// @ts-expect-error: Ignore type error coercion. +Quat2.len = Quat.magnitude; + +// Static method alias assignments +Quat2.mul = Quat2.multiply; diff --git a/src/_lib/f64/Vec2.ts b/src/_lib/f64/Vec2.ts new file mode 100644 index 00000000..6731c5fb --- /dev/null +++ b/src/_lib/f64/Vec2.ts @@ -0,0 +1,1002 @@ +import { GLM_EPSILON } from '#gl-matrix/common'; + +import type { Mat2Like, Mat2dLike, Mat3Like, Mat4Like, Vec2Like } from '#gl-matrix/types'; + +/** + * 2 Dimensional Vector + */ +export class Vec2 extends Float64Array { + /** + * Create a {@link Vec2}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { + switch (values.length) { + case 2:{ + const v = values[0]; + if (typeof v === 'number') { + super([v, values[1]!]); + } else { + super(v as ArrayBufferLike, values[1], 2); + } + break; + } + case 1: { + const v = values[0]; + if (typeof v === 'number') { + super([v, v]); + } else { + super(v as ArrayBufferLike, 0, 2); + } + break; + } + default: + super(2); break; + } + } + + // ============ + // Accessors + // ============ + + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x(): number { return this[0]; } + set x(value: number) { this[0] = value; } + + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y(): number { return this[1]; } + set y(value: number) { this[1] = value; } + + // Alternate set of getters and setters in case this is being used to define + // a color. + + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r(): number { return this[0]; } + set r(value: number) { this[0] = value; } + + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g(): number { return this[1]; } + set g(value: number) { this[1] = value; } + + /** + * The magnitude (length) of this. + * Equivalent to `Vec2.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number { + return Math.hypot(this[0], this[1]); + } + + /** + * Alias for {@link Vec2.magnitude} + * + * @category Accessors + */ + get mag(): number { return this.magnitude; } + + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec2.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude(): number { + const x = this[0]; + const y = this[1]; + return x * x + y * y; + } + + /** + * Alias for {@link Vec2.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag(): number { return this.squaredMagnitude; } + + /** + * A string representation of `this` + * Equivalent to `Vec2.str(this);` + * + * @category Accessors + */ + get str(): string { + return Vec2.str(this); + } + + // =================== + // Instances methods + // =================== + + /** + * Copy the values from another {@link Vec2} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this { + this.set(a); + return this; + } + + // Instead of zero(), use a.fill(0) for instances; + + /** + * Adds a {@link Vec2} to `this`. + * Equivalent to `Vec2.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b: Readonly): this { + this[0] += b[0]; + this[1] += b[1]; + return this; + } + + /** + * Subtracts a {@link Vec2} from `this`. + * Equivalent to `Vec2.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b: Readonly): this { + this[0] -= b[0]; + this[1] -= b[1]; + return this; + } + + /** + * Alias for {@link Vec2.subtract} + * @category Methods + */ + sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Multiplies `this` by a {@link Vec2}. + * Equivalent to `Vec2.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this { + this[0] *= b[0]; + this[1] *= b[1]; + return this; + } + + /** + * Alias for {@link Vec2.multiply} + * @category Methods + */ + mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Divides `this` by a {@link Vec2}. + * Equivalent to `Vec2.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b: Readonly): this { + this[0] /= b[0]; + this[1] /= b[1]; + return this; + } + + /** + * Alias for {@link Vec2.divide} + * @category Methods + */ + div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec2.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b: number): this { + this[0] *= b; + this[1] *= b; + return this; + } + + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b: Readonly, scale: number): this { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + return this; + } + + /** + * Calculates the Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b: Readonly): number { + return Vec2.distance(this, b); + } + /** + * Alias for {@link Vec2.distance} + * @category Methods + */ + dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Calculates the squared Euclidean distance between another {@link Vec2} and `this`. + * Equivalent to `Vec2.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b: Readonly): number { + return Vec2.squaredDistance(this, b); + } + /** + * Alias for {@link Vec2.squaredDistance} + * @category Methods + */ + sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Negates the components of `this`. + * Equivalent to `Vec2.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate(): this { + this[0] *= -1; + this[1] *= -1; + return this; + } + + /** + * Inverts the components of `this`. + * Equivalent to `Vec2.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this { + this[0] = 1.0 / this[0]; + this[1] = 1.0 / this[1]; + return this; + } + + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec2.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs(): this { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + return this; + } + + /** + * Calculates the dot product of this and another {@link Vec2}. + * Equivalent to `Vec2.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b: Readonly): number { + return this[0] * b[0] + this[1] * b[1]; + } + + /** + * Normalize `this`. + * Equivalent to `Vec2.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize(): this { + return Vec2.normalize(this, this) as this; + } + + // =================== + // Static accessors + // =================== + + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec2}. + */ + static get BYTE_LENGTH(): number { + return 2 * Float64Array.BYTES_PER_ELEMENT; + } + + // =================== + // Static methods + // =================== + + /** + * Creates a new, empty {@link Vec2} + * @category Static + * + * @returns A new 2D vector + */ + static create(): Vec2 { + return new Vec2(); + } + + /** + * Creates a new {@link Vec2} initialized with values from an existing vector + * @category Static + * + * @param a - Vector to clone + * @returns A new 2D vector + */ + static clone(a: Readonly): Vec2 { + return new Vec2(a); + } + + /** + * Creates a new {@link Vec2} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @returns A new 2D vector + */ + static fromValues(x: number, y: number): Vec2 { + return new Vec2(x, y); + } + + /** + * Copy the values from one {@link Vec2} to another + * @category Static + * + * @param out - the receiving vector + * @param a - The source vector + * @returns `out` + */ + static copy(out: Vec2Like, a: Readonly): Vec2Like { + out[0] = a[0]; + out[1] = a[1]; + return out; + } + + /** + * Set the components of a {@link Vec2} to the given values + * @category Static + * + * @param out - The receiving vector + * @param x - X component + * @param y - Y component + * @returns `out` + */ + static set(out: Vec2Like, x: number, y: number): Vec2Like { + out[0] = x; + out[1] = y; + return out; + } + + /** + * Adds two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + return out; + } + + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static subtract(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + return out; + } + + /** + * Alias for {@link Vec2.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; } + + /** + * Multiplies two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + return out; + } + + /** + * Alias for {@link Vec2.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; } + + /** + * Divides two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static divide(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + return out; + } + + /** + * Alias for {@link Vec2.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { return [0, 0]; } + + /** + * Math.ceil the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to ceil + * @returns `out` + */ + static ceil(out: Vec2Like, a: Readonly): Vec2Like { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + return out; + } + + /** + * Math.floor the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to floor + * @returns `out` + */ + static floor(out: Vec2Like, a: Readonly): Vec2Like { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + return out; + } + + /** + * Returns the minimum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static min(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + return out; + } + + /** + * Returns the maximum of two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static max(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + return out; + } + + /** + * Math.round the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to round + * @returns `out` + */ + static round(out: Vec2Like, a: Readonly): Vec2Like { + out[0] = Math.round(a[0]); + out[1] = Math.round(a[1]); + return out; + } + + /** + * Scales a {@link Vec2} by a scalar number + * @category Static + * + * @param out - The receiving vector + * @param a - The vector to scale + * @param b - Amount to scale the vector by + * @returns `out` + */ + static scale(out: Vec2Like, a: Readonly, b: number): Vec2Like { + out[0] = a[0] * b; + out[1] = a[1] * b; + return out; + } + + /** + * Adds two Vec2's after scaling the second operand by a scalar value + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param scale - The amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out: Vec2Like, a: Readonly, b: Readonly, scale: number): Vec2Like { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + return out; + } + + /** + * Calculates the Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns distance between `a` and `b` + */ + static distance(a: Readonly, b: Readonly): number { + return Math.hypot(b[0] - a[0], b[1] - a[1]); + } + + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a: Readonly, b: Readonly): number { return 0; } + + /** + * Calculates the squared Euclidean distance between two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Squared distance between `a` and `b` + */ + static squaredDistance(a: Readonly, b: Readonly): number { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + return x * x + y * y; + } + + /** + * Alias for {@link Vec2.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a: Readonly, b: Readonly): number { return 0; } + + /** + * Calculates the magnitude (length) of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a: Readonly): number { + const x = a[0]; + const y = a[1]; + return Math.sqrt(x * x + y * y); + } + + /** + * Alias for {@link Vec2.magnitude} + * @category Static + */ + static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + // Length conflicts with Function.length + static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Alias for {@link Vec2.magnitude} + * @category Static + * @deprecated Use {@link Vec2.mag} + */ + static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Calculates the squared length of a {@link Vec2} + * @category Static + * + * @param a - Vector to calculate squared length of + * @returns Squared length of a + */ + static squaredLength(a: Readonly): number { + const x = a[0]; + const y = a[1]; + return x * x + y * y; + } + + /** + * Alias for {@link Vec2.squaredLength} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrLen(a: Readonly, b: Readonly): number { return 0; } + + /** + * Negates the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to negate + * @returns `out` + */ + static negate(out: Vec2Like, a: Readonly) { + out[0] = -a[0]; + out[1] = -a[1]; + return out; + } + + /** + * Returns the inverse of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to invert + * @returns `out` + */ + static inverse(out: Vec2Like, a: Readonly): Vec2Like { + out[0] = 1.0 / a[0]; + out[1] = 1.0 / a[1]; + return out; + } + + /** + * Returns the absolute value of the components of a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out: Vec2Like, a: Readonly): Vec2Like { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + return out; + } + + /** + * Normalize a {@link Vec2} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to normalize + * @returns `out` + */ + static normalize(out: Vec2Like, a: Readonly): Vec2Like { + const x = a[0]; + const y = a[1]; + let len = x * x + y * y; + if (len > 0) { + // TODO: evaluate use of glm_invsqrt here? + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + return out; + } + + /** + * Calculates the dot product of two {@link Vec2}s + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns Dot product of `a` and `b` + */ + static dot(a: Readonly, b: Readonly): number { + return a[0] * b[0] + a[1] * b[1]; + } + + /** + * Computes the cross product of two {@link Vec2}s + * Note that the cross product must by definition produce a 3D vector. + * For this reason there is also not instance equivalent for this function. + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static cross(out: Vec2Like, a: Readonly, b: Readonly): Vec2Like { + const z = a[0] * b[1] - a[1] * b[0]; + out[0] = out[1] = 0; + out[2] = z; + return out; + } + + /** + * Performs a linear interpolation between two {@link Vec2}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @param t - Interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Vec2Like, a: Readonly, b: Readonly, t: number): Vec2Like { + const ax = a[0]; + const ay = a[1]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + return out; + } + + /** + * Transforms the {@link Vec2} with a {@link Mat2} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[2] * y; + out[1] = m[1] * x + m[3] * y; + return out; + } + + /** + * Transforms the {@link Vec2} with a {@link Mat2d} + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat2d(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[2] * y + m[4]; + out[1] = m[1] * x + m[3] * y + m[5]; + return out; + } + + /** + * Transforms the {@link Vec2} with a {@link Mat3} + * 3rd vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat3(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[3] * y + m[6]; + out[1] = m[1] * x + m[4] * y + m[7]; + return out; + } + + /** + * Transforms the {@link Vec2} with a {@link Mat4} + * 3rd vector component is implicitly '0' + * 4th vector component is implicitly '1' + * + * @param out - The receiving vector + * @param a - The vector to transform + * @param m - Matrix to transform with + * @returns `out` + * @category Static + */ + static transformMat4(out: Vec2Like, a: Readonly, m: Readonly): Vec2Like { + const x = a[0]; + const y = a[1]; + out[0] = m[0] * x + m[4] * y + m[12]; + out[1] = m[1] * x + m[5] * y + m[13]; + return out; + } + + /** + * Rotate a 2D vector + * @category Static + * + * @param out - The receiving {@link Vec2} + * @param a - The {@link Vec2} point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotate(out: Vec2Like, a: Readonly, b: Readonly, rad: number): Vec2Like { + // Translate point to the origin + const p0 = a[0] - b[0]; + const p1 = a[1] - b[1]; + const sinC = Math.sin(rad); + const cosC = Math.cos(rad); + + // perform rotation and translate to correct position + out[0] = p0 * cosC - p1 * sinC + b[0]; + out[1] = p0 * sinC + p1 * cosC + b[1]; + + return out; + } + + /** + * Get the angle between two 2D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static angle(a: Readonly, b: Readonly): number { + const x1 = a[0]; + const y1 = a[1]; + const x2 = b[0]; + const y2 = b[1]; + // mag is the product of the magnitudes of a and b + const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2); + // mag &&.. short circuits if mag == 0 + const cosine = mag && (x1 * x2 + y1 * y2) / mag; + // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1 + return Math.acos(Math.min(Math.max(cosine, -1), 1)); + } + + /** + * Set the components of a {@link Vec2} to zero + * @category Static + * + * @param out - The receiving vector + * @returns `out` + */ + static zero(out: Vec2Like): Vec2Like { + out[0] = 0.0; + out[1] = 0.0; + return out; + } + + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors components are ===, `false` otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean { + return a[0] === b[0] && a[1] === b[1]; + } + + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns `true` if the vectors are approximately equal, `false` otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean { + const a0 = a[0]; + const a1 = a[1]; + const b0 = b[0]; + const b1 = b[1]; + return ( + Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && + Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) + ); + } + + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - Vector to represent as a string + * @returns String representation of the vector + */ + static str(a: Readonly): string { + return `Vec2(${a.join(', ')})`; + } +} + +// Instance method alias assignments +Vec2.prototype.sub = Vec2.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method +Vec2.prototype.mul = Vec2.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method +Vec2.prototype.div = Vec2.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method +Vec2.prototype.dist = Vec2.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method +Vec2.prototype.sqrDist = Vec2.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method + +// Static method alias assignments +Vec2.sub = Vec2.subtract; +Vec2.mul = Vec2.multiply; +Vec2.div = Vec2.divide; +Vec2.dist = Vec2.distance; +Vec2.sqrDist = Vec2.squaredDistance; +Vec2.sqrLen = Vec2.squaredLength; +Vec2.mag = Vec2.magnitude; +Vec2.length = Vec2.magnitude; +Vec2.len = Vec2.magnitude; diff --git a/src/_lib/f64/Vec3.ts b/src/_lib/f64/Vec3.ts new file mode 100644 index 00000000..6eeec3cf --- /dev/null +++ b/src/_lib/f64/Vec3.ts @@ -0,0 +1,1220 @@ +import { GLM_EPSILON } from '#gl-matrix/common'; + +import type { Mat3Like, Mat4Like, QuatLike, Vec3Like } from '#gl-matrix/types'; + +/** + * 3 Dimensional Vector + */ +export class Vec3 extends Float64Array { + /** + * Create a {@link Vec3}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { + switch (values.length) { + case 3: + super(values); break; + case 2: + super(values[0] as ArrayBufferLike, values[1], 3); break; + case 1: { + const v = values[0]; + if (typeof v === 'number') { + super([v, v, v]); + } else { + super(v as ArrayBufferLike, 0, 3); + } + break; + } + default: + super(3); break; + } + } + + // ============ + // Accessors + // ============ + + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x(): number { return this[0]; } + set x(value: number) { this[0] = value; } + + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y(): number { return this[1]; } + set y(value: number) { this[1] = value; } + + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z(): number { return this[2]; } + set z(value: number) { this[2] = value; } + + // Alternate set of getters and setters in case this is being used to define + // a color. + + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r(): number { return this[0]; } + set r(value: number) { this[0] = value; } + + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g(): number { return this[1]; } + set g(value: number) { this[1] = value; } + + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b(): number { return this[2]; } + set b(value: number) { this[2] = value; } + + /** + * The magnitude (length) of this. + * Equivalent to `Vec3.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number { + const x = this[0]; + const y = this[1]; + const z = this[2]; + return Math.sqrt(x * x + y * y + z * z); + } + + /** + * Alias for {@link Vec3.magnitude} + * + * @category Accessors + */ + get mag(): number { return this.magnitude; } + + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec3.squaredMagnitude(this);` + * + * @category Accessors + */ + get squaredMagnitude(): number { + const x = this[0]; + const y = this[1]; + const z = this[2]; + return x * x + y * y + z * z; + } + + /** + * Alias for {@link Vec3.squaredMagnitude} + * + * @category Accessors + */ + get sqrMag(): number { return this.squaredMagnitude; } + + /** + * A string representation of `this` + * Equivalent to `Vec3.str(this);` + * + * @category Accessors + */ + get str(): string { + return Vec3.str(this); + } + + // =================== + // Instances methods + // =================== + + /** + * Copy the values from another {@link Vec3} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this { + this.set(a); + return this; + } + + /** + * Adds a {@link Vec3} to `this`. + * Equivalent to `Vec3.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b: Readonly): this { + this[0] += b[0]; + this[1] += b[1]; + this[2] += b[2]; + return this; + } + + /** + * Subtracts a {@link Vec3} from `this`. + * Equivalent to `Vec3.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b: Readonly): this { + this[0] -= b[0]; + this[1] -= b[1]; + this[2] -= b[2]; + return this; + } + + /** + * Alias for {@link Vec3.subtract} + * @category Methods + */ + sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Multiplies `this` by a {@link Vec3}. + * Equivalent to `Vec3.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this { + this[0] *= b[0]; + this[1] *= b[1]; + this[2] *= b[2]; + return this; + } + + /** + * Alias for {@link Vec3.multiply} + * @category Methods + */ + mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Divides `this` by a {@link Vec3}. + * Equivalent to `Vec3.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b: Readonly): this { + this[0] /= b[0]; + this[1] /= b[1]; + this[2] /= b[2]; + return this; + } + + /** + * Alias for {@link Vec3.divide} + * @category Methods + */ + div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec3.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b: number): this { + this[0] *= b; + this[1] *= b; + this[2] *= b; + return this; + } + + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b: Readonly, scale: number): this { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + this[2] += b[2] * scale; + return this; + } + + /** + * Calculates the Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b: Readonly): number { + return Vec3.distance(this, b); + } + /** + * Alias for {@link Vec3.distance} + * @category Methods + */ + dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Calculates the squared Euclidean distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b: Readonly): number { + return Vec3.squaredDistance(this, b); + } + + /** + * Alias for {@link Vec3.squaredDistance} + * @category Methods + */ + sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Negates the components of `this`. + * Equivalent to `Vec3.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate(): this { + this[0] *= -1; + this[1] *= -1; + this[2] *= -1; + return this; + } + + /** + * Inverts the components of `this`. + * Equivalent to `Vec3.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this { + this[0] = 1.0 / this[0]; + this[1] = 1.0 / this[1]; + this[2] = 1.0 / this[2]; + return this; + } + + /** + * Sets each component of `this` to its absolute value. + * Equivalent to `Vec3.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs(): this { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + this[2] = Math.abs(this[2]); + return this; + } + + /** + * Calculates the dot product of this and another {@link Vec3}. + * Equivalent to `Vec3.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b: Readonly): number { + return this[0] * b[0] + this[1] * b[1] + this[2] * b[2]; + } + + /** + * Normalize `this`. + * Equivalent to `Vec3.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize(): this { + return Vec3.normalize(this, this) as this; + } + + // =================== + // Static accessors + // =================== + + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec3}. + */ + static get BYTE_LENGTH(): number { + return 3 * Float64Array.BYTES_PER_ELEMENT; + } + + // =================== + // Static methods + // =================== + + /** + * Creates a new, empty vec3 + * @category Static + * + * @returns a new 3D vector + */ + static create(): Vec3 { + return new Vec3(); + } + + /** + * Creates a new vec3 initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 3D vector + */ + static clone(a: Readonly): Vec3 { + return new Vec3(a); + } + + /** + * Calculates the magnitude (length) of a {@link Vec3} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a: Readonly): number { + const x = a[0]; + const y = a[1]; + const z = a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.magnitude} + * @category Static + */ + static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + // Length conflicts with Function.length + static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.mag} + */ + static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Creates a new vec3 initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns a new 3D vector + */ + static fromValues(x: number, y: number, z: number): Vec3 { + return new Vec3(x, y, z); + } + + /** + * Copy the values from one vec3 to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out: Vec3Like, a: Readonly): Vec3Like { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + return out; + } + + /** + * Set the components of a vec3 to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns `out` + */ + static set(out: Vec3Like, x: number, y: number, z: number): Vec3Like { + out[0] = x; + out[1] = y; + out[2] = z; + return out; + } + + /** + * Adds two {@link Vec3}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + return out; + } + + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + return out; + } + + /** + * Alias for {@link Vec3.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; }; + + /** + * Multiplies two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + return out; + } + + /** + * Alias for {@link Vec3.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; } + + /** + * Divides two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + out[2] = a[2] / b[2]; + return out; + } + + /** + * Alias for {@link Vec3.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { return [0, 0, 0]; }; + + /** + * Math.ceil the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out: Vec3Like, a: Readonly): Vec3Like { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + out[2] = Math.ceil(a[2]); + return out; + } + + /** + * Math.floor the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out: Vec3Like, a: Readonly): Vec3Like { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + out[2] = Math.floor(a[2]); + return out; + } + + /** + * Returns the minimum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + return out; + } + + /** + * Returns the maximum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + return out; + } + + /** + * symmetric round the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + /* + static round(out: Vec3Like, a: Readonly): Vec3Like { + out[0] = glMatrix.round(a[0]); + out[1] = glMatrix.round(a[1]); + out[2] = glMatrix.round(a[2]); + return out; + }*/ + + /** + * Scales a vec3 by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out: Vec3Like, a: Readonly, scale: number): Vec3Like { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + return out; + } + + /** + * Adds two vec3's after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out: Vec3Like, a: Readonly, b: Readonly, scale: number) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + return out; + } + + /** + * Calculates the Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a: Readonly, b: Readonly): number { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a: Readonly, b: Readonly): number { return 0; } + + /** + * Calculates the squared Euclidean distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a: Readonly, b: Readonly): number { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + return x * x + y * y + z * z; + } + + /** + * Alias for {@link Vec3.squaredDistance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a: Readonly, b: Readonly): number { return 0; } + + /** + * Calculates the squared length of a vec3 + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a: Readonly): number { + const x = a[0]; + const y = a[1]; + const z = a[2]; + return x * x + y * y + z * z; + } + + /** + * Alias for {@link Vec3.squaredLength} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrLen(a: Readonly, b: Readonly): number { return 0; } + + /** + * Negates the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out: Vec3Like, a: Readonly): Vec3Like { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + return out; + } + + /** + * Returns the inverse of the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out: Vec3Like, a: Readonly): Vec3Like { + out[0] = 1.0 / a[0]; + out[1] = 1.0 / a[1]; + out[2] = 1.0 / a[2]; + return out; + } + + /** + * Returns the absolute value of the components of a {@link Vec3} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out: Vec3Like, a: Readonly): Vec3Like { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + out[2] = Math.abs(a[2]); + return out; + } + + /** + * Normalize a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out: Vec3Like, a: Readonly): Vec3Like { + const x = a[0]; + const y = a[1]; + const z = a[2]; + let len = x * x + y * y + z * z; + if (len > 0) { + // TODO: evaluate use of glm_invsqrt here? + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + out[2] = a[2] * len; + return out; + } + + /** + * Calculates the dot product of two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a: Readonly, b: Readonly): number { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; + } + + /** + * Computes the cross product of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static cross(out: Vec3Like, a: Readonly, b: Readonly): Vec3Like { + const ax = a[0], + ay = a[1], + az = a[2]; + const bx = b[0], + by = b[1], + bz = b[2]; + + out[0] = ay * bz - az * by; + out[1] = az * bx - ax * bz; + out[2] = ax * by - ay * bx; + return out; + } + + /** + * Performs a linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + return out; + } + + /** + * Performs a spherical linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out: Vec3Like, a: Readonly, b: Readonly, t: number): Vec3Like { + const angle = Math.acos(Math.min(Math.max(Vec3.dot(a, b), -1), 1)); + const sinTotal = Math.sin(angle); + + const ratioA = Math.sin((1 - t) * angle) / sinTotal; + const ratioB = Math.sin(t * angle) / sinTotal; + out[0] = ratioA * a[0] + ratioB * b[0]; + out[1] = ratioA * a[1] + ratioB * b[1]; + out[2] = ratioA * a[2] + ratioB * b[2]; + + return out; + } + + /** + * Performs a hermite interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static hermite(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly, + d: Readonly, t: number): Vec3Like { + const factorTimes2 = t * t; + const factor1 = factorTimes2 * (2 * t - 3) + 1; + const factor2 = factorTimes2 * (t - 2) + t; + const factor3 = factorTimes2 * (t - 1); + const factor4 = factorTimes2 * (3 - 2 * t); + + out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; + out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; + out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; + + return out; + } + + /** + * Performs a bezier interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static bezier(out: Vec3Like, a: Readonly, b: Readonly, c: Readonly, + d: Readonly, t: number): Vec3Like { + const inverseFactor = 1 - t; + const inverseFactorTimesTwo = inverseFactor * inverseFactor; + const factorTimes2 = t * t; + const factor1 = inverseFactorTimesTwo * inverseFactor; + const factor2 = 3 * t * inverseFactorTimesTwo; + const factor3 = 3 * factorTimes2 * inverseFactor; + const factor4 = factorTimes2 * t; + + out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; + out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; + out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; + + return out; + } + + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned + * @returns `out` + */ + /* + static random(out: Vec3Like, scale) { + scale = scale === undefined ? 1.0 : scale; + + let r = glMatrix.RANDOM() * 2.0 * Math.PI; + let z = glMatrix.RANDOM() * 2.0 - 1.0; + let zScale = Math.sqrt(1.0 - z * z) * scale; + + out[0] = Math.cos(r) * zScale; + out[1] = Math.sin(r) * zScale; + out[2] = z * scale; + return out; + }*/ + + /** + * Transforms the vec3 with a mat4. + * 4th vector component is implicitly '1' + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out: Vec3Like, a: Readonly, m: Readonly): Vec3Like { + const x = a[0], + y = a[1], + z = a[2]; + const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1.0; + out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; + out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; + out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; + return out; + } + + /** + * Transforms the vec3 with a mat3. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - the 3x3 matrix to transform with + * @returns `out` + */ + static transformMat3(out: Vec3Like, a: Vec3Like, m: Mat3Like): Vec3Like { + const x = a[0], + y = a[1], + z = a[2]; + out[0] = x * m[0] + y * m[3] + z * m[6]; + out[1] = x * m[1] + y * m[4] + z * m[7]; + out[2] = x * m[2] + y * m[5] + z * m[8]; + return out; + } + + /** + * Transforms the vec3 with a quat + * Can also be used for dual quaternions. (Multiply it with the real part) + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out: Vec3Like, a: Readonly, q: Readonly): Vec3Like { + // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const w2 = q[3] * 2; + const x = a[0]; + const y = a[1]; + const z = a[2]; + // var qvec = [qx, qy, qz]; + // var uv = vec3.cross([], qvec, a); + const uvx = (qy * z - qz * y); + const uvy = (qz * x - qx * z); + const uvz = (qx * y - qy * x); + // var uuv = vec3.cross([], qvec, uv); + // vec3.scale(uuv, uuv, 2); + const uuvx = (qy * uvz - qz * uvy) * 2; + const uuvy = (qz * uvx - qx * uvz) * 2; + const uuvz = (qx * uvy - qy * uvx) * 2; + // vec3.scale(uv, uv, 2 * w); + // return vec3.add(out, a, vec3.add(out, uv, uuv)); + out[0] = x + (uvx * w2) + uuvx; + out[1] = y + (uvy * w2) + uuvy; + out[2] = z + (uvz * w2) + uuvz; + return out; + } + + /** + * Rotate a 3D vector around the x-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateX(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like { + const by = b[1]; + const bz = b[2]; + + // Translate point to the origin + const py = a[1] - by; + const pz = a[2] - bz; + + // perform rotation + // translate to correct position + out[0] = a[0]; + out[1] = (py * Math.cos(rad) - pz * Math.sin(rad)) + by; + out[2] = (py * Math.sin(rad) + pz * Math.cos(rad)) + bz; + + return out; + } + + /** + * Rotate a 3D vector around the y-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateY(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like { + const bx = b[0]; + const bz = b[2]; + + // Translate point to the origin + const px = a[0] - bx; + const pz = a[2] - bz; + + // perform rotation + // translate to correct position + out[0] = (pz * Math.sin(rad) + px * Math.cos(rad)) + bx; + out[1] = a[1]; + out[2] = (pz * Math.cos(rad) - px * Math.sin(rad)) + bz; + + return out; + } + + /** + * Rotate a 3D vector around the z-axis + * @category Static + * + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateZ(out: Vec3Like, a: Readonly, b: Readonly, rad: number): Vec3Like { + const bx = b[0]; + const by = b[1]; + + // Translate point to the origin + const px = a[0] - bx; + const py = a[1] - by; + + // perform rotation + // translate to correct position + out[0] = (px * Math.cos(rad) - py * Math.sin(rad)) + bx; + out[1] = (px * Math.sin(rad) + py * Math.cos(rad)) + by; + out[2] = b[2]; + + return out; + } + + /** + * Get the angle between two 3D vectors + * @category Static + * + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static angle(a: Readonly, b: Readonly) { + 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 mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz)); + const cosine = mag && Vec3.dot(a, b) / mag; + return Math.acos(Math.min(Math.max(cosine, -1), 1)); + } + + /** + * Set the components of a vec3 to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out: Vec3Like): Vec3Like { + out[0] = 0.0; + out[1] = 0.0; + out[2] = 0.0; + return out; + } + + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a: Readonly): string { + return `Vec3(${a.join(', ')})`; + } + + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; + } + + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + return ( + Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && + Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && + Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) + ); + } +} + +// Instance method alias assignments +Vec3.prototype.sub = Vec3.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method +Vec3.prototype.mul = Vec3.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method +Vec3.prototype.div = Vec3.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method +Vec3.prototype.dist = Vec3.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method +Vec3.prototype.sqrDist = Vec3.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method + +// Static method alias assignments +Vec3.sub = Vec3.subtract; +Vec3.mul = Vec3.multiply; +Vec3.div = Vec3.divide; +Vec3.dist = Vec3.distance; +Vec3.sqrDist = Vec3.squaredDistance; +Vec3.sqrLen = Vec3.squaredLength; +Vec3.mag = Vec3.magnitude; +Vec3.length = Vec3.magnitude; +Vec3.len = Vec3.magnitude; diff --git a/src/_lib/f64/Vec4.ts b/src/_lib/f64/Vec4.ts new file mode 100644 index 00000000..540d4c38 --- /dev/null +++ b/src/_lib/f64/Vec4.ts @@ -0,0 +1,1067 @@ +import { GLM_EPSILON } from '#gl-matrix/common'; + +import type { Mat4Like, QuatLike, Vec4Like } from '#gl-matrix/types'; + +/** + * 4 Dimensional Vector + */ +export class Vec4 extends Float64Array { + /** + * Create a {@link Vec4}. + * + * @category Constructor + */ + constructor(...values: [Readonly | ArrayBufferLike, number?] | number[]) { + switch (values.length) { + case 4: + super(values); break; + case 2: + super(values[0] as ArrayBufferLike, values[1], 4); break; + case 1: { + const v = values[0]; + if (typeof v === 'number') { + super([v, v, v, v]); + } else { + super(v as ArrayBufferLike, 0, 4); + } + break; + } + default: + super(4); break; + } + } + + // ============ + // Accessors + // ============ + + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector Components + */ + get x(): number { return this[0]; } + set x(value: number) { this[0] = value; } + + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector Components + */ + get y(): number { return this[1]; } + set y(value: number) { this[1] = value; } + + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector Components + */ + get z(): number { return this[2]; } + set z(value: number) { this[2] = value; } + + /** + * The w component of the vector. Equivalent to `this[3];` + * @category Vector Components + */ + get w(): number { return this[3]; } + set w(value: number) { this[3] = value; } + + // Alternate set of getters and setters in case this is being used to define + // a color. + + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color Components + */ + get r(): number { return this[0]; } + set r(value: number) { this[0] = value; } + + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color Components + */ + get g(): number { return this[1]; } + set g(value: number) { this[1] = value; } + + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color Components + */ + get b(): number { return this[2]; } + set b(value: number) { this[2] = value; } + + /** + * The a component of the vector. Equivalent to `this[3];` + * @category Color Components + */ + get a(): number { return this[3]; } + set a(value: number) { this[3] = value; } + + /** + * The magnitude (length) of this. + * Equivalent to `Vec4.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * TypedArrays to mean the number of elements in the array. + * + * @category Accessors + */ + get magnitude(): number { + const x = this[0]; + const y = this[1]; + const z = this[2]; + const w = this[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + + /** + * Alias for {@link Vec4.magnitude} + * + * @category Accessors + */ + get mag(): number { return this.magnitude; } + + /** + * A string representation of `this` + * Equivalent to `Vec4.str(this);` + * + * @category Accessors + */ + get str(): string { + return Vec4.str(this); + } + + // =================== + // Instances methods + // =================== + + /** + * Copy the values from another {@link Vec4} into `this`. + * @category Methods + * + * @param a the source vector + * @returns `this` + */ + copy(a: Readonly): this { + super.set(a); + return this; + } + + /** + * Adds a {@link Vec4} to `this`. + * Equivalent to `Vec4.add(this, this, b);` + * @category Methods + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b: Readonly): this { + this[0] += b[0]; + this[1] += b[1]; + this[2] += b[2]; + this[3] += b[3]; + return this; + } + + /** + * Subtracts a {@link Vec4} from `this`. + * Equivalent to `Vec4.subtract(this, this, b);` + * @category Methods + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b: Readonly): this { + this[0] -= b[0]; + this[1] -= b[1]; + this[2] -= b[2]; + this[3] -= b[3]; + return this; + } + + /** + * Alias for {@link Vec4.subtract} + * @category Methods + */ + sub(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Multiplies `this` by a {@link Vec4}. + * Equivalent to `Vec4.multiply(this, this, b);` + * @category Methods + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b: Readonly): this { + this[0] *= b[0]; + this[1] *= b[1]; + this[2] *= b[2]; + this[3] *= b[3]; + return this; + } + + /** + * Alias for {@link Vec4.multiply} + * @category Methods + */ + mul(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Divides `this` by a {@link Vec4}. + * Equivalent to `Vec4.divide(this, this, b);` + * @category Methods + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b: Readonly): this { + this[0] /= b[0]; + this[1] /= b[1]; + this[2] /= b[2]; + this[3] /= b[3]; + return this; + } + + /** + * Alias for {@link Vec4.divide} + * @category Methods + */ + div(b: Readonly): this { return this; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec4.scale(this, this, b);` + * @category Methods + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b: number): this { + this[0] *= b; + this[1] *= b; + this[2] *= b; + this[3] *= b; + return this; + } + + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);` + * @category Methods + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b: Readonly, scale: number): this { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + this[2] += b[2] * scale; + this[3] += b[3] * scale; + return this; + } + + /** + * Calculates the Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.distance(this, b);` + * @category Methods + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b: Readonly): number { + return Vec4.distance(this, b); + } + + /** + * Alias for {@link Vec4.distance} + * @category Methods + */ + dist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Calculates the squared Euclidean distance between another {@link Vec4} and `this`. + * Equivalent to `Vec4.squaredDistance(this, b);` + * @category Methods + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b: Readonly): number { + return Vec4.squaredDistance(this, b); + } + + /** + * Alias for {@link Vec4.squaredDistance} + * @category Methods + */ + sqrDist(b: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Negates the components of `this`. + * Equivalent to `Vec4.negate(this, this);` + * @category Methods + * + * @returns `this` + */ + negate(): this { + this[0] *= -1; + this[1] *= -1; + this[2] *= -1; + this[3] *= -1; + return this; + } + + /** + * Inverts the components of `this`. + * Equivalent to `Vec4.inverse(this, this);` + * @category Methods + * + * @returns `this` + */ + invert(): this { + this[0] = 1.0 / this[0]; + this[1] = 1.0 / this[1]; + this[2] = 1.0 / this[2]; + this[3] = 1.0 / this[3]; + return this; + } + + /** + * Sets each component of `this` to it's absolute value. + * Equivalent to `Vec4.abs(this, this);` + * @category Methods + * + * @returns `this` + */ + abs(): this { + this[0] = Math.abs(this[0]); + this[1] = Math.abs(this[1]); + this[2] = Math.abs(this[2]); + this[3] = Math.abs(this[3]); + return this; + } + + /** + * Calculates the dot product of this and another {@link Vec4}. + * Equivalent to `Vec4.dot(this, b);` + * @category Methods + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b: Readonly): number { + return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3]; + } + + /** + * Normalize `this`. + * Equivalent to `Vec4.normalize(this, this);` + * @category Methods + * + * @returns `this` + */ + normalize(): this { + return Vec4.normalize(this, this) as this; + } + + // =================== + // Static accessors + // =================== + + /** + * @category Static + * + * @returns The number of bytes in a {@link Vec4}. + */ + static get BYTE_LENGTH(): number { + return 4 * Float64Array.BYTES_PER_ELEMENT; + } + + // =================== + // Static methods + // =================== + + /** + * Creates a new, empty {@link Vec4} + * @category Static + * + * @returns a new 4D vector + */ + static create(): Vec4 { + return new Vec4(); + } + + /** + * Creates a new {@link Vec4} initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 4D vector + */ + static clone(a: Vec4Like): Vec4 { + return new Vec4(a); + } + + /** + * Creates a new {@link Vec4} initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns a new 4D vector + */ + static fromValues(x: number, y: number, z: number, w: number): Vec4 { + return new Vec4(x, y, z, w); + } + + /** + * Copy the values from one {@link Vec4} to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out: Vec4Like, a: Readonly): Vec4Like { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + + /** + * Set the components of a {@link Vec4} to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @param w - W component + * @returns `out` + */ + static set(out: Vec4Like, x: number, y: number, z: number, w: number): Vec4Like { + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = w; + return out; + } + + /** + * Adds two {@link Vec4}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + return out; + } + + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + return out; + } + + /** + * Alias for {@link Vec4.subtract} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sub(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; } + + /** + * Multiplies two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + out[3] = a[3] * b[3]; + return out; + } + + /** + * Alias for {@link Vec4.multiply} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static mul(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; } + + /** + * Divides two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + out[2] = a[2] / b[2]; + out[3] = a[3] / b[3]; + return out; + } + + /** + * Alias for {@link Vec4.divide} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static div(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { return out; } + + /** + * Math.ceil the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out: Vec4Like, a: Readonly): Vec4Like { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + out[2] = Math.ceil(a[2]); + out[3] = Math.ceil(a[3]); + return out; + } + + /** + * Math.floor the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out: Vec4Like, a: Readonly): Vec4Like { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + out[2] = Math.floor(a[2]); + out[3] = Math.floor(a[3]); + return out; + } + + /** + * Returns the minimum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + out[3] = Math.min(a[3], b[3]); + return out; + } + + /** + * Returns the maximum of two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out: Vec4Like, a: Readonly, b: Readonly): Vec4Like { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + out[3] = Math.max(a[3], b[3]); + return out; + } + + /** + * Math.round the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + static round(out: Vec4Like, a: Readonly): Vec4Like { + out[0] = Math.round(a[0]); + out[1] = Math.round(a[1]); + out[2] = Math.round(a[2]); + out[3] = Math.round(a[3]); + return out; + } + + /** + * Scales a {@link Vec4} by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out: Vec4Like, a: Readonly, scale: number): Vec4Like { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + out[3] = a[3] * scale; + return out; + } + + /** + * Adds two {@link Vec4}'s after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out: Vec4Like, a: Readonly, b: Readonly, scale: number): Vec4Like { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + return out; + } + + /** + * Calculates the Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a: Readonly, b: Readonly): number { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + const w = b[3] - a[3]; + return Math.hypot(x, y, z, w); + } + /** + * Alias for {@link Vec4.distance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static dist(a: Readonly, b: Readonly): number { return 0; } + + /** + * Calculates the squared Euclidean distance between two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a: Readonly, b: Readonly): number { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + const w = b[3] - a[3]; + return x * x + y * y + z * z + w * w; + } + /** + * Alias for {@link Vec4.squaredDistance} + * @category Static + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + static sqrDist(a: Readonly, b: Readonly): number { return 0; } + + /** + * Calculates the magnitude (length) of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate length of + * @returns length of `a` + */ + static magnitude(a: Readonly): number { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + return Math.sqrt(x * x + y * y + z * z + w * w); + } + /** + * Alias for {@link Vec4.magnitude} + * @category Static + */ + static mag(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs + */ + // Length conflicts with Function.length + static length(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Alias for {@link Vec4.magnitude} + * @category Static + * @deprecated Use {@link Vec4.mag} + */ + static len(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Calculates the squared length of a {@link Vec4} + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a: Readonly): number { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + return x * x + y * y + z * z + w * w; + } + + /** + * Alias for {@link Vec4.squaredLength} + * @category Static + */ + static sqrLen(a: Readonly): number { return 0; } // eslint-disable-line @typescript-eslint/no-unused-vars + + /** + * Negates the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out: Vec4Like, a: Readonly): Vec4Like { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = -a[3]; + return out; + } + + /** + * Returns the inverse of the components of a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out: Vec4Like, a: Readonly): Vec4Like { + out[0] = 1.0 / a[0]; + out[1] = 1.0 / a[1]; + out[2] = 1.0 / a[2]; + out[3] = 1.0 / a[3]; + return out; + } + + /** + * Returns the absolute value of the components of a {@link Vec4} + * @category Static + * + * @param out - The receiving vector + * @param a - Vector to compute the absolute values of + * @returns `out` + */ + static abs(out: Vec4Like, a: Readonly): Vec4Like { + out[0] = Math.abs(a[0]); + out[1] = Math.abs(a[1]); + out[2] = Math.abs(a[2]); + out[3] = Math.abs(a[3]); + return out; + } + + /** + * Normalize a {@link Vec4} + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out: Vec4Like, a: Readonly): Vec4Like { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + let len = x * x + y * y + z * z + w * w; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = x * len; + out[1] = y * len; + out[2] = z * len; + out[3] = w * len; + return out; + } + + /** + * Calculates the dot product of two {@link Vec4}'s + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a: Readonly, b: Readonly): number { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + + /** + * Returns the cross-product of three vectors in a 4-dimensional space + * @category Static + * + * @param out the receiving vector + * @param u - the first vector + * @param v - the second vector + * @param w - the third vector + * @returns result + */ + static cross(out: Vec4Like, u: Readonly, v: Readonly, w: Readonly): Vec4Like { + const a = v[0] * w[1] - v[1] * w[0]; + const b = v[0] * w[2] - v[2] * w[0]; + const c = v[0] * w[3] - v[3] * w[0]; + const d = v[1] * w[2] - v[2] * w[1]; + const e = v[1] * w[3] - v[3] * w[1]; + const f = v[2] * w[3] - v[3] * w[2]; + const g = u[0]; + const h = u[1]; + const i = u[2]; + const j = u[3]; + + out[0] = h * f - i * e + j * d; + out[1] = -(g * f) + i * c - j * b; + out[2] = g * e - h * c + j * a; + out[3] = -(g * d) + h * b - i * a; + + return out; + } + + /** + * Performs a linear interpolation between two {@link Vec4}'s + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out: Vec4Like, a: Readonly, b: Readonly, t: number): Vec4Like { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + out[3] = aw + t * (b[3] - aw); + return out; + } + + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns `out` + */ + /* + static random(out: Vec4Like, scale): Vec4Like { + scale = scale || 1.0; + + // Marsaglia, George. Choosing a Point from the Surface of a + // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646. + // http://projecteuclid.org/euclid.aoms/1177692644; + var v1, v2, v3, v4; + var s1, s2; + do { + v1 = glMatrix.RANDOM() * 2 - 1; + v2 = glMatrix.RANDOM() * 2 - 1; + s1 = v1 * v1 + v2 * v2; + } while (s1 >= 1); + do { + v3 = glMatrix.RANDOM() * 2 - 1; + v4 = glMatrix.RANDOM() * 2 - 1; + s2 = v3 * v3 + v4 * v4; + } while (s2 >= 1); + + var d = Math.sqrt((1 - s1) / s2); + out[0] = scale * v1; + out[1] = scale * v2; + out[2] = scale * v3 * d; + out[3] = scale * v4 * d; + return out; + }*/ + + /** + * Transforms the {@link Vec4} with a {@link Mat4}. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out: Vec4Like, a: Readonly, m: Readonly): Vec4Like { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const w = a[3]; + out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; + out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; + out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; + out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; + return out; + } + + /** + * Transforms the {@link Vec4} with a {@link Quat} + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out: Vec4Like, a: Readonly, q: Readonly): Vec4Like { + const x = a[0]; + const y = a[1]; + const z = a[2]; + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + + // calculate quat * vec + const ix = qw * x + qy * z - qz * y; + const iy = qw * y + qz * x - qx * z; + const iz = qw * z + qx * y - qy * x; + const iw = -qx * x - qy * y - qz * z; + + // calculate result * inverse quat + out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy; + out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz; + out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx; + out[3] = a[3]; + return out; + } + + /** + * Set the components of a {@link Vec4} to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out: Vec4Like): Vec4Like { + out[0] = 0.0; + out[1] = 0.0; + out[2] = 0.0; + out[3] = 0.0; + return out; + } + + /** + * Returns a string representation of a {@link Vec4} + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a: Readonly): string { + return `Vec4(${a.join(', ')})`; + } + + /** + * Returns whether the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a: Readonly, b: Readonly): boolean { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + + /** + * Returns whether the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a: Readonly, b: Readonly): boolean { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + return ( + Math.abs(a0 - b0) <= GLM_EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && + Math.abs(a1 - b1) <= GLM_EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && + Math.abs(a2 - b2) <= GLM_EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && + Math.abs(a3 - b3) <= GLM_EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) + ); + } +} + +// Instance method alias assignments +Vec4.prototype.sub = Vec4.prototype.subtract; // eslint-disable-line @typescript-eslint/unbound-method +Vec4.prototype.mul = Vec4.prototype.multiply; // eslint-disable-line @typescript-eslint/unbound-method +Vec4.prototype.div = Vec4.prototype.divide; // eslint-disable-line @typescript-eslint/unbound-method +Vec4.prototype.dist = Vec4.prototype.distance; // eslint-disable-line @typescript-eslint/unbound-method +Vec4.prototype.sqrDist = Vec4.prototype.squaredDistance; // eslint-disable-line @typescript-eslint/unbound-method + +// Static method alias assignments +Vec4.sub = Vec4.subtract; +Vec4.mul = Vec4.multiply; +Vec4.div = Vec4.divide; +Vec4.dist = Vec4.distance; +Vec4.sqrDist = Vec4.squaredDistance; +Vec4.sqrLen = Vec4.squaredLength; +Vec4.mag = Vec4.magnitude; +Vec4.length = Vec4.magnitude; +Vec4.len = Vec4.magnitude; diff --git a/src/_lib/f64/index.ts b/src/_lib/f64/index.ts new file mode 100644 index 00000000..d7e65584 --- /dev/null +++ b/src/_lib/f64/index.ts @@ -0,0 +1,9 @@ +export { Mat2 } from './Mat2.js'; +export { Mat2d } from './Mat2d.js'; +export { Mat3 } from './Mat3.js'; +export { Mat4 } from './Mat4.js'; +export { Quat } from './Quat.js'; +export { Quat2 } from './Quat2.js'; +export { Vec2 } from './Vec2.js'; +export { Vec3 } from './Vec3.js'; +export { Vec4 } from './Vec4.js'; diff --git a/src/cdn/f64/index.ts b/src/cdn/f64/index.ts new file mode 100644 index 00000000..7e48871d --- /dev/null +++ b/src/cdn/f64/index.ts @@ -0,0 +1,12 @@ +/** + * Provides an all-inclusive ESM distribution of `gl-matrix` (64-bit). All library classes extends `Float64Array`. + * + * @packageDocumentation + */ + +/* v8 ignore next 5 */ +export * from '#gl-matrix/f64'; +export * from '#gl-matrix/swizzle/f64'; +export * from '#gl-matrix/types'; +export * from '#gl-matrix/types/swizzle/f64'; +export * from '#gl-matrix/util'; diff --git a/src/cdn/index.ts b/src/cdn/index.ts new file mode 100644 index 00000000..7b222da3 --- /dev/null +++ b/src/cdn/index.ts @@ -0,0 +1,13 @@ +/** + * Provides an all-inclusive ESM distribution of `gl-matrix` (32-bit). All library classes extends `Float32Array`. + * + * @packageDocumentation + */ + +/* v8 ignore next 6 */ +export * from '#gl-matrix'; +export * from '#gl-matrix/classic'; +export * from '#gl-matrix/swizzle'; +export * from '#gl-matrix/types'; +export * from '#gl-matrix/types/swizzle'; +export * from '#gl-matrix/util'; diff --git a/src/classic/index.ts b/src/classic/index.ts new file mode 100644 index 00000000..a0d7ff89 --- /dev/null +++ b/src/classic/index.ts @@ -0,0 +1,28 @@ +/** + * Provides aliases for backwards compatibility with the `3.x` API (32-bit). + * + * To facilitate easier adoption of version 4 of `gl-matrix` and maintain compatability with existing codebases the + * modern API can be accessed via remapped exports matching the version 3 API from the `gl-matrix/classic` sub-path + * export. The only change required is altering imports from `gl-matrix` to `gl-matrix/classic`. + * + * ```js + * import { vec3 } from 'gl-matrix/classic'; + * + * const vec = vec3.create(); + * ``` + * + * @packageDocumentation + */ + +export { + Mat2 as mat2, + Mat2d as mat2d, + Mat3 as mat3, + Mat4 as mat4, + Quat as quat, + Quat2 as quat2, + Vec2 as vec2, + Vec3 as vec3, + Vec4 as vec4, +} from '#gl-matrix'; + diff --git a/src/common.ts b/src/common.ts deleted file mode 100644 index 935c269c..00000000 --- a/src/common.ts +++ /dev/null @@ -1,31 +0,0 @@ -export const EPSILON = 0.000001; -export const ANGLE_ORDER = "zyx"; - -/** - * The floating point typed arrays that can be used in place of a vector, - * matrix, or quaternion. - */ -export type FloatArray = Float32Array | Float64Array; - -const DEG_TO_RAD = Math.PI / 180; -const RAD_TO_DEG = 180 / Math.PI; - -/** - * Convert Degrees To Radians - * - * @param value - Angle in Degrees - * @returns Angle in Radians - */ -export function toRadian(value: number): number { - return value * DEG_TO_RAD; -} - -/** - * Convert Radians To Degrees - * - * @param value - Angle in Radians - * @returns Angle in Degrees - */ -export function toDegree(value: number): number { - return value * RAD_TO_DEG; -} diff --git a/src/common/index.ts b/src/common/index.ts new file mode 100644 index 00000000..0913dcde --- /dev/null +++ b/src/common/index.ts @@ -0,0 +1,10 @@ +/** + * Provides common resources and constants shared across `gl-matrix`. + * + * @packageDocumentation + */ + +/** + * A small constant used to determine the acceptable error margin in floating-point calculations. + */ +export const GLM_EPSILON = 0.000001; diff --git a/src/f64/index.ts b/src/f64/index.ts new file mode 100644 index 00000000..775efe65 --- /dev/null +++ b/src/f64/index.ts @@ -0,0 +1,23 @@ +/** + * Provides the modern `gl-matrix` API (64-bit). All classes extend from `Float64Array`. The API is identical to + * the main 32-bit variation. + * + * ```js + * import { Vec3 } from 'gl-matrix/f64'; + * + * const vec = new Vec3(0, 1, 2); + * ``` + * + * If you have a need to mix and match the 64-bit and 32-bit versions you can do so by importing them as different + * names. + * + * ```js + * import { Vec3 as Vec3F32 } from 'gl-matrix'; + * import { Vec3 as Vec3F64 } from 'gl-matrix/f64'; + * ``` + * + * @packageDocumentation + */ + +export * from '../_lib/f64/index.js'; + diff --git a/src/index.ts b/src/index.ts index fbc224c4..12dada5d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,25 +1,13 @@ -import { Mat2, mat2, Mat2Like } from './mat2.js'; -import { Mat2d, mat2d, Mat2dLike } from './mat2d.js'; -import { Mat3, mat3, Mat3Like } from './mat3.js'; -import { Mat4, mat4, Mat4Like } from './mat4.js'; -import { Quat, quat, QuatLike } from './quat.js'; -import { Quat2, quat2, Quat2Like } from './quat2.js'; -import { Vec2, vec2, Vec2Like } from './vec2.js'; -import { Vec3, vec3, Vec3Like } from './vec3.js'; -import { Vec4, vec4, Vec4Like } from './vec4.js'; -import { FloatArray } from './common.js'; -import { EnableSwizzles } from './swizzle.js'; +/** + * Provides the modern `gl-matrix` API (32-bit). All classes extend from `Float32Array`. + * + * ```js + * import { Vec3 } from 'gl-matrix'; + * + * const vec = new Vec3(0, 1, 2); + * ``` + * + * @packageDocumentation + */ -export { - Mat2, mat2, Mat2Like, - Mat2d, mat2d, Mat2dLike, - Mat3, mat3, Mat3Like, - Mat4, mat4, Mat4Like, - Quat, quat, QuatLike, - Quat2, quat2, Quat2Like, - Vec2, vec2, Vec2Like, - Vec3, vec3, Vec3Like, - Vec4, vec4, Vec4Like, - FloatArray, - EnableSwizzles -}; \ No newline at end of file +export * from './_lib/f32/index.js'; diff --git a/src/swizzle/f64/index.ts b/src/swizzle/f64/index.ts new file mode 100644 index 00000000..220b0f06 --- /dev/null +++ b/src/swizzle/f64/index.ts @@ -0,0 +1,141 @@ +/** + * To enable additional swizzle accessors for vector classes (64-bit) invoke the {@link EnableSwizzlesF64} function from + * the `gl-matrix/swizzle/f64` sub-path export. To enable ambient module declarations for IDE / Typescript support + * please see {@link gl-matrix/types/swizzle/f64}. + * + * To enable swizzling for the 32-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle}. + * + * @example + * ```ts + * import { Vec3 } from 'gl-matrix/f64'; + * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64'; + * + * EnableSwizzlesF64(); + * + * const vec = new Vec3(0, 1, 2); + * const vecSwizzled = vec.zyx; // Returns a new Vec3(2, 1, 0). + * ``` + * + * @packageDocumentation + */ + +import { Vec2, Vec3, Vec4 } from '#gl-matrix/f64'; + +/** + * Internal `gl-matrix` variable tracking if swizzling is enabled (64-bit). + */ +let GLM_SWIZZLES_ENABLED_F64 = false; + +/** + * Enables Swizzle operations on {@link gl-matrix/f64.Vec2 | Vec2} / {@link gl-matrix/f64.Vec3 | Vec3} / + * {@link gl-matrix/f64.Vec4 | Vec4} types from {@link gl-matrix/f64} (64-bit). + * + * Swizzle operations are performed by using the `.` operator in conjunction with any combination + * of between two and four component names, either from the set `xyzw` or `rgbw` (though not intermixed). + * They return a new vector with the same number of components as specified in the swizzle attribute. + * + * @example + * ```js + * import { Vec3 } from 'gl-matrix/f64'; + * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64'; + * + * EnableSwizzlesF64(); + * + * let v = new Vec3(0, 1, 2); + * + * v.yx; // returns new Vec2(1, 0) + * v.xzy; // returns new Vec3(0, 2, 1) + * v.zyxz; // returns new Vec4(2, 1, 0, 2) + * + * v.rgb; // returns new Vec3(0, 1, 2) + * v.rbg; // returns new Vec3(0, 2, 1) + * v.gg; // returns new Vec2(1, 1) + * ``` + */ +export function EnableSwizzlesF64(): void { + /* v8 ignore next 1 */ + if (GLM_SWIZZLES_ENABLED_F64) { return; } + + /* eslint-disable comma-spacing, max-len */ + + // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should + // not be modified by hand. + // [Swizzle Autogen] + + const VEC2_SWIZZLES = ['xx','xy','yx','yy','xxx','xxy','xyx','xyy','yxx','yxy','yyx','yyy','xxxx','xxxy','xxyx','xxyy','xyxx','xyxy','xyyx','xyyy','yxxx','yxxy','yxyx','yxyy','yyxx','yyxy','yyyx','yyyy','rr','rg','gr','gg','rrr','rrg','rgr','rgg','grr','grg','ggr','ggg','rrrr','rrrg','rrgr','rrgg','rgrr','rgrg','rggr','rggg','grrr','grrg','grgr','grgg','ggrr','ggrg','gggr','gggg']; + const VEC3_SWIZZLES = ['xz','yz','zx','zy','zz','xxz','xyz','xzx','xzy','xzz','yxz','yyz','yzx','yzy','yzz','zxx','zxy','zxz','zyx','zyy','zyz','zzx','zzy','zzz','xxxz','xxyz','xxzx','xxzy','xxzz','xyxz','xyyz','xyzx','xyzy','xyzz','xzxx','xzxy','xzxz','xzyx','xzyy','xzyz','xzzx','xzzy','xzzz','yxxz','yxyz','yxzx','yxzy','yxzz','yyxz','yyyz','yyzx','yyzy','yyzz','yzxx','yzxy','yzxz','yzyx','yzyy','yzyz','yzzx','yzzy','yzzz','zxxx','zxxy','zxxz','zxyx','zxyy','zxyz','zxzx','zxzy','zxzz','zyxx','zyxy','zyxz','zyyx','zyyy','zyyz','zyzx','zyzy','zyzz','zzxx','zzxy','zzxz','zzyx','zzyy','zzyz','zzzx','zzzy','zzzz','rb','gb','br','bg','bb','rrb','rgb','rbr','rbg','rbb','grb','ggb','gbr','gbg','gbb','brr','brg','brb','bgr','bgg','bgb','bbr','bbg','bbb','rrrb','rrgb','rrbr','rrbg','rrbb','rgrb','rggb','rgbr','rgbg','rgbb','rbrr','rbrg','rbrb','rbgr','rbgg','rbgb','rbbr','rbbg','rbbb','grrb','grgb','grbr','grbg','grbb','ggrb','gggb','ggbr','ggbg','ggbb','gbrr','gbrg','gbrb','gbgr','gbgg','gbgb','gbbr','gbbg','gbbb','brrr','brrg','brrb','brgr','brgg','brgb','brbr','brbg','brbb','bgrr','bgrg','bgrb','bggr','bggg','bggb','bgbr','bgbg','bgbb','bbrr','bbrg','bbrb','bbgr','bbgg','bbgb','bbbr','bbbg','bbbb']; + const VEC4_SWIZZLES = ['xw','yw','zw','wx','wy','wz','ww','xxw','xyw','xzw','xwx','xwy','xwz','xww','yxw','yyw','yzw','ywx','ywy','ywz','yww','zxw','zyw','zzw','zwx','zwy','zwz','zww','wxx','wxy','wxz','wxw','wyx','wyy','wyz','wyw','wzx','wzy','wzz','wzw','wwx','wwy','wwz','www','xxxw','xxyw','xxzw','xxwx','xxwy','xxwz','xxww','xyxw','xyyw','xyzw','xywx','xywy','xywz','xyww','xzxw','xzyw','xzzw','xzwx','xzwy','xzwz','xzww','xwxx','xwxy','xwxz','xwxw','xwyx','xwyy','xwyz','xwyw','xwzx','xwzy','xwzz','xwzw','xwwx','xwwy','xwwz','xwww','yxxw','yxyw','yxzw','yxwx','yxwy','yxwz','yxww','yyxw','yyyw','yyzw','yywx','yywy','yywz','yyww','yzxw','yzyw','yzzw','yzwx','yzwy','yzwz','yzww','ywxx','ywxy','ywxz','ywxw','ywyx','ywyy','ywyz','ywyw','ywzx','ywzy','ywzz','ywzw','ywwx','ywwy','ywwz','ywww','zxxw','zxyw','zxzw','zxwx','zxwy','zxwz','zxww','zyxw','zyyw','zyzw','zywx','zywy','zywz','zyww','zzxw','zzyw','zzzw','zzwx','zzwy','zzwz','zzww','zwxx','zwxy','zwxz','zwxw','zwyx','zwyy','zwyz','zwyw','zwzx','zwzy','zwzz','zwzw','zwwx','zwwy','zwwz','zwww','wxxx','wxxy','wxxz','wxxw','wxyx','wxyy','wxyz','wxyw','wxzx','wxzy','wxzz','wxzw','wxwx','wxwy','wxwz','wxww','wyxx','wyxy','wyxz','wyxw','wyyx','wyyy','wyyz','wyyw','wyzx','wyzy','wyzz','wyzw','wywx','wywy','wywz','wyww','wzxx','wzxy','wzxz','wzxw','wzyx','wzyy','wzyz','wzyw','wzzx','wzzy','wzzz','wzzw','wzwx','wzwy','wzwz','wzww','wwxx','wwxy','wwxz','wwxw','wwyx','wwyy','wwyz','wwyw','wwzx','wwzy','wwzz','wwzw','wwwx','wwwy','wwwz','wwww','ra','ga','ba','ar','ag','ab','aa','rra','rga','rba','rar','rag','rab','raa','gra','gga','gba','gar','gag','gab','gaa','bra','bga','bba','bar','bag','bab','baa','arr','arg','arb','ara','agr','agg','agb','aga','abr','abg','abb','aba','aar','aag','aab','aaa','rrra','rrga','rrba','rrar','rrag','rrab','rraa','rgra','rgga','rgba','rgar','rgag','rgab','rgaa','rbra','rbga','rbba','rbar','rbag','rbab','rbaa','rarr','rarg','rarb','rara','ragr','ragg','ragb','raga','rabr','rabg','rabb','raba','raar','raag','raab','raaa','grra','grga','grba','grar','grag','grab','graa','ggra','ggga','ggba','ggar','ggag','ggab','ggaa','gbra','gbga','gbba','gbar','gbag','gbab','gbaa','garr','garg','garb','gara','gagr','gagg','gagb','gaga','gabr','gabg','gabb','gaba','gaar','gaag','gaab','gaaa','brra','brga','brba','brar','brag','brab','braa','bgra','bgga','bgba','bgar','bgag','bgab','bgaa','bbra','bbga','bbba','bbar','bbag','bbab','bbaa','barr','barg','barb','bara','bagr','bagg','bagb','baga','babr','babg','babb','baba','baar','baag','baab','baaa','arrr','arrg','arrb','arra','argr','argg','argb','arga','arbr','arbg','arbb','arba','arar','arag','arab','araa','agrr','agrg','agrb','agra','aggr','aggg','aggb','agga','agbr','agbg','agbb','agba','agar','agag','agab','agaa','abrr','abrg','abrb','abra','abgr','abgg','abgb','abga','abbr','abbg','abbb','abba','abar','abag','abab','abaa','aarr','aarg','aarb','aara','aagr','aagg','aagb','aaga','aabr','aabg','aabb','aaba','aaar','aaag','aaab','aaaa']; + + // [/Swizzle Autogen] + + /* eslint-enable comma-spacing, max-len */ + + /** + * Internal swizzle index table for `gl-matrix`. + */ + const SWIZZLE_INDEX: Record = { + x: 0, r: 0, + y: 1, g: 1, + z: 2, b: 2, + w: 3, a: 3, + }; + + /** + * Internal helper function to convert and return a `gl-matrix` vector by swizzle format. + * + * @param swizzle - Swizzle format to apply. + * @returns {Vec2 | Vec3 | Vec4} New swizzled vector instance. + */ + function getSwizzleImpl(swizzle: string): () => Vec2 | Vec3 | Vec4 { + switch (swizzle.length) { + case 2: + return function(this: Float64Array) { + return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]); + }; + case 3: + return function(this: Float64Array) { + return new Vec3(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]], + this[SWIZZLE_INDEX[swizzle[2]]]); + }; + case 4: + return function(this: Float64Array) { + return new Vec4(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]], + this[SWIZZLE_INDEX[swizzle[2]]], this[SWIZZLE_INDEX[swizzle[3]]]); + }; + } + + throw new Error('Illegal swizzle length'); + } + + for (const swizzle of VEC2_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec2.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec3.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + + for (const swizzle of VEC3_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec3.prototype, swizzle, { + get: impl + }); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + + for (const swizzle of VEC4_SWIZZLES) { + const impl = getSwizzleImpl(swizzle); + Object.defineProperty(Vec4.prototype, swizzle, { + get: impl + }); + } + + GLM_SWIZZLES_ENABLED_F64 = true; +} diff --git a/src/swizzle.ts b/src/swizzle/index.ts similarity index 65% rename from src/swizzle.ts rename to src/swizzle/index.ts index 8aafaa95..9dfe3c39 100644 --- a/src/swizzle.ts +++ b/src/swizzle/index.ts @@ -1,42 +1,37 @@ -import { Vec2 } from './vec2.js'; -import { Vec3 } from './vec3.js'; -import { Vec4 } from './vec4.js'; - -// The contents of the following section are autogenerated by scripts/gen-swizzle.js and should -// not be modified by hand. -// [Swizzle Autogen] - - const VEC2_SWIZZLES = ['xx','xy','yx','yy','xxx','xxy','xyx','xyy','yxx','yxy','yyx','yyy','xxxx','xxxy','xxyx','xxyy','xyxx','xyxy','xyyx','xyyy','yxxx','yxxy','yxyx','yxyy','yyxx','yyxy','yyyx','yyyy','rr','rg','gr','gg','rrr','rrg','rgr','rgg','grr','grg','ggr','ggg','rrrr','rrrg','rrgr','rrgg','rgrr','rgrg','rggr','rggg','grrr','grrg','grgr','grgg','ggrr','ggrg','gggr','gggg']; - const VEC3_SWIZZLES = ['xz','yz','zx','zy','zz','xxz','xyz','xzx','xzy','xzz','yxz','yyz','yzx','yzy','yzz','zxx','zxy','zxz','zyx','zyy','zyz','zzx','zzy','zzz','xxxz','xxyz','xxzx','xxzy','xxzz','xyxz','xyyz','xyzx','xyzy','xyzz','xzxx','xzxy','xzxz','xzyx','xzyy','xzyz','xzzx','xzzy','xzzz','yxxz','yxyz','yxzx','yxzy','yxzz','yyxz','yyyz','yyzx','yyzy','yyzz','yzxx','yzxy','yzxz','yzyx','yzyy','yzyz','yzzx','yzzy','yzzz','zxxx','zxxy','zxxz','zxyx','zxyy','zxyz','zxzx','zxzy','zxzz','zyxx','zyxy','zyxz','zyyx','zyyy','zyyz','zyzx','zyzy','zyzz','zzxx','zzxy','zzxz','zzyx','zzyy','zzyz','zzzx','zzzy','zzzz','rb','gb','br','bg','bb','rrb','rgb','rbr','rbg','rbb','grb','ggb','gbr','gbg','gbb','brr','brg','brb','bgr','bgg','bgb','bbr','bbg','bbb','rrrb','rrgb','rrbr','rrbg','rrbb','rgrb','rggb','rgbr','rgbg','rgbb','rbrr','rbrg','rbrb','rbgr','rbgg','rbgb','rbbr','rbbg','rbbb','grrb','grgb','grbr','grbg','grbb','ggrb','gggb','ggbr','ggbg','ggbb','gbrr','gbrg','gbrb','gbgr','gbgg','gbgb','gbbr','gbbg','gbbb','brrr','brrg','brrb','brgr','brgg','brgb','brbr','brbg','brbb','bgrr','bgrg','bgrb','bggr','bggg','bggb','bgbr','bgbg','bgbb','bbrr','bbrg','bbrb','bbgr','bbgg','bbgb','bbbr','bbbg','bbbb']; - const VEC4_SWIZZLES = ['xw','yw','zw','wx','wy','wz','ww','xxw','xyw','xzw','xwx','xwy','xwz','xww','yxw','yyw','yzw','ywx','ywy','ywz','yww','zxw','zyw','zzw','zwx','zwy','zwz','zww','wxx','wxy','wxz','wxw','wyx','wyy','wyz','wyw','wzx','wzy','wzz','wzw','wwx','wwy','wwz','www','xxxw','xxyw','xxzw','xxwx','xxwy','xxwz','xxww','xyxw','xyyw','xyzw','xywx','xywy','xywz','xyww','xzxw','xzyw','xzzw','xzwx','xzwy','xzwz','xzww','xwxx','xwxy','xwxz','xwxw','xwyx','xwyy','xwyz','xwyw','xwzx','xwzy','xwzz','xwzw','xwwx','xwwy','xwwz','xwww','yxxw','yxyw','yxzw','yxwx','yxwy','yxwz','yxww','yyxw','yyyw','yyzw','yywx','yywy','yywz','yyww','yzxw','yzyw','yzzw','yzwx','yzwy','yzwz','yzww','ywxx','ywxy','ywxz','ywxw','ywyx','ywyy','ywyz','ywyw','ywzx','ywzy','ywzz','ywzw','ywwx','ywwy','ywwz','ywww','zxxw','zxyw','zxzw','zxwx','zxwy','zxwz','zxww','zyxw','zyyw','zyzw','zywx','zywy','zywz','zyww','zzxw','zzyw','zzzw','zzwx','zzwy','zzwz','zzww','zwxx','zwxy','zwxz','zwxw','zwyx','zwyy','zwyz','zwyw','zwzx','zwzy','zwzz','zwzw','zwwx','zwwy','zwwz','zwww','wxxx','wxxy','wxxz','wxxw','wxyx','wxyy','wxyz','wxyw','wxzx','wxzy','wxzz','wxzw','wxwx','wxwy','wxwz','wxww','wyxx','wyxy','wyxz','wyxw','wyyx','wyyy','wyyz','wyyw','wyzx','wyzy','wyzz','wyzw','wywx','wywy','wywz','wyww','wzxx','wzxy','wzxz','wzxw','wzyx','wzyy','wzyz','wzyw','wzzx','wzzy','wzzz','wzzw','wzwx','wzwy','wzwz','wzww','wwxx','wwxy','wwxz','wwxw','wwyx','wwyy','wwyz','wwyw','wwzx','wwzy','wwzz','wwzw','wwwx','wwwy','wwwz','wwww','ra','ga','ba','ar','ag','ab','aa','rra','rga','rba','rar','rag','rab','raa','gra','gga','gba','gar','gag','gab','gaa','bra','bga','bba','bar','bag','bab','baa','arr','arg','arb','ara','agr','agg','agb','aga','abr','abg','abb','aba','aar','aag','aab','aaa','rrra','rrga','rrba','rrar','rrag','rrab','rraa','rgra','rgga','rgba','rgar','rgag','rgab','rgaa','rbra','rbga','rbba','rbar','rbag','rbab','rbaa','rarr','rarg','rarb','rara','ragr','ragg','ragb','raga','rabr','rabg','rabb','raba','raar','raag','raab','raaa','grra','grga','grba','grar','grag','grab','graa','ggra','ggga','ggba','ggar','ggag','ggab','ggaa','gbra','gbga','gbba','gbar','gbag','gbab','gbaa','garr','garg','garb','gara','gagr','gagg','gagb','gaga','gabr','gabg','gabb','gaba','gaar','gaag','gaab','gaaa','brra','brga','brba','brar','brag','brab','braa','bgra','bgga','bgba','bgar','bgag','bgab','bgaa','bbra','bbga','bbba','bbar','bbag','bbab','bbaa','barr','barg','barb','bara','bagr','bagg','bagb','baga','babr','babg','babb','baba','baar','baag','baab','baaa','arrr','arrg','arrb','arra','argr','argg','argb','arga','arbr','arbg','arbb','arba','arar','arag','arab','araa','agrr','agrg','agrb','agra','aggr','aggg','aggb','agga','agbr','agbg','agbb','agba','agar','agag','agab','agaa','abrr','abrg','abrb','abra','abgr','abgg','abgb','abga','abbr','abbg','abbb','abba','abar','abag','abab','abaa','aarr','aarg','aarb','aara','aagr','aagg','aagb','aaga','aabr','aabg','aabb','aaba','aaar','aaag','aaab','aaaa']; - -// [/Swizzle Autogen] - -const SWIZZLE_INDEX = { - x: 0, r: 0, - y: 1, g: 1, - z: 2, b: 2, - w: 3, a: 3, -}; +/** + * To enable additional swizzle accessors for vector classes (32-bit) invoke the {@link EnableSwizzles} function from + * the `gl-matrix/swizzle` sub-path export. To enable ambient module declarations for IDE / Typescript support please + * see {@link gl-matrix/types/swizzle}. + * + * To enable swizzling for the 64-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle/f64}. + * + * @example + * ```ts + * import { Vec3 } from 'gl-matrix'; + * import { EnableSwizzles } from 'gl-matrix/swizzle'; + * + * EnableSwizzles(); + * + * const vec = new Vec3(0, 1, 2); + * const vecSwizzled = vec.zyx; // Returns a new Vec3(2, 1, 0). + * ``` + * + * @packageDocumentation + */ -function getSwizzleImpl(swizzle: string): () => any { - switch(swizzle.length) { - case 2: - return function() { return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]); }; - case 3: - return function() { return new Vec3(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]], this[SWIZZLE_INDEX[swizzle[2]]]); }; - case 4: - return function() { return new Vec4(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]], this[SWIZZLE_INDEX[swizzle[2]]], this[SWIZZLE_INDEX[swizzle[3]]]); }; - } -} +import { Vec2, Vec3, Vec4 } from '#gl-matrix'; -let swizzlesEnabled = false; +/** + * Internal `gl-matrix` variable tracking if swizzling is enabled (32-bit). + */ +let GLM_SWIZZLES_ENABLED_F32 = false; /** - * Enables Swizzle operations on {@link Vec2}, {@link Vec3}, and {@link Vec4} types. + * Enables Swizzle operations on {@link gl-matrix.Vec2 | Vec2} / {@link gl-matrix.Vec3 | Vec3} / + * {@link gl-matrix.Vec4 | Vec4} types from {@link gl-matrix | gl-matrix} (32-bit). * * Swizzle operations are performed by using the `.` operator in conjunction with any combination - * of between two to four component names, either from the set `xyzw` or `rgbw` (though not intermixed). + * of between two and four component names, either from the set `xyzw` or `rgbw` (though not intermixed). * They return a new vector with the same number of components as specified in the swizzle attribute. * * @example @@ -47,17 +42,69 @@ let swizzlesEnabled = false; * * let v = new Vec3(0, 1, 2); * - * v.yx // returns new Vec2(1, 0); - * v.xzy // returns new Vec3(0, 2, 1); - * v.zyxz // returns new Vec4(2, 1, 0, 2); + * v.yx; // returns new Vec2(1, 0) + * v.xzy; // returns new Vec3(0, 2, 1) + * v.zyxz; // returns new Vec4(2, 1, 0, 2) * - * v.rgb // returns new Vec3(0, 1, 2); - * v.rbg // returns new Vec3(0, 2, 1); - * v.gg // returns new Vec2(1, 1); + * v.rgb; // returns new Vec3(0, 1, 2) + * v.rbg; // returns new Vec3(0, 2, 1) + * v.gg; // returns new Vec2(1, 1) * ``` */ -export function EnableSwizzles() { - if (swizzlesEnabled) { return; } +export function EnableSwizzles(): void { + /* v8 ignore next 1 */ + if (GLM_SWIZZLES_ENABLED_F32) { return; } + + /* eslint-disable comma-spacing, max-len */ + + // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should + // not be modified by hand. + // [Swizzle Autogen] + + const VEC2_SWIZZLES = ['xx','xy','yx','yy','xxx','xxy','xyx','xyy','yxx','yxy','yyx','yyy','xxxx','xxxy','xxyx','xxyy','xyxx','xyxy','xyyx','xyyy','yxxx','yxxy','yxyx','yxyy','yyxx','yyxy','yyyx','yyyy','rr','rg','gr','gg','rrr','rrg','rgr','rgg','grr','grg','ggr','ggg','rrrr','rrrg','rrgr','rrgg','rgrr','rgrg','rggr','rggg','grrr','grrg','grgr','grgg','ggrr','ggrg','gggr','gggg']; + const VEC3_SWIZZLES = ['xz','yz','zx','zy','zz','xxz','xyz','xzx','xzy','xzz','yxz','yyz','yzx','yzy','yzz','zxx','zxy','zxz','zyx','zyy','zyz','zzx','zzy','zzz','xxxz','xxyz','xxzx','xxzy','xxzz','xyxz','xyyz','xyzx','xyzy','xyzz','xzxx','xzxy','xzxz','xzyx','xzyy','xzyz','xzzx','xzzy','xzzz','yxxz','yxyz','yxzx','yxzy','yxzz','yyxz','yyyz','yyzx','yyzy','yyzz','yzxx','yzxy','yzxz','yzyx','yzyy','yzyz','yzzx','yzzy','yzzz','zxxx','zxxy','zxxz','zxyx','zxyy','zxyz','zxzx','zxzy','zxzz','zyxx','zyxy','zyxz','zyyx','zyyy','zyyz','zyzx','zyzy','zyzz','zzxx','zzxy','zzxz','zzyx','zzyy','zzyz','zzzx','zzzy','zzzz','rb','gb','br','bg','bb','rrb','rgb','rbr','rbg','rbb','grb','ggb','gbr','gbg','gbb','brr','brg','brb','bgr','bgg','bgb','bbr','bbg','bbb','rrrb','rrgb','rrbr','rrbg','rrbb','rgrb','rggb','rgbr','rgbg','rgbb','rbrr','rbrg','rbrb','rbgr','rbgg','rbgb','rbbr','rbbg','rbbb','grrb','grgb','grbr','grbg','grbb','ggrb','gggb','ggbr','ggbg','ggbb','gbrr','gbrg','gbrb','gbgr','gbgg','gbgb','gbbr','gbbg','gbbb','brrr','brrg','brrb','brgr','brgg','brgb','brbr','brbg','brbb','bgrr','bgrg','bgrb','bggr','bggg','bggb','bgbr','bgbg','bgbb','bbrr','bbrg','bbrb','bbgr','bbgg','bbgb','bbbr','bbbg','bbbb']; + const VEC4_SWIZZLES = ['xw','yw','zw','wx','wy','wz','ww','xxw','xyw','xzw','xwx','xwy','xwz','xww','yxw','yyw','yzw','ywx','ywy','ywz','yww','zxw','zyw','zzw','zwx','zwy','zwz','zww','wxx','wxy','wxz','wxw','wyx','wyy','wyz','wyw','wzx','wzy','wzz','wzw','wwx','wwy','wwz','www','xxxw','xxyw','xxzw','xxwx','xxwy','xxwz','xxww','xyxw','xyyw','xyzw','xywx','xywy','xywz','xyww','xzxw','xzyw','xzzw','xzwx','xzwy','xzwz','xzww','xwxx','xwxy','xwxz','xwxw','xwyx','xwyy','xwyz','xwyw','xwzx','xwzy','xwzz','xwzw','xwwx','xwwy','xwwz','xwww','yxxw','yxyw','yxzw','yxwx','yxwy','yxwz','yxww','yyxw','yyyw','yyzw','yywx','yywy','yywz','yyww','yzxw','yzyw','yzzw','yzwx','yzwy','yzwz','yzww','ywxx','ywxy','ywxz','ywxw','ywyx','ywyy','ywyz','ywyw','ywzx','ywzy','ywzz','ywzw','ywwx','ywwy','ywwz','ywww','zxxw','zxyw','zxzw','zxwx','zxwy','zxwz','zxww','zyxw','zyyw','zyzw','zywx','zywy','zywz','zyww','zzxw','zzyw','zzzw','zzwx','zzwy','zzwz','zzww','zwxx','zwxy','zwxz','zwxw','zwyx','zwyy','zwyz','zwyw','zwzx','zwzy','zwzz','zwzw','zwwx','zwwy','zwwz','zwww','wxxx','wxxy','wxxz','wxxw','wxyx','wxyy','wxyz','wxyw','wxzx','wxzy','wxzz','wxzw','wxwx','wxwy','wxwz','wxww','wyxx','wyxy','wyxz','wyxw','wyyx','wyyy','wyyz','wyyw','wyzx','wyzy','wyzz','wyzw','wywx','wywy','wywz','wyww','wzxx','wzxy','wzxz','wzxw','wzyx','wzyy','wzyz','wzyw','wzzx','wzzy','wzzz','wzzw','wzwx','wzwy','wzwz','wzww','wwxx','wwxy','wwxz','wwxw','wwyx','wwyy','wwyz','wwyw','wwzx','wwzy','wwzz','wwzw','wwwx','wwwy','wwwz','wwww','ra','ga','ba','ar','ag','ab','aa','rra','rga','rba','rar','rag','rab','raa','gra','gga','gba','gar','gag','gab','gaa','bra','bga','bba','bar','bag','bab','baa','arr','arg','arb','ara','agr','agg','agb','aga','abr','abg','abb','aba','aar','aag','aab','aaa','rrra','rrga','rrba','rrar','rrag','rrab','rraa','rgra','rgga','rgba','rgar','rgag','rgab','rgaa','rbra','rbga','rbba','rbar','rbag','rbab','rbaa','rarr','rarg','rarb','rara','ragr','ragg','ragb','raga','rabr','rabg','rabb','raba','raar','raag','raab','raaa','grra','grga','grba','grar','grag','grab','graa','ggra','ggga','ggba','ggar','ggag','ggab','ggaa','gbra','gbga','gbba','gbar','gbag','gbab','gbaa','garr','garg','garb','gara','gagr','gagg','gagb','gaga','gabr','gabg','gabb','gaba','gaar','gaag','gaab','gaaa','brra','brga','brba','brar','brag','brab','braa','bgra','bgga','bgba','bgar','bgag','bgab','bgaa','bbra','bbga','bbba','bbar','bbag','bbab','bbaa','barr','barg','barb','bara','bagr','bagg','bagb','baga','babr','babg','babb','baba','baar','baag','baab','baaa','arrr','arrg','arrb','arra','argr','argg','argb','arga','arbr','arbg','arbb','arba','arar','arag','arab','araa','agrr','agrg','agrb','agra','aggr','aggg','aggb','agga','agbr','agbg','agbb','agba','agar','agag','agab','agaa','abrr','abrg','abrb','abra','abgr','abgg','abgb','abga','abbr','abbg','abbb','abba','abar','abag','abab','abaa','aarr','aarg','aarb','aara','aagr','aagg','aagb','aaga','aabr','aabg','aabb','aaba','aaar','aaag','aaab','aaaa']; + + // [/Swizzle Autogen] + + /* eslint-enable comma-spacing, max-len */ + + /** + * Internal swizzle index table for `gl-matrix`. + */ + const SWIZZLE_INDEX: Record = { + x: 0, r: 0, + y: 1, g: 1, + z: 2, b: 2, + w: 3, a: 3, + }; + + /** + * Internal helper function to convert and return a `gl-matrix` vector by swizzle format. + * + * @param swizzle - Swizzle format to apply. + * @returns {Vec2 | Vec3 | Vec4} New swizzled vector instance. + */ + function getSwizzleImpl(swizzle: string): () => Vec2 | Vec3 | Vec4 { + switch (swizzle.length) { + case 2: + return function(this: Float32Array) { + return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]); + }; + case 3: + return function(this: Float32Array) { + return new Vec3(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]], + this[SWIZZLE_INDEX[swizzle[2]]]); + }; + case 4: + return function(this: Float32Array) { + return new Vec4(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]], + this[SWIZZLE_INDEX[swizzle[2]]], this[SWIZZLE_INDEX[swizzle[3]]]); + }; + } + + throw new Error('Illegal swizzle length'); + } for (const swizzle of VEC2_SWIZZLES) { const impl = getSwizzleImpl(swizzle); @@ -89,6 +136,5 @@ export function EnableSwizzles() { }); } - swizzlesEnabled = true; + GLM_SWIZZLES_ENABLED_F32 = true; } - diff --git a/src/types/index.ts b/src/types/index.ts new file mode 100644 index 00000000..cc712a7d --- /dev/null +++ b/src/types/index.ts @@ -0,0 +1,108 @@ +/** + * Provides all common type declarations shared across `gl-matrix`. + * + * ```ts + * import { Vec3 } from 'gl-matrix'; + * import type { Vec3Like } from 'gl-matrix/types'; + * + * const vec: Vec3Like = new Vec3(0, 1, 2); + * ``` + * + * For JSDoc using the new Typescript 5.5 `@import` tag: + * ```js + * /** + * * @import { Vec3Like } from 'gl-matrix/types' + * *\/ + * ``` + * + * For JSDoc using the older `import types` Typescript mechanism: + * ```js + * /** + * * @type {import('gl-matrix/types').Vec3Like} + * *\/ + * ``` + * + * @packageDocumentation + */ + +/** + * The floating-point typed arrays that can be used in place of a vector, matrix, or quaternion. + */ +type FloatArray = Float32Array | Float64Array; + +/** + * A 2x2 Matrix given as a {@link Mat2}, a 4-element floating-point TypedArray, or an array of 4 numbers. + */ +type Mat2Like = [ + number, number, + number, number +] | FloatArray; + +/** + * A 2x3 Matrix given as a {@link Mat2d}, a 6-element floating-point TypedArray, or an array of 6 numbers. + */ +type Mat2dLike = [ + number, number, + number, number, + number, number +] | FloatArray; + +/** + * A 3x3 Matrix given as a {@link Mat3}, a 9-element floating-point TypedArray, or an array of 9 numbers. + */ +type Mat3Like = [ + number, number, number, + number, number, number, + number, number, number +] | FloatArray; + +/** + * A 4x4 Matrix given as a {@link Mat4}, a 16-element floating-point TypedArray, or an array of 16 numbers. + */ +type Mat4Like = [ + number, number, number, number, + number, number, number, number, + number, number, number, number, + number, number, number, number +] | FloatArray; + +/** + * A Quaternion given as a {@link Quat}, a 4-element floating-point TypedArray, or an array of 4 numbers. + */ +type QuatLike = Vec4Like; + +/** + * A Dual Quaternion given as a {@link Quat2}, an 8-element floating-point TypedArray, or an array of 8 numbers. + */ +type Quat2Like = [ + number, number, number, number, + number, number, number, number +] | FloatArray; + +/** + * A 2-dimensional vector given as a {@link Vec2}, a 2-element floating-point TypedArray, or an array of 2 numbers. + */ +type Vec2Like = [number, number] | FloatArray; + +/** + * A 3-dimensional vector given as a {@link Vec3}, a 3-element floating-point TypedArray, or an array of 3 numbers. + */ +type Vec3Like = [number, number, number] | FloatArray; + +/** + * A 4-dimensional vector given as a {@link Vec4}, a 4-element floating-point TypedArray, or an array of 4 numbers. + */ +type Vec4Like = [number, number, number, number] | FloatArray; + +export { + FloatArray, + Mat2Like, + Mat2dLike, + Mat3Like, + Mat4Like, + QuatLike, + Quat2Like, + Vec2Like, + Vec3Like, + Vec4Like +}; diff --git a/src/types/swizzle/f64/index.ts b/src/types/swizzle/f64/index.ts new file mode 100644 index 00000000..93dcccd0 --- /dev/null +++ b/src/types/swizzle/f64/index.ts @@ -0,0 +1,4883 @@ +/** + * Ambient module declarations for `gl-matrix/f64` (64-bit) swizzle extensions for vector classes. + * + * When swizzle accessors via {@link gl-matrix/swizzle/f64.EnableSwizzlesF64 | EnableSwizzlesF64} are enabled include + * this sub-path export as a `side effect` import to add ambient module declarations for the additional accessors to + * {@link gl-matrix/f64.Vec2 | Vec2} / {@link gl-matrix/f64.Vec3 | Vec3} / {@link gl-matrix/f64.Vec4 | Vec4}. + * + * To enable swizzling for the 64-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle/f64}. + * + * ```js + * import { Vec2 } from 'gl-matrix/f64'; + * import { EnableSwizzlesF64 } from 'gl-matrix/swizzle/f64'; + * + * import 'gl-matrix/types/swizzle/f64'; + * + * EnableSwizzlesF64(); + * + * const vec = new Vec2(0, 1); + * + * // Swizzled instance - returns new Vec2(1, 0). + * const vecSwizzled = vec.yx; + * ``` + * + * @packageDocumentation + */ + +import type { Vec2, Vec3, Vec4 } from '#gl-matrix/f64'; + +/** + * A type alias for Vec2 (64-bit). + * @hidden + */ +type Vec2Alias = Vec2; + +/** + * A type alias for Vec3 (64-bit). + * @hidden + */ +type Vec3Alias = Vec3; + +/** + * A type alias for Vec4 (64-bit). + * @hidden + */ +type Vec4Alias = Vec4; + +declare module '#gl-matrix/f64' { + // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should + // not be modified by hand. + // [Swizzle Autogen] + + /** + * Vec2 swizzle extension accessors. + */ + interface Vec2 { + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggg(): Vec4Alias; + } + + /** + * Vec3 swizzle extension accessors. + */ + interface Vec3 { + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get br(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbb(): Vec4Alias; + } + + /** + * Vec4 swizzle extension accessors. + */ + interface Vec4 { + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get br(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xw(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yw(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zw(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get wx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get wy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get wz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ww(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xwx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xwy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xwz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xww(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ywx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ywy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ywz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yww(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zwx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zwy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zwz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zww(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wwx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wwy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wwz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get www(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ra(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ga(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ba(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ar(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ag(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ab(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get aa(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rra(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get raa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gra(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gaa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bra(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get baa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get arr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get arg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get arb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ara(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get agr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get agg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get agb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get abr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get abg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get abb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aaa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rraa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rarr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rarg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rarb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ragr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ragg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ragb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rabr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rabg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rabb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get graa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get garr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get garg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get garb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gagr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gagg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gagb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gabr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gabg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gabb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get braa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get barr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get barg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get barb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bagr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bagg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bagb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get babr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get babg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get babb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get argr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get argg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get argb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get araa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aarr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aarg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aarb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aagr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aagg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aagb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aabr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aabg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aabb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaaa(): Vec4Alias; + } + + // [/Swizzle Autogen] +} + +export {}; diff --git a/src/types/swizzle/index.ts b/src/types/swizzle/index.ts new file mode 100644 index 00000000..74f24c5f --- /dev/null +++ b/src/types/swizzle/index.ts @@ -0,0 +1,4883 @@ +/** + * Ambient module declarations for `gl-matrix` (32-bit) swizzle extensions for vector classes. + * + * When swizzle accessors via {@link gl-matrix/swizzle.EnableSwizzles | EnableSwizzles} are enabled include this + * sub-path export as a `side effect` import to add ambient module declarations for the additional accessors to + * {@link gl-matrix.Vec2 | Vec2} / {@link gl-matrix.Vec3 | Vec3} / {@link gl-matrix.Vec4 | Vec4} + * + * To enable swizzling for the 32-bit variation of `gl-matrix` please see {@link gl-matrix/swizzle}. + * + * ```js + * import { Vec2 } from 'gl-matrix'; + * import { EnableSwizzles } from 'gl-matrix/swizzle'; + * + * import 'gl-matrix/types/swizzle'; + * + * EnableSwizzles(); + * + * const vec = new Vec2(0, 1); + * + * // Swizzled instance - returns new Vec2(1, 0). + * const vecSwizzled = vec.yx; + * ``` + * + * @packageDocumentation + */ + +import type { Vec2, Vec3, Vec4 } from '#gl-matrix'; + +/** + * A type alias for Vec2 (32-bit). + * @hidden + */ +type Vec2Alias = Vec2; + +/** + * A type alias for Vec3 (32-bit). + * @hidden + */ +type Vec3Alias = Vec3; + +/** + * A type alias for Vec4 (32-bit). + * @hidden + */ +type Vec4Alias = Vec4; + +declare module '#gl-matrix' { + // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should + // not be modified by hand. + // [Swizzle Autogen] + + /** + * Vec2 swizzle extension accessors. + */ + interface Vec2 { + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggg(): Vec4Alias; + } + + /** + * Vec3 swizzle extension accessors. + */ + interface Vec3 { + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get br(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbb(): Vec4Alias; + } + + /** + * Vec4 swizzle extension accessors. + */ + interface Vec4 { + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gr(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get rb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get gb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get br(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bg(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get bb(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rrb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get grb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ggb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get brb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bgb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bbb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get xw(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get yw(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get zw(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get wx(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get wy(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get wz(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ww(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xwx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xwy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xwz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get xww(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ywx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ywy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ywz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get yww(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zwx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zwy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zwz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get zww(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wxw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wyw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wzw(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wwx(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wwy(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get wwz(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get www(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get xwww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get yzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ywww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get zwww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wxww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wywx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wywy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wywz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wyww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wzww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwxw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwyw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwzw(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwwx(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwwy(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwwz(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get wwww(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ra(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ga(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ba(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ar(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ag(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get ab(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec2 + */ + get aa(): Vec2Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rra(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get rab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get raa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gra(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get gaa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bra(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get bab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get baa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get arr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get arg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get arb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get ara(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get agr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get agg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get agb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aga(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get abr(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get abg(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get abb(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aba(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aar(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aag(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aab(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec3 + */ + get aaa(): Vec3Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rrab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rraa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rgaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rbaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rarr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rarg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rarb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ragr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ragg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ragb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rabr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rabg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get rabb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get raaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get grab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get graa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get ggaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gbaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get garr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get garg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get garb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gagr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gagg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gagb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gabr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gabg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gabb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get gaaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get brab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get braa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bgaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bbaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get barr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get barg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get barb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bagr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bagg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get bagb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get babr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get babg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get babb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get baaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get argr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get argg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get argb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get arab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get araa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aggr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aggg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aggb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get agaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abrr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abrg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abrb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abra(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abgr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abgg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abgb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abbr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abbg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abbb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get abaa(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aarr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aarg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aarb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aara(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aagr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aagg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aagb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaga(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aabr(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aabg(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aabb(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaba(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaar(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaag(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaab(): Vec4Alias; + /** + * @category Swizzle Accessors (Optional) + * @returns New instance of swizzled Vec4 + */ + get aaaa(): Vec4Alias; + } + + // [/Swizzle Autogen] +} + +export {}; diff --git a/src/util/angleConversion.ts b/src/util/angleConversion.ts new file mode 100644 index 00000000..19da140f --- /dev/null +++ b/src/util/angleConversion.ts @@ -0,0 +1,29 @@ +/** + * Constant used in `gl-matrix` angle conversions. + */ +const GLM_DEG_TO_RAD: number = Math.PI / 180; + +/** + * Constant used in `gl-matrix` angle conversions. + */ +const GLM_RAD_TO_DEG: number = 180 / Math.PI; + +/** + * Convert `radians` to `degrees`. + * + * @param value - Angle in `radians`. + * @returns Angle in `degrees`. + */ +export function toDegree(value: number): number { + return value * GLM_RAD_TO_DEG; +} + +/** + * Convert `degrees` to `radians`. + * + * @param value - Angle in `degrees`. + * @returns Angle in `radians`. + */ +export function toRadian(value: number): number { + return value * GLM_DEG_TO_RAD; +} diff --git a/src/util/index.ts b/src/util/index.ts new file mode 100644 index 00000000..f3bfaafd --- /dev/null +++ b/src/util/index.ts @@ -0,0 +1,13 @@ +/** + * Provides optional utilities useful for working with `gl-matrix`. + * + * ```js + * import { toDegree, toRadian } from 'gl-matrix/util'; + * + * const rad = toRadian(180); + * ``` + * + * @packageDocumentation + */ + +export * from './angleConversion.js'; diff --git a/tests/common.spec.ts b/tests/common.spec.ts deleted file mode 100644 index 798a9722..00000000 --- a/tests/common.spec.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { expect, describe, it } from 'vitest'; -import "./test-utils" -import { toRadian, toDegree } from "../src/common" - -describe("Common", function() { - describe("toRadian", function(){ - it("should return a value of 0 when passed 0", function(){ expect(toRadian(0)).toBeCloseTo(0); }); - it("should return a value of Math.PI/2 when passed 90", function(){ expect(toRadian(90)).toBeCloseTo(Math.PI/2); }); - it("should return a value of Math.PI when passed 180", function(){ expect(toRadian(180)).toBeCloseTo(Math.PI); }); - it("should return a value of Math.PI*2 when passed 360", function(){ expect(toRadian(360)).toBeCloseTo(Math.PI*2); }); - }); - - describe("toDegree", function(){ - it("should return a value of 0 when passed 0", function(){ expect(toDegree(0)).toBeCloseTo(0); }); - it("should return a value of 90 when passed Math.PI/2", function(){ expect(toDegree(Math.PI/2)).toBeCloseTo(90); }); - it("should return a value of 180 when passed Math.PI", function(){ expect(toDegree(Math.PI)).toBeCloseTo(180); }); - it("should return a value of 360 when passed Math.PI*2", function(){ expect(toDegree(Math.PI*2)).toBeCloseTo(360); }); - }); -}); \ No newline at end of file diff --git a/tests/f32/Mat2.spec.ts b/tests/f32/Mat2.spec.ts new file mode 100644 index 00000000..94db01b2 --- /dev/null +++ b/tests/f32/Mat2.spec.ts @@ -0,0 +1,400 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Mat2 } from '#gl-matrix'; + +import type { FloatArray, Mat2Like, Vec2Like } from '#gl-matrix/types'; + +describe('Mat2', () => { + describe('constructor', () => { + it('should return an identity Mat2 if called with no arguments', () => { + expect(new Mat2()).toBeVec( + 1, 0, + 0, 1); + }); + + it('should return Mat2(m0, m1, ...m8) if called with (m0, m1, ...m8)', () => { + expect(new Mat2( + 1, 2, + 3, 4)).toBeVec( + 1, 2, + 3, 4); + }); + + it('should return Mat2(x, x, x, ...) if called with (x)', () => { + expect(new Mat2(1)).toBeVec( + 1, 1, + 1, 1); + }); + + it('should return Mat2(m0, m1, ...m8) if called with ([m0, m1, ...m8])', () => { + expect(new Mat2([ + 1, 2, + 3, 4])).toBeVec( + 1, 2, + 3, 4); + }); + + it('should return Mat2(m0, m1, ...m8) if called with (Mat4(m0, m1, ...m9))', () => { + const v = new Mat2( + 1, 2, + 3, 4); + expect(new Mat2(v)).toBeVec(v); + }); + + it('should return Mat2(m0, m1, ...m8) if called with (Float32Array([m0, m1, ...m8]))', () => { + const arr = new Float32Array([ + 1, 2, + 3, 4]); + expect(new Mat2(arr)).toBeVec(arr); + }); + }); + + describe('static', () => { + let out: Mat2Like, matA: Mat2Like, matB: Mat2Like, identity: Mat2Like, + result: [Mat2Like, Readonly, Mat2Like] | FloatArray | Mat2Like | null | number | string; + + beforeEach(() => { + matA = new Float32Array([1, 2, 3, 4]); + matB = new Float32Array([5, 6, 7, 8]); + out = new Float32Array([0, 0, 0, 0]); + identity = new Float32Array([1, 0, 0, 1]); + }); + + describe('create', () => { + beforeEach(() => { result = Mat2.create(); }); + + it('should return a 4 element array initialized to a 2x2 identity matrix', + () => expect(result).toBeVec(identity)); + }); + + describe('clone', () => { + beforeEach(() => { result = Mat2.clone(matA); }); + + it('should return a 4 element array initialized to the values in matA', () => expect(result).toBeVec(matA)); + }); + + describe('copy', () => { + beforeEach(() => { result = Mat2.copy(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec(matA)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('identity', () => { + beforeEach(() => { result = Mat2.identity(out); }); + + it('should place values into out', () => expect(result).toBeVec(identity)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('transpose', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2.transpose(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 3, 2, 4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2.transpose(matA, matA); }); + + it('should place values into matA', () => expect(matA).toBeVec(1, 3, 2, 4)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('invert', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2.invert(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec(-2, 1, 1.5, -0.5)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2.invert(matA, matA); }); + + it('should place values into matA', () => expect(matA).toBeVec(-2, 1, 1.5, -0.5)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('adjoint', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2.adjoint(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec(4, -2, -3, 1)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2.adjoint(matA, matA); }); + + it('should place values into matA', () => expect(matA).toBeVec(4, -2, -3, 1)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('determinant', () => { + beforeEach(() => { result = Mat2.determinant(matA); }); + + it('should return the determinant', () => expect(result).toEqual(-2)); + }); + + describe('multiply', () => { + it('should have an alias called `mul`', () => expect(Mat2.mul).toEqual(Mat2.multiply)); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2.multiply(out, matA, matB); }); + + it('should place values into out', () => expect(out).toBeVec(23, 34, 31, 46)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + it('should not modify matB', () => expect(matB).toBeVec(5, 6, 7, 8)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2.multiply(matA, matA, matB); }); + + it('should place values into matA', () => expect(matA).toBeVec(23, 34, 31, 46)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(5, 6, 7, 8)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat2.multiply(matB, matA, matB); }); + + it('should place values into matB', () => expect(matB).toBeVec(23, 34, 31, 46)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('rotate', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2.rotate(out, matA, Math.PI * 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(3, 4, -1, -2)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2.rotate(matA, matA, Math.PI * 0.5); }); + + it('should place values into matA', () => expect(matA).toBeVec(3, 4, -1, -2)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('scale', () => { + let vecA: Vec2Like; + + beforeEach(() => { vecA = [2, 3]; }); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2.scale(out, matA, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(2, 4, 9, 12)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2.scale(matA, matA, vecA); }); + + it('should place values into matA', () => expect(matA).toBeVec(2, 4, 9, 12)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('str', () => { + beforeEach(() => { result = Mat2.str(matA); }); + + it('should return a string representation of the matrix', () => expect(result).toEqual('Mat2(1, 2, 3, 4)')); + }); + + describe('frob', () => { + beforeEach(() => { result = Mat2.frob(matA); }); + it('should return the Frobenius Norm of the matrix', + () => expect(result).toEqual(Math.sqrt(Math.pow(1, 2) + Math.pow(2, 2) + Math.pow(3, 2) + Math.pow(4, 2)))); + }); + + describe('LDU', () => { + let L: Mat2, D: Mat2, U: Mat2, L_result: Mat2, D_result: Mat2, U_result: Mat2; + + beforeEach(() => { + L = Mat2.create(); + D = Mat2.create(); + U = Mat2.create(); + result = Mat2.LDU(L, D, U, [4, 3, 6, 3]); + L_result = Mat2.create(); L_result[2] = 1.5; + D_result = Mat2.create(); + U_result = Mat2.create(); + U_result[0] = 4; U_result[1] = 3; U_result[3] = -1.5; + }); + + it('should return a lower triangular, a diagonal and an upper triangular matrix', () => { + // @ts-expect-error Not null + expect(result[0]).toBeVec(L_result); + // @ts-expect-error Not null + expect(result[1]).toBeVec(D_result); + // @ts-expect-error Not null + expect(result[2]).toBeVec(U_result); + }); + }); + + describe('add', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2.add(out, matA, matB); }); + + it('should place values into out', () => expect(out).toBeVec(6, 8, 10, 12)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + it('should not modify matB', () => expect(matB).toBeVec(5, 6, 7, 8)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2.add(matA, matA, matB); }); + + it('should place values into matA', () => expect(matA).toBeVec(6, 8, 10, 12)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(5, 6, 7, 8)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat2.add(matB, matA, matB); }); + + it('should place values into matB', () => expect(matB).toBeVec(6, 8, 10, 12)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('subtract', () => { + it('should have an alias called `sub`', () => expect(Mat2.sub).toEqual(Mat2.subtract)); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2.subtract(out, matA, matB); }); + + it('should place values into out', () => expect(out).toBeVec(-4, -4, -4, -4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + it('should not modify matB', () => expect(matB).toBeVec(5, 6, 7, 8)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2.subtract(matA, matA, matB); }); + + it('should place values into matA', () => expect(matA).toBeVec(-4, -4, -4, -4)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(5, 6, 7, 8)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat2.subtract(matB, matA, matB); }); + + it('should place values into matB', () => expect(matB).toBeVec(-4, -4, -4, -4)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('fromValues', () => { + beforeEach(() => { result = Mat2.fromValues(1, 2, 3, 4); }); + + it('should return a 4 element array initialized to the values passed', () => expect(result).toBeVec(1, 2, 3, 4)); + }); + + describe('set', () => { + beforeEach(() => { result = Mat2.set(out, 1, 2, 3, 4); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3, 4)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('multiplyScalar', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2.multiplyScalar(out, matA, 2); }); + + it('should place values into out', () => expect(out).toBeVec(2, 4, 6, 8)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2.multiplyScalar(matA, matA, 2); }); + + it('should place values into matA', () => expect(matA).toBeVec(2, 4, 6, 8)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('multiplyScalarAndAdd', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2.multiplyScalarAndAdd(out, matA, matB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(3.5, 5, 6.5, 8)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + it('should not modify matB', () => expect(matB).toBeVec(5, 6, 7, 8)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2.multiplyScalarAndAdd(matA, matA, matB, 0.5); }); + + it('should place values into matA', () => expect(matA).toBeVec(3.5, 5, 6.5, 8)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(5, 6, 7, 8)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat2.multiplyScalarAndAdd(matB, matA, matB, 0.5); }); + + it('should place values into matB', () => expect(matB).toBeVec(3.5, 5, 6.5, 8)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('exactEquals', () => { + let matC: Mat2Like, r0: boolean, r1: boolean; + + beforeEach(() => { + matA = [0, 1, 2, 3]; + matB = [0, 1, 2, 3]; + matC = [1, 2, 3, 4]; + r0 = Mat2.exactEquals(matA, matB); + r1 = Mat2.exactEquals(matA, matC); + }); + + it('should return true for identical matrices', () => expect(r0).toBe(true)); + it('should return false for different matrices', () => expect(r1).toBe(false)); + it('should not modify matA', () => expect(matA).toBeVec(0, 1, 2, 3)); + it('should not modify matB', () => expect(matB).toBeVec(0, 1, 2, 3)); + }); + + describe('equals', () => { + let matC: Mat2Like, matD: Mat2Like, r0: boolean, r1: boolean, r2: boolean; + + beforeEach(() => { + matA = [0, 1, 2, 3]; + matB = [0, 1, 2, 3]; + matC = [1, 2, 3, 4]; + matD = [1e-16, 1, 2, 3]; + r0 = Mat2.equals(matA, matB); + r1 = Mat2.equals(matA, matC); + r2 = Mat2.equals(matA, matD); + }); + + it('should return true for identical matrices', () => expect(r0).toBe(true)); + it('should return false for different matrices', () => expect(r1).toBe(false)); + it('should return true for close but not identical matrices', () => expect(r2).toBe(true)); + it('should not modify matA', () => expect(matA).toBeVec(0, 1, 2, 3)); + it('should not modify matB', () => expect(matB).toBeVec(0, 1, 2, 3)); + }); + }); +}); diff --git a/tests/f32/Mat2d.spec.ts b/tests/f32/Mat2d.spec.ts new file mode 100644 index 00000000..dc10fe34 --- /dev/null +++ b/tests/f32/Mat2d.spec.ts @@ -0,0 +1,390 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Mat2d } from '#gl-matrix'; + +import type { Mat2dLike, Vec2Like } from '#gl-matrix/types'; + +describe('Mat2d', () => { + describe('constructor', () => { + it('should return an identity Mat2d if called with no arguments', () => { + expect(new Mat2d()).toBeVec( + 1, 0, + 0, 1, + 0, 0); + }); + + it('should return Mat2d(m0, m1, ...m5) if called with (m0, m1, ...m5)', () => { + expect(new Mat2d( + 1, 2, + 3, 4, + 5, 6)).toBeVec( + 1, 2, + 3, 4, + 5, 6); + }); + + it('should return Mat2d(x, x, x, ...) if called with (x)', () => { + expect(new Mat2d(1)).toBeVec( + 1, 1, + 1, 1, + 1, 1); + }); + + it('should return Mat2d(m0, m1, ...m8) if called with ([m0, m1, ...m8])', () => { + expect(new Mat2d([ + 1, 2, + 3, 4, + 5, 6])).toBeVec( + 1, 2, + 3, 4, + 5, 6); + }); + + it('should return Mat2d(m0, m1, ...m8) if called with (Mat2d(m0, m1, ...m9))', () => { + const v = new Mat2d( + 1, 2, + 3, 4, + 5, 6); + expect(new Mat2d(v)).toBeVec(v); + }); + + it('should return Mat2d(m0, m1, ...m8) if called with (Float32Array([m0, m1, ...m8]))', () => { + const arr = new Float32Array([ + 1, 2, + 3, 4, + 5, 6]); + expect(new Mat2d(arr)).toBeVec(arr); + }); + }); + + describe('static', () => { + let out: Mat2dLike, matA: Mat2dLike, matB: Mat2dLike, oldA: Mat2dLike, oldB: Mat2dLike, + identity: Mat2dLike, result: Mat2dLike | null | number | string; + + beforeEach(() => { + matA = new Float32Array([1, 2, + 3, 4, + 5, 6]); + + oldA = new Float32Array([1, 2, + 3, 4, + 5, 6]); + + matB = new Float32Array([7, 8, + 9, 10, + 11, 12]); + + oldB = new Float32Array([7, 8, + 9, 10, + 11, 12]); + + out = new Float32Array([0, 0, + 0, 0, + 0, 0]); + + identity = new Float32Array([1, 0, + 0, 1, + 0, 0]); + }); + + describe('create', () => { + beforeEach(() => { result = Mat2d.create(); }); + + it('should return a 6 element array initialized to a 2x3 identity matrix', + () => expect(result).toBeVec(identity)); + }); + + describe('clone', () => { + beforeEach(() => { result = Mat2d.clone(matA); }); + + it('should return a 6 element array initialized to the values in matA', () => expect(result).toBeVec(matA)); + }); + + describe('copy', () => { + beforeEach(() => { result = Mat2d.copy(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec(matA)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('identity', () => { + beforeEach(() => { result = Mat2d.identity(out); }); + + it('should place values into out', () => expect(result).toBeVec(identity)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('invert', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2d.invert(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec(-2, 1, 1.5, -0.5, 1, -2)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(oldA)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2d.invert(matA, matA); }); + + it('should place values into matA', () => expect(matA).toBeVec(-2, 1, 1.5, -0.5, 1, -2)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('determinant', () => { + beforeEach(() => { result = Mat2d.determinant(matA); }); + + it('should return the determinant', () => expect(result).toEqual(-2)); + }); + + describe('multiply', () => { + it('should have an alias called `mul`', () => expect(Mat2d.mul).toEqual(Mat2d.multiply)); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2d.multiply(out, matA, matB); }); + + it('should place values into out', () => expect(out).toBeVec(31, 46, 39, 58, 52, 76)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(oldA)); + it('should not modify matB', () => expect(matB).toBeVec(oldB)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2d.multiply(matA, matA, matB); }); + + it('should place values into matA', () => expect(matA).toBeVec(31, 46, 39, 58, 52, 76)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(oldB)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat2d.multiply(matB, matA, matB); }); + + it('should place values into matB', () => expect(matB).toBeVec(31, 46, 39, 58, 52, 76)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(oldA)); + }); + }); + + describe('rotate', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2d.rotate(out, matA, Math.PI * 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(3, 4, -1, -2, 5, 6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(oldA)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2d.rotate(matA, matA, Math.PI * 0.5); }); + + it('should place values into matA', () => expect(matA).toBeVec(3, 4, -1, -2, 5, 6)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('scale', () => { + let vecA: Vec2Like; + beforeEach(() => { vecA = [2, 3]; }); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2d.scale(out, matA, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(2, 4, 9, 12, 5, 6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(oldA)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2d.scale(matA, matA, vecA); }); + + it('should place values into matA', () => expect(matA).toBeVec(2, 4, 9, 12, 5, 6)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('translate', () => { + let vecA: Vec2Like; + beforeEach(() => { vecA = [2, 3]; }); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2d.translate(out, matA, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3, 4, 16, 22)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(oldA)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2d.translate(matA, matA, vecA); }); + + it('should place values into matA', () => expect(matA).toBeVec(1, 2, 3, 4, 16, 22)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('str', () => { + beforeEach(() => { result = Mat2d.str(matA); }); + + it('should return a string representation of the matrix', + () => expect(result).toEqual('Mat2d(1, 2, 3, 4, 5, 6)')); + }); + + describe('frob', () => { + beforeEach(() => { result = Mat2d.frob(matA); }); + + it('should return the Frobenius Norm of the matrix', () => expect(result).toEqual(Math.sqrt(Math.pow(1, 2) + + Math.pow(2, 2) + Math.pow(3, 2) + Math.pow(4, 2) + Math.pow(5, 2) + Math.pow(6, 2) + 1))); + }); + + describe('add', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2d.add(out, matA, matB); }); + + it('should place values into out', () => expect(out).toBeVec(8, 10, 12, 14, 16, 18)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(oldA)); + it('should not modify matB', () => expect(matB).toBeVec(oldB)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2d.add(matA, matA, matB); }); + + it('should place values into matA', () => expect(matA).toBeVec(8, 10, 12, 14, 16, 18)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(oldB)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat2d.add(matB, matA, matB); }); + + it('should place values into matB', () => expect(matB).toBeVec(8, 10, 12, 14, 16, 18)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(oldA)); + }); + }); + + describe('subtract', () => { + it('should have an alias called `sub`', () => expect(Mat2d.sub).toEqual(Mat2d.subtract)); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2d.subtract(out, matA, matB); }); + + it('should place values into out', () => expect(out).toBeVec(-6, -6, -6, -6, -6, -6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(oldA)); + it('should not modify matB', () => expect(matB).toBeVec(oldB)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2d.subtract(matA, matA, matB); }); + + it('should place values into matA', () => expect(matA).toBeVec(-6, -6, -6, -6, -6, -6)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(oldB)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat2d.subtract(matB, matA, matB); }); + + it('should place values into matB', () => expect(matB).toBeVec(-6, -6, -6, -6, -6, -6)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(oldA)); + }); + }); + + describe('fromValues', () => { + beforeEach(() => { result = Mat2d.fromValues(1, 2, 3, 4, 5, 6); }); + + it('should return a 6 element array initialized to the values passed', + () => expect(result).toBeVec(1, 2, 3, 4, 5, 6)); + }); + + describe('set', () => { + beforeEach(() => { result = Mat2d.set(out, 1, 2, 3, 4, 5, 6); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3, 4, 5, 6)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('multiplyScalar', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2d.multiplyScalar(out, matA, 2); }); + + it('should place values into out', () => expect(out).toBeVec(2, 4, 6, 8, 10, 12)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2d.multiplyScalar(matA, matA, 2); }); + + it('should place values into matA', () => expect(matA).toBeVec(2, 4, 6, 8, 10, 12)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('multiplyScalarAndAdd', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2d.multiplyScalarAndAdd(out, matA, matB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(4.5, 6, 7.5, 9, 10.5, 12)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6)); + it('should not modify matB', () => expect(matB).toBeVec(7, 8, 9, 10, 11, 12)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2d.multiplyScalarAndAdd(matA, matA, matB, 0.5); }); + + it('should place values into matA', () => expect(matA).toBeVec(4.5, 6, 7.5, 9, 10.5, 12)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(7, 8, 9, 10, 11, 12)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat2d.multiplyScalarAndAdd(matB, matA, matB, 0.5); }); + + it('should place values into matB', () => expect(matB).toBeVec(4.5, 6, 7.5, 9, 10.5, 12)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6)); + }); + }); + + describe('exactEquals', () => { + let matC: Mat2dLike, r0: boolean, r1: boolean; + beforeEach(() => { + matA = [0, 1, 2, 3, 4, 5]; + matB = [0, 1, 2, 3, 4, 5]; + matC = [1, 2, 3, 4, 5, 6]; + r0 = Mat2d.exactEquals(matA, matB); + r1 = Mat2d.exactEquals(matA, matC); + }); + + it('should return true for identical matrices', () => expect(r0).toBe(true)); + it('should return false for different matrices', () => expect(r1).toBe(false)); + it('should not modify matA', () => expect(matA).toBeVec(0, 1, 2, 3, 4, 5)); + it('should not modify matB', () => expect(matB).toBeVec(0, 1, 2, 3, 4, 5)); + }); + + describe('equals', () => { + let matC: Mat2dLike, matD: Mat2dLike, r0: boolean, r1: boolean, r2: boolean; + + beforeEach(() => { + matA = [0, 1, 2, 3, 4, 5]; + matB = [0, 1, 2, 3, 4, 5]; + matC = [1, 2, 3, 4, 5, 6]; + matD = [1e-16, 1, 2, 3, 4, 5]; + r0 = Mat2d.equals(matA, matB); + r1 = Mat2d.equals(matA, matC); + r2 = Mat2d.equals(matA, matD); + }); + + it('should return true for identical matrices', () => expect(r0).toBe(true)); + it('should return false for different matrices', () => expect(r1).toBe(false)); + it('should return true for close but not identical matrices', () => expect(r2).toBe(true)); + it('should not modify matA', () => expect(matA).toBeVec(0, 1, 2, 3, 4, 5)); + it('should not modify matB', () => expect(matB).toBeVec(0, 1, 2, 3, 4, 5)); + }); + }); +}); diff --git a/tests/f32/Mat3.spec.ts b/tests/f32/Mat3.spec.ts new file mode 100644 index 00000000..b70014a2 --- /dev/null +++ b/tests/f32/Mat3.spec.ts @@ -0,0 +1,581 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Mat3, Mat4, Vec3 } from '#gl-matrix'; + +import type { Mat3Like, Mat4Like, Vec4Like } from '#gl-matrix/types'; + +describe('Mat3', () => { + describe('constructor', () => { + it('should return an identity Mat3 if called with no arguments', () => { + expect(new Mat3()).toBeVec( + 1, 0, 0, + 0, 1, 0, + 0, 0, 1); + }); + + it('should return Mat3(m0, m1, ...m8) if called with (m0, m1, ...m8)', () => { + expect(new Mat3( + 1, 2, 3, + 4, 5, 6, + 7, 8, 9)).toBeVec( + 1, 2, 3, + 4, 5, 6, + 7, 8, 9); + }); + + it('should return Mat3(x, x, x, ...) if called with (x)', () => { + expect(new Mat3(1)).toBeVec( + 1, 1, 1, + 1, 1, 1, + 1, 1, 1); + }); + + it('should return Mat3(m0, m1, ...m8) if called with ([m0, m1, ...m8])', () => { + expect(new Mat3([ + 1, 2, 3, + 4, 5, 6, + 7, 8, 9])).toBeVec( + 1, 2, 3, + 4, 5, 6, + 7, 8, 9); + }); + + it('should return Mat3(m0, m1, ...m8) if called with (Mat3(m0, m1, ...m9))', () => { + const v = new Mat3( + 1, 2, 3, + 4, 5, 6, + 7, 8, 9); + expect(new Mat3(v)).toBeVec(v); + }); + + it('should return Mat3(m0, m1, ...m8) if called with (Float32Array([m0, m1, ...m8]))', () => { + const arr = new Float32Array([ + 1, 2, 3, + 4, 5, 6, + 7, 8, 9]); + expect(new Mat3(arr)).toBeVec(arr); + }); + }); + + describe('static', () => { + let out: Mat3Like, matA: Mat3Like, matB: Mat3Like, mat4: Mat4Like, identity: Mat3Like, + result: Mat3Like | null | number | string; + + beforeEach(() => { + matA = new Float32Array([1, 0, 0, + 0, 1, 0, + 1, 2, 1]); + + matB = new Float32Array([1, 0, 0, + 0, 1, 0, + 3, 4, 1]); + + out = new Float32Array([0, 0, 0, + 0, 0, 0, + 0, 0, 0]); + + identity = new Float32Array([1, 0, 0, + 0, 1, 0, + 0, 0, 1]); + }); + + describe('normalFromMat4', () => { + beforeEach(() => { + mat4 = new Float32Array([1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1]); + result = Mat3.normalFromMat4(out, mat4); + }); + + it('should return out', () => expect(result).toBe(out)); + + describe('with translation and rotation', () => { + beforeEach(() => { + Mat4.translate(mat4, mat4, [2, 4, 6]); + Mat4.rotateX(mat4, mat4, Math.PI / 2); + + result = Mat3.normalFromMat4(out, mat4); + }); + + it('should give rotated matrix', () => { + expect(result).toBeVec( + 1, 0, 0, + 0, 0, 1, + 0, -1, 0); + }); + + describe('and scale', () => { + beforeEach(() => { + Mat4.scale(mat4, mat4, [2, 3, 4]); + + result = Mat3.normalFromMat4(out, mat4); + }); + + it('should give rotated matrix', () => { + expect(result).toBeVec( + 0.5, 0, 0, + 0, 0, 0.333333, + 0, -0.25, 0); + }); + }); + }); + }); + + describe('fromQuat', () => { + let q: Vec4Like; + + beforeEach(() => { + q = [0, -0.7071067811865475, 0, 0.7071067811865475]; + result = Mat3.fromQuat(out, q); + }); + + it('should return out', () => expect(result).toBe(out)); + + it('should rotate a vector the same as the original quat', () => { + const vecOut = new Vec3(); + Vec3.transformQuat(vecOut, [0, 0, -1], q); + expect(Vec3.transformMat3([0, 0, 0], [0, 0, -1], out)).toBeVec(vecOut); + }); + + it('should rotate a vector by PI/2 radians', + () => expect(Vec3.transformMat3([0, 0, 0], [0, 0, -1], out)).toBeVec(1, 0, 0)); + }); + + describe('fromMat4', () => { + beforeEach(() => { + result = Mat3.fromMat4(out, [ + 1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16]); + }); + + it('should return out', () => expect(result).toBe(out)); + + it('should calculate proper Mat3', () => { + expect(out).toBeVec( + 1, 2, 3, + 5, 6, 7, + 9, 10, 11); + }); + }); + + describe('scale', () => { + beforeEach(() => { result = Mat3.scale(out, matA, [2, 2]); }); + + it('should return out', () => expect(result).toBe(out)); + it('should place proper values in out', () => { + expect(out).toBeVec( + 2, 0, 0, + 0, 2, 0, + 1, 2, 1); + }); + }); + + describe('create', () => { + beforeEach(() => { result = Mat3.create(); }); + + it('should return a 9 element array initialized to a 3x3 identity matrix', + () => expect(result).toBeVec(identity)); + }); + + describe('clone', () => { + beforeEach(() => { result = Mat3.clone(matA); }); + + it('should return a 9 element array initialized to the values in matA', () => expect(result).toBeVec(matA)); + }); + + describe('copy', () => { + beforeEach(() => { result = Mat3.copy(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec(matA)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('identity', () => { + beforeEach(() => { result = Mat3.identity(out); }); + + it('should place values into out', () => expect(result).toBeVec(identity)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('transpose', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat3.transpose(out, matA); }); + + it('should place values into out', () => { + expect(out).toBeVec( + 1, 0, 1, + 0, 1, 2, + 0, 0, 1 + ); + }); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => { + expect(matA).toBeVec( + 1, 0, 0, + 0, 1, 0, + 1, 2, 1 + ); + }); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat3.transpose(matA, matA); }); + + it('should place values into matA', () => { + expect(matA).toBeVec( + 1, 0, 1, + 0, 1, 2, + 0, 0, 1 + ); + }); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('invert', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat3.invert(out, matA); }); + + it('should place values into out', () => { + expect(out).toBeVec( + 1, 0, 0, + 0, 1, 0, + -1, -2, 1 + ); + }); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => { + expect(matA).toBeVec( + 1, 0, 0, + 0, 1, 0, + 1, 2, 1 + ); + }); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat3.invert(matA, matA); }); + + it('should place values into matA', () => { + expect(matA).toBeVec( + 1, 0, 0, + 0, 1, 0, + -1, -2, 1 + ); + }); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('adjoint', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat3.adjoint(out, matA); }); + + it('should place values into out', () => { + expect(out).toBeVec( + 1, 0, 0, + 0, 1, 0, + -1, -2, 1 + ); + }); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => { + expect(matA).toBeVec( + 1, 0, 0, + 0, 1, 0, + 1, 2, 1 + ); + }); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat3.adjoint(matA, matA); }); + + it('should place values into matA', () => { + expect(matA).toBeVec( + 1, 0, 0, + 0, 1, 0, + -1, -2, 1 + ); + }); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('determinant', () => { + beforeEach(() => { result = Mat3.determinant(matA); }); + + it('should return the determinant', () => expect(result).toEqual(1)); + }); + + describe('multiply', () => { + it('should have an alias called `mul`', () => expect(Mat3.mul).toEqual(Mat3.multiply)); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat3.multiply(out, matA, matB); }); + + it('should place values into out', () => { + expect(out).toBeVec( + 1, 0, 0, + 0, 1, 0, + 4, 6, 1 + ); + }); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => { + expect(matA).toBeVec( + 1, 0, 0, + 0, 1, 0, + 1, 2, 1 + ); + }); + it('should not modify matB', () => { + expect(matB).toBeVec( + 1, 0, 0, + 0, 1, 0, + 3, 4, 1 + ); + }); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat3.multiply(matA, matA, matB); }); + + it('should place values into matA', () => { + expect(matA).toBeVec( + 1, 0, 0, + 0, 1, 0, + 4, 6, 1 + ); + }); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => { + expect(matB).toBeVec( + 1, 0, 0, + 0, 1, 0, + 3, 4, 1 + ); + }); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat3.multiply(matB, matA, matB); }); + + it('should place values into matB', () => { + expect(matB).toBeVec( + 1, 0, 0, + 0, 1, 0, + 4, 6, 1 + ); + }); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => { + expect(matA).toBeVec( + 1, 0, 0, + 0, 1, 0, + 1, 2, 1 + ); + }); + }); + }); + + describe('str', () => { + beforeEach(() => { result = Mat3.str(matA); }); + + it('should return a string representation of the matrix', + () => expect(result).toEqual('Mat3(1, 0, 0, 0, 1, 0, 1, 2, 1)')); + }); + + describe('frob', () => { + beforeEach(() => { result = Mat3.frob(matA); }); + + it('should return the Frobenius Norm of the matrix', () => expect(result).toEqual(Math.sqrt(Math.pow(1, 2) + + Math.pow(0, 2) + Math.pow(0, 2) + Math.pow(0, 2) + Math.pow(1, 2) + Math.pow(0, 2) + Math.pow(1, 2) + + Math.pow(2, 2) + Math.pow(1, 2)))); + }); + + describe('add', () => { + beforeEach(() => { + matA = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + matB = [10, 11, 12, 13, 14, 15, 16, 17, 18]; + }); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat3.add(out, matA, matB); }); + + it('should place values into out', () => expect(out).toBeVec(11, 13, 15, 17, 19, 21, 23, 25, 27)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9)); + it('should not modify matB', () => expect(matB).toBeVec(10, 11, 12, 13, 14, 15, 16, 17, 18)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat3.add(matA, matA, matB); }); + + it('should place values into matA', () => expect(matA).toBeVec(11, 13, 15, 17, 19, 21, 23, 25, 27)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(10, 11, 12, 13, 14, 15, 16, 17, 18)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat3.add(matB, matA, matB); }); + + it('should place values into matB', () => expect(matB).toBeVec(11, 13, 15, 17, 19, 21, 23, 25, 27)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9)); + }); + }); + + describe('subtract', () => { + beforeEach(() => { + matA = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + matB = [10, 11, 12, 13, 14, 15, 16, 17, 18]; + }); + + it('should have an alias called `sub`', () => expect(Mat3.sub).toEqual(Mat3.subtract)); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat3.subtract(out, matA, matB); }); + + it('should place values into out', () => expect(out).toBeVec(-9, -9, -9, -9, -9, -9, -9, -9, -9)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9)); + it('should not modify matB', () => expect(matB).toBeVec(10, 11, 12, 13, 14, 15, 16, 17, 18)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat3.subtract(matA, matA, matB); }); + + it('should place values into matA', () => expect(matA).toBeVec(-9, -9, -9, -9, -9, -9, -9, -9, -9)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(10, 11, 12, 13, 14, 15, 16, 17, 18)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat3.subtract(matB, matA, matB); }); + + it('should place values into matB', () => expect(matB).toBeVec(-9, -9, -9, -9, -9, -9, -9, -9, -9)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9)); + }); + }); + + describe('fromValues', () => { + beforeEach(() => { result = Mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9); }); + + it('should return a 9 element array initialized to the values passed', + () => expect(result).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9)); + }); + + describe('set', () => { + beforeEach(() => { result = Mat3.set(out, 1, 2, 3, 4, 5, 6, 7, 8, 9); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('multiplyScalar', () => { + beforeEach(() => { matA = [1, 2, 3, 4, 5, 6, 7, 8, 9]; }); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat3.multiplyScalar(out, matA, 2); }); + + it('should place values into out', () => expect(out).toBeVec(2, 4, 6, 8, 10, 12, 14, 16, 18)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat3.multiplyScalar(matA, matA, 2); }); + + it('should place values into matA', () => expect(matA).toBeVec(2, 4, 6, 8, 10, 12, 14, 16, 18)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('multiplyScalarAndAdd', () => { + beforeEach(() => { + matA = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + matB = [10, 11, 12, 13, 14, 15, 16, 17, 18]; + }); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat3.multiplyScalarAndAdd(out, matA, matB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(6, 7.5, 9, 10.5, 12, 13.5, 15, 16.5, 18)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9)); + it('should not modify matB', () => expect(matB).toBeVec(10, 11, 12, 13, 14, 15, 16, 17, 18)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat3.multiplyScalarAndAdd(matA, matA, matB, 0.5); }); + + it('should place values into matA', () => expect(matA).toBeVec(6, 7.5, 9, 10.5, 12, 13.5, 15, 16.5, 18)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(10, 11, 12, 13, 14, 15, 16, 17, 18)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat3.multiplyScalarAndAdd(matB, matA, matB, 0.5); }); + + it('should place values into matB', () => expect(matB).toBeVec(6, 7.5, 9, 10.5, 12, 13.5, 15, 16.5, 18)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9)); + }); + }); + + describe('projection', () => { + beforeEach(() => { result = Mat3.projection(out, 100.0, 200.0); }); + + it('should return out', () => expect(result).toBe(out)); + + it('should give projection matrix', () => { + expect(result).toBeVec( + 0.02, 0, 0, + 0, -0.01, 0, + -1, 1, 1); + }); + }); + + describe('exactEquals', () => { + let matC: Mat3Like, r0: boolean, r1: boolean; + + beforeEach(() => { + matA = [0, 1, 2, 3, 4, 5, 6, 7, 8]; + matB = [0, 1, 2, 3, 4, 5, 6, 7, 8]; + matC = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + r0 = Mat3.exactEquals(matA, matB); + r1 = Mat3.exactEquals(matA, matC); + }); + + it('should return true for identical matrices', () => expect(r0).toBe(true)); + it('should return false for different matrices', () => expect(r1).toBe(false)); + it('should not modify matA', () => expect(matA).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8)); + it('should not modify matB', () => expect(matB).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8)); + }); + + describe('equals', () => { + let matC: Mat3Like, matD: Mat3Like, r0: boolean, r1: boolean, r2: boolean; + + beforeEach(() => { + matA = [0, 1, 2, 3, 4, 5, 6, 7, 8]; + matB = [0, 1, 2, 3, 4, 5, 6, 7, 8]; + matC = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + matD = [1e-16, 1, 2, 3, 4, 5, 6, 7, 8]; + r0 = Mat3.equals(matA, matB); + r1 = Mat3.equals(matA, matC); + r2 = Mat3.equals(matA, matD); + }); + + it('should return true for identical matrices', () => expect(r0).toBe(true)); + it('should return false for different matrices', () => expect(r1).toBe(false)); + it('should return true for close but not identical matrices', () => expect(r2).toBe(true)); + it('should not modify matA', () => expect(matA).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8)); + it('should not modify matB', () => expect(matB).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8)); + }); + }); +}); diff --git a/tests/f32/Mat4.spec.ts b/tests/f32/Mat4.spec.ts new file mode 100644 index 00000000..506f52d4 --- /dev/null +++ b/tests/f32/Mat4.spec.ts @@ -0,0 +1,1167 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Mat4, Quat, Vec3 } from '#gl-matrix'; + +import type { FloatArray, Mat4Like, Vec3Like, Vec4Like } from '#gl-matrix/types'; + +describe('Mat4', () => { + describe('constructor', () => { + it('should return an identity Mat4 if called with no arguments', () => { + expect(new Mat4()).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + }); + + it('should return Mat4(m0, m1, ...m15) if called with (m0, m1, ...m15)', () => { + expect(new Mat4( + 1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16)).toBeVec( + 1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16); + }); + + it('should return Mat4(x, x, x) if called with (x)', () => { + expect(new Mat4(1)).toBeVec( + 1, 1, 1, 1, + 1, 1, 1, 1, + 1, 1, 1, 1, + 1, 1, 1, 1); + }); + + it('should return Mat4(m0, m1, ...m15) if called with ([m0, m1, ...m15])', () => { + expect(new Mat4([ + 1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16])).toBeVec( + 1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16); + }); + + it('should return Mat4(m0, m1, ...m15) if called with (Mat4(m0, m1, ...m15))', () => { + const v = new Mat4( + 1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16); + expect(new Mat4(v)).toBeVec(v); + }); + + it('should return Mat4(m0, m1, ...m15) if called with (Float32Array([m0, m1, ...m15]))', () => { + const arr = new Float32Array([ + 1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16]); + expect(new Mat4(arr)).toBeVec(arr); + }); + }); + + describe('static', () => { + let out: Mat4Like, matA: Mat4Like, matB: Mat4Like, identity: Mat4Like, + result: Mat4Like | Vec3Like | Vec4Like | null | number | string; + + beforeEach(() => { + // Attempting to portray a semi-realistic transform matrix + matA = new Float32Array([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + ]); + + matB = new Float32Array([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 4, 5, 6, 1 + ]); + + out = new Float32Array([ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0 + ]); + + identity = new Float32Array([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]); + }); + + describe('create', () => { + beforeEach(() => { result = Mat4.create(); }); + + it('should return a 16 element array initialized to a 4x4 identity matrix', + () => expect(result).toBeVec(identity)); + }); + + describe('clone', () => { + beforeEach(() => { result = Mat4.clone(matA); }); + + it('should return a 16 element array initialized to the values in matA', () => expect(result).toBeVec(matA)); + }); + + describe('copy', () => { + beforeEach(() => { result = Mat4.copy(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec(matA)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('identity', () => { + beforeEach(() => { result = Mat4.identity(out); }); + + it('should place values into out', () => expect(result).toBeVec(identity)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('transpose', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.transpose(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec( + 1, 0, 0, 1, + 0, 1, 0, 2, + 0, 0, 1, 3, + 0, 0, 0, 1 + )); + + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.transpose(matA, matA); }); + + it('should place values into matA', () => expect(matA).toBeVec( + 1, 0, 0, 1, + 0, 1, 0, 2, + 0, 0, 1, 3, + 0, 0, 0, 1 + )); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('invert', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.invert(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + -1, -2, -3, 1 + )); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.invert(matA, matA); }); + + it('should place values into matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + -1, -2, -3, 1 + )); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('adjoint', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.adjoint(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + -1, -2, -3, 1 + )); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.adjoint(matA, matA); }); + + it('should place values into matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + -1, -2, -3, 1 + )); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('determinant', () => { + beforeEach(() => { result = Mat4.determinant(matA); }); + + it('should return the determinant', () => expect(result).toEqual(1)); + }); + + describe('multiply', () => { + it('should have an alias called `mul`', () => expect(Mat4.mul).toEqual(Mat4.multiply)); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.multiply(out, matA, matB); }); + + it('should place values into out', () => expect(out).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 5, 7, 9, 1 + )); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + it('should not modify matB', () => expect(matB).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 4, 5, 6, 1 + )); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.multiply(matA, matA, matB); }); + + it('should place values into matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 5, 7, 9, 1 + )); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 4, 5, 6, 1 + )); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat4.multiply(matB, matA, matB); }); + + it('should place values into matB', () => expect(matB).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 5, 7, 9, 1 + )); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + }); + }); + + describe('translate', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.translate(out, matA, [4, 5, 6]); }); + + it('should place values into out', () => expect(out).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 5, 7, 9, 1 + )); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.translate(matA, matA, [4, 5, 6]); }); + + it('should place values into matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 5, 7, 9, 1 + )); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('scale', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.scale(out, matA, [4, 5, 6]); }); + + it('should place values into out', () => expect(out).toBeVec( + 4, 0, 0, 0, + 0, 5, 0, 0, + 0, 0, 6, 0, + 1, 2, 3, 1 + )); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.scale(matA, matA, [4, 5, 6]); }); + + it('should place values into matA', () => expect(matA).toBeVec( + 4, 0, 0, 0, + 0, 5, 0, 0, + 0, 0, 6, 0, + 1, 2, 3, 1 + )); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('rotate', () => { + const rad = Math.PI * 0.5; + const axis: Vec3Like = [1, 0, 0]; + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.rotate(out, matA, rad, axis); }); + + it('should place values into out', () => expect(out).toBeVec( + 1, 0, 0, 0, + 0, Math.cos(rad), Math.sin(rad), 0, + 0, -Math.sin(rad), Math.cos(rad), 0, + 1, 2, 3, 1 + )); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.rotate(matA, matA, rad, axis); }); + + it('should place values into matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, Math.cos(rad), Math.sin(rad), 0, + 0, -Math.sin(rad), Math.cos(rad), 0, + 1, 2, 3, 1 + )); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('rotateX', () => { + const rad = Math.PI * 0.5; + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.rotateX(out, matA, rad); }); + + it('should place values into out', () => expect(out).toBeVec( + 1, 0, 0, 0, + 0, Math.cos(rad), Math.sin(rad), 0, + 0, -Math.sin(rad), Math.cos(rad), 0, + 1, 2, 3, 1 + )); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.rotateX(matA, matA, rad); }); + + it('should place values into matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, Math.cos(rad), Math.sin(rad), 0, + 0, -Math.sin(rad), Math.cos(rad), 0, + 1, 2, 3, 1 + )); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('rotateY', () => { + const rad = Math.PI * 0.5; + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.rotateY(out, matA, rad); }); + + it('should place values into out', () => expect(out).toBeVec( + Math.cos(rad), 0, -Math.sin(rad), 0, + 0, 1, 0, 0, + Math.sin(rad), 0, Math.cos(rad), 0, + 1, 2, 3, 1 + )); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.rotateY(matA, matA, rad); }); + + it('should place values into matA', () => expect(matA).toBeVec( + Math.cos(rad), 0, -Math.sin(rad), 0, + 0, 1, 0, 0, + Math.sin(rad), 0, Math.cos(rad), 0, + 1, 2, 3, 1 + )); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('rotateZ', () => { + const rad = Math.PI * 0.5; + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.rotateZ(out, matA, rad); }); + + it('should place values into out', () => expect(out).toBeVec( + Math.cos(rad), Math.sin(rad), 0, 0, + -Math.sin(rad), Math.cos(rad), 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.rotateZ(matA, matA, rad); }); + + it('should place values into matA', () => expect(matA).toBeVec( + Math.cos(rad), Math.sin(rad), 0, 0, + -Math.sin(rad), Math.cos(rad), 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + // TODO: fromRotationTranslation + + describe('normalFromMat4', () => { + beforeEach(() => { + matA = new Float32Array([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1]); + result = Mat4.normalFromMat4(out, matA); + }); + + it('should return out', () => expect(result).toBe(out)); + + describe('with translation and rotation', () => { + beforeEach(() => { + Mat4.translate(matA, matA, [2, 4, 6]); + Mat4.rotateX(matA, matA, Math.PI / 2); + + result = Mat4.normalFromMat4(out, matA); + }); + + it('should give rotated matrix', () => expect(result).toBeVec( + 1, 0, 0, 0, + 0, 0, 1, 0, + 0, -1, 0, 0, + 0, 0, 0, 1 + )); + + describe('and scale', () => { + beforeEach(() => { + Mat4.scale(matA, matA, [2, 3, 4]); + + result = Mat4.normalFromMat4(out, matA); + }); + + it('should give rotated matrix', () => expect(result).toBeVec( + 0.5, 0, 0, 0, + 0, 0, 0.333333, 0, + 0, -0.25, 0, 0, + 0, 0, 0, 1 + )); + }); + }); + }); + + describe('getTranslation', () => { + describe('from the identity matrix', () => { + beforeEach(() => { + result = Vec3.fromValues(1, 2, 3); + out = Vec3.fromValues(1, 2, 3); + result = Mat4.getTranslation(out, identity); + }); + + it('should place result both in result and out', () => expect(result).toBe(out)); + it('should return the zero vector', () => expect(result).toBeVec(0, 0, 0)); + }); + + describe('from a translation-only matrix', () => { + beforeEach(() => { + result = new Vec3(1, 2, 3); + out = new Vec3(1, 2, 3); + result = Mat4.getTranslation(out, matB); + }); + + it('should return translation vector', () => expect(out).toBeVec(4, 5, 6)); + }); + + describe('from a translation and rotation matrix', () => { + beforeEach(() => { + const q = new Quat(); + const v = new Vec3(5, 6, 7); + Quat.setAxisAngle(q, [0.26726124, 0.534522474, 0.8017837], 0.55); + Mat4.fromRotationTranslation(out, q, v); + + result = new Vec3(); + Mat4.getTranslation(result, out); + }); + + it('should keep the same translation vector, regardless of rotation', () => expect(result).toBeVec(5, 6, 7)); + }); + }); + + describe('getScaling', () => { + describe('from the identity matrix', () => { + beforeEach(() => { + result = new Vec3(1, 2, 3); + out = new Vec3(1, 2, 3); + result = Mat4.getScaling(out, identity); + }); + + it('should place result both in result and out', () => expect(result).toBe(out)); + it('should return the identity vector', () => expect(result).toBeVec(1, 1, 1)); + }); + + describe('from a scale-only matrix', () => { + beforeEach(() => { + const v = new Vec3(4, 5, 6); + result = new Vec3(1, 2, 3); + out = new Vec3(1, 2, 3); + Mat4.fromScaling(matA, v); + result = Mat4.getScaling(out, matA); + }); + + it('should return translation vector', () => expect(out).toBeVec(4, 5, 6)); + }); + + describe('from a translation and rotation matrix', () => { + beforeEach(() => { + let q = Quat.create(); + const v = Vec3.fromValues(5, 6, 7); + q = Quat.setAxisAngle(q, [1, 0, 0], 0.5) as Quat; + Mat4.fromRotationTranslation(out, q, v); + + result = Vec3.fromValues(1, 2, 3); + Mat4.getScaling(result, out); + }); + + it('should return the identity vector', () => expect(result).toBeVec(1, 1, 1)); + }); + + describe('from a translation, rotation and scale matrix', () => { + beforeEach(() => { + let q = Quat.create(); + const t = Vec3.fromValues(1, 2, 3); + const s = Vec3.fromValues(5, 6, 7); + q = Quat.setAxisAngle(q, [0, 1, 0], 0.7) as Quat; + Mat4.fromRotationTranslationScale(out, q, t, s); + result = Vec3.fromValues(5, 6, 7); + Mat4.getScaling(result, out); + }); + + it('should return the same scaling factor when created', () => expect(result).toBeVec(5, 6, 7)); + }); + }); + + describe('getRotation', () => { + describe('from the identity matrix', () => { + beforeEach(() => { + result = Quat.fromValues(1, 2, 3, 4); + out = Quat.fromValues(1, 2, 3, 4); + result = Mat4.getRotation(out, identity); + }); + + it('should place result both in result and out', () => expect(result).toBe(out)); + it('should return the unit quaternion', () => { + const unitQuat = Quat.create(); + Quat.identity(unitQuat); + expect(result).toBeVec(unitQuat); + }); + }); + + describe('from a translation-only matrix', () => { + beforeEach(() => { + result = Quat.fromValues(1, 2, 3, 4); + out = Quat.fromValues(1, 2, 3, 4); + result = Mat4.getRotation(out, matB); + }); + + it('should return the unit quaternion', () => { + const unitQuat = Quat.create(); + Quat.identity(unitQuat); + expect(result).toBeVec(unitQuat); + }); + }); + + describe('from a translation and rotation matrix', () => { + it('should keep the same rotation as when created', () => { + let q = Quat.create(); + const outVec = Vec3.fromValues(5, 6, 7); + const testVec = Vec3.fromValues(1, 5, 2); + const ang = 0.78972; + + Vec3.normalize(testVec, testVec); + q = Quat.setAxisAngle(q, testVec, ang) as Quat; + Mat4.fromRotationTranslation(out, q, outVec); + + result = Quat.fromValues(2, 3, 4, 6); + Mat4.getRotation(result, out); + const outaxis = Vec3.create(); + const outangle = Quat.getAxisAngle(outaxis, result); + + expect(outaxis).toBeVec(testVec); + expect(outangle).toBeCloseTo(ang); + }); + }); + }); + + describe('frustumNO', () => { + it('should have an alias called `frustum`', () => expect(Mat4.frustumNO).toEqual(Mat4.frustum)); + + beforeEach(() => { result = Mat4.frustumNO(out, -1, 1, -1, 1, -1, 1); }); + + it('should place values into out', () => expect(result).toBeVec( + -1, 0, 0, 0, + 0, -1, 0, 0, + 0, 0, 0, -1, + 0, 0, 1, 0 + )); + it('should return out', () => expect(result).toBe(out)); + + describe('with an Infinite far plane', () => { + beforeEach(() => { result = Mat4.frustumNO(out, -1, 1, -1, 1, -1, Infinity); }); + + it('should calculate correct matrix', () => expect(result).toBeVec( + -1, 0, 0, 0, + 0, -1, 0, 0, + 0, 0, -1, -1, + 0, 0, 2, 0 + )); + }); + }); + + describe('frustumZO', () => { + beforeEach(() => { result = Mat4.frustumZO(out, -1, 1, -1, 1, -1, 1); }); + + it('should place values into out', () => expect(result).toBeVec( + -1, 0, 0, 0, + 0, -1, 0, 0, + 0, 0, -0.5, -1, + 0, 0, 0.5, 0 + )); + it('should return out', () => expect(result).toBe(out)); + + describe('with an Infinite far plane', () => { + beforeEach(() => { result = Mat4.frustumZO(out, -1, 1, -1, 1, -1, Infinity); }); + + it('should calculate correct matrix', () => expect(result).toBeVec( + -1, 0, 0, 0, + 0, -1, 0, 0, + 0, 0, -1, -1, + 0, 0, 1, 0 + )); + }); + }); + + describe('perspectiveNO', () => { + it('should have an alias called `perspective`', () => expect(Mat4.perspectiveNO).toEqual(Mat4.perspective)); + + const fovy = Math.PI * 0.5; + beforeEach(() => { result = Mat4.perspectiveNO(out, fovy, 1, 0, 1); }); + + it('should place values into out', () => expect(result).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, -1, -1, + 0, 0, 0, 0 + )); + it('should return out', () => expect(result).toBe(out)); + + describe('with nonzero near, 45deg fovy, and realistic aspect ratio', () => { + beforeEach(() => { result = Mat4.perspectiveNO(out, 45 * Math.PI / 180.0, 640 / 480, 0.1, 200); }); + + it('should calculate correct matrix', () => expect(result).toBeVec( + 1.81066, 0, 0, 0, + 0, 2.414213, 0, 0, + 0, 0, -1.001, -1, + 0, 0, -0.2001, 0 + )); + }); + + describe('with no far plane, 45deg fovy, and realistic aspect ratio', () => { + beforeEach(() => { result = Mat4.perspectiveNO(out, 45 * Math.PI / 180.0, 640 / 480, 0.1); }); + + it('should calculate correct matrix', () => expect(result).toBeVec( + 1.81066, 0, 0, 0, + 0, 2.414213, 0, 0, + 0, 0, -1, -1, + 0, 0, -0.2, 0 + )); + }); + + describe('with infinite far plane, 45deg fovy, and realistic aspect ratio', () => { + beforeEach(() => { result = Mat4.perspectiveNO(out, 45 * Math.PI / 180.0, 640 / 480, 0.1, Infinity); }); + + it('should calculate correct matrix', () => expect(result).toBeVec( + 1.81066, 0, 0, 0, + 0, 2.414213, 0, 0, + 0, 0, -1, -1, + 0, 0, -0.2, 0 + )); + }); + }); + + describe('orthoNO', () => { + beforeEach(() => { result = Mat4.orthoNO(out, -1, 1, -1, 1, -1, 1); }); + + it('should have an alias called `ortho`', () => expect(Mat4.orthoNO).toEqual(Mat4.ortho)); + it('should place values into out', () => expect(result).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, -1, 0, + 0, 0, 0, 1 + )); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('lookAt', () => { + let eye: FloatArray = new Float32Array([0, 0, 1]); + let center: FloatArray = new Float32Array([0, 0, -1]); + let up: FloatArray = new Float32Array([0, 1, 0]); + let view: FloatArray, right: FloatArray; + + beforeEach(() => { + eye = new Float32Array([0, 0, 1]); + center = new Float32Array([0, 0, -1]); + up = new Float32Array([0, 1, 0]); + result = Mat4.lookAt(out, eye, center, up); + }); + + describe('looking down', () => { + beforeEach(() => { + view = new Float32Array([0, -1, 0]); + up = new Float32Array([0, 0, -1]); + right = new Float32Array([1, 0, 0]); + result = Mat4.lookAt(out, [0, 0, 0], view, up); + }); + + it('should transform view into local -Z', () => { + result = Vec3.transformMat4(new Float32Array(3), view, out); + expect(result).toBeVec(0, 0, -1); + }); + + it('should transform up into local +Y', () => { + result = Vec3.transformMat4(new Float32Array(3), up, out); + expect(result).toBeVec(0, 1, 0); + }); + + it('should transform right into local +X', () => { + result = Vec3.transformMat4(new Float32Array(3), right, out); + expect(result).toBeVec(1, 0, 0); + }); + + it('should return out', () => expect(result).toBe(out)); + }); + + describe('#74', () => { + beforeEach(() => { + Mat4.lookAt(out, + new Float32Array([0, 2, 0]), + new Float32Array([0, 0.6, 0]), + new Float32Array([0, 0, -1])); + }); + + it('should transform a point `above` into local +Y', () => { + result = Vec3.transformMat4(new Float32Array(3), [0, 2, -1], out); + expect(result).toBeVec(0, 1, 0); + }); + + it('should transform a point `right of` into local +X', () => { + result = Vec3.transformMat4(new Float32Array(3), [1, 2, 0], out); + expect(result).toBeVec(1, 0, 0); + }); + + it('should transform a point `in front of` into local -Z', () => { + result = Vec3.transformMat4(new Float32Array(3), [0, 1, 0], out); + expect(result).toBeVec(0, 0, -1); + }); + }); + + it('should place values into out', () => expect(result).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, -1, 1 + )); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('targetTo', () => { + let eye: FloatArray = new Float32Array([0, 0, 1]); + let center: FloatArray = new Float32Array([0, 0, -1]); + let up: FloatArray = new Float32Array([0, 1, 0]); + let view: FloatArray, right: FloatArray; + + beforeEach(() => { + eye = new Float32Array([0, 0, 1]); + center = new Float32Array([0, 0, -1]); + up = new Float32Array([0, 1, 0]); + result = Mat4.targetTo(out, eye, center, up); + }); + + describe('looking down', () => { + beforeEach(() => { + view = new Float32Array([0, -1, 0]); + up = new Float32Array([0, 0, -1]); + right = new Float32Array([1, 0, 0]); + result = Mat4.targetTo(out, [0, 0, 0], view, up); + }); + + it('should transform view into local Z', () => { + result = Vec3.transformMat4(new Float32Array(3), view, out); + expect(result).toBeVec(0, 0, 1); + }); + + it('should transform up into local -Y', () => { + result = Vec3.transformMat4(new Float32Array(3), up, out); + expect(result).toBeVec(0, -1, 0); + }); + + it('should transform right into local +X', () => { + result = Vec3.transformMat4(new Float32Array(3), right, out); + expect(result).toBeVec(1, 0, 0); + }); + + it('should return out', () => expect(result).toBe(out)); + + it('scaling should be [1, 1, 1]', () => { + const scaling = Mat4.getScaling(new Float32Array(3), out); + expect(scaling).toBeVec(1, 1, 1); + }); + }); + + describe('#74', () => { + beforeEach(() => { + Mat4.targetTo(out, + new Float32Array([0, 2, 0]), + new Float32Array([0, 0.6, 0]), + new Float32Array([0, 0, -1])); + }); + + it('should transform a point `above` into local +Y', () => { + result = Vec3.transformMat4(new Float32Array(3), [0, 2, -1], out); + expect(result).toBeVec(0, 1, -2); + }); + + it('should transform a point `right of` into local +X', () => { + result = Vec3.transformMat4(new Float32Array(3), [1, 2, 0], out); + expect(result).toBeVec(1, 2, -2); + }); + + it('should transform a point `in front of` into local -Z', () => { + result = Vec3.transformMat4(new Float32Array(3), [0, 1, 0], out); + expect(result).toBeVec(0, 2, -1); + }); + + it('scaling should be [1, 1, 1]', () => { + const scaling = Mat4.getScaling(new Float32Array(3), out); + expect(scaling).toBeVec(1, 1, 1); + }); + }); + + describe('scaling test', () => { + beforeEach(() => { + Mat4.targetTo(out, + new Float32Array([0, 1, 0]), + new Float32Array([0, 0, 1]), + new Float32Array([0, 0, -1])); + }); + + it('scaling should be [1, 1, 1]', () => { + const scaling = Mat4.getScaling(new Float32Array(3), out); + expect(scaling).toBeVec(1, 1, 1); + }); + }); + + it('should place values into out', () => expect(result).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 1, 1 + )); + it('should return out', () => expect(result).toBe(out)); + it('scaling should be [1, 1, 1]', () => { + const scaling = Mat4.getScaling(new Float32Array(3), out); + expect(scaling).toBeVec(1, 1, 1); + }); + }); + + describe('str', () => { + beforeEach(() => { result = Mat4.str(matA); }); + + it('should return a string representation of the matrix', + () => expect(result).toEqual('Mat4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 2, 3, 1)')); + }); + + describe('frob', () => { + beforeEach(() => { result = Mat4.frob(matA); }); + + it('should return the Frobenius Norm of the matrix', () => expect(result).toBeCloseTo(Math.sqrt(Math.pow(1, 2) + + Math.pow(1, 2) + Math.pow(1, 2) + Math.pow(1, 2) + Math.pow(1, 2) + Math.pow(2, 2) + Math.pow(3, 2)))); + }); + + describe('add', () => { + beforeEach(() => { + matA = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + matB = [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]; + }); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.add(out, matA, matB); }); + + it('should place values into out', + () => expect(out).toBeVec(18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); + it('should not modify matB', + () => expect(matB).toBeVec(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.add(matA, matA, matB); }); + + it('should place values into matA', + () => expect(matA).toBeVec(18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', + () => expect(matB).toBeVec(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat4.add(matB, matA, matB); }); + + it('should place values into matB', + () => expect(matB).toBeVec(18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); + }); + }); + + describe('subtract', () => { + beforeEach(() => { + matA = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + matB = [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]; + }); + + it('should have an alias called `sub`', () => expect(Mat4.sub).toEqual(Mat4.subtract)); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.subtract(out, matA, matB); }); + + it('should place values into out', + () => expect(out).toBeVec(-16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); + it('should not modify matB', + () => expect(matB).toBeVec(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.subtract(matA, matA, matB); }); + + it('should place values into matA', + () => expect(matA).toBeVec(-16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', + () => expect(matB).toBeVec(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat4.subtract(matB, matA, matB); }); + + it('should place values into matB', + () => expect(matB).toBeVec(-16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); + }); + }); + + describe('fromValues', () => { + beforeEach(() => { result = Mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); }); + + it('should return a 16 element array initialized to the values passed', + () => expect(result).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); + }); + + describe('set', () => { + beforeEach(() => { result = Mat4.set(out, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); }); + + it('should place values into out', + () => expect(out).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('multiplyScalar', () => { + beforeEach(() => { matA = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; }); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.multiplyScalar(out, matA, 2); }); + + it('should place values into out', + () => expect(out).toBeVec(2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.multiplyScalar(matA, matA, 2); }); + + it('should place values into matA', + () => expect(matA).toBeVec(2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('multiplyScalarAndAdd', () => { + beforeEach(() => { + matA = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + matB = [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]; + }); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.multiplyScalarAndAdd(out, matA, matB, 0.5); }); + + it('should place values into out', + () => expect(out).toBeVec(9.5, 11, 12.5, 14, 15.5, 17, 18.5, 20, 21.5, 23, 24.5, 26, 27.5, 29, 30.5, 32)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); + it('should not modify matB', + () => expect(matB).toBeVec(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.multiplyScalarAndAdd(matA, matA, matB, 0.5); }); + + it('should place values into matA', + () => expect(matA).toBeVec(9.5, 11, 12.5, 14, 15.5, 17, 18.5, 20, 21.5, 23, 24.5, 26, 27.5, 29, 30.5, 32)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', + () => expect(matB).toBeVec(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat4.multiplyScalarAndAdd(matB, matA, matB, 0.5); }); + + it('should place values into matB', + () => expect(matB).toBeVec(9.5, 11, 12.5, 14, 15.5, 17, 18.5, 20, 21.5, 23, 24.5, 26, 27.5, 29, 30.5, 32)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); + }); + }); + + describe('exactEquals', () => { + let matC: Mat4Like, r0: boolean, r1: boolean; + + beforeEach(() => { + matA = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; + matB = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; + matC = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + r0 = Mat4.exactEquals(matA, matB); + r1 = Mat4.exactEquals(matA, matC); + }); + + it('should return true for identical matrices', () => expect(r0).toBe(true)); + it('should return false for different matrices', () => expect(r1).toBe(false)); + it('should not modify matA', () => expect(matA).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)); + it('should not modify matB', () => expect(matB).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)); + }); + + describe('equals', () => { + let matC: Mat4Like, matD: Mat4Like, r0: boolean, r1: boolean, r2: boolean; + + beforeEach(() => { + matA = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; + matB = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; + matC = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + matD = [1e-16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; + r0 = Mat4.equals(matA, matB); + r1 = Mat4.equals(matA, matC); + r2 = Mat4.equals(matA, matD); + }); + + it('should return true for identical matrices', () => expect(r0).toBe(true)); + it('should return false for different matrices', () => expect(r1).toBe(false)); + it('should return true for close but not identical matrices', () => expect(r2).toBe(true)); + it('should not modify matA', () => expect(matA).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)); + it('should not modify matB', () => expect(matB).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)); + }); + }); +}); diff --git a/tests/f32/Quat.spec.ts b/tests/f32/Quat.spec.ts new file mode 100644 index 00000000..312f0d9a --- /dev/null +++ b/tests/f32/Quat.spec.ts @@ -0,0 +1,753 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Quat, Vec3 } from '#gl-matrix'; + +import type { Vec3Like, Vec4Like, QuatLike } from '#gl-matrix/types'; + +describe('Quat', () => { + describe('constructor', () => { + it('should return Quat(0, 0, 0, 1) if called with no arguments', () => expect(new Quat()).toBeVec(0, 0, 0, 1)); + + it('should return Quat(x, y, z, w) if called with (x, y, z, w)', () => { + expect(new Quat(1, 2, 3, 4)).toBeVec(1, 2, 3, 4); + expect(new Quat(-3, 4.4, -5.6, 7.8)).toBeVec(-3, 4.4, -5.6, 7.8); + }); + + it('should return Quat(x, x, x, x) if called with (x)', () => { + expect(new Quat(1)).toBeVec(1, 1, 1, 1); + expect(new Quat(-2.3)).toBeVec(-2.3, -2.3, -2.3, -2.3); + }); + + it('should return Quat(x, y, z, w) if called with ([x, y, z, w])', () => { + expect(new Quat([1, 2, 3, 4])).toBeVec(1, 2, 3, 4); + expect(new Quat([-3, 4.4, -5.6, 7.8])).toBeVec(-3, 4.4, -5.6, 7.8); + }); + + it('should return Quat(x, y, z, w) if called with (Quat(x, y, z, w))', () => { + const v = new Quat(3.4, 5.6, 7.8, 9); + expect(new Quat(v)).toBeVec(v); + }); + + it('should return Quat(x, y, z, w) if called with (Float32Array([x, y, z, w]))', () => { + const arr = new Float32Array([1.2, 3.4, 5.6, 7.8]); + expect(new Quat(arr)).toBeVec(arr); + }); + }); + + describe('static', () => { + let out: Quat; + let quatA: QuatLike; + let quatB: QuatLike; + let result: Vec4Like | number | string; + let vec: Vec3Like; + + const id = new Quat(0, 0, 0, 1); + const deg90 = Math.PI / 2; + + beforeEach(() => { + quatA = new Quat(1, 2, 3, 4); + quatB = new Quat(5, 6, 7, 8); + out = new Quat(0, 0, 0, 0); + vec = [1, 1, -1]; + }); + + describe('slerp', () => { + describe('the normal case', () => { + beforeEach(() => { result = Quat.slerp(out, [0, 0, 0, 1], [0, 1, 0, 0], 0.5); }); + + it('should return out', () => expect(result).toBe(out)); + it('should calculate proper quat', () => expect(result).toBeVec(0, 0.707106, 0, 0.707106)); + }); + + describe('where a == b', () => { + beforeEach(() => { result = Quat.slerp(out, [0, 0, 0, 1], [0, 0, 0, 1], 0.5); }); + + it('should return out', () => expect(result).toBe(out)); + it('should calculate proper quat', () => expect(result).toBeVec(0, 0, 0, 1)); + }); + + describe('where theta == 180deg', () => { + beforeEach(() => { + Quat.rotateX(quatA, [1, 0, 0, 0], Math.PI); // 180 deg + result = Quat.slerp(out, [1, 0, 0, 0], quatA, 1); + }); + + it('should calculate proper quat', () => expect(result).toBeVec(0, 0, 0, -1)); + }); + + describe('where a == -b', () => { + beforeEach(() => { result = Quat.slerp(out, [1, 0, 0, 0], [-1, 0, 0, 0], 0.5); }); + + it('should return out', () => expect(result).toBe(out)); + it('should calculate proper quat', () => expect(result).toBeVec(1, 0, 0, 0)); + }); + }); + + describe('pow', () => { + describe('identity quat', () => { + beforeEach(() => { result = Quat.pow(out, id, 2.1 /* random number */); }); + + it('should return out', () => expect(result).toBe(out)); + it('should be the identity', () => expect(result).toBeVec(id)); + }); + + describe('power of one', () => { + beforeEach(() => { + Quat.normalize(quatA, quatA); + + result = Quat.pow(out, quatA, 1); + }); + + it('should be the identity', () => expect(result).toBeVec(quatA)); + it('should be normalized', () => expect(Quat.length(result as Vec4Like)).toBeCloseTo(1)); + }); + + describe('squared', () => { + beforeEach(() => { + Quat.normalize(quatA, quatA); + + result = Quat.pow(out, quatA, 2); + }); + + it('should be the square', () => { + const reference = Quat.multiply(Quat.create(), quatA, quatA); + expect(result).toBeVec(reference); + }); + + it('should be normalized', () => expect(Quat.length(result as Vec4Like)).toBeCloseTo(1)); + }); + + describe('conjugate', () => { + beforeEach(() => { + Quat.normalize(quatA, quatA); + + result = Quat.pow(out, quatA, -1); + }); + + it('should be the conjugate', () => { + const reference = Quat.conjugate(Quat.create(), quatA); + expect(result).toBeVec(reference); + }); + it('should be normalized', () => expect(Quat.length(result as Vec4Like)).toBeCloseTo(1)); + }); + + describe('reversible', () => { + beforeEach(() => { + Quat.normalize(quatA, quatA); + + const b = 2.1; // random number + result = Quat.pow(out, quatA, b); + result = Quat.pow(out, result, 1 / b); + }); + + it('should be reverted', () => expect(result).toBeVec(quatA)); + it('should be normalized', () => expect(Quat.length(result as Vec4Like)).toBeCloseTo(1)); + }); + }); + + describe('rotateX', () => { + beforeEach(() => { result = Quat.rotateX(out, id, deg90); }); + + it('should return out', () => expect(result).toBe(out)); + it('should transform vec accordingly', () => { + Vec3.transformQuat(vec, [0, 0, -1], out); + expect(vec).toBeVec(0, 1, 0); + }); + }); + + describe('rotateY', () => { + beforeEach(() => { result = Quat.rotateY(out, id, deg90); }); + + it('should return out', () => expect(result).toBe(out)); + it('should transform vec accordingly', () => { + Vec3.transformQuat(vec, [0, 0, -1], out); + expect(vec).toBeVec(-1, 0, 0); + }); + }); + + describe('rotateZ', () => { + beforeEach(() => { result = Quat.rotateZ(out, id, deg90); }); + + it('should return out', () => expect(result).toBe(out)); + it('should transform vec accordingly', () => { + Vec3.transformQuat(vec, [0, 1, 0], out); + expect(vec).toBeVec(-1, 0, 0); + }); + }); + + /* + describe('fromMat3', () => { + let matr; + + describe('legacy', () => { + beforeEach(() => { + matr = [ 1, 0, 0, + 0, 0, -1, + 0, 1, 0 ]; + result = Quat.fromMat3(out, matr); + }); + + it('should set dest to the correct value', () => expect(result).toBeVec(-0.707106, 0, 0, 0.707106)); + }); + + describe('where trace > 0', () => { + beforeEach(() => { + matr = [ 1, 0, 0, + 0, 0, -1, + 0, 1, 0 ]; + result = Quat.fromMat3(out, matr); + }); + + it('should return out', () => expect(result).toBe(out)); + + it('should produce the correct transformation', + () => expect(Vec3.transformQuat([], [0,1,0], out)).toBeVec(0,0,-1)); + }); + + describe('from a normal matrix looking `backward`', () => { + beforeEach(() => { + matr = mat3.create(); + mat3.transpose(matr, mat3.invert(matr, mat3.fromMat4(matr, mat4.lookAt( + mat4.create(), [0, 0, 0], [0, 0, 1], [0, 1, 0])))); + result = Quat.fromMat3(out, matr); + }); + + it('should return out', () => expect(result).toBe(out)); + + it('should produce the same transformation as the given matrix', () => expect(Vec3.transformQuat([], [3,2,-1], + Quat.normalize(out, out))).toBeEqualish(Vec3.transformMat3([], [3,2,-1], matr))); + }); + + describe('from a normal matrix looking `left` and `upside down`', () => { + beforeEach(() => { + matr = mat3.create(); + mat3.transpose(matr, mat3.invert(matr, mat3.fromMat4(matr, mat4.lookAt( + mat4.create(), [0, 0, 0], [-1, 0, 0], [0, -1, 0])))); + result = Quat.fromMat3(out, matr); + }); + + it('should return out', () => expect(result).toBe(out)); + + it('should produce the same transformation as the given matrix', () => expect(Vec3.transformQuat([], [3,2,-1], + Quat.normalize(out, out))).toBeEqualish(Vec3.transformMat3([], [3,2,-1], matr))); + }); + + describe('from a normal matrix looking `upside down`', () => { + beforeEach(() => { + matr = mat3.create(); + mat3.transpose(matr, mat3.invert(matr, mat3.fromMat4(matr, mat4.lookAt( + mat4.create(), [0, 0, 0], [0, 0, -1], [0, -1, 0])))); + result = Quat.fromMat3(out, matr); + }); + + it('should return out', () => expect(result).toBe(out)); + + it('should produce the same transformation as the given matrix', () => expect(Vec3.transformQuat([], [3,2,-1], + Quat.normalize(out, out))).toBeEqualish(Vec3.transformMat3([], [3,2,-1], matr))); + }); + });*/ + + describe('fromEuler', () => { + describe('legacy', () => { + beforeEach(() => { result = Quat.fromEuler(out, -90, 0, 0); }); + + it('should set dest to the correct value', () => expect(result).toBeVec(-0.707106, 0, 0, 0.707106)); + }); + + describe('where trace > 0', () => { + beforeEach(() => { result = Quat.fromEuler(out, -90, 0, 0); }); + + it('should return out', () => expect(result).toBe(out)); + + it('should produce the correct transformation', + () => expect(Vec3.transformQuat([0, 0, 0], [0, 1, 0], out)).toBeVec(0, 0, -1)); + }); + }); + + /* + describe('setAxes', () => { + let r; + beforeEach(() => { r = Vec3.create(); }); + + describe('looking left', () => { + let view, up, right; + + beforeEach(() => { + view = [-1, 0, 0]; + up = [ 0, 1, 0]; + right= [ 0, 0,-1]; + result = Quat.setAxes([], view, right, up); + }); + + it('should transform local view into world left', () => { + r = Vec3.transformQuat([], [0,0,-1], result); + expect(r).toBeVec(1, 0, 0); + }); + + it('should transform local right into world front', () => { + r = Vec3.transformQuat([], [1,0,0], result); + expect(r).toBeVec(0, 0, 1); + }); + }); + + describe('given opengl defaults', () => { + let view, up, right; + + beforeEach(() => { + view = [0, 0, -1]; + up = [0, 1, 0]; + right= [1, 0, 0]; + result = Quat.setAxes(out, view, right, up); + }); + + it('should return out', () => expect(result).toBe(out)); + it('should produce identity', () => expect(out).toBeVec(0, 0, 0, 1)); + }); + + describe('legacy example', () => { + let view, up, right; + + beforeEach(() => { + right= [1, 0, 0]; + up = [0, 0, 1]; + view = [0, -1, 0]; + result = Quat.setAxes(out, view, right, up); + }); + + it('should set correct quat4 values', () => expect(result).toBeVec(0.707106, 0, 0, 0.707106)); + }); + });*/ + + describe('rotationTo', () => { + let r: Vec3; + + beforeEach(() => { r = Vec3.create(); }); + + describe('at right angle', () => { + beforeEach(() => { result = Quat.rotationTo(out, [0, 1, 0], [1, 0, 0]); }); + + it('should return out', () => expect(result).toBe(out)); + it('should calculate proper quaternion', () => expect(out).toBeVec(0, 0, -0.707106, 0.707106)); + }); + + describe('when vectors are parallel', () => { + beforeEach(() => { result = Quat.rotationTo(out, [0, 1, 0], [0, 1, 0]); }); + + it('should return out', () => expect(result).toBe(out)); + it('multiplying A should produce B', () => expect(Vec3.transformQuat(r, [0, 1, 0], out)).toBeVec(0, 1, 0)); + }); + + describe('when vectors are opposed X', () => { + beforeEach(() => { result = Quat.rotationTo(out, [1, 0, 0], [-1, 0, 0]); }); + + it('should return out', () => expect(result).toBe(out)); + it('multiplying A should produce B', () => expect(Vec3.transformQuat(r, [1, 0, 0], out)).toBeVec(-1, 0, 0)); + }); + + describe('when vectors are opposed Y', () => { + beforeEach(() => { result = Quat.rotationTo(out, [0, 1, 0], [0, -1, 0]); }); + + it('should return out', () => expect(result).toBe(out)); + it('multiplying A should produce B', () => expect(Vec3.transformQuat(r, [0, 1, 0], out)).toBeVec(0, -1, 0)); + }); + + describe('when vectors are opposed Z', () => { + beforeEach(() => { result = Quat.rotationTo(out, [0, 0, 1], [0, 0, -1]); }); + + it('should return out', () => expect(result).toBe(out)); + it('multiplying A should produce B', () => expect(Vec3.transformQuat(r, [0, 0, 1], out)).toBeVec(0, 0, -1)); + }); + }); + + describe('create', () => { + beforeEach(() => { result = Quat.create(); }); + + it('should return a 4 element array initialized to an identity quaternion', + () => expect(result).toBeVec(0, 0, 0, 1)); + }); + + describe('clone', () => { + beforeEach(() => { result = Quat.clone(quatA); }); + + it('should return a 4 element array initialized to the values in quatA', () => expect(result).toBeVec(quatA)); + }); + + describe('fromValues', () => { + beforeEach(() => { result = Quat.fromValues(1, 2, 3, 4); }); + + it('should return a 4 element array initialized to the values passed', () => expect(result).toBeVec(1, 2, 3, 4)); + }); + + describe('copy', () => { + beforeEach(() => { result = Quat.copy(out, quatA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3, 4)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('set', () => { + beforeEach(() => { result = Quat.set(out, 1, 2, 3, 4); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3, 4)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('identity', () => { + beforeEach(() => { result = Quat.identity(out); }); + + it('should place values into out', () => expect(result).toBeVec(0, 0, 0, 1)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('setAxisAngle', () => { + beforeEach(() => { result = Quat.setAxisAngle(out, [1, 0, 0], Math.PI * 0.5); }); + + it('should place values into out', () => expect(result).toBeVec(0.707106, 0, 0, 0.707106)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('getAxisAngle', () => { + let angle: number; + + describe('for a quaternion representing no rotation', () => { + beforeEach(() => { result = Quat.setAxisAngle(out, [0, 1, 0], 0.0); angle = Quat.getAxisAngle(vec, out); }); + + it('should return a multiple of 2*PI as the angle component', + () => expect(angle % (Math.PI * 2.0)).toBeCloseTo(0.0)); + }); + + describe('for a simple rotation about X axis', () => { + beforeEach(() => { result = Quat.setAxisAngle(out, [1, 0, 0], 0.7778); angle = Quat.getAxisAngle(vec, out); }); + + it('should return the same provided angle', () => expect(angle).toBeCloseTo(0.7778)); + it('should return the X axis as the angle', () => expect(vec).toBeVec(1, 0, 0)); + }); + + describe('for a simple rotation about Y axis', () => { + beforeEach(() => { + result = Quat.setAxisAngle(out, [0, 1, 0], 0.879546); + angle = Quat.getAxisAngle(vec, out); + }); + + it('should return the same provided angle', () => expect(angle).toBeCloseTo(0.879546)); + it('should return the X axis as the angle', () => expect(vec).toBeVec(0, 1, 0)); + }); + + describe('for a simple rotation about Z axis', () => { + beforeEach(() => { + result = Quat.setAxisAngle(out, [0, 0, 1], 0.123456); + angle = Quat.getAxisAngle(vec, out); + }); + + it('should return the same provided angle', () => expect(angle).toBeCloseTo(0.123456)); + it('should return the X axis as the angle', () => expect(vec).toBeVec(0, 0, 1)); + }); + + describe('for a slightly irregular axis and right angle', () => { + beforeEach(() => { + result = Quat.setAxisAngle(out, [0.707106, 0, 0.707106], Math.PI * 0.5); + angle = Quat.getAxisAngle(vec, out); + }); + + it('should place values into vec', () => expect(vec).toBeVec(0.707106, 0, 0.707106)); + it('should return a numeric angle', () => expect(angle).toBeCloseTo(Math.PI * 0.5)); + }); + + describe('for a very irregular axis and negative input angle', () => { + beforeEach(() => { + quatA = Quat.setAxisAngle(quatA, [0.65538555, 0.49153915, 0.57346237], 8.8888) as Quat; + angle = Quat.getAxisAngle(vec, quatA); + quatB = Quat.setAxisAngle(quatB, vec, angle) as Quat; + }); + + it('should return an angle between 0 and 2*PI', () => { + expect(angle).toBeGreaterThan(0.0); + expect(angle).toBeLessThan(Math.PI * 2.0); + }); + it('should create the same quaternion from axis and angle extracted', () => expect(quatA).toBeVec(quatB)); + }); + }); + + describe('getAngle', () => { + describe('from itself', () => { + beforeEach(() => { Quat.normalize(quatA, quatA); }); + + it('should be zero', () => expect(Quat.getAngle(quatA, quatA)).toBeCloseTo(0)); + }); + + describe('from rotated', () => { + beforeEach(() => { + Quat.normalize(quatA, quatA); + Quat.rotateX(quatB, quatA, Math.PI / 4); + }); + + it('should be 45 degrees', () => expect(Quat.getAngle(quatA, quatB)).toBeCloseTo(Math.PI / 4)); + }); + + describe('compare with axisAngle', () => { + beforeEach(() => { + Quat.normalize(quatA, quatA); + Quat.normalize(quatB, quatB); + }); + + it('should be equalish', () => { + // compute reference value as axisAngle of quatA^{-1} * quatB + const quatAInv = Quat.conjugate(Quat.create(), quatA); + const quatAB = Quat.multiply(quatAInv, quatAInv, quatB); + const dummy = Vec3.create(); + const reference = Quat.getAxisAngle(dummy, quatAB); + + expect(Quat.getAngle(quatA, quatB)).toBeCloseTo(reference); + }); + }); + }); + + describe('add', () => { + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat.add(out, quatA, quatB); }); + + it('should place values into out', () => expect(out).toBeVec(6, 8, 10, 12)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + it('should not modify quatB', () => expect(quatB).toBeVec(5, 6, 7, 8)); + }); + + describe('when quatA is the output quaternion', () => { + beforeEach(() => { result = Quat.add(quatA, quatA, quatB); }); + + it('should place values into quatA', () => expect(quatA).toBeVec(6, 8, 10, 12)); + it('should return quatA', () => expect(result).toBe(quatA)); + it('should not modify quatB', () => expect(quatB).toBeVec(5, 6, 7, 8)); + }); + + describe('when quatB is the output quaternion', () => { + beforeEach(() => { result = Quat.add(quatB, quatA, quatB); }); + + it('should place values into quatB', () => expect(quatB).toBeVec(6, 8, 10, 12)); + it('should return quatB', () => expect(result).toBe(quatB)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('multiply', () => { + it('should have an alias called `mul`', () => expect(Quat.mul).toEqual(Quat.multiply)); + + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat.multiply(out, quatA, quatB); }); + + it('should place values into out', () => expect(out).toBeVec(24, 48, 48, -6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + it('should not modify quatB', () => expect(quatB).toBeVec(5, 6, 7, 8)); + }); + + describe('when quatA is the output quaternion', () => { + beforeEach(() => { result = Quat.multiply(quatA, quatA, quatB); }); + + it('should place values into quatA', () => expect(quatA).toBeVec(24, 48, 48, -6)); + it('should return quatA', () => expect(result).toBe(quatA)); + it('should not modify quatB', () => expect(quatB).toBeVec(5, 6, 7, 8)); + }); + + describe('when quatB is the output quaternion', () => { + beforeEach(() => { result = Quat.multiply(quatB, quatA, quatB); }); + + it('should place values into quatB', () => expect(quatB).toBeVec(24, 48, 48, -6)); + it('should return quatB', () => expect(result).toBe(quatB)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('scale', () => { + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat.scale(out, quatA, 2); }); + + it('should place values into out', () => expect(out).toBeVec(2, 4, 6, 8)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + }); + + describe('when quatA is the output quaternion', () => { + beforeEach(() => { result = Quat.scale(quatA, quatA, 2); }); + + it('should place values into quatA', () => expect(quatA).toBeVec(2, 4, 6, 8)); + it('should return quatA', () => expect(result).toBe(quatA)); + }); + }); + + describe('length', () => { + beforeEach(() => { result = Quat.len(quatA); }); + + it('should have an alias called `len`', () => expect(Quat.len).toEqual(Quat.length)); + it('should return the length', () => expect(result).toBeCloseTo(5.477225)); + }); + + describe('squaredLength', () => { + beforeEach(() => { result = Quat.squaredLength(quatA); }); + + it('should have an alias called `sqrLen``', () => expect(Quat.sqrLen).toEqual(Quat.squaredLength)); + it('should return the squared length', () => expect(result).toEqual(30)); + }); + + describe('normalize', () => { + beforeEach(() => { quatA = [5, 0, 0, 0]; }); + + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat.normalize(out, quatA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 0, 0, 0)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quatA', () => expect(quatA).toBeVec(5, 0, 0, 0)); + }); + + describe('when quatA is the output quaternion', () => { + beforeEach(() => { result = Quat.normalize(quatA, quatA); }); + + it('should place values into quatA', () => expect(quatA).toBeVec(1, 0, 0, 0)); + it('should return quatA', () => expect(result).toBe(quatA)); + }); + }); + + describe('lerp', () => { + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat.lerp(out, quatA, quatB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(3, 4, 5, 6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + it('should not modify quatB', () => expect(quatB).toBeVec(5, 6, 7, 8)); + }); + + describe('when quatA is the output quaternion', () => { + beforeEach(() => { result = Quat.lerp(quatA, quatA, quatB, 0.5); }); + + it('should place values into quatA', () => expect(quatA).toBeVec(3, 4, 5, 6)); + it('should return quatA', () => expect(result).toBe(quatA)); + it('should not modify quatB', () => expect(quatB).toBeVec(5, 6, 7, 8)); + }); + + describe('when quatB is the output quaternion', () => { + beforeEach(() => { result = Quat.lerp(quatB, quatA, quatB, 0.5); }); + + it('should place values into quatB', () => expect(quatB).toBeVec(3, 4, 5, 6)); + it('should return quatB', () => expect(result).toBe(quatB)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('slerp', () => { + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat.slerp(out, quatA, quatB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(3, 4, 5, 6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + it('should not modify quatB', () => expect(quatB).toBeVec(5, 6, 7, 8)); + }); + + describe('when quatA is the output quaternion', () => { + beforeEach(() => { result = Quat.slerp(quatA, quatA, quatB, 0.5); }); + + it('should place values into quatA', () => expect(quatA).toBeVec(3, 4, 5, 6)); + it('should return quatA', () => expect(result).toBe(quatA)); + it('should not modify quatB', () => expect(quatB).toBeVec(5, 6, 7, 8)); + }); + + describe('when quatB is the output quaternion', () => { + beforeEach(() => { result = Quat.slerp(quatB, quatA, quatB, 0.5); }); + + it('should place values into quatB', () => expect(quatB).toBeVec(3, 4, 5, 6)); + it('should return quatB', () => expect(result).toBe(quatB)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + }); + }); + + /* + describe('random', () => { + beforeEach(() => { result = Quat.random(out); }); + + it('should result in a normalized quaternion', () => { + let copy = Quat.clone(out); + expect(Quat.normalize(out, out)).toBeVec(copy); + }); + it('should return out', () => expect(result).toBe(out)); + });*/ + + describe('invert', () => { + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat.invert(out, quatA); }); + + it('should place values into out', () => expect(out).toBeVec(-0.033333, -0.066666, -0.1, 0.133333)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + }); + + describe('when quatA is the output quaternion', () => { + beforeEach(() => { result = Quat.invert(quatA, quatA); }); + + it('should place values into quatA', () => expect(quatA).toBeVec(-0.033333, -0.066666, -0.1, 0.133333)); + it('should return quatA', () => expect(result).toBe(quatA)); + }); + }); + + describe('conjugate', () => { + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat.conjugate(out, quatA); }); + + it('should place values into out', () => expect(out).toBeVec(-1, -2, -3, 4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + }); + + describe('when quatA is the output quaternion', () => { + beforeEach(() => { result = Quat.conjugate(quatA, quatA); }); + + it('should place values into quatA', () => expect(quatA).toBeVec(-1, -2, -3, 4)); + it('should return quatA', () => expect(result).toBe(quatA)); + }); + }); + + describe('str', () => { + beforeEach(() => { result = Quat.str(quatA); }); + + it('should return a string representation of the quaternion', () => expect(result).toEqual('Quat(1, 2, 3, 4)')); + }); + + describe('exactEquals', () => { + let quatC: Vec4Like, r0: boolean, r1: boolean; + + beforeEach(() => { + quatA = [0, 1, 2, 3]; + quatB = [0, 1, 2, 3]; + quatC = [1, 2, 3, 4]; + r0 = Quat.exactEquals(quatA, quatB); + r1 = Quat.exactEquals(quatA, quatC); + }); + + it('should return true for identical quaternions', () => expect(r0).toBe(true)); + it('should return false for different quaternions', () => expect(r1).toBe(false)); + it('should not modify quatA', () => expect(quatA).toBeVec(0, 1, 2, 3)); + it('should not modify quatB', () => expect(quatB).toBeVec(0, 1, 2, 3)); + }); + + describe('equals', () => { + let quatC: Vec4Like, quatD: Vec4Like, r0: boolean, r1: boolean, r2: boolean; + + beforeEach(() => { + quatA = [0, 1, 2, 3]; + quatB = [0, 1, 2, 3]; + quatC = [1, 2, 3, 4]; + quatD = [1e-16, 1, 2, 3]; + r0 = Quat.equals(quatA, quatB); + r1 = Quat.equals(quatA, quatC); + r2 = Quat.equals(quatA, quatD); + }); + + it('should return true for identical quaternions', () => expect(r0).toBe(true)); + it('should return false for different quaternions', () => expect(r1).toBe(false)); + it('should return true for close but not identical quaternions', () => expect(r2).toBe(true)); + it('should not modify quatA', () => expect(quatA).toBeVec(0, 1, 2, 3)); + it('should not modify quatB', () => expect(quatB).toBeVec(0, 1, 2, 3)); + }); + }); +}); diff --git a/tests/f32/Quat2.spec.ts b/tests/f32/Quat2.spec.ts new file mode 100644 index 00000000..1c63ff12 --- /dev/null +++ b/tests/f32/Quat2.spec.ts @@ -0,0 +1,791 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Mat4, Quat, Quat2, Vec3 } from '#gl-matrix'; + +import type { QuatLike, Quat2Like, Vec3Like, Vec4Like } from '#gl-matrix/types'; + +describe('Quat2', () => { + describe('constructor', () => { + it('should return Quat2(0, 0, 0, 1, 0, 0, 0, 0) if called with no arguments', () => { + expect(new Quat2()).toBeVec(0, 0, 0, 1, 0, 0, 0, 0); + }); + + it('should return Quat(x, y, z, w, x2, y2, z2, w2) if called with (x, y, z, w, x2, y2, z2, w2)', () => { + expect(new Quat2(1, 2, 3, 4, 5, 6, 7, 8)).toBeVec(1, 2, 3, 4, 5, 6, 7, 8); + expect(new Quat2(-3, 4.4, -5.6, 7.8, 9.0, -10.11, 12.13, -14.15)).toBeVec( + -3, 4.4, -5.6, 7.8, 9.0, -10.11, 12.13, -14.15); + }); + + it('should return Quat(x, x, x, x, x, x, x, x) if called with (x)', () => { + expect(new Quat2(1)).toBeVec(1, 1, 1, 1, 1, 1, 1, 1); + expect(new Quat2(-2.3)).toBeVec(-2.3, -2.3, -2.3, -2.3, -2.3, -2.3, -2.3, -2.3); + }); + + it('should return Quat(x, y, z, w) if called with ([x, y, z, w])', () => { + expect(new Quat2([1, 2, 3, 4, 5, 6, 7, 8])).toBeVec(1, 2, 3, 4, 5, 6, 7, 8); + expect(new Quat2([-3, 4.4, -5.6, 7.8, 9.0, -10.11, 12.13, -14.15])).toBeVec( + -3, 4.4, -5.6, 7.8, 9.0, -10.11, 12.13, -14.15); + }); + + it('should return Quat(x, y, z, w, x2, y2, z2, w2) if called with (Quat(x, y, z, w, x2, y2, z2, w2))', () => { + const v = new Quat2(1, 2, 3, 4, 5, 6, 7, 8); + expect(new Quat2(v)).toBeVec(v); + }); + + it('should return Quat(x, y, z, w, x2, y2, z2, w2) if called with (Float32Array([x, y, z, w, x2, y2, z2, w2]))', + () => { + const arr = new Float32Array([1.2, 3.4, 5.6, 7.8, 9.10, 11.12, 13.14, 15.16]); + expect(new Quat2(arr)).toBeVec(arr); + }); + }); + + describe('static', () => { + let out: Quat2; + let outVec: Vec3; + let quat2A: Quat2Like; + let quat2B: Quat2Like; + let result: Vec4Like | Quat2Like | number | string; + let resultVec: Vec3Like; + let outQuat: QuatLike; + let vec: Vec3Like; + + beforeEach(() => { + quat2A = new Quat2(1, 2, 3, 4, 2, 5, 6, -2); + quat2B = new Quat2(5, 6, 7, 8, 9, 8, 6, -4); + out = new Quat2(); + outVec = new Vec3(); + outQuat = new Quat(); + vec = new Vec3(1, 1, -1); + }); + + describe('translate', () => { + const matrixA = Mat4.create(), matOut = Mat4.create(), quatOut = Quat2.create(); + + beforeEach(() => { + // quat2A only seems to work when created using this function? + quat2B = Quat2.fromRotationTranslation(quat2A, [1, 2, 3, 4], [-5, 4, 10]); + Quat2.normalize(quat2A, quat2A); + Mat4.fromQuat2(matrixA, quat2A); + }); + + describe('with a separate output quaternion', () => { + beforeEach(() => { + result = Quat2.translate(out, quat2A, vec); + // Same thing with a matrix + Mat4.translate(matOut, matrixA, vec); + Quat2.fromMat4(quatOut, matOut); + }); + + it('should place values into out', () => expect(out).toBeQuat2(quatOut)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(quat2B)); + it('should not modify vec', () => expect(vec).toBeVec(1, 1, -1)); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { + result = Quat2.translate(quat2A, quat2A, vec); + // Same thing with a matrix + Mat4.translate(matOut, matrixA, vec); + Quat2.fromMat4(quatOut, matOut); + }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(quatOut)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + }); + }); + + describe('rotateAroundAxis', () => { + const matrixA = new Mat4(); + const matOut = new Mat4(); + const ax: Vec3Like = [1, 4, 2]; + + beforeEach(() => { + // quat2A only seems to work when created using this function? + Quat2.fromRotationTranslation(quat2A, [1, 2, 3, 4], [-5, 4, 10]); + Quat2.normalize(quat2A, quat2A); + Mat4.fromQuat2(matrixA, quat2A); + }); + + describe('with a separate output quaternion', () => { + beforeEach(() => { + result = Quat2.rotateAroundAxis(out, quat2A, ax, 5); + + // Same thing with a matrix + Mat4.rotate(matOut, matrixA, 5, ax); + Quat2.fromMat4(quat2B, matOut); + }); + + it('should place values into out', () => expect(out).toBeQuat2(quat2B)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2( + 0.18257418583505536, 0.3651483716701107, 0.5477225575051661, 0.7302967433402214, + -2.556038601690775, 3.742770809618635, 2.37346441585572, -3.0124740662784135 + )); + it('should not modify ax', () => expect(ax).toBeVec(1, 4, 2)); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { + result = Quat2.rotateAroundAxis(quat2A, quat2A, ax, 5); + // Same thing with a matrix + + Mat4.rotate(matOut, matrixA, 5, ax); + Quat2.fromMat4(quat2B, matOut); + }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(quat2B)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + it('should not modify ax', () => expect(ax).toBeVec(1, 4, 2)); + }); + }); + + describe('rotateByQuatAppend', () => { + const correctResult = Quat2.create(); + const rotationQuat = Quat2.create(); + + beforeEach(() => { + rotationQuat[0] = 2; + rotationQuat[1] = 5; + rotationQuat[2] = 2; + rotationQuat[3] = -10; + Quat2.multiply(correctResult, quat2A, rotationQuat); + }); + + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat2.rotateByQuatAppend(out, quat2A, [2, 5, 2, -10]); }); + + it('should place values into out', () => expect(out).toBeQuat2(correctResult)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + it('should not modify the rotation quaternion', () => expect(rotationQuat).toBeQuat2(2, 5, 2, -10, 0, 0, 0, 0)); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { result = Quat2.rotateByQuatAppend(quat2A, quat2A, [2, 5, 2, -10]); }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(correctResult)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + it('should not modify the rotation quaternion', () => expect(rotationQuat).toBeQuat2(2, 5, 2, -10, 0, 0, 0, 0)); + }); + }); + + describe('rotateByQuatPrepend', () => { + const correctResult = Quat2.create(); + const rotationQuat = Quat2.create(); + + beforeEach(() => { + rotationQuat[0] = 2; + rotationQuat[1] = 5; + rotationQuat[2] = 2; + rotationQuat[3] = -10; + Quat2.multiply(correctResult, rotationQuat, quat2A); + }); + + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat2.rotateByQuatPrepend(out, Quat2.getReal(outQuat, rotationQuat), quat2A); }); + + it('should place values into out', () => expect(out).toBeQuat2(correctResult)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + it('should not modify the rotation quaternion', () => expect(rotationQuat).toBeQuat2(2, 5, 2, -10, 0, 0, 0, 0)); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { result = Quat2.rotateByQuatPrepend(quat2A, Quat2.getReal(outQuat, rotationQuat), quat2A); }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(correctResult)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + it('should not modify the rotation quaternion', () => expect(rotationQuat).toBeQuat2(2, 5, 2, -10, 0, 0, 0, 0)); + }); + }); + + describe('rotateX', () => { + const matrixA = Mat4.create(), matOut = Mat4.create(), quatOut = Quat2.create(); + + beforeEach(() => { + // quat2A only seems to work when created using this function? + quat2B = Quat2.fromRotationTranslation(quat2A, [1, 2, 3, 4], [-5, 4, 10]) as Quat2; + Quat2.normalize(quat2A, quat2A); + Mat4.fromQuat2(matrixA, quat2A); + }); + + describe('with a separate output quaternion', () => { + beforeEach(() => { + result = Quat2.rotateX(out, quat2A, 5); + // Same thing with a matrix + Mat4.rotateX(matOut, matrixA, 5); + Quat2.fromMat4(quatOut, matOut); + }); + + it('should place values into out', () => expect(out).toBeQuat2(quatOut)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(quat2B)); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { + result = Quat2.rotateX(quat2A, quat2A, 5); + // Same thing with a matrix + Mat4.rotateX(matOut, matrixA, 5); + Quat2.fromMat4(quatOut, matOut); + }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(quatOut)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + }); + }); + + describe('rotateY', () => { + const matrixA = Mat4.create(), matOut = Mat4.create(), quatOut = Quat2.create(); + + beforeEach(() => { + // quat2A only seems to work when created using this function? + quat2B = Quat2.fromRotationTranslation(quat2A, [1, 2, 3, 4], [5, 4, -10]) as Quat2; + Quat2.normalize(quat2A, quat2A); + Mat4.fromQuat2(matrixA, quat2A); + }); + + describe('with a separate output quaternion', () => { + beforeEach(() => { + result = Quat2.rotateY(out, quat2A, -2); + // Same thing with a matrix + Mat4.rotateY(matOut, matrixA, -2); + Quat2.fromMat4(quatOut, matOut); + }); + + it('should place values into out', () => expect(out).toBeQuat2(quatOut)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(quat2B)); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { + result = Quat2.rotateY(quat2A, quat2A, -2); + // Same thing with a matrix + Mat4.rotateY(matOut, matrixA, -2); + Quat2.fromMat4(quatOut, matOut); + }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(quatOut)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + }); + }); + + describe('rotateZ', () => { + const matrixA = Mat4.create(), matOut = Mat4.create(), quatOut = Quat2.create(); + + beforeEach(() => { + // quat2A only seems to work when created using this function? + quat2B = Quat2.fromRotationTranslation(quat2A, [1, 0, 3, -4], [0, -4, -10]) as Quat2; + Quat2.normalize(quat2A, quat2A); + Mat4.fromQuat2(matrixA, quat2A); + }); + + describe('with a separate output quaternion', () => { + beforeEach(() => { + result = Quat2.rotateZ(out, quat2A, 1); + // Same thing with a matrix + Mat4.rotateZ(matOut, matrixA, 1); + Quat2.fromMat4(quatOut, matOut); + }); + + it('should place values into out', () => expect(out).toBeQuat2(quatOut)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(quat2B)); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { + result = Quat2.rotateZ(quat2A, quat2A, 1); + // Same thing with a matrix + Mat4.rotateZ(matOut, matrixA, 1); + Quat2.fromMat4(quatOut, matOut); + }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(quatOut)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + }); + }); + + describe('from/toMat4', () => { + let matRes = Mat4.create(); + const matOut = Mat4.create(); + const rotationQuat = Quat.create(); + + describe('quat to matrix and back', () => { + beforeEach(() => { + Quat.normalize(rotationQuat, [1, 2, 3, 4]); + + Quat2.fromRotationTranslation(quat2A, rotationQuat, [1, -5, 3]); + matRes = Mat4.fromQuat2(matOut, quat2A) as Mat4; + + result = Quat2.fromMat4(out, matRes); + }); + + it('should return out', () => expect(result).toBe(out)); + it('should return matOut', () => expect(matRes).toBe(matOut)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(0.18257418, 0.36514836, 0.54772257, 0.73029673, + -1.5518806, -1.82574184, 1.73445473, 0)); + it('should be equal to the starting dual quat', () => expect(quat2A).toBeQuat2(result as Quat2Like)); + }); + }); + + describe('create', () => { + beforeEach(() => { result = Quat2.create(); }); + + it('should return 2 4 element arrays initialized to an identity dual quaternion', + () => expect(result).toBeQuat2(0, 0, 0, 1, 0, 0, 0, 0)); + }); + + describe('clone', () => { + beforeEach(() => { result = Quat2.clone(quat2A); }); + + it('should return 2 4 element arrays initialized to the values in quat2A', + () => expect(result).toBeQuat2(quat2A)); + }); + + describe('fromValues', () => { + beforeEach(() => { result = Quat2.fromValues(1, 2, 3, 4, 5, 7, 8, -2); }); + + it('should return 2 4 element arrays initialized to the values passedd to the values passed', + () => expect(result).toBeQuat2(1, 2, 3, 4, 5, 7, 8, -2)); + }); + + describe('copy', () => { + beforeEach(() => { result = Quat2.copy(out, quat2A); }); + + it('should place values into out', () => expect(out).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('set', () => { + beforeEach(() => { result = Quat2.set(out, 1, 2, 3, 4, 2, 5, 6, -2); }); + + it('should place values into out', () => expect(out).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('identity', () => { + beforeEach(() => { result = Quat2.identity(out); }); + + it('should place values into out', () => expect(result).toBeQuat2(0, 0, 0, 1, 0, 0, 0, 0)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('add', () => { + describe('with a separate output dual quaternion', () => { + beforeEach(() => { result = Quat2.add(out, quat2A, quat2B); }); + + it('should place values into out', () => expect(out).toBeQuat2(6, 8, 10, 12, 11, 13, 12, -6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + it('should not modify quat2B', () => expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4)); + }); + + describe('when quat2A is the output dual quaternion', () => { + beforeEach(() => { result = Quat2.add(quat2A, quat2A, quat2B); }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(6, 8, 10, 12, 11, 13, 12, -6)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + it('should not modify quat2B', () => expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4)); + }); + + describe('when quat2B is the output dual quaternion', () => { + beforeEach(() => { result = Quat2.add(quat2B, quat2A, quat2B); }); + + it('should place values into quat2B', () => expect(quat2B).toBeQuat2(6, 8, 10, 12, 11, 13, 12, -6)); + it('should return quat2B', () => expect(result).toBe(quat2B)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + }); + }); + + describe('multiply', () => { + it('should have an alias called `mul`', () => expect(Quat2.mul).toEqual(Quat2.multiply)); + + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat2.multiply(out, quat2A, quat2B); }); + + it('should place values into out', () => expect(out).toBeQuat2(24, 48, 48, -6, 25, 89, 23, -157)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + it('should not modify quat2B', () => expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4)); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { result = Quat2.multiply(quat2A, quat2A, quat2B); }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(24, 48, 48, -6, 25, 89, 23, -157)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + it('should not modify quat2B', () => expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4)); + }); + + describe('when quat2B is the output quaternion', () => { + beforeEach(() => { result = Quat2.multiply(quat2B, quat2A, quat2B); }); + + it('should place values into quat2B', () => expect(quat2B).toBeQuat2(24, 48, 48, -6, 25, 89, 23, -157)); + it('should return quat2B', () => expect(result).toBe(quat2B)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + }); + + describe('same as matrix multiplication', () => { + const matrixA = Mat4.create(), matrixB = Mat4.create(); + const matOut = Mat4.create(), quatOut = Quat2.create(); + + beforeEach(() => { + // quat2A and quat2B only seem to work when created using this function? + Quat2.fromRotationTranslation(quat2A, [1, 2, 3, 4], [-5, 4, 10]); + Quat2.normalize(quat2A, quat2A); + Mat4.fromQuat2(matrixA, quat2A); + + Quat2.fromRotationTranslation(quat2B, [5, 6, 7, 8], [9, 8, 6]); + Quat2.normalize(quat2B, quat2B); + Mat4.fromQuat2(matrixB, quat2B); + }); + + it('the matrices should be equal to the dual quaternions', () => { + const testQuat = Quat2.create(); + Quat2.fromMat4(testQuat, matrixA); + expect(testQuat).toBeQuat2(...quat2A); + + Quat2.fromMat4(testQuat, matrixB); + expect(testQuat).toBeQuat2(...quat2B); + }); + + it('should be equal to the matrix multiplication', () => { + Quat2.multiply(out, quat2A, quat2B); + Mat4.mul(matOut, matrixA, matrixB); + Quat2.fromMat4(quatOut, matOut); + expect(out).toBeQuat2(quatOut); + }); + }); + }); + + describe('scale', () => { + describe('with a separate output dual quaternion', () => { + beforeEach(() => { result = Quat2.scale(out, quat2A, 2); }); + + it('should place values into out', () => expect(out).toBeQuat2(2, 4, 6, 8, 4, 10, 12, -4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + }); + + describe('when quat2A is the output dual quaternion', () => { + beforeEach(() => { result = Quat2.scale(quat2A, quat2A, 2); }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(2, 4, 6, 8, 4, 10, 12, -4)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + }); + }); + + describe('length', () => { + beforeEach(() => { result = Quat2.length(quat2A); }); + + it('should have an alias called `len`', () => expect(Quat2.len).toEqual(Quat2.length)); + it('should return the length', () => expect(result).toBeCloseTo(5.477225)); + }); + + describe('squaredLength', () => { + beforeEach(() => { result = Quat2.squaredLength(quat2A); }); + + it('should have an alias called `sqrLen`', () => expect(Quat2.sqrLen).toEqual(Quat2.squaredLength)); + it('should return the squared length', () => expect(result).toBeCloseTo(30)); + }); + + describe('fromRotation', () => { + beforeEach(() => { result = Quat2.fromRotation(out, [1, 2, 3, 4]); }); + + it('should place values into out', () => expect(out).toBeQuat2(1, 2, 3, 4, 0, 0, 0, 0)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify the quaternion', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + }); + + describe('fromTranslation', () => { + beforeEach(() => { vec = [1, 2, 3]; result = Quat2.fromTranslation(out, vec); }); + + it('should place values into out', () => expect(out).toBeQuat2(0, 0, 0, 1, 0.5, 1, 1.5, 0)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify the vector', () => expect(vec).toBeVec(1, 2, 3)); + }); + + describe('fromRotationTranslation', () => { + beforeEach(() => { + vec = [1, 2, 3]; + result = Quat2.fromRotationTranslation(out, [1, 2, 3, 4], vec); + }); + + it('should place values into out', () => expect(out).toBeQuat2(1, 2, 3, 4, 2, 4, 6, -7)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify the quaternion', () => expect(Quat2.getReal(outQuat, quat2A)).toBeVec(1, 2, 3, 4)); + it('should not modify the vector', () => expect(vec).toBeVec(1, 2, 3)); + it('should have a translation that can be retrieved with getTranslation', () => { + const t: Vec3Like = [0, 0, 0]; + Quat2.normalize(out, out); + Quat2.getTranslation(t, out); + + expect(t).toBeVec(1, 2, 3); + }); + }); + + describe('fromRotationTranslationValues', () => { + beforeEach(() => { result = Quat2.fromRotationTranslationValues(1, 2, 3, 4, 1, 2, 3); }); + + it('should return the correct result', () => expect(result).toBeQuat2(1, 2, 3, 4, 2, 4, 6, -7)); + it('should have a translation that can be retrieved with getTranslation', () => { + const t: Vec3Like = [0, 0, 0]; + + Quat2.normalize(result as Quat2Like, result as Quat2Like); + Quat2.getTranslation(t, result as Quat2Like); + expect(t).toBeVec(1, 2, 3); + }); + }); + + describe('getTranslation', () => { + describe('without a real part', () => { + beforeEach(() => { + Quat2.fromTranslation(out, [1, 2, 3]); + resultVec = Quat2.getTranslation(outVec, out); + }); + + describe('not normalized', () => { + it('should return the same translation value', () => expect(outVec).toBeVec(1, 2, 3)); + it('should return out', () => expect(outVec).toBe(resultVec)); + }); + + describe('normalized', () => { + it('should return the same translation value', () => { + Quat2.normalize(outVec, outVec); + expect(outVec).toBeVec(1, 2, 3); + }); + }); + }); + + describe('with a real part', () => { + beforeEach(() => { + Quat2.fromRotationTranslation(out, [2, 4, 6, 2], [1, 2, 3]); + resultVec = Quat2.getTranslation(outVec, out); + }); + + describe('not normalized', () => { + it('should not return the same translation value', () => expect(outVec).not.toBeVec(1, 2, 3)); + it('should return out', () => expect(outVec).toBe(resultVec)); + }); + + describe('normalized', () => { + it('should return the same translation value', () => { + Quat2.normalize(out, out); + Quat2.getTranslation(outVec, out); + expect(outVec).toBeVec(1, 2, 3); + }); + }); + }); + }); + + describe('normalize', () => { + describe('when it is normalizing quat2A', () => { + beforeEach(() => { + quat2A = [1, 2, 3, 4, 2, 5, 6, -2]; + Quat2.normalize(out, quat2A); + }); + + it('both parts should have been normalized', () => expect(out).toBeQuat2(1 / 5.4772255, 2 / 5.4772255, + 3 / 5.4772255, 4 / 5.4772255, 0.231260, 0.6450954, 0.693781, -0.9006993)); + }); + + beforeEach(() => { quat2A = [5, 0, 0, 0, 0, 0, 0, 0]; }); + + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat2.normalize(out, quat2A); }); + + it('should place values into out', () => expect(out).toBeQuat2(1, 0, 0, 0, 0, 0, 0, 0)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(5, 0, 0, 0, 0, 0, 0, 0)); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { result = Quat2.normalize(quat2A, quat2A); }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(1, 0, 0, 0, 0, 0, 0, 0)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + }); + + describe('when it contains a translation', () => { + beforeEach(() => { + Quat2.set(out, 5, 0, 0, 0, 1, 2, 3, 5); + Quat2.normalize(out, out); + }); + + it('both parts should have been normalized', () => expect(out).toBeQuat2(1, 0, 0, 0, 0, 0.4, 0.6, 1)); + }); + }); + + describe('lerp', () => { + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat2.lerp(out, quat2A, quat2B, 0.7); }); + + it('should place values into out', () => expect(out).toBeQuat2(3.8, 4.8, 5.8, 6.8, 6.9, 7.1, 6.0, -3.4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + it('should not modify quat2B', () => expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4)); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { result = Quat2.lerp(quat2A, quat2A, quat2B, 0.5); }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(3, 4, 5, 6, 5.5, 6.5, 6, -3)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + it('should not modify quat2B', () => expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4)); + }); + + describe('when quat2B is the output quaternion', () => { + beforeEach(() => { result = Quat2.lerp(quat2B, quat2A, quat2B, 0.5); }); + + it('should place values into quat2B', () => expect(quat2B).toBeQuat2(3, 4, 5, 6, 5.5, 6.5, 6, -3)); + it('should return quat2B', () => expect(result).toBe(quat2B)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + }); + + describe('shortest path', () => { + beforeEach(() => { result = Quat2.lerp(out, [1, 2, 3, -4, 2, 5, 6, -2], [5, -6, 7, 8, 9, 8, 6, -4], 0.4); }); + + it('should pick the shorter path', () => expect(out).toBeQuat2(-1.4, 3.6, -1, -5.6, -2.4, -0.2, 1.2, 0.4)); + }); + }); + + describe('dot', () => { + describe('with a separate output dual quaternion', () => { + beforeEach(() => { result = Quat2.dot(quat2A, quat2B); }); + + it('should return the dot product', () => expect(result).toBe(70)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + it('should not modify quat2B', () => expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4)); + }); + }); + + describe('invert', () => { + describe('with a separate output dual quaternion', () => { + beforeEach(() => { result = Quat2.invert(out, quat2A); }); + + it('should place values into out', () => expect(out).toBeQuat2( + -0.0333333333, -0.06666666666, -0.1, 0.13333333333, -2 / 30, -5 / 30, -6 / 30, -2 / 30)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + it('the real part should be equal to a inverted quaternion', () => { + Quat.invert(outQuat, [1, 2, 3, 4]); + expect(Quat2.getReal(outQuat, out)).toBeVec(...outQuat); + }); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { result = Quat2.invert(quat2A, quat2A); }); + + it('should place values into quat2A', () => expect(quat2A).toBeVec( + -0.0333333333, -0.06666666666, -0.1, 0.13333333333, -2 / 30, -5 / 30, -6 / 30, -2 / 30)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + }); + }); + + describe('get real/dual', () => { + describe('get real', () => { + beforeEach(() => { result = Quat2.getReal(outQuat, quat2A); }); + + it('should place values into out', () => expect(outQuat).toBeVec(1, 2, 3, 4)); + it('should return out', () => expect(result).toBe(outQuat)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + }); + + describe('get dual', () => { + beforeEach(() => { result = Quat2.getDual(outQuat, quat2A); }); + + it('should place values into out', () => expect(outQuat).toBeVec(2, 5, 6, -2)); + it('should return out', () => expect(result).toBe(outQuat)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + }); + }); + + describe('set real/dual', () => { + describe('set real', () => { + beforeEach(() => { + outQuat = [4, 6, 8, -100]; + result = Quat2.setReal(quat2A, outQuat); + }); + + it('should place values into out', () => expect(quat2A).toBeQuat2(4, 6, 8, -100, 2, 5, 6, -2)); + it('should return out', () => expect(result).toBe(quat2A)); + it('should not modify outQuat', () => expect(outQuat).toBeVec(4, 6, 8, -100)); + }); + + describe('set dual', () => { + beforeEach(() => { + outQuat = [4.3, 6, 8, -100]; + result = Quat2.setDual(quat2A, outQuat); + }); + + it('should place values into out', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 4.3, 6, 8, -100)); + it('should return out', () => expect(result).toBe(quat2A)); + it('should not modify outQuat', () => expect(outQuat).toBeVec(4.3, 6, 8, -100)); + }); + }); + + describe('conjugate', () => { + describe('with a separate output dual quaternion', () => { + beforeEach(() => { result = Quat2.conjugate(out, quat2A); }); + + it('should place values into out', () => expect(out).toBeQuat2(-1, -2, -3, 4, -2, -5, -6, -2)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + }); + + describe('when quat2A is the output dual quaternion', () => { + beforeEach(() => { result = Quat2.conjugate(quat2A, quat2A); }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(-1, -2, -3, 4, -2, -5, -6, -2)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + }); + }); + + describe('str', () => { + beforeEach(() => { result = Quat2.str(quat2A); }); + + it('should return a string representation of the quaternion', + () => expect(result).toEqual('Quat2(1, 2, 3, 4, 2, 5, 6, -2)')); + }); + + describe('exactEquals', () => { + let quat2C: Quat2Like, r0: boolean, r1: boolean; + + beforeEach(() => { + quat2A = [0, 1, 2, 3, 4, 5, 6, 7]; + quat2B = [0, 1, 2, 3, 4, 5, 6, 7]; + quat2C = [1, 2, 3, 4, 5, 6, 7, 8]; + r0 = Quat2.exactEquals(quat2A, quat2B); + r1 = Quat2.exactEquals(quat2A, quat2C); + }); + + it('should return true for identical quaternions', () => expect(r0).toBe(true)); + it('should return false for different quaternions', () => expect(r1).toBe(false)); + it('should not modify quat2A', () => expect(quat2A).toBeVec(0, 1, 2, 3, 4, 5, 6, 7)); + it('should not modify quat2B', () => expect(quat2B).toBeVec(0, 1, 2, 3, 4, 5, 6, 7)); + }); + + describe('equals', () => { + let quat2C: Quat2Like, quat2D: Quat2Like, r0: boolean, r1: boolean, r2: boolean; + + beforeEach(() => { + quat2A = [0, 1, 2, 3, 4, 5, 6, 7]; + quat2B = [0, 1, 2, 3, 4, 5, 6, 7]; + quat2C = [1, 2, 3, 4, 5, 6, 7, 8]; + quat2D = [1e-16, 1, 2, 3, 4, 5, 6, 7]; + r0 = Quat2.equals(quat2A, quat2B); + r1 = Quat2.equals(quat2A, quat2C); + r2 = Quat2.equals(quat2A, quat2D); + }); + + it('should return true for identical dual quaternions', () => expect(r0).toBe(true)); + it('should return false for different dual quaternions', () => expect(r1).toBe(false)); + it('should return true for close but not identical quaternions', () => expect(r2).toBe(true)); + it('should not modify quat2A', () => expect(quat2A).toBeVec(0, 1, 2, 3, 4, 5, 6, 7)); + it('should not modify quat2B', () => expect(quat2B).toBeVec(0, 1, 2, 3, 4, 5, 6, 7)); + }); + }); +}); diff --git a/tests/f32/Vec2-swizzle.spec.ts b/tests/f32/Vec2-swizzle.spec.ts new file mode 100644 index 00000000..767a610c --- /dev/null +++ b/tests/f32/Vec2-swizzle.spec.ts @@ -0,0 +1,521 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Vec2 } from '#gl-matrix'; +import { EnableSwizzles } from '#gl-matrix/swizzle'; + +describe('Vec2 Swizzles', () => { + EnableSwizzles(); + + let v: Vec2; + beforeEach(() => { v = new Vec2(1, 2); }); + + // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should + // not be modified by hand. + // [Swizzle Autogen] + + describe('Vec2().xx', () => { + it('should return Vec2(x, x)', () => expect(v.xx).toBeVec(v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xy', () => { + it('should return Vec2(x, y)', () => expect(v.xy).toBeVec(v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yx', () => { + it('should return Vec2(y, x)', () => expect(v.yx).toBeVec(v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yy', () => { + it('should return Vec2(y, y)', () => expect(v.yy).toBeVec(v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xxx', () => { + it('should return Vec3(x, x, x)', () => expect(v.xxx).toBeVec(v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xxy', () => { + it('should return Vec3(x, x, y)', () => expect(v.xxy).toBeVec(v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xyx', () => { + it('should return Vec3(x, y, x)', () => expect(v.xyx).toBeVec(v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xyy', () => { + it('should return Vec3(x, y, y)', () => expect(v.xyy).toBeVec(v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yxx', () => { + it('should return Vec3(y, x, x)', () => expect(v.yxx).toBeVec(v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yxy', () => { + it('should return Vec3(y, x, y)', () => expect(v.yxy).toBeVec(v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yyx', () => { + it('should return Vec3(y, y, x)', () => expect(v.yyx).toBeVec(v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yyy', () => { + it('should return Vec3(y, y, y)', () => expect(v.yyy).toBeVec(v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xxxx', () => { + it('should return Vec4(x, x, x, x)', () => expect(v.xxxx).toBeVec(v[0], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xxxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xxxy', () => { + it('should return Vec4(x, x, x, y)', () => expect(v.xxxy).toBeVec(v[0], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xxxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xxyx', () => { + it('should return Vec4(x, x, y, x)', () => expect(v.xxyx).toBeVec(v[0], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xxyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xxyy', () => { + it('should return Vec4(x, x, y, y)', () => expect(v.xxyy).toBeVec(v[0], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xxyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xyxx', () => { + it('should return Vec4(x, y, x, x)', () => expect(v.xyxx).toBeVec(v[0], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xyxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xyxy', () => { + it('should return Vec4(x, y, x, y)', () => expect(v.xyxy).toBeVec(v[0], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xyxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xyyx', () => { + it('should return Vec4(x, y, y, x)', () => expect(v.xyyx).toBeVec(v[0], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xyyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xyyy', () => { + it('should return Vec4(x, y, y, y)', () => expect(v.xyyy).toBeVec(v[0], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xyyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yxxx', () => { + it('should return Vec4(y, x, x, x)', () => expect(v.yxxx).toBeVec(v[1], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yxxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yxxy', () => { + it('should return Vec4(y, x, x, y)', () => expect(v.yxxy).toBeVec(v[1], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yxxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yxyx', () => { + it('should return Vec4(y, x, y, x)', () => expect(v.yxyx).toBeVec(v[1], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yxyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yxyy', () => { + it('should return Vec4(y, x, y, y)', () => expect(v.yxyy).toBeVec(v[1], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yxyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yyxx', () => { + it('should return Vec4(y, y, x, x)', () => expect(v.yyxx).toBeVec(v[1], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yyxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yyxy', () => { + it('should return Vec4(y, y, x, y)', () => expect(v.yyxy).toBeVec(v[1], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yyxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yyyx', () => { + it('should return Vec4(y, y, y, x)', () => expect(v.yyyx).toBeVec(v[1], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yyyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yyyy', () => { + it('should return Vec4(y, y, y, y)', () => expect(v.yyyy).toBeVec(v[1], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yyyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rr', () => { + it('should return Vec2(r, r)', () => expect(v.rr).toBeVec(v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rg', () => { + it('should return Vec2(r, g)', () => expect(v.rg).toBeVec(v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().gr', () => { + it('should return Vec2(g, r)', () => expect(v.gr).toBeVec(v[1], v[0])); + it('should be return a copy', () => { + const sw = v.gr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().gg', () => { + it('should return Vec2(g, g)', () => expect(v.gg).toBeVec(v[1], v[1])); + it('should be return a copy', () => { + const sw = v.gg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rrr', () => { + it('should return Vec3(r, r, r)', () => expect(v.rrr).toBeVec(v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rrg', () => { + it('should return Vec3(r, r, g)', () => expect(v.rrg).toBeVec(v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rgr', () => { + it('should return Vec3(r, g, r)', () => expect(v.rgr).toBeVec(v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rgg', () => { + it('should return Vec3(r, g, g)', () => expect(v.rgg).toBeVec(v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().grr', () => { + it('should return Vec3(g, r, r)', () => expect(v.grr).toBeVec(v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.grr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().grg', () => { + it('should return Vec3(g, r, g)', () => expect(v.grg).toBeVec(v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.grg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().ggr', () => { + it('should return Vec3(g, g, r)', () => expect(v.ggr).toBeVec(v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.ggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().ggg', () => { + it('should return Vec3(g, g, g)', () => expect(v.ggg).toBeVec(v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.ggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rrrr', () => { + it('should return Vec4(r, r, r, r)', () => expect(v.rrrr).toBeVec(v[0], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rrrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rrrg', () => { + it('should return Vec4(r, r, r, g)', () => expect(v.rrrg).toBeVec(v[0], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rrrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rrgr', () => { + it('should return Vec4(r, r, g, r)', () => expect(v.rrgr).toBeVec(v[0], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rrgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rrgg', () => { + it('should return Vec4(r, r, g, g)', () => expect(v.rrgg).toBeVec(v[0], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rrgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rgrr', () => { + it('should return Vec4(r, g, r, r)', () => expect(v.rgrr).toBeVec(v[0], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rgrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rgrg', () => { + it('should return Vec4(r, g, r, g)', () => expect(v.rgrg).toBeVec(v[0], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rgrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rggr', () => { + it('should return Vec4(r, g, g, r)', () => expect(v.rggr).toBeVec(v[0], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rggg', () => { + it('should return Vec4(r, g, g, g)', () => expect(v.rggg).toBeVec(v[0], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().grrr', () => { + it('should return Vec4(g, r, r, r)', () => expect(v.grrr).toBeVec(v[1], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.grrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().grrg', () => { + it('should return Vec4(g, r, r, g)', () => expect(v.grrg).toBeVec(v[1], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.grrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().grgr', () => { + it('should return Vec4(g, r, g, r)', () => expect(v.grgr).toBeVec(v[1], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.grgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().grgg', () => { + it('should return Vec4(g, r, g, g)', () => expect(v.grgg).toBeVec(v[1], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.grgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().ggrr', () => { + it('should return Vec4(g, g, r, r)', () => expect(v.ggrr).toBeVec(v[1], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.ggrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().ggrg', () => { + it('should return Vec4(g, g, r, g)', () => expect(v.ggrg).toBeVec(v[1], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.ggrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().gggr', () => { + it('should return Vec4(g, g, g, r)', () => expect(v.gggr).toBeVec(v[1], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.gggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().gggg', () => { + it('should return Vec4(g, g, g, g)', () => expect(v.gggg).toBeVec(v[1], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.gggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + // [/Swizzle Autogen] +}); diff --git a/tests/f32/Vec2.spec.ts b/tests/f32/Vec2.spec.ts new file mode 100644 index 00000000..e0cdde72 --- /dev/null +++ b/tests/f32/Vec2.spec.ts @@ -0,0 +1,801 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Vec2 } from '#gl-matrix'; + +import type { Mat2Like, Mat2dLike, Vec2Like, Vec3Like } from '#gl-matrix/types'; + +describe('Vec2', () => { + let vecA: Vec2; + let vecB: Vec2; + let out: Vec2; + + beforeEach(() => { + vecA = new Vec2(1, 2); + vecB = new Vec2([3, 4]); + out = new Vec2(); + }); + + describe('constructor', () => { + it('should return Vec2(0, 0) if called with no arguments', () => expect(new Vec2()).toBeVec(0, 0)); + + it('should return Vec2(x, y) if called with (x, y)', () => { + expect(new Vec2(1, 2)).toBeVec(1, 2); + expect(new Vec2(-3, 4.4)).toBeVec(-3, 4.4); + }); + + it('should return Vec2(x, x) if called with (x)', () => { + expect(new Vec2(1)).toBeVec(1, 1); + expect(new Vec2(-2.3)).toBeVec(-2.3, -2.3); + }); + + it('should return Vec2(x, y) if called with ([x, y])', () => { + expect(new Vec2([1, 2])).toBeVec(1, 2); + expect(new Vec2([-3, 4.4])).toBeVec(-3, 4.4); + }); + + it('should return Vec2(x, y) if called with (Vec2(x, y))', () => { + const v = new Vec2(3.4, 5.6); + expect(new Vec2(v)).toBeVec(v); + }); + + it('should return Vec2(x, y) if called with (Float32Array([x, y]))', () => { + const arr = new Float32Array([1.2, 3.4]); + expect(new Vec2(arr)).toBeVec(arr); + }); + }); + + describe('static methods', () => { + describe('create', () => { + it('should return Vec2(0, 0)', () => expect(Vec2.create()).toBeVec(0, 0)); + }); + + describe('add', () => { + let result: Vec2Like; + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.add(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(4, 6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.add(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(4, 6)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec2.add(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(4, 6)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + + describe('with raw array as the output', () => { + const outArray: Vec2Like = [0, 0]; + beforeEach(() => { result = Vec2.add(outArray, vecA, vecB); }); + + it('should place values into out', () => expect(outArray).toBeVec(4, 6)); + it('should return out', () => expect(result).toBe(outArray)); + }); + + describe('with raw arrays as the inputs', () => { + beforeEach(() => { result = Vec2.add(out, [1, 2], [3, 4]); }); + + it('should place values into out', () => expect(out).toBeVec(4, 6)); + it('should return out', () => expect(result).toBe(out)); + }); + }); + }); + + describe('static', () => { + let out: Vec2Like, vecA: Vec2Like, vecB: Vec2Like, result: Vec2Like | number; + + beforeEach(() => { + vecA = new Vec2(1, 2); + vecB = new Vec2(3, 4); + out = new Vec2(0, 0); + }); + + describe('create', () => { + beforeEach(() => { result = Vec2.create(); }); + + it('should return a 2 element array initialized to 0s', () => expect(result).toBeVec(0, 0)); + }); + + describe('clone', () => { + beforeEach(() => { result = Vec2.clone(vecA); }); + + it('should return a 2 element array initialized to the values in vecA', () => expect(result).toBeVec(vecA)); + }); + + describe('fromValues', () => { + beforeEach(() => { result = Vec2.fromValues(1, 2); }); + + it('should return a 2 element array initialized to the values passed', () => expect(result).toBeVec(1, 2)); + }); + + describe('copy', () => { + beforeEach(() => { result = Vec2.copy(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('set', () => { + beforeEach(() => { result = Vec2.set(out, 1, 2); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('add', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.add(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(4, 6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.add(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(4, 6)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec2.add(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(4, 6)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + }); + + describe('subtract', () => { + it('should have an alias called `sub`', () => expect(Vec2.sub).toEqual(Vec2.subtract)); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.subtract(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(-2, -2)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.subtract(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(-2, -2)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec2.subtract(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(-2, -2)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + }); + + describe('multiply', () => { + it('should have an alias called `mul`', () => expect(Vec2.mul).toEqual(Vec2.multiply)); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.multiply(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(3, 8)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.multiply(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 8)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec2.multiply(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(3, 8)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + }); + + describe('divide', () => { + it('should have an alias called `div`', () => expect(Vec2.div).toEqual(Vec2.divide)); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.divide(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(0.3333333, 0.5)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.divide(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(0.3333333, 0.5)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec2.divide(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(0.3333333, 0.5)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + }); + + describe('ceil', () => { + beforeEach(() => { vecA = [Math.E, Math.PI]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.ceil(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(3, 4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(Math.E, Math.PI)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.ceil(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 4)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('floor', () => { + beforeEach(() => { vecA = [Math.E, Math.PI]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.floor(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(2, 3)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(Math.E, Math.PI)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.floor(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(2, 3)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('min', () => { + beforeEach(() => { vecA = [1, 4]; vecB = [3, 2]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.min(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 4)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.min(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 2)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 2)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec2.min(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(1, 2)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 4)); + }); + }); + + describe('max', () => { + beforeEach(() => { vecA = [1, 4]; vecB = [3, 2]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.max(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(3, 4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 4)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.max(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 4)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 2)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec2.max(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(3, 4)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 4)); + }); + }); + + describe('round', () => { + beforeEach(() => { vecA = [Math.E, Math.PI]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.round(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(3, 3)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(Math.E, Math.PI)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.round(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 3)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('scale', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.scale(out, vecA, 2); }); + + it('should place values into out', () => expect(out).toBeVec(2, 4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.scale(vecA, vecA, 2); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(2, 4)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('scaleAndAdd', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.scaleAndAdd(out, vecA, vecB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(2.5, 4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.scaleAndAdd(vecA, vecA, vecB, 0.5); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(2.5, 4)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec2.scaleAndAdd(vecB, vecA, vecB, 0.5); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(2.5, 4)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + }); + + describe('distance', () => { + beforeEach(() => { result = Vec2.distance(vecA, vecB); }); + + it('should have an alias called `dist`', () => expect(Vec2.dist).toEqual(Vec2.distance)); + it('should return the distance', () => expect(result).toBeCloseTo(2.828427)); + }); + + describe('squaredDistance', () => { + beforeEach(() => { result = Vec2.squaredDistance(vecA, vecB); }); + + it('should have an alias called `sqrDist`', () => expect(Vec2.sqrDist).toEqual(Vec2.squaredDistance)); + it('should return the squared distance', () => expect(result).toEqual(8)); + }); + + describe('length', () => { + beforeEach(() => { result = Vec2.len(vecA); }); + + it('should have an alias called `len`', () => expect(Vec2.len).toEqual(Vec2.length)); + it('should return the length', () => expect(result).toBeCloseTo(2.236067)); + }); + + describe('squaredLength', () => { + beforeEach(() => { result = Vec2.squaredLength(vecA); }); + + it('should have an alias called `sqrLen`', () => expect(Vec2.sqrLen).toEqual(Vec2.squaredLength)); + it('should return the squared length', () => expect(result).toEqual(5)); + }); + + describe('negate', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.negate(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(-1, -2)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.negate(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(-1, -2)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('inverse', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.inverse(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 1 / 2)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.inverse(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 1 / 2)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('abs', () => { + beforeEach(() => { vecA = [-1, -2]; }); + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.abs(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(-1, -2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.abs(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 2)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('normalize', () => { + beforeEach(() => { vecA = [5, 0]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.normalize(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 0)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(5, 0)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.normalize(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 0)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('dot', () => { + beforeEach(() => { result = Vec2.dot(vecA, vecB); }); + + it('should return the dot product', () => expect(result).toEqual(11)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('cross', () => { + let out3: Vec3Like; + + beforeEach(() => { + out3 = [0, 0, 0]; + result = Vec2.cross(out3 as unknown as Vec2Like, vecA, vecB); + }); + + it('should place values into out', () => expect(out3).toBeVec(0, 0, -2)); + it('should return out', () => expect(result).toBe(out3)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('lerp', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.lerp(out, vecA, vecB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(2, 3)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.lerp(vecA, vecA, vecB, 0.5); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(2, 3)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec2.lerp(vecB, vecA, vecB, 0.5); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(2, 3)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + }); + + /* + describe('random', () => { + describe('with no scale', () => { + beforeEach(() => { result = Vec2.random(out); }); + + it('should result in a unit length vector', () => expect(Vec2.len(out)).toBeCloseTo(1.0)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('with a scale', () => { + beforeEach(() => { result = Vec2.random(out, 5.0); }); + + it('should result in a unit length vector', () => expect(Vec2.len(out)).toBeCloseTo(5.0)); + it('should return out', () => expect(result).toBe(out)); + }); + });*/ + + describe('transformMat2', () => { + let matA: Mat2Like; + + beforeEach(() => { matA = [1, 2, 3, 4]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.transformMat2(out, vecA, matA); }); + + it('should place values into out', () => expect(out).toBeVec(7, 10)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.transformMat2(vecA, vecA, matA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(7, 10)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('transformMat2d', () => { + let matA: Mat2dLike; + + beforeEach(() => { matA = [1, 2, 3, 4, 5, 6]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.transformMat2d(out, vecA, matA); }); + + it('should place values into out', () => expect(out).toBeVec(12, 16)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.transformMat2d(vecA, vecA, matA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(12, 16)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6)); + }); + }); + + /* + describe('forEach', () => { + let vecArray; + + beforeEach(() => { + vecArray = [ + 1, 2, + 3, 4, + 0, 0 + ]; + }); + + describe('when performing operations that take no extra arguments', () => { + beforeEach(() => { result = Vec2.forEach(vecArray, 0, 0, 0, Vec2.normalize); }); + + it('should update all values', () => { + expect(vecArray).toBeEqualish([ + 0.447214, 0.894427, + 0.6, 0.8, + 0, 0 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + }); + + describe('when performing operations that takes one extra arguments', () => { + beforeEach(() => { result = Vec2.forEach(vecArray, 0, 0, 0, Vec2.add, vecA); }); + + it('should update all values', () => { + expect(vecArray).toBeEqualish([ + 2, 4, + 4, 6, + 1, 2 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + + describe('when specifying an offset', () => { + beforeEach(() => { result = Vec2.forEach(vecArray, 0, 2, 0, Vec2.add, vecA); }); + + it('should update all values except the first vector', () => { + expect(vecArray).toBeEqualish([ + 1, 2, + 4, 6, + 1, 2 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + + describe('when specifying a count', () => { + beforeEach(() => { result = Vec2.forEach(vecArray, 0, 0, 2, Vec2.add, vecA); }); + + it('should update all values except the last vector', () => { + expect(vecArray).toBeEqualish([ + 2, 4, + 4, 6, + 0, 0 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + + describe('when specifying a stride', () => { + beforeEach(() => { result = Vec2.forEach(vecArray, 4, 0, 0, Vec2.add, vecA); }); + + it('should update all values except the second vector', () => { + expect(vecArray).toBeEqualish([ + 2, 4, + 3, 4, + 1, 2 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + + describe('when calling a function that does not modify the out variable', () => { + beforeEach(() => { result = Vec2.forEach(vecArray, 0, 0, 0, function(out, vec) {}); }); + + it('values should remain unchanged', () => { + expect(vecArray).toBeEqualish([ + 1, 2, + 3, 4, + 0, 0, + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + }); + });*/ + + describe('rotate', () => { + describe('rotation around world origin [0, 0, 0]', () => { + beforeEach(() => { + vecA = [0, 1]; + vecB = [0, 0]; + result = Vec2.rotate(out, vecA, vecB, Math.PI); + }); + + it('should return the rotated vector', () => expect(result).toBeVec(0, -1)); + }); + + describe('rotation around an arbitrary origin', () => { + beforeEach(() => { + vecA = [6, -5]; + vecB = [0, -5]; + result = Vec2.rotate(out, vecA, vecB, Math.PI); + }); + + it('should return the rotated vector', () => expect(result).toBeVec(-6, -5)); + }); + }); + + describe('angle', () => { + beforeEach(() => { + vecA = [1, 0]; + vecB = [1, 2]; + result = Vec2.angle(vecA, vecB); + }); + + it('should return the angle', () => expect(result).toBeCloseTo(1.10714)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 0)); + it('should not modify vecB', () => expect(vecB).toBeVec(1, 2)); + }); + + describe('str', () => { + it('should return a string representation of the vector', () => expect(Vec2.str(vecA)).toEqual('Vec2(1, 2)')); + }); + + describe('exactEquals', () => { + let vecC: Vec2Like, r0: boolean, r1: boolean; + + beforeEach(() => { + vecA = [0, 1]; + vecB = [0, 1]; + vecC = [1, 2]; + r0 = Vec2.exactEquals(vecA, vecB); + r1 = Vec2.exactEquals(vecA, vecC); + }); + + it('should return true for identical vectors', () => expect(r0).toBe(true)); + it('should return false for different vectors', () => expect(r1).toBe(false)); + it('should not modify vecA', () => expect(vecA).toBeVec(0, 1)); + it('should not modify vecB', () => expect(vecB).toBeVec(0, 1)); + }); + + describe('equals', () => { + let vecC: Vec2Like, vecD: Vec2Like, r0: boolean, r1: boolean, r2: boolean; + + beforeEach(() => { + vecA = [0, 1]; + vecB = [0, 1]; + vecC = [1, 2]; + vecD = [1e-16, 1]; + r0 = Vec2.equals(vecA, vecB); + r1 = Vec2.equals(vecA, vecC); + r2 = Vec2.equals(vecA, vecD); + }); + + it('should return true for identical vectors', () => expect(r0).toBe(true)); + it('should return false for different vectors', () => expect(r1).toBe(false)); + it('should return true for close but not identical vectors', () => expect(r2).toBe(true)); + it('should not modify vecA', () => expect(vecA).toBeVec(0, 1)); + it('should not modify vecB', () => expect(vecB).toBeVec(0, 1)); + }); + + describe('zero', () => { + beforeEach(() => { + vecA = [1, 2]; + result = Vec2.zero(vecA); + }); + + it('should result in a 2 element vector with zeros', () => expect(result).toBeVec(0, 0)); + }); + }); +}); diff --git a/tests/f32/Vec3-swizzle.spec.ts b/tests/f32/Vec3-swizzle.spec.ts new file mode 100644 index 00000000..d7ee3ce3 --- /dev/null +++ b/tests/f32/Vec3-swizzle.spec.ts @@ -0,0 +1,2123 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Vec3 } from '#gl-matrix'; +import { EnableSwizzles } from '#gl-matrix/swizzle'; + +describe('Vec3 Swizzles', () => { + EnableSwizzles(); + + let v: Vec3; + beforeEach(() => { v = new Vec3(1, 2, 3); }); + + // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should + // not be modified by hand. + // [Swizzle Autogen] + + describe('Vec3().xx', () => { + it('should return Vec2(x, x)', () => expect(v.xx).toBeVec(v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xy', () => { + it('should return Vec2(x, y)', () => expect(v.xy).toBeVec(v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xz', () => { + it('should return Vec2(x, z)', () => expect(v.xz).toBeVec(v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yx', () => { + it('should return Vec2(y, x)', () => expect(v.yx).toBeVec(v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yy', () => { + it('should return Vec2(y, y)', () => expect(v.yy).toBeVec(v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yz', () => { + it('should return Vec2(y, z)', () => expect(v.yz).toBeVec(v[1], v[2])); + it('should be return a copy', () => { + const sw = v.yz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zx', () => { + it('should return Vec2(z, x)', () => expect(v.zx).toBeVec(v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zy', () => { + it('should return Vec2(z, y)', () => expect(v.zy).toBeVec(v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zz', () => { + it('should return Vec2(z, z)', () => expect(v.zz).toBeVec(v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxx', () => { + it('should return Vec3(x, x, x)', () => expect(v.xxx).toBeVec(v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxy', () => { + it('should return Vec3(x, x, y)', () => expect(v.xxy).toBeVec(v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxz', () => { + it('should return Vec3(x, x, z)', () => expect(v.xxz).toBeVec(v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyx', () => { + it('should return Vec3(x, y, x)', () => expect(v.xyx).toBeVec(v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyy', () => { + it('should return Vec3(x, y, y)', () => expect(v.xyy).toBeVec(v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyz', () => { + it('should return Vec3(x, y, z)', () => expect(v.xyz).toBeVec(v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.xyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzx', () => { + it('should return Vec3(x, z, x)', () => expect(v.xzx).toBeVec(v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.xzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzy', () => { + it('should return Vec3(x, z, y)', () => expect(v.xzy).toBeVec(v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.xzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzz', () => { + it('should return Vec3(x, z, z)', () => expect(v.xzz).toBeVec(v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.xzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxx', () => { + it('should return Vec3(y, x, x)', () => expect(v.yxx).toBeVec(v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxy', () => { + it('should return Vec3(y, x, y)', () => expect(v.yxy).toBeVec(v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxz', () => { + it('should return Vec3(y, x, z)', () => expect(v.yxz).toBeVec(v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.yxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyx', () => { + it('should return Vec3(y, y, x)', () => expect(v.yyx).toBeVec(v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyy', () => { + it('should return Vec3(y, y, y)', () => expect(v.yyy).toBeVec(v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyz', () => { + it('should return Vec3(y, y, z)', () => expect(v.yyz).toBeVec(v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.yyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzx', () => { + it('should return Vec3(y, z, x)', () => expect(v.yzx).toBeVec(v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.yzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzy', () => { + it('should return Vec3(y, z, y)', () => expect(v.yzy).toBeVec(v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.yzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzz', () => { + it('should return Vec3(y, z, z)', () => expect(v.yzz).toBeVec(v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.yzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxx', () => { + it('should return Vec3(z, x, x)', () => expect(v.zxx).toBeVec(v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.zxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxy', () => { + it('should return Vec3(z, x, y)', () => expect(v.zxy).toBeVec(v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.zxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxz', () => { + it('should return Vec3(z, x, z)', () => expect(v.zxz).toBeVec(v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.zxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyx', () => { + it('should return Vec3(z, y, x)', () => expect(v.zyx).toBeVec(v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.zyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyy', () => { + it('should return Vec3(z, y, y)', () => expect(v.zyy).toBeVec(v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.zyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyz', () => { + it('should return Vec3(z, y, z)', () => expect(v.zyz).toBeVec(v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.zyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzx', () => { + it('should return Vec3(z, z, x)', () => expect(v.zzx).toBeVec(v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzy', () => { + it('should return Vec3(z, z, y)', () => expect(v.zzy).toBeVec(v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzz', () => { + it('should return Vec3(z, z, z)', () => expect(v.zzz).toBeVec(v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxxx', () => { + it('should return Vec4(x, x, x, x)', () => expect(v.xxxx).toBeVec(v[0], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xxxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxxy', () => { + it('should return Vec4(x, x, x, y)', () => expect(v.xxxy).toBeVec(v[0], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xxxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxxz', () => { + it('should return Vec4(x, x, x, z)', () => expect(v.xxxz).toBeVec(v[0], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xxxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxyx', () => { + it('should return Vec4(x, x, y, x)', () => expect(v.xxyx).toBeVec(v[0], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xxyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxyy', () => { + it('should return Vec4(x, x, y, y)', () => expect(v.xxyy).toBeVec(v[0], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xxyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxyz', () => { + it('should return Vec4(x, x, y, z)', () => expect(v.xxyz).toBeVec(v[0], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.xxyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxzx', () => { + it('should return Vec4(x, x, z, x)', () => expect(v.xxzx).toBeVec(v[0], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.xxzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxzy', () => { + it('should return Vec4(x, x, z, y)', () => expect(v.xxzy).toBeVec(v[0], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.xxzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxzz', () => { + it('should return Vec4(x, x, z, z)', () => expect(v.xxzz).toBeVec(v[0], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.xxzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyxx', () => { + it('should return Vec4(x, y, x, x)', () => expect(v.xyxx).toBeVec(v[0], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xyxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyxy', () => { + it('should return Vec4(x, y, x, y)', () => expect(v.xyxy).toBeVec(v[0], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xyxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyxz', () => { + it('should return Vec4(x, y, x, z)', () => expect(v.xyxz).toBeVec(v[0], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xyxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyyx', () => { + it('should return Vec4(x, y, y, x)', () => expect(v.xyyx).toBeVec(v[0], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xyyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyyy', () => { + it('should return Vec4(x, y, y, y)', () => expect(v.xyyy).toBeVec(v[0], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xyyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyyz', () => { + it('should return Vec4(x, y, y, z)', () => expect(v.xyyz).toBeVec(v[0], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.xyyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyzx', () => { + it('should return Vec4(x, y, z, x)', () => expect(v.xyzx).toBeVec(v[0], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.xyzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyzy', () => { + it('should return Vec4(x, y, z, y)', () => expect(v.xyzy).toBeVec(v[0], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.xyzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyzz', () => { + it('should return Vec4(x, y, z, z)', () => expect(v.xyzz).toBeVec(v[0], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.xyzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzxx', () => { + it('should return Vec4(x, z, x, x)', () => expect(v.xzxx).toBeVec(v[0], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xzxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzxy', () => { + it('should return Vec4(x, z, x, y)', () => expect(v.xzxy).toBeVec(v[0], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xzxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzxz', () => { + it('should return Vec4(x, z, x, z)', () => expect(v.xzxz).toBeVec(v[0], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xzxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzyx', () => { + it('should return Vec4(x, z, y, x)', () => expect(v.xzyx).toBeVec(v[0], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xzyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzyy', () => { + it('should return Vec4(x, z, y, y)', () => expect(v.xzyy).toBeVec(v[0], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xzyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzyz', () => { + it('should return Vec4(x, z, y, z)', () => expect(v.xzyz).toBeVec(v[0], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.xzyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzzx', () => { + it('should return Vec4(x, z, z, x)', () => expect(v.xzzx).toBeVec(v[0], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.xzzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzzy', () => { + it('should return Vec4(x, z, z, y)', () => expect(v.xzzy).toBeVec(v[0], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.xzzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzzz', () => { + it('should return Vec4(x, z, z, z)', () => expect(v.xzzz).toBeVec(v[0], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.xzzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxxx', () => { + it('should return Vec4(y, x, x, x)', () => expect(v.yxxx).toBeVec(v[1], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yxxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxxy', () => { + it('should return Vec4(y, x, x, y)', () => expect(v.yxxy).toBeVec(v[1], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yxxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxxz', () => { + it('should return Vec4(y, x, x, z)', () => expect(v.yxxz).toBeVec(v[1], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.yxxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxyx', () => { + it('should return Vec4(y, x, y, x)', () => expect(v.yxyx).toBeVec(v[1], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yxyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxyy', () => { + it('should return Vec4(y, x, y, y)', () => expect(v.yxyy).toBeVec(v[1], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yxyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxyz', () => { + it('should return Vec4(y, x, y, z)', () => expect(v.yxyz).toBeVec(v[1], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.yxyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxzx', () => { + it('should return Vec4(y, x, z, x)', () => expect(v.yxzx).toBeVec(v[1], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.yxzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxzy', () => { + it('should return Vec4(y, x, z, y)', () => expect(v.yxzy).toBeVec(v[1], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.yxzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxzz', () => { + it('should return Vec4(y, x, z, z)', () => expect(v.yxzz).toBeVec(v[1], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.yxzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyxx', () => { + it('should return Vec4(y, y, x, x)', () => expect(v.yyxx).toBeVec(v[1], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yyxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyxy', () => { + it('should return Vec4(y, y, x, y)', () => expect(v.yyxy).toBeVec(v[1], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yyxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyxz', () => { + it('should return Vec4(y, y, x, z)', () => expect(v.yyxz).toBeVec(v[1], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.yyxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyyx', () => { + it('should return Vec4(y, y, y, x)', () => expect(v.yyyx).toBeVec(v[1], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yyyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyyy', () => { + it('should return Vec4(y, y, y, y)', () => expect(v.yyyy).toBeVec(v[1], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yyyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyyz', () => { + it('should return Vec4(y, y, y, z)', () => expect(v.yyyz).toBeVec(v[1], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.yyyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyzx', () => { + it('should return Vec4(y, y, z, x)', () => expect(v.yyzx).toBeVec(v[1], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.yyzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyzy', () => { + it('should return Vec4(y, y, z, y)', () => expect(v.yyzy).toBeVec(v[1], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.yyzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyzz', () => { + it('should return Vec4(y, y, z, z)', () => expect(v.yyzz).toBeVec(v[1], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.yyzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzxx', () => { + it('should return Vec4(y, z, x, x)', () => expect(v.yzxx).toBeVec(v[1], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yzxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzxy', () => { + it('should return Vec4(y, z, x, y)', () => expect(v.yzxy).toBeVec(v[1], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yzxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzxz', () => { + it('should return Vec4(y, z, x, z)', () => expect(v.yzxz).toBeVec(v[1], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.yzxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzyx', () => { + it('should return Vec4(y, z, y, x)', () => expect(v.yzyx).toBeVec(v[1], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yzyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzyy', () => { + it('should return Vec4(y, z, y, y)', () => expect(v.yzyy).toBeVec(v[1], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yzyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzyz', () => { + it('should return Vec4(y, z, y, z)', () => expect(v.yzyz).toBeVec(v[1], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.yzyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzzx', () => { + it('should return Vec4(y, z, z, x)', () => expect(v.yzzx).toBeVec(v[1], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.yzzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzzy', () => { + it('should return Vec4(y, z, z, y)', () => expect(v.yzzy).toBeVec(v[1], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.yzzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzzz', () => { + it('should return Vec4(y, z, z, z)', () => expect(v.yzzz).toBeVec(v[1], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.yzzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxxx', () => { + it('should return Vec4(z, x, x, x)', () => expect(v.zxxx).toBeVec(v[2], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.zxxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxxy', () => { + it('should return Vec4(z, x, x, y)', () => expect(v.zxxy).toBeVec(v[2], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.zxxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxxz', () => { + it('should return Vec4(z, x, x, z)', () => expect(v.zxxz).toBeVec(v[2], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.zxxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxyx', () => { + it('should return Vec4(z, x, y, x)', () => expect(v.zxyx).toBeVec(v[2], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.zxyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxyy', () => { + it('should return Vec4(z, x, y, y)', () => expect(v.zxyy).toBeVec(v[2], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.zxyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxyz', () => { + it('should return Vec4(z, x, y, z)', () => expect(v.zxyz).toBeVec(v[2], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.zxyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxzx', () => { + it('should return Vec4(z, x, z, x)', () => expect(v.zxzx).toBeVec(v[2], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zxzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxzy', () => { + it('should return Vec4(z, x, z, y)', () => expect(v.zxzy).toBeVec(v[2], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zxzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxzz', () => { + it('should return Vec4(z, x, z, z)', () => expect(v.zxzz).toBeVec(v[2], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zxzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyxx', () => { + it('should return Vec4(z, y, x, x)', () => expect(v.zyxx).toBeVec(v[2], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.zyxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyxy', () => { + it('should return Vec4(z, y, x, y)', () => expect(v.zyxy).toBeVec(v[2], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.zyxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyxz', () => { + it('should return Vec4(z, y, x, z)', () => expect(v.zyxz).toBeVec(v[2], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.zyxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyyx', () => { + it('should return Vec4(z, y, y, x)', () => expect(v.zyyx).toBeVec(v[2], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.zyyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyyy', () => { + it('should return Vec4(z, y, y, y)', () => expect(v.zyyy).toBeVec(v[2], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.zyyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyyz', () => { + it('should return Vec4(z, y, y, z)', () => expect(v.zyyz).toBeVec(v[2], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.zyyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyzx', () => { + it('should return Vec4(z, y, z, x)', () => expect(v.zyzx).toBeVec(v[2], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zyzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyzy', () => { + it('should return Vec4(z, y, z, y)', () => expect(v.zyzy).toBeVec(v[2], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zyzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyzz', () => { + it('should return Vec4(z, y, z, z)', () => expect(v.zyzz).toBeVec(v[2], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zyzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzxx', () => { + it('should return Vec4(z, z, x, x)', () => expect(v.zzxx).toBeVec(v[2], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.zzxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzxy', () => { + it('should return Vec4(z, z, x, y)', () => expect(v.zzxy).toBeVec(v[2], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.zzxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzxz', () => { + it('should return Vec4(z, z, x, z)', () => expect(v.zzxz).toBeVec(v[2], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.zzxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzyx', () => { + it('should return Vec4(z, z, y, x)', () => expect(v.zzyx).toBeVec(v[2], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.zzyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzyy', () => { + it('should return Vec4(z, z, y, y)', () => expect(v.zzyy).toBeVec(v[2], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.zzyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzyz', () => { + it('should return Vec4(z, z, y, z)', () => expect(v.zzyz).toBeVec(v[2], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.zzyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzzx', () => { + it('should return Vec4(z, z, z, x)', () => expect(v.zzzx).toBeVec(v[2], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zzzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzzy', () => { + it('should return Vec4(z, z, z, y)', () => expect(v.zzzy).toBeVec(v[2], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zzzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzzz', () => { + it('should return Vec4(z, z, z, z)', () => expect(v.zzzz).toBeVec(v[2], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zzzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rr', () => { + it('should return Vec2(r, r)', () => expect(v.rr).toBeVec(v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rg', () => { + it('should return Vec2(r, g)', () => expect(v.rg).toBeVec(v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rb', () => { + it('should return Vec2(r, b)', () => expect(v.rb).toBeVec(v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gr', () => { + it('should return Vec2(g, r)', () => expect(v.gr).toBeVec(v[1], v[0])); + it('should be return a copy', () => { + const sw = v.gr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gg', () => { + it('should return Vec2(g, g)', () => expect(v.gg).toBeVec(v[1], v[1])); + it('should be return a copy', () => { + const sw = v.gg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gb', () => { + it('should return Vec2(g, b)', () => expect(v.gb).toBeVec(v[1], v[2])); + it('should be return a copy', () => { + const sw = v.gb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().br', () => { + it('should return Vec2(b, r)', () => expect(v.br).toBeVec(v[2], v[0])); + it('should be return a copy', () => { + const sw = v.br; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bg', () => { + it('should return Vec2(b, g)', () => expect(v.bg).toBeVec(v[2], v[1])); + it('should be return a copy', () => { + const sw = v.bg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bb', () => { + it('should return Vec2(b, b)', () => expect(v.bb).toBeVec(v[2], v[2])); + it('should be return a copy', () => { + const sw = v.bb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrr', () => { + it('should return Vec3(r, r, r)', () => expect(v.rrr).toBeVec(v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrg', () => { + it('should return Vec3(r, r, g)', () => expect(v.rrg).toBeVec(v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrb', () => { + it('should return Vec3(r, r, b)', () => expect(v.rrb).toBeVec(v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rgr', () => { + it('should return Vec3(r, g, r)', () => expect(v.rgr).toBeVec(v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rgg', () => { + it('should return Vec3(r, g, g)', () => expect(v.rgg).toBeVec(v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rgb', () => { + it('should return Vec3(r, g, b)', () => expect(v.rgb).toBeVec(v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.rgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbr', () => { + it('should return Vec3(r, b, r)', () => expect(v.rbr).toBeVec(v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.rbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbg', () => { + it('should return Vec3(r, b, g)', () => expect(v.rbg).toBeVec(v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.rbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbb', () => { + it('should return Vec3(r, b, b)', () => expect(v.rbb).toBeVec(v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.rbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grr', () => { + it('should return Vec3(g, r, r)', () => expect(v.grr).toBeVec(v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.grr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grg', () => { + it('should return Vec3(g, r, g)', () => expect(v.grg).toBeVec(v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.grg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grb', () => { + it('should return Vec3(g, r, b)', () => expect(v.grb).toBeVec(v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.grb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().ggr', () => { + it('should return Vec3(g, g, r)', () => expect(v.ggr).toBeVec(v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.ggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().ggg', () => { + it('should return Vec3(g, g, g)', () => expect(v.ggg).toBeVec(v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.ggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().ggb', () => { + it('should return Vec3(g, g, b)', () => expect(v.ggb).toBeVec(v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.ggb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbr', () => { + it('should return Vec3(g, b, r)', () => expect(v.gbr).toBeVec(v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.gbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbg', () => { + it('should return Vec3(g, b, g)', () => expect(v.gbg).toBeVec(v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.gbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbb', () => { + it('should return Vec3(g, b, b)', () => expect(v.gbb).toBeVec(v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.gbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brr', () => { + it('should return Vec3(b, r, r)', () => expect(v.brr).toBeVec(v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.brr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brg', () => { + it('should return Vec3(b, r, g)', () => expect(v.brg).toBeVec(v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.brg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brb', () => { + it('should return Vec3(b, r, b)', () => expect(v.brb).toBeVec(v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.brb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bgr', () => { + it('should return Vec3(b, g, r)', () => expect(v.bgr).toBeVec(v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.bgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bgg', () => { + it('should return Vec3(b, g, g)', () => expect(v.bgg).toBeVec(v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.bgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bgb', () => { + it('should return Vec3(b, g, b)', () => expect(v.bgb).toBeVec(v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.bgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbr', () => { + it('should return Vec3(b, b, r)', () => expect(v.bbr).toBeVec(v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.bbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbg', () => { + it('should return Vec3(b, b, g)', () => expect(v.bbg).toBeVec(v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.bbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbb', () => { + it('should return Vec3(b, b, b)', () => expect(v.bbb).toBeVec(v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.bbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrrr', () => { + it('should return Vec4(r, r, r, r)', () => expect(v.rrrr).toBeVec(v[0], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rrrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrrg', () => { + it('should return Vec4(r, r, r, g)', () => expect(v.rrrg).toBeVec(v[0], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rrrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrrb', () => { + it('should return Vec4(r, r, r, b)', () => expect(v.rrrb).toBeVec(v[0], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rrrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrgr', () => { + it('should return Vec4(r, r, g, r)', () => expect(v.rrgr).toBeVec(v[0], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rrgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrgg', () => { + it('should return Vec4(r, r, g, g)', () => expect(v.rrgg).toBeVec(v[0], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rrgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrgb', () => { + it('should return Vec4(r, r, g, b)', () => expect(v.rrgb).toBeVec(v[0], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.rrgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrbr', () => { + it('should return Vec4(r, r, b, r)', () => expect(v.rrbr).toBeVec(v[0], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.rrbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrbg', () => { + it('should return Vec4(r, r, b, g)', () => expect(v.rrbg).toBeVec(v[0], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.rrbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrbb', () => { + it('should return Vec4(r, r, b, b)', () => expect(v.rrbb).toBeVec(v[0], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.rrbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rgrr', () => { + it('should return Vec4(r, g, r, r)', () => expect(v.rgrr).toBeVec(v[0], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rgrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rgrg', () => { + it('should return Vec4(r, g, r, g)', () => expect(v.rgrg).toBeVec(v[0], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rgrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rgrb', () => { + it('should return Vec4(r, g, r, b)', () => expect(v.rgrb).toBeVec(v[0], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rgrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rggr', () => { + it('should return Vec4(r, g, g, r)', () => expect(v.rggr).toBeVec(v[0], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rggg', () => { + it('should return Vec4(r, g, g, g)', () => expect(v.rggg).toBeVec(v[0], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rggb', () => { + it('should return Vec4(r, g, g, b)', () => expect(v.rggb).toBeVec(v[0], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.rggb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rgbr', () => { + it('should return Vec4(r, g, b, r)', () => expect(v.rgbr).toBeVec(v[0], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.rgbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rgbg', () => { + it('should return Vec4(r, g, b, g)', () => expect(v.rgbg).toBeVec(v[0], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.rgbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rgbb', () => { + it('should return Vec4(r, g, b, b)', () => expect(v.rgbb).toBeVec(v[0], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.rgbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbrr', () => { + it('should return Vec4(r, b, r, r)', () => expect(v.rbrr).toBeVec(v[0], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rbrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbrg', () => { + it('should return Vec4(r, b, r, g)', () => expect(v.rbrg).toBeVec(v[0], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rbrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbrb', () => { + it('should return Vec4(r, b, r, b)', () => expect(v.rbrb).toBeVec(v[0], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rbrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbgr', () => { + it('should return Vec4(r, b, g, r)', () => expect(v.rbgr).toBeVec(v[0], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rbgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbgg', () => { + it('should return Vec4(r, b, g, g)', () => expect(v.rbgg).toBeVec(v[0], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rbgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbgb', () => { + it('should return Vec4(r, b, g, b)', () => expect(v.rbgb).toBeVec(v[0], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.rbgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbbr', () => { + it('should return Vec4(r, b, b, r)', () => expect(v.rbbr).toBeVec(v[0], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.rbbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbbg', () => { + it('should return Vec4(r, b, b, g)', () => expect(v.rbbg).toBeVec(v[0], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.rbbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbbb', () => { + it('should return Vec4(r, b, b, b)', () => expect(v.rbbb).toBeVec(v[0], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.rbbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grrr', () => { + it('should return Vec4(g, r, r, r)', () => expect(v.grrr).toBeVec(v[1], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.grrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grrg', () => { + it('should return Vec4(g, r, r, g)', () => expect(v.grrg).toBeVec(v[1], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.grrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grrb', () => { + it('should return Vec4(g, r, r, b)', () => expect(v.grrb).toBeVec(v[1], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.grrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grgr', () => { + it('should return Vec4(g, r, g, r)', () => expect(v.grgr).toBeVec(v[1], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.grgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grgg', () => { + it('should return Vec4(g, r, g, g)', () => expect(v.grgg).toBeVec(v[1], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.grgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grgb', () => { + it('should return Vec4(g, r, g, b)', () => expect(v.grgb).toBeVec(v[1], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.grgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grbr', () => { + it('should return Vec4(g, r, b, r)', () => expect(v.grbr).toBeVec(v[1], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.grbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grbg', () => { + it('should return Vec4(g, r, b, g)', () => expect(v.grbg).toBeVec(v[1], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.grbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grbb', () => { + it('should return Vec4(g, r, b, b)', () => expect(v.grbb).toBeVec(v[1], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.grbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().ggrr', () => { + it('should return Vec4(g, g, r, r)', () => expect(v.ggrr).toBeVec(v[1], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.ggrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().ggrg', () => { + it('should return Vec4(g, g, r, g)', () => expect(v.ggrg).toBeVec(v[1], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.ggrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().ggrb', () => { + it('should return Vec4(g, g, r, b)', () => expect(v.ggrb).toBeVec(v[1], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.ggrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gggr', () => { + it('should return Vec4(g, g, g, r)', () => expect(v.gggr).toBeVec(v[1], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.gggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gggg', () => { + it('should return Vec4(g, g, g, g)', () => expect(v.gggg).toBeVec(v[1], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.gggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gggb', () => { + it('should return Vec4(g, g, g, b)', () => expect(v.gggb).toBeVec(v[1], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.gggb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().ggbr', () => { + it('should return Vec4(g, g, b, r)', () => expect(v.ggbr).toBeVec(v[1], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.ggbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().ggbg', () => { + it('should return Vec4(g, g, b, g)', () => expect(v.ggbg).toBeVec(v[1], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.ggbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().ggbb', () => { + it('should return Vec4(g, g, b, b)', () => expect(v.ggbb).toBeVec(v[1], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.ggbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbrr', () => { + it('should return Vec4(g, b, r, r)', () => expect(v.gbrr).toBeVec(v[1], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.gbrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbrg', () => { + it('should return Vec4(g, b, r, g)', () => expect(v.gbrg).toBeVec(v[1], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.gbrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbrb', () => { + it('should return Vec4(g, b, r, b)', () => expect(v.gbrb).toBeVec(v[1], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.gbrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbgr', () => { + it('should return Vec4(g, b, g, r)', () => expect(v.gbgr).toBeVec(v[1], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.gbgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbgg', () => { + it('should return Vec4(g, b, g, g)', () => expect(v.gbgg).toBeVec(v[1], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.gbgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbgb', () => { + it('should return Vec4(g, b, g, b)', () => expect(v.gbgb).toBeVec(v[1], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.gbgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbbr', () => { + it('should return Vec4(g, b, b, r)', () => expect(v.gbbr).toBeVec(v[1], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.gbbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbbg', () => { + it('should return Vec4(g, b, b, g)', () => expect(v.gbbg).toBeVec(v[1], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.gbbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbbb', () => { + it('should return Vec4(g, b, b, b)', () => expect(v.gbbb).toBeVec(v[1], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.gbbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brrr', () => { + it('should return Vec4(b, r, r, r)', () => expect(v.brrr).toBeVec(v[2], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.brrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brrg', () => { + it('should return Vec4(b, r, r, g)', () => expect(v.brrg).toBeVec(v[2], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.brrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brrb', () => { + it('should return Vec4(b, r, r, b)', () => expect(v.brrb).toBeVec(v[2], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.brrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brgr', () => { + it('should return Vec4(b, r, g, r)', () => expect(v.brgr).toBeVec(v[2], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.brgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brgg', () => { + it('should return Vec4(b, r, g, g)', () => expect(v.brgg).toBeVec(v[2], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.brgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brgb', () => { + it('should return Vec4(b, r, g, b)', () => expect(v.brgb).toBeVec(v[2], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.brgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brbr', () => { + it('should return Vec4(b, r, b, r)', () => expect(v.brbr).toBeVec(v[2], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.brbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brbg', () => { + it('should return Vec4(b, r, b, g)', () => expect(v.brbg).toBeVec(v[2], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.brbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brbb', () => { + it('should return Vec4(b, r, b, b)', () => expect(v.brbb).toBeVec(v[2], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.brbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bgrr', () => { + it('should return Vec4(b, g, r, r)', () => expect(v.bgrr).toBeVec(v[2], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.bgrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bgrg', () => { + it('should return Vec4(b, g, r, g)', () => expect(v.bgrg).toBeVec(v[2], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.bgrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bgrb', () => { + it('should return Vec4(b, g, r, b)', () => expect(v.bgrb).toBeVec(v[2], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.bgrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bggr', () => { + it('should return Vec4(b, g, g, r)', () => expect(v.bggr).toBeVec(v[2], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.bggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bggg', () => { + it('should return Vec4(b, g, g, g)', () => expect(v.bggg).toBeVec(v[2], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.bggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bggb', () => { + it('should return Vec4(b, g, g, b)', () => expect(v.bggb).toBeVec(v[2], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.bggb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bgbr', () => { + it('should return Vec4(b, g, b, r)', () => expect(v.bgbr).toBeVec(v[2], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.bgbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bgbg', () => { + it('should return Vec4(b, g, b, g)', () => expect(v.bgbg).toBeVec(v[2], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.bgbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bgbb', () => { + it('should return Vec4(b, g, b, b)', () => expect(v.bgbb).toBeVec(v[2], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.bgbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbrr', () => { + it('should return Vec4(b, b, r, r)', () => expect(v.bbrr).toBeVec(v[2], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.bbrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbrg', () => { + it('should return Vec4(b, b, r, g)', () => expect(v.bbrg).toBeVec(v[2], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.bbrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbrb', () => { + it('should return Vec4(b, b, r, b)', () => expect(v.bbrb).toBeVec(v[2], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.bbrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbgr', () => { + it('should return Vec4(b, b, g, r)', () => expect(v.bbgr).toBeVec(v[2], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.bbgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbgg', () => { + it('should return Vec4(b, b, g, g)', () => expect(v.bbgg).toBeVec(v[2], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.bbgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbgb', () => { + it('should return Vec4(b, b, g, b)', () => expect(v.bbgb).toBeVec(v[2], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.bbgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbbr', () => { + it('should return Vec4(b, b, b, r)', () => expect(v.bbbr).toBeVec(v[2], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.bbbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbbg', () => { + it('should return Vec4(b, b, b, g)', () => expect(v.bbbg).toBeVec(v[2], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.bbbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbbb', () => { + it('should return Vec4(b, b, b, b)', () => expect(v.bbbb).toBeVec(v[2], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.bbbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + // [/Swizzle Autogen] +}); diff --git a/tests/f32/Vec3.spec.ts b/tests/f32/Vec3.spec.ts new file mode 100644 index 00000000..de774310 --- /dev/null +++ b/tests/f32/Vec3.spec.ts @@ -0,0 +1,730 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Mat4, Vec3 } from '#gl-matrix'; + +import type { Mat4Like, Vec3Like } from '#gl-matrix/types'; + +describe('Vec3', () => { + describe('constructor', () => { + it('should return Vec3(0, 0, 0) if called with no arguments', () => expect(new Vec3()).toBeVec(0, 0, 0)); + + it('should return Vec3(x, y, z) if called with (x, y, z)', () => { + expect(new Vec3(1, 2, 3)).toBeVec(1, 2, 3); + expect(new Vec3(-3, 4.4, -5.6)).toBeVec(-3, 4.4, -5.6); + }); + + it('should return Vec3(x, x, x) if called with (x)', () => { + expect(new Vec3(1)).toBeVec(1, 1, 1); + expect(new Vec3(-2.3)).toBeVec(-2.3, -2.3, -2.3); + }); + + it('should return Vec3(x, y, z) if called with ([x, y, z])', () => { + expect(new Vec3([1, 2, 3])).toBeVec(1, 2, 3); + expect(new Vec3([-3, 4.4, -5.6])).toBeVec(-3, 4.4, -5.6); + }); + + it('should return Vec3(x, y, z) if called with (Vec3(x, y, z))', () => { + const v = new Vec3(3.4, 5.6, 7.8); + expect(new Vec3(v)).toBeVec(v); + }); + + it('should return Vec3(x, y, z) if called with (Float32Array([x, y, z]))', () => { + const arr = new Float32Array([1.2, 3.4, 5.6]); + expect(new Vec3(arr)).toBeVec(arr); + }); + }); + + describe('static', () => { + let out: Vec3Like; + let vecA: Vec3Like; + let vecB: Vec3Like; + let result: Vec3Like; + + beforeEach(() => { + vecA = new Vec3(1, 2, 3); + vecB = new Vec3(4, 5, 6); + out = new Vec3(0, 0, 0); + }); + + describe('rotateX', () => { + describe('rotation around world origin [0, 0, 0]', () => { + beforeEach(() => { + vecA = [0, 1, 0]; + vecB = [0, 0, 0]; + result = Vec3.rotateX(out, vecA, vecB, Math.PI); + }); + + it('should return the rotated vector', () => expect(result).toBeVec(0, -1, 0)); + }); + + describe('rotation around an arbitrary origin', () => { + beforeEach(() => { + vecA = [2, 7, 0]; + vecB = [2, 5, 0]; + result = Vec3.rotateX(out, vecA, vecB, Math.PI); + }); + + it('should return the rotated vector', () => expect(result).toBeVec(2, 3, 0)); + }); + }); + + describe('rotateY', () => { + describe('rotation around world origin [0, 0, 0]', () => { + beforeEach(() => { + vecA = [1, 0, 0]; + vecB = [0, 0, 0]; + result = Vec3.rotateY(out, vecA, vecB, Math.PI); + }); + + it('should return the rotated vector', () => expect(result).toBeVec(-1, 0, 0)); + }); + describe('rotation around an arbitrary origin', () => { + beforeEach(() => { + vecA = [-2, 3, 10]; + vecB = [-4, 3, 10]; + result = Vec3.rotateY(out, vecA, vecB, Math.PI); + }); + + it('should return the rotated vector', () => expect(result).toBeVec(-6, 3, 10)); + }); + }); + + describe('rotateZ', () => { + describe('rotation around world origin [0, 0, 0]', () => { + beforeEach(() => { + vecA = [0, 1, 0]; + vecB = [0, 0, 0]; + result = Vec3.rotateZ(out, vecA, vecB, Math.PI); + }); + + it('should return the rotated vector', () => expect(result).toBeVec(0, -1, 0)); + }); + describe('rotation around an arbitrary origin', () => { + beforeEach(() => { + vecA = [0, 6, -5]; + vecB = [0, 0, -5]; + result = Vec3.rotateZ(out, vecA, vecB, Math.PI); + }); + + it('should return the rotated vector', () => expect(result).toBeVec(0, -6, -5)); + }); + }); + + describe('transformMat4', () => { + let matr : Mat4Like; + + describe('with an identity', () => { + beforeEach(() => { + matr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; + result = Vec3.transformMat4(out, vecA, matr); + }); + + it('should produce the input', () => expect(out).toBeVec(1, 2, 3)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('with a lookAt', () => { + beforeEach(() => { + matr = Mat4.lookAt(new Mat4(), [5, 6, 7], [2, 6, 7], [0, 1, 0]); + result = Vec3.transformMat4(out, vecA, matr); + }); + + it('should rotate and translate the input', () => expect(out).toBeVec(4, -4, -4)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('with a perspective matrix (#92)', () => { + it('should transform a point from perspective(pi/2, 4/3, 1, 100)', () => { + matr = [ + 0.750, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, -1.02, -1, + 0, 0, -2.02, 0]; + result = Vec3.transformMat4([0, 0, 0], [10, 20, 30], matr); + expect(result).toBeVec(-0.25, -0.666666, 1.087333); + }); + }); + }); + + /* + describe('transformMat3', () => { + let matr; + + describe('with an identity', () => { + beforeEach(() => { + matr = [1, 0, 0, 0, 1, 0, 0, 0, 1 ]; + result = Vec3.transformMat3(out, vecA, matr); + }); + + it('should produce the input', () => expect(out).toBeVec(1, 2, 3)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('with 90deg about X', () => { + beforeEach(() => { result = Vec3.transformMat3(out, [0,1,0], [1,0,0,0,0,1,0,-1,0]); }); + + it('should produce correct output', () => expect(out).toBeVec(0,0,1)); + }); + + describe('with 90deg about Y', () => { + beforeEach(() => { result = Vec3.transformMat3(out, [1,0,0], [0,0,-1,0,1,0,1,0,0]); }); + + it('should produce correct output', () => expect(out).toBeVec(0,0,-1)); + }); + + describe('with 90deg about Z', () => { + beforeEach(() => { result = Vec3.transformMat3(out, [1,0,0], [0,1,0,-1,0,0,0,0,1]); }); + + it('should produce correct output', () => expect(out).toBeVec(0,1,0)); + }); + + describe('with a lookAt normal matrix', () => { + beforeEach(() => { + matr = mat4.lookAt(mat4.create(), [5, 6, 7], [2, 6, 7], [0, 1, 0]); + let n = mat3.create(); + matr = mat3.transpose(n, mat3.invert(n, mat3.fromMat4(n, matr))); + + result = Vec3.transformMat3(out, [1,0,0], matr); + }); + + it('should rotate the input', () => expect(out).toBeVec( 0,0,1 )); + it('should return out', () => expect(result).toBe(out)); + }); + });*/ + + describe('transformQuat', () => { + beforeEach(() => { + result = Vec3.transformQuat(out, vecA, + [0.18257418567011074, 0.3651483713402215, 0.5477225570103322, 0.730296742680443]); + }); + + it('should rotate the input vector', () => expect(out).toBeVec(1, 2, 3)); + it('should return out', () => expect(result).not.toBe([1, 2, 3, 4])); + }); + + describe('create', () => { + beforeEach(() => { result = Vec3.create(); }); + + it('should return a 3 element array initialized to 0s', () => expect(result).toBeVec(0, 0, 0)); + }); + + describe('clone', () => { + beforeEach(() => { result = Vec3.clone(vecA); }); + + it('should return a 3 element array initialized to the values in vecA', () => expect(result).toBeVec(vecA)); + }); + + describe('fromValues', () => { + beforeEach(() => { result = Vec3.fromValues(1, 2, 3); }); + + it('should return a 3 element array initialized to the values passed', () => expect(result).toBeVec(1, 2, 3)); + }); + + describe('copy', () => { + beforeEach(() => { result = Vec3.copy(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('set', () => { + beforeEach(() => { result = Vec3.set(out, 1, 2, 3); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('add', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.add(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(5, 7, 9)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.add(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(5, 7, 9)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec3.add(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(5, 7, 9)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + }); + }); + + describe('subtract', () => { + it('should have an alias called `sub`', () => expect(Vec3.sub).toEqual(Vec3.subtract)); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.subtract(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(-3, -3, -3)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.subtract(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(-3, -3, -3)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec3.subtract(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(-3, -3, -3)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + }); + }); + + describe('multiply', () => { + it('should have an alias called `mul`', () => expect(Vec3.mul).toEqual(Vec3.multiply)); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.multiply(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(4, 10, 18)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.multiply(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(4, 10, 18)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec3.multiply(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(4, 10, 18)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + }); + }); + + describe('divide', () => { + it('should have an alias called `div`', () => expect(Vec3.div).toEqual(Vec3.divide)); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.divide(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(0.25, 0.4, 0.5)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.divide(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(0.25, 0.4, 0.5)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec3.divide(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(0.25, 0.4, 0.5)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + }); + }); + + describe('ceil', () => { + beforeEach(() => { vecA = [Math.E, Math.PI, Math.SQRT2]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.ceil(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(3, 4, 2)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(Math.E, Math.PI, Math.SQRT2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.ceil(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 4, 2)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('floor', () => { + beforeEach(() => { vecA = [Math.E, Math.PI, Math.SQRT2]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.floor(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(2, 3, 1)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(Math.E, Math.PI, Math.SQRT2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.floor(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(2, 3, 1)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('min', () => { + beforeEach(() => { vecA = [1, 3, 1]; vecB = [3, 1, 3]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.min(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(1, 1, 1)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 3, 1)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 1, 3)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.min(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 1, 1)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 1, 3)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec3.min(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(1, 1, 1)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 3, 1)); + }); + }); + + describe('max', () => { + beforeEach(() => { vecA = [1, 3, 1]; vecB = [3, 1, 3]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.max(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(3, 3, 3)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 3, 1)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 1, 3)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.max(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 3, 3)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 1, 3)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec3.max(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(3, 3, 3)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 3, 1)); + }); + }); + + /* + describe('round', () => { + beforeEach(() => { vecA = [Math.E, Math.PI, Math.SQRT2]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.round(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(3, 3, 1)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(Math.E, Math.PI, Math.SQRT2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.round(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 3, 1)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + });*/ + + describe('scale', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.scale(out, vecA, 2); }); + + it('should place values into out', () => expect(out).toBeVec(2, 4, 6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.scale(vecA, vecA, 2); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(2, 4, 6)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('scaleAndAdd', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.scaleAndAdd(out, vecA, vecB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(3, 4.5, 6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.scaleAndAdd(vecA, vecA, vecB, 0.5); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 4.5, 6)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec3.scaleAndAdd(vecB, vecA, vecB, 0.5); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(3, 4.5, 6)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + }); + }); + + describe('distance', () => { + it('should have an alias called `dist`', () => expect(Vec3.dist).toEqual(Vec3.distance)); + it('should return the distance', () => expect(Vec3.distance(vecA, vecB)).toBeCloseTo(5.196152)); + }); + + describe('squaredDistance', () => { + it('should have an alias called `sqrDist`', () => expect(Vec3.sqrDist).toEqual(Vec3.squaredDistance)); + it('should return the squared distance', () => expect(Vec3.squaredDistance(vecA, vecB)).toEqual(27)); + }); + + describe('length', () => { + it('should have an alias called `len`', () => expect(Vec3.len).toEqual(Vec3.length)); + it('should return the length', () => expect(Vec3.len(vecA)).toBeCloseTo(3.741657)); + }); + + describe('squaredLength', () => { + it('should have an alias called `sqrLen`', () => expect(Vec3.sqrLen).toEqual(Vec3.squaredLength)); + it('should return the squared length', () => expect(Vec3.squaredLength(vecA)).toEqual(14)); + }); + + describe('negate', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.negate(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(-1, -2, -3)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.negate(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(-1, -2, -3)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('inverse', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.inverse(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 1 / 2, 1 / 3)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.inverse(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 1 / 2, 1 / 3)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('abs', () => { + beforeEach(() => { vecA = [-1, -2, -3]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.abs(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(-1, -2, -3)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.abs(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 2, 3)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('normalize', () => { + beforeEach(() => { vecA = [5, 0, 0]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.normalize(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 0, 0)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(5, 0, 0)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.normalize(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 0, 0)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('dot', () => { + let value: number; + beforeEach(() => { value = Vec3.dot(vecA, vecB); }); + + it('should return the dot product', () => expect(value).toEqual(32)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('cross', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.cross(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(-3, 6, -3)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.cross(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(-3, 6, -3)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec3.cross(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(-3, 6, -3)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + }); + }); + + describe('lerp', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.lerp(out, vecA, vecB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(2.5, 3.5, 4.5)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.lerp(vecA, vecA, vecB, 0.5); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(2.5, 3.5, 4.5)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec3.lerp(vecB, vecA, vecB, 0.5); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(2.5, 3.5, 4.5)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + }); + }); + + describe('angle', () => { + let value: number; + + beforeEach(() => { value = Vec3.angle(vecA, vecB); }); + + it('should return the angle', () => expect(value).toBeCloseTo(0.225726)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('str', () => { + it('should return a string representation of the vector', () => expect(Vec3.str(vecA)).toEqual('Vec3(1, 2, 3)')); + }); + + describe('exactEquals', () => { + let vecC: Vec3Like, r0: boolean, r1: boolean; + + beforeEach(() => { + vecA = [0, 1, 2]; + vecB = [0, 1, 2]; + vecC = [1, 2, 3]; + r0 = Vec3.exactEquals(vecA, vecB); + r1 = Vec3.exactEquals(vecA, vecC); + }); + + it('should return true for identical vectors', () => expect(r0).toBe(true)); + it('should return false for different vectors', () => expect(r1).toBe(false)); + it('should not modify vecA', () => expect(vecA).toBeVec(0, 1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(0, 1, 2)); + }); + + describe('equals', () => { + let vecC: Vec3Like, + vecD: Vec3Like, + r0: boolean, + r1: boolean, + r2: boolean; + + beforeEach(() => { + vecA = [0, 1, 2]; + vecB = [0, 1, 2]; + vecC = [1, 2, 3]; + vecD = [1e-16, 1, 2]; + r0 = Vec3.equals(vecA, vecB); + r1 = Vec3.equals(vecA, vecC); + r2 = Vec3.equals(vecA, vecD); + }); + + it('should return true for identical vectors', () => expect(r0).toBe(true)); + it('should return false for different vectors', () => expect(r1).toBe(false)); + it('should return true for close but not identical vectors', () => expect(r2).toBe(true)); + it('should not modify vecA', () => expect(vecA).toBeVec(0, 1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(0, 1, 2)); + }); + + describe('zero', () => { + beforeEach(() => { + vecA = [1, 2, 3]; + result = Vec3.zero(vecA); + }); + + it('should result in a 3 element vector with zeros', () => expect(result).toBeVec(0, 0, 0)); + }); + }); +}); diff --git a/tests/f32/Vec4-swizzle.spec.ts b/tests/f32/Vec4-swizzle.spec.ts new file mode 100644 index 00000000..f3161e54 --- /dev/null +++ b/tests/f32/Vec4-swizzle.spec.ts @@ -0,0 +1,6065 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Vec4 } from '#gl-matrix'; +import { EnableSwizzles } from '#gl-matrix/swizzle'; + +describe('Vec4 Swizzles', () => { + EnableSwizzles(); + + let v: Vec4; + beforeEach(() => { v = new Vec4(1, 2, 3); }); + + // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should + // not be modified by hand. + // [Swizzle Autogen] + + describe('Vec4().xx', () => { + it('should return Vec2(x, x)', () => expect(v.xx).toBeVec(v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xy', () => { + it('should return Vec2(x, y)', () => expect(v.xy).toBeVec(v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xz', () => { + it('should return Vec2(x, z)', () => expect(v.xz).toBeVec(v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xw', () => { + it('should return Vec2(x, w)', () => expect(v.xw).toBeVec(v[0], v[3])); + it('should be return a copy', () => { + const sw = v.xw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yx', () => { + it('should return Vec2(y, x)', () => expect(v.yx).toBeVec(v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yy', () => { + it('should return Vec2(y, y)', () => expect(v.yy).toBeVec(v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yz', () => { + it('should return Vec2(y, z)', () => expect(v.yz).toBeVec(v[1], v[2])); + it('should be return a copy', () => { + const sw = v.yz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yw', () => { + it('should return Vec2(y, w)', () => expect(v.yw).toBeVec(v[1], v[3])); + it('should be return a copy', () => { + const sw = v.yw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zx', () => { + it('should return Vec2(z, x)', () => expect(v.zx).toBeVec(v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zy', () => { + it('should return Vec2(z, y)', () => expect(v.zy).toBeVec(v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zz', () => { + it('should return Vec2(z, z)', () => expect(v.zz).toBeVec(v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zw', () => { + it('should return Vec2(z, w)', () => expect(v.zw).toBeVec(v[2], v[3])); + it('should be return a copy', () => { + const sw = v.zw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wx', () => { + it('should return Vec2(w, x)', () => expect(v.wx).toBeVec(v[3], v[0])); + it('should be return a copy', () => { + const sw = v.wx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wy', () => { + it('should return Vec2(w, y)', () => expect(v.wy).toBeVec(v[3], v[1])); + it('should be return a copy', () => { + const sw = v.wy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wz', () => { + it('should return Vec2(w, z)', () => expect(v.wz).toBeVec(v[3], v[2])); + it('should be return a copy', () => { + const sw = v.wz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ww', () => { + it('should return Vec2(w, w)', () => expect(v.ww).toBeVec(v[3], v[3])); + it('should be return a copy', () => { + const sw = v.ww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxx', () => { + it('should return Vec3(x, x, x)', () => expect(v.xxx).toBeVec(v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxy', () => { + it('should return Vec3(x, x, y)', () => expect(v.xxy).toBeVec(v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxz', () => { + it('should return Vec3(x, x, z)', () => expect(v.xxz).toBeVec(v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxw', () => { + it('should return Vec3(x, x, w)', () => expect(v.xxw).toBeVec(v[0], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.xxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyx', () => { + it('should return Vec3(x, y, x)', () => expect(v.xyx).toBeVec(v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyy', () => { + it('should return Vec3(x, y, y)', () => expect(v.xyy).toBeVec(v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyz', () => { + it('should return Vec3(x, y, z)', () => expect(v.xyz).toBeVec(v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.xyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyw', () => { + it('should return Vec3(x, y, w)', () => expect(v.xyw).toBeVec(v[0], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.xyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzx', () => { + it('should return Vec3(x, z, x)', () => expect(v.xzx).toBeVec(v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.xzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzy', () => { + it('should return Vec3(x, z, y)', () => expect(v.xzy).toBeVec(v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.xzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzz', () => { + it('should return Vec3(x, z, z)', () => expect(v.xzz).toBeVec(v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.xzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzw', () => { + it('should return Vec3(x, z, w)', () => expect(v.xzw).toBeVec(v[0], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.xzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwx', () => { + it('should return Vec3(x, w, x)', () => expect(v.xwx).toBeVec(v[0], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.xwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwy', () => { + it('should return Vec3(x, w, y)', () => expect(v.xwy).toBeVec(v[0], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.xwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwz', () => { + it('should return Vec3(x, w, z)', () => expect(v.xwz).toBeVec(v[0], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.xwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xww', () => { + it('should return Vec3(x, w, w)', () => expect(v.xww).toBeVec(v[0], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.xww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxx', () => { + it('should return Vec3(y, x, x)', () => expect(v.yxx).toBeVec(v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxy', () => { + it('should return Vec3(y, x, y)', () => expect(v.yxy).toBeVec(v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxz', () => { + it('should return Vec3(y, x, z)', () => expect(v.yxz).toBeVec(v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.yxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxw', () => { + it('should return Vec3(y, x, w)', () => expect(v.yxw).toBeVec(v[1], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.yxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyx', () => { + it('should return Vec3(y, y, x)', () => expect(v.yyx).toBeVec(v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyy', () => { + it('should return Vec3(y, y, y)', () => expect(v.yyy).toBeVec(v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyz', () => { + it('should return Vec3(y, y, z)', () => expect(v.yyz).toBeVec(v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.yyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyw', () => { + it('should return Vec3(y, y, w)', () => expect(v.yyw).toBeVec(v[1], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.yyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzx', () => { + it('should return Vec3(y, z, x)', () => expect(v.yzx).toBeVec(v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.yzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzy', () => { + it('should return Vec3(y, z, y)', () => expect(v.yzy).toBeVec(v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.yzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzz', () => { + it('should return Vec3(y, z, z)', () => expect(v.yzz).toBeVec(v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.yzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzw', () => { + it('should return Vec3(y, z, w)', () => expect(v.yzw).toBeVec(v[1], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.yzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywx', () => { + it('should return Vec3(y, w, x)', () => expect(v.ywx).toBeVec(v[1], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.ywx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywy', () => { + it('should return Vec3(y, w, y)', () => expect(v.ywy).toBeVec(v[1], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.ywy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywz', () => { + it('should return Vec3(y, w, z)', () => expect(v.ywz).toBeVec(v[1], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.ywz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yww', () => { + it('should return Vec3(y, w, w)', () => expect(v.yww).toBeVec(v[1], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.yww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxx', () => { + it('should return Vec3(z, x, x)', () => expect(v.zxx).toBeVec(v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.zxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxy', () => { + it('should return Vec3(z, x, y)', () => expect(v.zxy).toBeVec(v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.zxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxz', () => { + it('should return Vec3(z, x, z)', () => expect(v.zxz).toBeVec(v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.zxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxw', () => { + it('should return Vec3(z, x, w)', () => expect(v.zxw).toBeVec(v[2], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.zxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyx', () => { + it('should return Vec3(z, y, x)', () => expect(v.zyx).toBeVec(v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.zyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyy', () => { + it('should return Vec3(z, y, y)', () => expect(v.zyy).toBeVec(v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.zyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyz', () => { + it('should return Vec3(z, y, z)', () => expect(v.zyz).toBeVec(v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.zyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyw', () => { + it('should return Vec3(z, y, w)', () => expect(v.zyw).toBeVec(v[2], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.zyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzx', () => { + it('should return Vec3(z, z, x)', () => expect(v.zzx).toBeVec(v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzy', () => { + it('should return Vec3(z, z, y)', () => expect(v.zzy).toBeVec(v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzz', () => { + it('should return Vec3(z, z, z)', () => expect(v.zzz).toBeVec(v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzw', () => { + it('should return Vec3(z, z, w)', () => expect(v.zzw).toBeVec(v[2], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.zzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwx', () => { + it('should return Vec3(z, w, x)', () => expect(v.zwx).toBeVec(v[2], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.zwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwy', () => { + it('should return Vec3(z, w, y)', () => expect(v.zwy).toBeVec(v[2], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.zwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwz', () => { + it('should return Vec3(z, w, z)', () => expect(v.zwz).toBeVec(v[2], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.zwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zww', () => { + it('should return Vec3(z, w, w)', () => expect(v.zww).toBeVec(v[2], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.zww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxx', () => { + it('should return Vec3(w, x, x)', () => expect(v.wxx).toBeVec(v[3], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.wxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxy', () => { + it('should return Vec3(w, x, y)', () => expect(v.wxy).toBeVec(v[3], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.wxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxz', () => { + it('should return Vec3(w, x, z)', () => expect(v.wxz).toBeVec(v[3], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.wxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxw', () => { + it('should return Vec3(w, x, w)', () => expect(v.wxw).toBeVec(v[3], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.wxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyx', () => { + it('should return Vec3(w, y, x)', () => expect(v.wyx).toBeVec(v[3], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.wyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyy', () => { + it('should return Vec3(w, y, y)', () => expect(v.wyy).toBeVec(v[3], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.wyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyz', () => { + it('should return Vec3(w, y, z)', () => expect(v.wyz).toBeVec(v[3], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.wyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyw', () => { + it('should return Vec3(w, y, w)', () => expect(v.wyw).toBeVec(v[3], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.wyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzx', () => { + it('should return Vec3(w, z, x)', () => expect(v.wzx).toBeVec(v[3], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.wzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzy', () => { + it('should return Vec3(w, z, y)', () => expect(v.wzy).toBeVec(v[3], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.wzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzz', () => { + it('should return Vec3(w, z, z)', () => expect(v.wzz).toBeVec(v[3], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.wzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzw', () => { + it('should return Vec3(w, z, w)', () => expect(v.wzw).toBeVec(v[3], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.wzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwx', () => { + it('should return Vec3(w, w, x)', () => expect(v.wwx).toBeVec(v[3], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.wwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwy', () => { + it('should return Vec3(w, w, y)', () => expect(v.wwy).toBeVec(v[3], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.wwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwz', () => { + it('should return Vec3(w, w, z)', () => expect(v.wwz).toBeVec(v[3], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.wwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().www', () => { + it('should return Vec3(w, w, w)', () => expect(v.www).toBeVec(v[3], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.www; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxxx', () => { + it('should return Vec4(x, x, x, x)', () => expect(v.xxxx).toBeVec(v[0], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xxxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxxy', () => { + it('should return Vec4(x, x, x, y)', () => expect(v.xxxy).toBeVec(v[0], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xxxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxxz', () => { + it('should return Vec4(x, x, x, z)', () => expect(v.xxxz).toBeVec(v[0], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xxxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxxw', () => { + it('should return Vec4(x, x, x, w)', () => expect(v.xxxw).toBeVec(v[0], v[0], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.xxxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxyx', () => { + it('should return Vec4(x, x, y, x)', () => expect(v.xxyx).toBeVec(v[0], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xxyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxyy', () => { + it('should return Vec4(x, x, y, y)', () => expect(v.xxyy).toBeVec(v[0], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xxyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxyz', () => { + it('should return Vec4(x, x, y, z)', () => expect(v.xxyz).toBeVec(v[0], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.xxyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxyw', () => { + it('should return Vec4(x, x, y, w)', () => expect(v.xxyw).toBeVec(v[0], v[0], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.xxyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxzx', () => { + it('should return Vec4(x, x, z, x)', () => expect(v.xxzx).toBeVec(v[0], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.xxzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxzy', () => { + it('should return Vec4(x, x, z, y)', () => expect(v.xxzy).toBeVec(v[0], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.xxzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxzz', () => { + it('should return Vec4(x, x, z, z)', () => expect(v.xxzz).toBeVec(v[0], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.xxzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxzw', () => { + it('should return Vec4(x, x, z, w)', () => expect(v.xxzw).toBeVec(v[0], v[0], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.xxzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxwx', () => { + it('should return Vec4(x, x, w, x)', () => expect(v.xxwx).toBeVec(v[0], v[0], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.xxwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxwy', () => { + it('should return Vec4(x, x, w, y)', () => expect(v.xxwy).toBeVec(v[0], v[0], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.xxwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxwz', () => { + it('should return Vec4(x, x, w, z)', () => expect(v.xxwz).toBeVec(v[0], v[0], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.xxwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxww', () => { + it('should return Vec4(x, x, w, w)', () => expect(v.xxww).toBeVec(v[0], v[0], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.xxww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyxx', () => { + it('should return Vec4(x, y, x, x)', () => expect(v.xyxx).toBeVec(v[0], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xyxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyxy', () => { + it('should return Vec4(x, y, x, y)', () => expect(v.xyxy).toBeVec(v[0], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xyxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyxz', () => { + it('should return Vec4(x, y, x, z)', () => expect(v.xyxz).toBeVec(v[0], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xyxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyxw', () => { + it('should return Vec4(x, y, x, w)', () => expect(v.xyxw).toBeVec(v[0], v[1], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.xyxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyyx', () => { + it('should return Vec4(x, y, y, x)', () => expect(v.xyyx).toBeVec(v[0], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xyyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyyy', () => { + it('should return Vec4(x, y, y, y)', () => expect(v.xyyy).toBeVec(v[0], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xyyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyyz', () => { + it('should return Vec4(x, y, y, z)', () => expect(v.xyyz).toBeVec(v[0], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.xyyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyyw', () => { + it('should return Vec4(x, y, y, w)', () => expect(v.xyyw).toBeVec(v[0], v[1], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.xyyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyzx', () => { + it('should return Vec4(x, y, z, x)', () => expect(v.xyzx).toBeVec(v[0], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.xyzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyzy', () => { + it('should return Vec4(x, y, z, y)', () => expect(v.xyzy).toBeVec(v[0], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.xyzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyzz', () => { + it('should return Vec4(x, y, z, z)', () => expect(v.xyzz).toBeVec(v[0], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.xyzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyzw', () => { + it('should return Vec4(x, y, z, w)', () => expect(v.xyzw).toBeVec(v[0], v[1], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.xyzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xywx', () => { + it('should return Vec4(x, y, w, x)', () => expect(v.xywx).toBeVec(v[0], v[1], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.xywx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xywy', () => { + it('should return Vec4(x, y, w, y)', () => expect(v.xywy).toBeVec(v[0], v[1], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.xywy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xywz', () => { + it('should return Vec4(x, y, w, z)', () => expect(v.xywz).toBeVec(v[0], v[1], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.xywz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyww', () => { + it('should return Vec4(x, y, w, w)', () => expect(v.xyww).toBeVec(v[0], v[1], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.xyww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzxx', () => { + it('should return Vec4(x, z, x, x)', () => expect(v.xzxx).toBeVec(v[0], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xzxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzxy', () => { + it('should return Vec4(x, z, x, y)', () => expect(v.xzxy).toBeVec(v[0], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xzxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzxz', () => { + it('should return Vec4(x, z, x, z)', () => expect(v.xzxz).toBeVec(v[0], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xzxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzxw', () => { + it('should return Vec4(x, z, x, w)', () => expect(v.xzxw).toBeVec(v[0], v[2], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.xzxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzyx', () => { + it('should return Vec4(x, z, y, x)', () => expect(v.xzyx).toBeVec(v[0], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xzyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzyy', () => { + it('should return Vec4(x, z, y, y)', () => expect(v.xzyy).toBeVec(v[0], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xzyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzyz', () => { + it('should return Vec4(x, z, y, z)', () => expect(v.xzyz).toBeVec(v[0], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.xzyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzyw', () => { + it('should return Vec4(x, z, y, w)', () => expect(v.xzyw).toBeVec(v[0], v[2], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.xzyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzzx', () => { + it('should return Vec4(x, z, z, x)', () => expect(v.xzzx).toBeVec(v[0], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.xzzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzzy', () => { + it('should return Vec4(x, z, z, y)', () => expect(v.xzzy).toBeVec(v[0], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.xzzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzzz', () => { + it('should return Vec4(x, z, z, z)', () => expect(v.xzzz).toBeVec(v[0], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.xzzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzzw', () => { + it('should return Vec4(x, z, z, w)', () => expect(v.xzzw).toBeVec(v[0], v[2], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.xzzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzwx', () => { + it('should return Vec4(x, z, w, x)', () => expect(v.xzwx).toBeVec(v[0], v[2], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.xzwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzwy', () => { + it('should return Vec4(x, z, w, y)', () => expect(v.xzwy).toBeVec(v[0], v[2], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.xzwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzwz', () => { + it('should return Vec4(x, z, w, z)', () => expect(v.xzwz).toBeVec(v[0], v[2], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.xzwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzww', () => { + it('should return Vec4(x, z, w, w)', () => expect(v.xzww).toBeVec(v[0], v[2], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.xzww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwxx', () => { + it('should return Vec4(x, w, x, x)', () => expect(v.xwxx).toBeVec(v[0], v[3], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xwxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwxy', () => { + it('should return Vec4(x, w, x, y)', () => expect(v.xwxy).toBeVec(v[0], v[3], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xwxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwxz', () => { + it('should return Vec4(x, w, x, z)', () => expect(v.xwxz).toBeVec(v[0], v[3], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xwxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwxw', () => { + it('should return Vec4(x, w, x, w)', () => expect(v.xwxw).toBeVec(v[0], v[3], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.xwxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwyx', () => { + it('should return Vec4(x, w, y, x)', () => expect(v.xwyx).toBeVec(v[0], v[3], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xwyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwyy', () => { + it('should return Vec4(x, w, y, y)', () => expect(v.xwyy).toBeVec(v[0], v[3], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xwyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwyz', () => { + it('should return Vec4(x, w, y, z)', () => expect(v.xwyz).toBeVec(v[0], v[3], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.xwyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwyw', () => { + it('should return Vec4(x, w, y, w)', () => expect(v.xwyw).toBeVec(v[0], v[3], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.xwyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwzx', () => { + it('should return Vec4(x, w, z, x)', () => expect(v.xwzx).toBeVec(v[0], v[3], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.xwzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwzy', () => { + it('should return Vec4(x, w, z, y)', () => expect(v.xwzy).toBeVec(v[0], v[3], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.xwzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwzz', () => { + it('should return Vec4(x, w, z, z)', () => expect(v.xwzz).toBeVec(v[0], v[3], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.xwzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwzw', () => { + it('should return Vec4(x, w, z, w)', () => expect(v.xwzw).toBeVec(v[0], v[3], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.xwzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwwx', () => { + it('should return Vec4(x, w, w, x)', () => expect(v.xwwx).toBeVec(v[0], v[3], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.xwwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwwy', () => { + it('should return Vec4(x, w, w, y)', () => expect(v.xwwy).toBeVec(v[0], v[3], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.xwwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwwz', () => { + it('should return Vec4(x, w, w, z)', () => expect(v.xwwz).toBeVec(v[0], v[3], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.xwwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwww', () => { + it('should return Vec4(x, w, w, w)', () => expect(v.xwww).toBeVec(v[0], v[3], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.xwww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxxx', () => { + it('should return Vec4(y, x, x, x)', () => expect(v.yxxx).toBeVec(v[1], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yxxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxxy', () => { + it('should return Vec4(y, x, x, y)', () => expect(v.yxxy).toBeVec(v[1], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yxxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxxz', () => { + it('should return Vec4(y, x, x, z)', () => expect(v.yxxz).toBeVec(v[1], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.yxxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxxw', () => { + it('should return Vec4(y, x, x, w)', () => expect(v.yxxw).toBeVec(v[1], v[0], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.yxxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxyx', () => { + it('should return Vec4(y, x, y, x)', () => expect(v.yxyx).toBeVec(v[1], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yxyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxyy', () => { + it('should return Vec4(y, x, y, y)', () => expect(v.yxyy).toBeVec(v[1], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yxyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxyz', () => { + it('should return Vec4(y, x, y, z)', () => expect(v.yxyz).toBeVec(v[1], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.yxyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxyw', () => { + it('should return Vec4(y, x, y, w)', () => expect(v.yxyw).toBeVec(v[1], v[0], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.yxyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxzx', () => { + it('should return Vec4(y, x, z, x)', () => expect(v.yxzx).toBeVec(v[1], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.yxzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxzy', () => { + it('should return Vec4(y, x, z, y)', () => expect(v.yxzy).toBeVec(v[1], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.yxzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxzz', () => { + it('should return Vec4(y, x, z, z)', () => expect(v.yxzz).toBeVec(v[1], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.yxzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxzw', () => { + it('should return Vec4(y, x, z, w)', () => expect(v.yxzw).toBeVec(v[1], v[0], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.yxzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxwx', () => { + it('should return Vec4(y, x, w, x)', () => expect(v.yxwx).toBeVec(v[1], v[0], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.yxwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxwy', () => { + it('should return Vec4(y, x, w, y)', () => expect(v.yxwy).toBeVec(v[1], v[0], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.yxwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxwz', () => { + it('should return Vec4(y, x, w, z)', () => expect(v.yxwz).toBeVec(v[1], v[0], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.yxwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxww', () => { + it('should return Vec4(y, x, w, w)', () => expect(v.yxww).toBeVec(v[1], v[0], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.yxww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyxx', () => { + it('should return Vec4(y, y, x, x)', () => expect(v.yyxx).toBeVec(v[1], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yyxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyxy', () => { + it('should return Vec4(y, y, x, y)', () => expect(v.yyxy).toBeVec(v[1], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yyxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyxz', () => { + it('should return Vec4(y, y, x, z)', () => expect(v.yyxz).toBeVec(v[1], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.yyxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyxw', () => { + it('should return Vec4(y, y, x, w)', () => expect(v.yyxw).toBeVec(v[1], v[1], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.yyxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyyx', () => { + it('should return Vec4(y, y, y, x)', () => expect(v.yyyx).toBeVec(v[1], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yyyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyyy', () => { + it('should return Vec4(y, y, y, y)', () => expect(v.yyyy).toBeVec(v[1], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yyyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyyz', () => { + it('should return Vec4(y, y, y, z)', () => expect(v.yyyz).toBeVec(v[1], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.yyyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyyw', () => { + it('should return Vec4(y, y, y, w)', () => expect(v.yyyw).toBeVec(v[1], v[1], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.yyyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyzx', () => { + it('should return Vec4(y, y, z, x)', () => expect(v.yyzx).toBeVec(v[1], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.yyzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyzy', () => { + it('should return Vec4(y, y, z, y)', () => expect(v.yyzy).toBeVec(v[1], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.yyzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyzz', () => { + it('should return Vec4(y, y, z, z)', () => expect(v.yyzz).toBeVec(v[1], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.yyzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyzw', () => { + it('should return Vec4(y, y, z, w)', () => expect(v.yyzw).toBeVec(v[1], v[1], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.yyzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yywx', () => { + it('should return Vec4(y, y, w, x)', () => expect(v.yywx).toBeVec(v[1], v[1], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.yywx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yywy', () => { + it('should return Vec4(y, y, w, y)', () => expect(v.yywy).toBeVec(v[1], v[1], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.yywy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yywz', () => { + it('should return Vec4(y, y, w, z)', () => expect(v.yywz).toBeVec(v[1], v[1], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.yywz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyww', () => { + it('should return Vec4(y, y, w, w)', () => expect(v.yyww).toBeVec(v[1], v[1], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.yyww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzxx', () => { + it('should return Vec4(y, z, x, x)', () => expect(v.yzxx).toBeVec(v[1], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yzxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzxy', () => { + it('should return Vec4(y, z, x, y)', () => expect(v.yzxy).toBeVec(v[1], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yzxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzxz', () => { + it('should return Vec4(y, z, x, z)', () => expect(v.yzxz).toBeVec(v[1], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.yzxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzxw', () => { + it('should return Vec4(y, z, x, w)', () => expect(v.yzxw).toBeVec(v[1], v[2], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.yzxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzyx', () => { + it('should return Vec4(y, z, y, x)', () => expect(v.yzyx).toBeVec(v[1], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yzyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzyy', () => { + it('should return Vec4(y, z, y, y)', () => expect(v.yzyy).toBeVec(v[1], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yzyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzyz', () => { + it('should return Vec4(y, z, y, z)', () => expect(v.yzyz).toBeVec(v[1], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.yzyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzyw', () => { + it('should return Vec4(y, z, y, w)', () => expect(v.yzyw).toBeVec(v[1], v[2], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.yzyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzzx', () => { + it('should return Vec4(y, z, z, x)', () => expect(v.yzzx).toBeVec(v[1], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.yzzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzzy', () => { + it('should return Vec4(y, z, z, y)', () => expect(v.yzzy).toBeVec(v[1], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.yzzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzzz', () => { + it('should return Vec4(y, z, z, z)', () => expect(v.yzzz).toBeVec(v[1], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.yzzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzzw', () => { + it('should return Vec4(y, z, z, w)', () => expect(v.yzzw).toBeVec(v[1], v[2], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.yzzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzwx', () => { + it('should return Vec4(y, z, w, x)', () => expect(v.yzwx).toBeVec(v[1], v[2], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.yzwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzwy', () => { + it('should return Vec4(y, z, w, y)', () => expect(v.yzwy).toBeVec(v[1], v[2], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.yzwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzwz', () => { + it('should return Vec4(y, z, w, z)', () => expect(v.yzwz).toBeVec(v[1], v[2], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.yzwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzww', () => { + it('should return Vec4(y, z, w, w)', () => expect(v.yzww).toBeVec(v[1], v[2], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.yzww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywxx', () => { + it('should return Vec4(y, w, x, x)', () => expect(v.ywxx).toBeVec(v[1], v[3], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.ywxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywxy', () => { + it('should return Vec4(y, w, x, y)', () => expect(v.ywxy).toBeVec(v[1], v[3], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.ywxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywxz', () => { + it('should return Vec4(y, w, x, z)', () => expect(v.ywxz).toBeVec(v[1], v[3], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.ywxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywxw', () => { + it('should return Vec4(y, w, x, w)', () => expect(v.ywxw).toBeVec(v[1], v[3], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.ywxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywyx', () => { + it('should return Vec4(y, w, y, x)', () => expect(v.ywyx).toBeVec(v[1], v[3], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.ywyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywyy', () => { + it('should return Vec4(y, w, y, y)', () => expect(v.ywyy).toBeVec(v[1], v[3], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.ywyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywyz', () => { + it('should return Vec4(y, w, y, z)', () => expect(v.ywyz).toBeVec(v[1], v[3], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.ywyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywyw', () => { + it('should return Vec4(y, w, y, w)', () => expect(v.ywyw).toBeVec(v[1], v[3], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.ywyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywzx', () => { + it('should return Vec4(y, w, z, x)', () => expect(v.ywzx).toBeVec(v[1], v[3], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.ywzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywzy', () => { + it('should return Vec4(y, w, z, y)', () => expect(v.ywzy).toBeVec(v[1], v[3], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.ywzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywzz', () => { + it('should return Vec4(y, w, z, z)', () => expect(v.ywzz).toBeVec(v[1], v[3], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.ywzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywzw', () => { + it('should return Vec4(y, w, z, w)', () => expect(v.ywzw).toBeVec(v[1], v[3], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.ywzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywwx', () => { + it('should return Vec4(y, w, w, x)', () => expect(v.ywwx).toBeVec(v[1], v[3], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.ywwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywwy', () => { + it('should return Vec4(y, w, w, y)', () => expect(v.ywwy).toBeVec(v[1], v[3], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.ywwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywwz', () => { + it('should return Vec4(y, w, w, z)', () => expect(v.ywwz).toBeVec(v[1], v[3], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.ywwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywww', () => { + it('should return Vec4(y, w, w, w)', () => expect(v.ywww).toBeVec(v[1], v[3], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.ywww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxxx', () => { + it('should return Vec4(z, x, x, x)', () => expect(v.zxxx).toBeVec(v[2], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.zxxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxxy', () => { + it('should return Vec4(z, x, x, y)', () => expect(v.zxxy).toBeVec(v[2], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.zxxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxxz', () => { + it('should return Vec4(z, x, x, z)', () => expect(v.zxxz).toBeVec(v[2], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.zxxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxxw', () => { + it('should return Vec4(z, x, x, w)', () => expect(v.zxxw).toBeVec(v[2], v[0], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.zxxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxyx', () => { + it('should return Vec4(z, x, y, x)', () => expect(v.zxyx).toBeVec(v[2], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.zxyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxyy', () => { + it('should return Vec4(z, x, y, y)', () => expect(v.zxyy).toBeVec(v[2], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.zxyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxyz', () => { + it('should return Vec4(z, x, y, z)', () => expect(v.zxyz).toBeVec(v[2], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.zxyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxyw', () => { + it('should return Vec4(z, x, y, w)', () => expect(v.zxyw).toBeVec(v[2], v[0], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.zxyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxzx', () => { + it('should return Vec4(z, x, z, x)', () => expect(v.zxzx).toBeVec(v[2], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zxzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxzy', () => { + it('should return Vec4(z, x, z, y)', () => expect(v.zxzy).toBeVec(v[2], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zxzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxzz', () => { + it('should return Vec4(z, x, z, z)', () => expect(v.zxzz).toBeVec(v[2], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zxzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxzw', () => { + it('should return Vec4(z, x, z, w)', () => expect(v.zxzw).toBeVec(v[2], v[0], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.zxzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxwx', () => { + it('should return Vec4(z, x, w, x)', () => expect(v.zxwx).toBeVec(v[2], v[0], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.zxwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxwy', () => { + it('should return Vec4(z, x, w, y)', () => expect(v.zxwy).toBeVec(v[2], v[0], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.zxwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxwz', () => { + it('should return Vec4(z, x, w, z)', () => expect(v.zxwz).toBeVec(v[2], v[0], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.zxwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxww', () => { + it('should return Vec4(z, x, w, w)', () => expect(v.zxww).toBeVec(v[2], v[0], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.zxww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyxx', () => { + it('should return Vec4(z, y, x, x)', () => expect(v.zyxx).toBeVec(v[2], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.zyxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyxy', () => { + it('should return Vec4(z, y, x, y)', () => expect(v.zyxy).toBeVec(v[2], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.zyxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyxz', () => { + it('should return Vec4(z, y, x, z)', () => expect(v.zyxz).toBeVec(v[2], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.zyxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyxw', () => { + it('should return Vec4(z, y, x, w)', () => expect(v.zyxw).toBeVec(v[2], v[1], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.zyxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyyx', () => { + it('should return Vec4(z, y, y, x)', () => expect(v.zyyx).toBeVec(v[2], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.zyyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyyy', () => { + it('should return Vec4(z, y, y, y)', () => expect(v.zyyy).toBeVec(v[2], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.zyyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyyz', () => { + it('should return Vec4(z, y, y, z)', () => expect(v.zyyz).toBeVec(v[2], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.zyyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyyw', () => { + it('should return Vec4(z, y, y, w)', () => expect(v.zyyw).toBeVec(v[2], v[1], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.zyyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyzx', () => { + it('should return Vec4(z, y, z, x)', () => expect(v.zyzx).toBeVec(v[2], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zyzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyzy', () => { + it('should return Vec4(z, y, z, y)', () => expect(v.zyzy).toBeVec(v[2], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zyzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyzz', () => { + it('should return Vec4(z, y, z, z)', () => expect(v.zyzz).toBeVec(v[2], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zyzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyzw', () => { + it('should return Vec4(z, y, z, w)', () => expect(v.zyzw).toBeVec(v[2], v[1], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.zyzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zywx', () => { + it('should return Vec4(z, y, w, x)', () => expect(v.zywx).toBeVec(v[2], v[1], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.zywx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zywy', () => { + it('should return Vec4(z, y, w, y)', () => expect(v.zywy).toBeVec(v[2], v[1], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.zywy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zywz', () => { + it('should return Vec4(z, y, w, z)', () => expect(v.zywz).toBeVec(v[2], v[1], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.zywz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyww', () => { + it('should return Vec4(z, y, w, w)', () => expect(v.zyww).toBeVec(v[2], v[1], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.zyww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzxx', () => { + it('should return Vec4(z, z, x, x)', () => expect(v.zzxx).toBeVec(v[2], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.zzxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzxy', () => { + it('should return Vec4(z, z, x, y)', () => expect(v.zzxy).toBeVec(v[2], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.zzxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzxz', () => { + it('should return Vec4(z, z, x, z)', () => expect(v.zzxz).toBeVec(v[2], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.zzxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzxw', () => { + it('should return Vec4(z, z, x, w)', () => expect(v.zzxw).toBeVec(v[2], v[2], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.zzxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzyx', () => { + it('should return Vec4(z, z, y, x)', () => expect(v.zzyx).toBeVec(v[2], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.zzyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzyy', () => { + it('should return Vec4(z, z, y, y)', () => expect(v.zzyy).toBeVec(v[2], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.zzyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzyz', () => { + it('should return Vec4(z, z, y, z)', () => expect(v.zzyz).toBeVec(v[2], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.zzyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzyw', () => { + it('should return Vec4(z, z, y, w)', () => expect(v.zzyw).toBeVec(v[2], v[2], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.zzyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzzx', () => { + it('should return Vec4(z, z, z, x)', () => expect(v.zzzx).toBeVec(v[2], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zzzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzzy', () => { + it('should return Vec4(z, z, z, y)', () => expect(v.zzzy).toBeVec(v[2], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zzzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzzz', () => { + it('should return Vec4(z, z, z, z)', () => expect(v.zzzz).toBeVec(v[2], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zzzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzzw', () => { + it('should return Vec4(z, z, z, w)', () => expect(v.zzzw).toBeVec(v[2], v[2], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.zzzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzwx', () => { + it('should return Vec4(z, z, w, x)', () => expect(v.zzwx).toBeVec(v[2], v[2], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.zzwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzwy', () => { + it('should return Vec4(z, z, w, y)', () => expect(v.zzwy).toBeVec(v[2], v[2], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.zzwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzwz', () => { + it('should return Vec4(z, z, w, z)', () => expect(v.zzwz).toBeVec(v[2], v[2], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.zzwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzww', () => { + it('should return Vec4(z, z, w, w)', () => expect(v.zzww).toBeVec(v[2], v[2], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.zzww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwxx', () => { + it('should return Vec4(z, w, x, x)', () => expect(v.zwxx).toBeVec(v[2], v[3], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.zwxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwxy', () => { + it('should return Vec4(z, w, x, y)', () => expect(v.zwxy).toBeVec(v[2], v[3], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.zwxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwxz', () => { + it('should return Vec4(z, w, x, z)', () => expect(v.zwxz).toBeVec(v[2], v[3], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.zwxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwxw', () => { + it('should return Vec4(z, w, x, w)', () => expect(v.zwxw).toBeVec(v[2], v[3], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.zwxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwyx', () => { + it('should return Vec4(z, w, y, x)', () => expect(v.zwyx).toBeVec(v[2], v[3], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.zwyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwyy', () => { + it('should return Vec4(z, w, y, y)', () => expect(v.zwyy).toBeVec(v[2], v[3], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.zwyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwyz', () => { + it('should return Vec4(z, w, y, z)', () => expect(v.zwyz).toBeVec(v[2], v[3], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.zwyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwyw', () => { + it('should return Vec4(z, w, y, w)', () => expect(v.zwyw).toBeVec(v[2], v[3], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.zwyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwzx', () => { + it('should return Vec4(z, w, z, x)', () => expect(v.zwzx).toBeVec(v[2], v[3], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zwzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwzy', () => { + it('should return Vec4(z, w, z, y)', () => expect(v.zwzy).toBeVec(v[2], v[3], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zwzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwzz', () => { + it('should return Vec4(z, w, z, z)', () => expect(v.zwzz).toBeVec(v[2], v[3], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zwzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwzw', () => { + it('should return Vec4(z, w, z, w)', () => expect(v.zwzw).toBeVec(v[2], v[3], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.zwzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwwx', () => { + it('should return Vec4(z, w, w, x)', () => expect(v.zwwx).toBeVec(v[2], v[3], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.zwwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwwy', () => { + it('should return Vec4(z, w, w, y)', () => expect(v.zwwy).toBeVec(v[2], v[3], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.zwwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwwz', () => { + it('should return Vec4(z, w, w, z)', () => expect(v.zwwz).toBeVec(v[2], v[3], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.zwwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwww', () => { + it('should return Vec4(z, w, w, w)', () => expect(v.zwww).toBeVec(v[2], v[3], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.zwww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxxx', () => { + it('should return Vec4(w, x, x, x)', () => expect(v.wxxx).toBeVec(v[3], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.wxxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxxy', () => { + it('should return Vec4(w, x, x, y)', () => expect(v.wxxy).toBeVec(v[3], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.wxxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxxz', () => { + it('should return Vec4(w, x, x, z)', () => expect(v.wxxz).toBeVec(v[3], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.wxxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxxw', () => { + it('should return Vec4(w, x, x, w)', () => expect(v.wxxw).toBeVec(v[3], v[0], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.wxxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxyx', () => { + it('should return Vec4(w, x, y, x)', () => expect(v.wxyx).toBeVec(v[3], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.wxyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxyy', () => { + it('should return Vec4(w, x, y, y)', () => expect(v.wxyy).toBeVec(v[3], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.wxyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxyz', () => { + it('should return Vec4(w, x, y, z)', () => expect(v.wxyz).toBeVec(v[3], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.wxyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxyw', () => { + it('should return Vec4(w, x, y, w)', () => expect(v.wxyw).toBeVec(v[3], v[0], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.wxyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxzx', () => { + it('should return Vec4(w, x, z, x)', () => expect(v.wxzx).toBeVec(v[3], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.wxzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxzy', () => { + it('should return Vec4(w, x, z, y)', () => expect(v.wxzy).toBeVec(v[3], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.wxzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxzz', () => { + it('should return Vec4(w, x, z, z)', () => expect(v.wxzz).toBeVec(v[3], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.wxzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxzw', () => { + it('should return Vec4(w, x, z, w)', () => expect(v.wxzw).toBeVec(v[3], v[0], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.wxzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxwx', () => { + it('should return Vec4(w, x, w, x)', () => expect(v.wxwx).toBeVec(v[3], v[0], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.wxwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxwy', () => { + it('should return Vec4(w, x, w, y)', () => expect(v.wxwy).toBeVec(v[3], v[0], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.wxwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxwz', () => { + it('should return Vec4(w, x, w, z)', () => expect(v.wxwz).toBeVec(v[3], v[0], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.wxwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxww', () => { + it('should return Vec4(w, x, w, w)', () => expect(v.wxww).toBeVec(v[3], v[0], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.wxww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyxx', () => { + it('should return Vec4(w, y, x, x)', () => expect(v.wyxx).toBeVec(v[3], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.wyxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyxy', () => { + it('should return Vec4(w, y, x, y)', () => expect(v.wyxy).toBeVec(v[3], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.wyxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyxz', () => { + it('should return Vec4(w, y, x, z)', () => expect(v.wyxz).toBeVec(v[3], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.wyxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyxw', () => { + it('should return Vec4(w, y, x, w)', () => expect(v.wyxw).toBeVec(v[3], v[1], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.wyxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyyx', () => { + it('should return Vec4(w, y, y, x)', () => expect(v.wyyx).toBeVec(v[3], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.wyyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyyy', () => { + it('should return Vec4(w, y, y, y)', () => expect(v.wyyy).toBeVec(v[3], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.wyyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyyz', () => { + it('should return Vec4(w, y, y, z)', () => expect(v.wyyz).toBeVec(v[3], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.wyyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyyw', () => { + it('should return Vec4(w, y, y, w)', () => expect(v.wyyw).toBeVec(v[3], v[1], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.wyyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyzx', () => { + it('should return Vec4(w, y, z, x)', () => expect(v.wyzx).toBeVec(v[3], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.wyzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyzy', () => { + it('should return Vec4(w, y, z, y)', () => expect(v.wyzy).toBeVec(v[3], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.wyzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyzz', () => { + it('should return Vec4(w, y, z, z)', () => expect(v.wyzz).toBeVec(v[3], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.wyzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyzw', () => { + it('should return Vec4(w, y, z, w)', () => expect(v.wyzw).toBeVec(v[3], v[1], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.wyzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wywx', () => { + it('should return Vec4(w, y, w, x)', () => expect(v.wywx).toBeVec(v[3], v[1], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.wywx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wywy', () => { + it('should return Vec4(w, y, w, y)', () => expect(v.wywy).toBeVec(v[3], v[1], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.wywy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wywz', () => { + it('should return Vec4(w, y, w, z)', () => expect(v.wywz).toBeVec(v[3], v[1], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.wywz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyww', () => { + it('should return Vec4(w, y, w, w)', () => expect(v.wyww).toBeVec(v[3], v[1], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.wyww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzxx', () => { + it('should return Vec4(w, z, x, x)', () => expect(v.wzxx).toBeVec(v[3], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.wzxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzxy', () => { + it('should return Vec4(w, z, x, y)', () => expect(v.wzxy).toBeVec(v[3], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.wzxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzxz', () => { + it('should return Vec4(w, z, x, z)', () => expect(v.wzxz).toBeVec(v[3], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.wzxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzxw', () => { + it('should return Vec4(w, z, x, w)', () => expect(v.wzxw).toBeVec(v[3], v[2], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.wzxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzyx', () => { + it('should return Vec4(w, z, y, x)', () => expect(v.wzyx).toBeVec(v[3], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.wzyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzyy', () => { + it('should return Vec4(w, z, y, y)', () => expect(v.wzyy).toBeVec(v[3], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.wzyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzyz', () => { + it('should return Vec4(w, z, y, z)', () => expect(v.wzyz).toBeVec(v[3], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.wzyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzyw', () => { + it('should return Vec4(w, z, y, w)', () => expect(v.wzyw).toBeVec(v[3], v[2], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.wzyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzzx', () => { + it('should return Vec4(w, z, z, x)', () => expect(v.wzzx).toBeVec(v[3], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.wzzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzzy', () => { + it('should return Vec4(w, z, z, y)', () => expect(v.wzzy).toBeVec(v[3], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.wzzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzzz', () => { + it('should return Vec4(w, z, z, z)', () => expect(v.wzzz).toBeVec(v[3], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.wzzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzzw', () => { + it('should return Vec4(w, z, z, w)', () => expect(v.wzzw).toBeVec(v[3], v[2], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.wzzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzwx', () => { + it('should return Vec4(w, z, w, x)', () => expect(v.wzwx).toBeVec(v[3], v[2], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.wzwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzwy', () => { + it('should return Vec4(w, z, w, y)', () => expect(v.wzwy).toBeVec(v[3], v[2], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.wzwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzwz', () => { + it('should return Vec4(w, z, w, z)', () => expect(v.wzwz).toBeVec(v[3], v[2], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.wzwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzww', () => { + it('should return Vec4(w, z, w, w)', () => expect(v.wzww).toBeVec(v[3], v[2], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.wzww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwxx', () => { + it('should return Vec4(w, w, x, x)', () => expect(v.wwxx).toBeVec(v[3], v[3], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.wwxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwxy', () => { + it('should return Vec4(w, w, x, y)', () => expect(v.wwxy).toBeVec(v[3], v[3], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.wwxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwxz', () => { + it('should return Vec4(w, w, x, z)', () => expect(v.wwxz).toBeVec(v[3], v[3], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.wwxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwxw', () => { + it('should return Vec4(w, w, x, w)', () => expect(v.wwxw).toBeVec(v[3], v[3], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.wwxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwyx', () => { + it('should return Vec4(w, w, y, x)', () => expect(v.wwyx).toBeVec(v[3], v[3], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.wwyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwyy', () => { + it('should return Vec4(w, w, y, y)', () => expect(v.wwyy).toBeVec(v[3], v[3], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.wwyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwyz', () => { + it('should return Vec4(w, w, y, z)', () => expect(v.wwyz).toBeVec(v[3], v[3], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.wwyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwyw', () => { + it('should return Vec4(w, w, y, w)', () => expect(v.wwyw).toBeVec(v[3], v[3], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.wwyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwzx', () => { + it('should return Vec4(w, w, z, x)', () => expect(v.wwzx).toBeVec(v[3], v[3], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.wwzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwzy', () => { + it('should return Vec4(w, w, z, y)', () => expect(v.wwzy).toBeVec(v[3], v[3], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.wwzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwzz', () => { + it('should return Vec4(w, w, z, z)', () => expect(v.wwzz).toBeVec(v[3], v[3], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.wwzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwzw', () => { + it('should return Vec4(w, w, z, w)', () => expect(v.wwzw).toBeVec(v[3], v[3], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.wwzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwwx', () => { + it('should return Vec4(w, w, w, x)', () => expect(v.wwwx).toBeVec(v[3], v[3], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.wwwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwwy', () => { + it('should return Vec4(w, w, w, y)', () => expect(v.wwwy).toBeVec(v[3], v[3], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.wwwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwwz', () => { + it('should return Vec4(w, w, w, z)', () => expect(v.wwwz).toBeVec(v[3], v[3], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.wwwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwww', () => { + it('should return Vec4(w, w, w, w)', () => expect(v.wwww).toBeVec(v[3], v[3], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.wwww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rr', () => { + it('should return Vec2(r, r)', () => expect(v.rr).toBeVec(v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rg', () => { + it('should return Vec2(r, g)', () => expect(v.rg).toBeVec(v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rb', () => { + it('should return Vec2(r, b)', () => expect(v.rb).toBeVec(v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ra', () => { + it('should return Vec2(r, a)', () => expect(v.ra).toBeVec(v[0], v[3])); + it('should be return a copy', () => { + const sw = v.ra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gr', () => { + it('should return Vec2(g, r)', () => expect(v.gr).toBeVec(v[1], v[0])); + it('should be return a copy', () => { + const sw = v.gr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gg', () => { + it('should return Vec2(g, g)', () => expect(v.gg).toBeVec(v[1], v[1])); + it('should be return a copy', () => { + const sw = v.gg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gb', () => { + it('should return Vec2(g, b)', () => expect(v.gb).toBeVec(v[1], v[2])); + it('should be return a copy', () => { + const sw = v.gb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ga', () => { + it('should return Vec2(g, a)', () => expect(v.ga).toBeVec(v[1], v[3])); + it('should be return a copy', () => { + const sw = v.ga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().br', () => { + it('should return Vec2(b, r)', () => expect(v.br).toBeVec(v[2], v[0])); + it('should be return a copy', () => { + const sw = v.br; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bg', () => { + it('should return Vec2(b, g)', () => expect(v.bg).toBeVec(v[2], v[1])); + it('should be return a copy', () => { + const sw = v.bg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bb', () => { + it('should return Vec2(b, b)', () => expect(v.bb).toBeVec(v[2], v[2])); + it('should be return a copy', () => { + const sw = v.bb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ba', () => { + it('should return Vec2(b, a)', () => expect(v.ba).toBeVec(v[2], v[3])); + it('should be return a copy', () => { + const sw = v.ba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ar', () => { + it('should return Vec2(a, r)', () => expect(v.ar).toBeVec(v[3], v[0])); + it('should be return a copy', () => { + const sw = v.ar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ag', () => { + it('should return Vec2(a, g)', () => expect(v.ag).toBeVec(v[3], v[1])); + it('should be return a copy', () => { + const sw = v.ag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ab', () => { + it('should return Vec2(a, b)', () => expect(v.ab).toBeVec(v[3], v[2])); + it('should be return a copy', () => { + const sw = v.ab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aa', () => { + it('should return Vec2(a, a)', () => expect(v.aa).toBeVec(v[3], v[3])); + it('should be return a copy', () => { + const sw = v.aa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrr', () => { + it('should return Vec3(r, r, r)', () => expect(v.rrr).toBeVec(v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrg', () => { + it('should return Vec3(r, r, g)', () => expect(v.rrg).toBeVec(v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrb', () => { + it('should return Vec3(r, r, b)', () => expect(v.rrb).toBeVec(v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rra', () => { + it('should return Vec3(r, r, a)', () => expect(v.rra).toBeVec(v[0], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.rra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgr', () => { + it('should return Vec3(r, g, r)', () => expect(v.rgr).toBeVec(v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgg', () => { + it('should return Vec3(r, g, g)', () => expect(v.rgg).toBeVec(v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgb', () => { + it('should return Vec3(r, g, b)', () => expect(v.rgb).toBeVec(v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.rgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rga', () => { + it('should return Vec3(r, g, a)', () => expect(v.rga).toBeVec(v[0], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.rga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbr', () => { + it('should return Vec3(r, b, r)', () => expect(v.rbr).toBeVec(v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.rbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbg', () => { + it('should return Vec3(r, b, g)', () => expect(v.rbg).toBeVec(v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.rbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbb', () => { + it('should return Vec3(r, b, b)', () => expect(v.rbb).toBeVec(v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.rbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rba', () => { + it('should return Vec3(r, b, a)', () => expect(v.rba).toBeVec(v[0], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.rba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rar', () => { + it('should return Vec3(r, a, r)', () => expect(v.rar).toBeVec(v[0], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.rar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rag', () => { + it('should return Vec3(r, a, g)', () => expect(v.rag).toBeVec(v[0], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.rag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rab', () => { + it('should return Vec3(r, a, b)', () => expect(v.rab).toBeVec(v[0], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.rab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().raa', () => { + it('should return Vec3(r, a, a)', () => expect(v.raa).toBeVec(v[0], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.raa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grr', () => { + it('should return Vec3(g, r, r)', () => expect(v.grr).toBeVec(v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.grr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grg', () => { + it('should return Vec3(g, r, g)', () => expect(v.grg).toBeVec(v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.grg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grb', () => { + it('should return Vec3(g, r, b)', () => expect(v.grb).toBeVec(v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.grb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gra', () => { + it('should return Vec3(g, r, a)', () => expect(v.gra).toBeVec(v[1], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.gra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggr', () => { + it('should return Vec3(g, g, r)', () => expect(v.ggr).toBeVec(v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.ggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggg', () => { + it('should return Vec3(g, g, g)', () => expect(v.ggg).toBeVec(v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.ggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggb', () => { + it('should return Vec3(g, g, b)', () => expect(v.ggb).toBeVec(v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.ggb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gga', () => { + it('should return Vec3(g, g, a)', () => expect(v.gga).toBeVec(v[1], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.gga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbr', () => { + it('should return Vec3(g, b, r)', () => expect(v.gbr).toBeVec(v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.gbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbg', () => { + it('should return Vec3(g, b, g)', () => expect(v.gbg).toBeVec(v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.gbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbb', () => { + it('should return Vec3(g, b, b)', () => expect(v.gbb).toBeVec(v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.gbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gba', () => { + it('should return Vec3(g, b, a)', () => expect(v.gba).toBeVec(v[1], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.gba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gar', () => { + it('should return Vec3(g, a, r)', () => expect(v.gar).toBeVec(v[1], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.gar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gag', () => { + it('should return Vec3(g, a, g)', () => expect(v.gag).toBeVec(v[1], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.gag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gab', () => { + it('should return Vec3(g, a, b)', () => expect(v.gab).toBeVec(v[1], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.gab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gaa', () => { + it('should return Vec3(g, a, a)', () => expect(v.gaa).toBeVec(v[1], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.gaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brr', () => { + it('should return Vec3(b, r, r)', () => expect(v.brr).toBeVec(v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.brr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brg', () => { + it('should return Vec3(b, r, g)', () => expect(v.brg).toBeVec(v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.brg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brb', () => { + it('should return Vec3(b, r, b)', () => expect(v.brb).toBeVec(v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.brb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bra', () => { + it('should return Vec3(b, r, a)', () => expect(v.bra).toBeVec(v[2], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.bra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgr', () => { + it('should return Vec3(b, g, r)', () => expect(v.bgr).toBeVec(v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.bgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgg', () => { + it('should return Vec3(b, g, g)', () => expect(v.bgg).toBeVec(v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.bgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgb', () => { + it('should return Vec3(b, g, b)', () => expect(v.bgb).toBeVec(v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.bgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bga', () => { + it('should return Vec3(b, g, a)', () => expect(v.bga).toBeVec(v[2], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.bga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbr', () => { + it('should return Vec3(b, b, r)', () => expect(v.bbr).toBeVec(v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.bbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbg', () => { + it('should return Vec3(b, b, g)', () => expect(v.bbg).toBeVec(v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.bbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbb', () => { + it('should return Vec3(b, b, b)', () => expect(v.bbb).toBeVec(v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.bbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bba', () => { + it('should return Vec3(b, b, a)', () => expect(v.bba).toBeVec(v[2], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.bba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bar', () => { + it('should return Vec3(b, a, r)', () => expect(v.bar).toBeVec(v[2], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.bar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bag', () => { + it('should return Vec3(b, a, g)', () => expect(v.bag).toBeVec(v[2], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.bag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bab', () => { + it('should return Vec3(b, a, b)', () => expect(v.bab).toBeVec(v[2], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.bab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().baa', () => { + it('should return Vec3(b, a, a)', () => expect(v.baa).toBeVec(v[2], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.baa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arr', () => { + it('should return Vec3(a, r, r)', () => expect(v.arr).toBeVec(v[3], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.arr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arg', () => { + it('should return Vec3(a, r, g)', () => expect(v.arg).toBeVec(v[3], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.arg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arb', () => { + it('should return Vec3(a, r, b)', () => expect(v.arb).toBeVec(v[3], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.arb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ara', () => { + it('should return Vec3(a, r, a)', () => expect(v.ara).toBeVec(v[3], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.ara; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agr', () => { + it('should return Vec3(a, g, r)', () => expect(v.agr).toBeVec(v[3], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.agr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agg', () => { + it('should return Vec3(a, g, g)', () => expect(v.agg).toBeVec(v[3], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.agg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agb', () => { + it('should return Vec3(a, g, b)', () => expect(v.agb).toBeVec(v[3], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.agb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aga', () => { + it('should return Vec3(a, g, a)', () => expect(v.aga).toBeVec(v[3], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.aga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abr', () => { + it('should return Vec3(a, b, r)', () => expect(v.abr).toBeVec(v[3], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.abr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abg', () => { + it('should return Vec3(a, b, g)', () => expect(v.abg).toBeVec(v[3], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.abg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abb', () => { + it('should return Vec3(a, b, b)', () => expect(v.abb).toBeVec(v[3], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.abb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aba', () => { + it('should return Vec3(a, b, a)', () => expect(v.aba).toBeVec(v[3], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.aba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aar', () => { + it('should return Vec3(a, a, r)', () => expect(v.aar).toBeVec(v[3], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.aar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aag', () => { + it('should return Vec3(a, a, g)', () => expect(v.aag).toBeVec(v[3], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.aag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aab', () => { + it('should return Vec3(a, a, b)', () => expect(v.aab).toBeVec(v[3], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.aab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aaa', () => { + it('should return Vec3(a, a, a)', () => expect(v.aaa).toBeVec(v[3], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.aaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrrr', () => { + it('should return Vec4(r, r, r, r)', () => expect(v.rrrr).toBeVec(v[0], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rrrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrrg', () => { + it('should return Vec4(r, r, r, g)', () => expect(v.rrrg).toBeVec(v[0], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rrrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrrb', () => { + it('should return Vec4(r, r, r, b)', () => expect(v.rrrb).toBeVec(v[0], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rrrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrra', () => { + it('should return Vec4(r, r, r, a)', () => expect(v.rrra).toBeVec(v[0], v[0], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.rrra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrgr', () => { + it('should return Vec4(r, r, g, r)', () => expect(v.rrgr).toBeVec(v[0], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rrgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrgg', () => { + it('should return Vec4(r, r, g, g)', () => expect(v.rrgg).toBeVec(v[0], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rrgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrgb', () => { + it('should return Vec4(r, r, g, b)', () => expect(v.rrgb).toBeVec(v[0], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.rrgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrga', () => { + it('should return Vec4(r, r, g, a)', () => expect(v.rrga).toBeVec(v[0], v[0], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.rrga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrbr', () => { + it('should return Vec4(r, r, b, r)', () => expect(v.rrbr).toBeVec(v[0], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.rrbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrbg', () => { + it('should return Vec4(r, r, b, g)', () => expect(v.rrbg).toBeVec(v[0], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.rrbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrbb', () => { + it('should return Vec4(r, r, b, b)', () => expect(v.rrbb).toBeVec(v[0], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.rrbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrba', () => { + it('should return Vec4(r, r, b, a)', () => expect(v.rrba).toBeVec(v[0], v[0], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.rrba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrar', () => { + it('should return Vec4(r, r, a, r)', () => expect(v.rrar).toBeVec(v[0], v[0], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.rrar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrag', () => { + it('should return Vec4(r, r, a, g)', () => expect(v.rrag).toBeVec(v[0], v[0], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.rrag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrab', () => { + it('should return Vec4(r, r, a, b)', () => expect(v.rrab).toBeVec(v[0], v[0], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.rrab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rraa', () => { + it('should return Vec4(r, r, a, a)', () => expect(v.rraa).toBeVec(v[0], v[0], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.rraa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgrr', () => { + it('should return Vec4(r, g, r, r)', () => expect(v.rgrr).toBeVec(v[0], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rgrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgrg', () => { + it('should return Vec4(r, g, r, g)', () => expect(v.rgrg).toBeVec(v[0], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rgrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgrb', () => { + it('should return Vec4(r, g, r, b)', () => expect(v.rgrb).toBeVec(v[0], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rgrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgra', () => { + it('should return Vec4(r, g, r, a)', () => expect(v.rgra).toBeVec(v[0], v[1], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.rgra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rggr', () => { + it('should return Vec4(r, g, g, r)', () => expect(v.rggr).toBeVec(v[0], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rggg', () => { + it('should return Vec4(r, g, g, g)', () => expect(v.rggg).toBeVec(v[0], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rggb', () => { + it('should return Vec4(r, g, g, b)', () => expect(v.rggb).toBeVec(v[0], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.rggb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgga', () => { + it('should return Vec4(r, g, g, a)', () => expect(v.rgga).toBeVec(v[0], v[1], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.rgga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgbr', () => { + it('should return Vec4(r, g, b, r)', () => expect(v.rgbr).toBeVec(v[0], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.rgbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgbg', () => { + it('should return Vec4(r, g, b, g)', () => expect(v.rgbg).toBeVec(v[0], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.rgbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgbb', () => { + it('should return Vec4(r, g, b, b)', () => expect(v.rgbb).toBeVec(v[0], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.rgbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgba', () => { + it('should return Vec4(r, g, b, a)', () => expect(v.rgba).toBeVec(v[0], v[1], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.rgba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgar', () => { + it('should return Vec4(r, g, a, r)', () => expect(v.rgar).toBeVec(v[0], v[1], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.rgar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgag', () => { + it('should return Vec4(r, g, a, g)', () => expect(v.rgag).toBeVec(v[0], v[1], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.rgag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgab', () => { + it('should return Vec4(r, g, a, b)', () => expect(v.rgab).toBeVec(v[0], v[1], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.rgab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgaa', () => { + it('should return Vec4(r, g, a, a)', () => expect(v.rgaa).toBeVec(v[0], v[1], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.rgaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbrr', () => { + it('should return Vec4(r, b, r, r)', () => expect(v.rbrr).toBeVec(v[0], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rbrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbrg', () => { + it('should return Vec4(r, b, r, g)', () => expect(v.rbrg).toBeVec(v[0], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rbrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbrb', () => { + it('should return Vec4(r, b, r, b)', () => expect(v.rbrb).toBeVec(v[0], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rbrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbra', () => { + it('should return Vec4(r, b, r, a)', () => expect(v.rbra).toBeVec(v[0], v[2], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.rbra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbgr', () => { + it('should return Vec4(r, b, g, r)', () => expect(v.rbgr).toBeVec(v[0], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rbgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbgg', () => { + it('should return Vec4(r, b, g, g)', () => expect(v.rbgg).toBeVec(v[0], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rbgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbgb', () => { + it('should return Vec4(r, b, g, b)', () => expect(v.rbgb).toBeVec(v[0], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.rbgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbga', () => { + it('should return Vec4(r, b, g, a)', () => expect(v.rbga).toBeVec(v[0], v[2], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.rbga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbbr', () => { + it('should return Vec4(r, b, b, r)', () => expect(v.rbbr).toBeVec(v[0], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.rbbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbbg', () => { + it('should return Vec4(r, b, b, g)', () => expect(v.rbbg).toBeVec(v[0], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.rbbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbbb', () => { + it('should return Vec4(r, b, b, b)', () => expect(v.rbbb).toBeVec(v[0], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.rbbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbba', () => { + it('should return Vec4(r, b, b, a)', () => expect(v.rbba).toBeVec(v[0], v[2], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.rbba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbar', () => { + it('should return Vec4(r, b, a, r)', () => expect(v.rbar).toBeVec(v[0], v[2], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.rbar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbag', () => { + it('should return Vec4(r, b, a, g)', () => expect(v.rbag).toBeVec(v[0], v[2], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.rbag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbab', () => { + it('should return Vec4(r, b, a, b)', () => expect(v.rbab).toBeVec(v[0], v[2], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.rbab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbaa', () => { + it('should return Vec4(r, b, a, a)', () => expect(v.rbaa).toBeVec(v[0], v[2], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.rbaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rarr', () => { + it('should return Vec4(r, a, r, r)', () => expect(v.rarr).toBeVec(v[0], v[3], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rarr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rarg', () => { + it('should return Vec4(r, a, r, g)', () => expect(v.rarg).toBeVec(v[0], v[3], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rarg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rarb', () => { + it('should return Vec4(r, a, r, b)', () => expect(v.rarb).toBeVec(v[0], v[3], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rarb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rara', () => { + it('should return Vec4(r, a, r, a)', () => expect(v.rara).toBeVec(v[0], v[3], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.rara; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ragr', () => { + it('should return Vec4(r, a, g, r)', () => expect(v.ragr).toBeVec(v[0], v[3], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.ragr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ragg', () => { + it('should return Vec4(r, a, g, g)', () => expect(v.ragg).toBeVec(v[0], v[3], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.ragg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ragb', () => { + it('should return Vec4(r, a, g, b)', () => expect(v.ragb).toBeVec(v[0], v[3], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.ragb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().raga', () => { + it('should return Vec4(r, a, g, a)', () => expect(v.raga).toBeVec(v[0], v[3], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.raga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rabr', () => { + it('should return Vec4(r, a, b, r)', () => expect(v.rabr).toBeVec(v[0], v[3], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.rabr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rabg', () => { + it('should return Vec4(r, a, b, g)', () => expect(v.rabg).toBeVec(v[0], v[3], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.rabg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rabb', () => { + it('should return Vec4(r, a, b, b)', () => expect(v.rabb).toBeVec(v[0], v[3], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.rabb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().raba', () => { + it('should return Vec4(r, a, b, a)', () => expect(v.raba).toBeVec(v[0], v[3], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.raba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().raar', () => { + it('should return Vec4(r, a, a, r)', () => expect(v.raar).toBeVec(v[0], v[3], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.raar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().raag', () => { + it('should return Vec4(r, a, a, g)', () => expect(v.raag).toBeVec(v[0], v[3], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.raag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().raab', () => { + it('should return Vec4(r, a, a, b)', () => expect(v.raab).toBeVec(v[0], v[3], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.raab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().raaa', () => { + it('should return Vec4(r, a, a, a)', () => expect(v.raaa).toBeVec(v[0], v[3], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.raaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grrr', () => { + it('should return Vec4(g, r, r, r)', () => expect(v.grrr).toBeVec(v[1], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.grrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grrg', () => { + it('should return Vec4(g, r, r, g)', () => expect(v.grrg).toBeVec(v[1], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.grrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grrb', () => { + it('should return Vec4(g, r, r, b)', () => expect(v.grrb).toBeVec(v[1], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.grrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grra', () => { + it('should return Vec4(g, r, r, a)', () => expect(v.grra).toBeVec(v[1], v[0], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.grra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grgr', () => { + it('should return Vec4(g, r, g, r)', () => expect(v.grgr).toBeVec(v[1], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.grgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grgg', () => { + it('should return Vec4(g, r, g, g)', () => expect(v.grgg).toBeVec(v[1], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.grgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grgb', () => { + it('should return Vec4(g, r, g, b)', () => expect(v.grgb).toBeVec(v[1], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.grgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grga', () => { + it('should return Vec4(g, r, g, a)', () => expect(v.grga).toBeVec(v[1], v[0], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.grga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grbr', () => { + it('should return Vec4(g, r, b, r)', () => expect(v.grbr).toBeVec(v[1], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.grbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grbg', () => { + it('should return Vec4(g, r, b, g)', () => expect(v.grbg).toBeVec(v[1], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.grbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grbb', () => { + it('should return Vec4(g, r, b, b)', () => expect(v.grbb).toBeVec(v[1], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.grbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grba', () => { + it('should return Vec4(g, r, b, a)', () => expect(v.grba).toBeVec(v[1], v[0], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.grba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grar', () => { + it('should return Vec4(g, r, a, r)', () => expect(v.grar).toBeVec(v[1], v[0], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.grar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grag', () => { + it('should return Vec4(g, r, a, g)', () => expect(v.grag).toBeVec(v[1], v[0], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.grag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grab', () => { + it('should return Vec4(g, r, a, b)', () => expect(v.grab).toBeVec(v[1], v[0], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.grab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().graa', () => { + it('should return Vec4(g, r, a, a)', () => expect(v.graa).toBeVec(v[1], v[0], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.graa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggrr', () => { + it('should return Vec4(g, g, r, r)', () => expect(v.ggrr).toBeVec(v[1], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.ggrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggrg', () => { + it('should return Vec4(g, g, r, g)', () => expect(v.ggrg).toBeVec(v[1], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.ggrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggrb', () => { + it('should return Vec4(g, g, r, b)', () => expect(v.ggrb).toBeVec(v[1], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.ggrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggra', () => { + it('should return Vec4(g, g, r, a)', () => expect(v.ggra).toBeVec(v[1], v[1], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.ggra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gggr', () => { + it('should return Vec4(g, g, g, r)', () => expect(v.gggr).toBeVec(v[1], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.gggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gggg', () => { + it('should return Vec4(g, g, g, g)', () => expect(v.gggg).toBeVec(v[1], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.gggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gggb', () => { + it('should return Vec4(g, g, g, b)', () => expect(v.gggb).toBeVec(v[1], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.gggb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggga', () => { + it('should return Vec4(g, g, g, a)', () => expect(v.ggga).toBeVec(v[1], v[1], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.ggga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggbr', () => { + it('should return Vec4(g, g, b, r)', () => expect(v.ggbr).toBeVec(v[1], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.ggbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggbg', () => { + it('should return Vec4(g, g, b, g)', () => expect(v.ggbg).toBeVec(v[1], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.ggbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggbb', () => { + it('should return Vec4(g, g, b, b)', () => expect(v.ggbb).toBeVec(v[1], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.ggbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggba', () => { + it('should return Vec4(g, g, b, a)', () => expect(v.ggba).toBeVec(v[1], v[1], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.ggba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggar', () => { + it('should return Vec4(g, g, a, r)', () => expect(v.ggar).toBeVec(v[1], v[1], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.ggar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggag', () => { + it('should return Vec4(g, g, a, g)', () => expect(v.ggag).toBeVec(v[1], v[1], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.ggag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggab', () => { + it('should return Vec4(g, g, a, b)', () => expect(v.ggab).toBeVec(v[1], v[1], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.ggab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggaa', () => { + it('should return Vec4(g, g, a, a)', () => expect(v.ggaa).toBeVec(v[1], v[1], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.ggaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbrr', () => { + it('should return Vec4(g, b, r, r)', () => expect(v.gbrr).toBeVec(v[1], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.gbrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbrg', () => { + it('should return Vec4(g, b, r, g)', () => expect(v.gbrg).toBeVec(v[1], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.gbrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbrb', () => { + it('should return Vec4(g, b, r, b)', () => expect(v.gbrb).toBeVec(v[1], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.gbrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbra', () => { + it('should return Vec4(g, b, r, a)', () => expect(v.gbra).toBeVec(v[1], v[2], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.gbra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbgr', () => { + it('should return Vec4(g, b, g, r)', () => expect(v.gbgr).toBeVec(v[1], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.gbgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbgg', () => { + it('should return Vec4(g, b, g, g)', () => expect(v.gbgg).toBeVec(v[1], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.gbgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbgb', () => { + it('should return Vec4(g, b, g, b)', () => expect(v.gbgb).toBeVec(v[1], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.gbgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbga', () => { + it('should return Vec4(g, b, g, a)', () => expect(v.gbga).toBeVec(v[1], v[2], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.gbga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbbr', () => { + it('should return Vec4(g, b, b, r)', () => expect(v.gbbr).toBeVec(v[1], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.gbbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbbg', () => { + it('should return Vec4(g, b, b, g)', () => expect(v.gbbg).toBeVec(v[1], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.gbbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbbb', () => { + it('should return Vec4(g, b, b, b)', () => expect(v.gbbb).toBeVec(v[1], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.gbbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbba', () => { + it('should return Vec4(g, b, b, a)', () => expect(v.gbba).toBeVec(v[1], v[2], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.gbba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbar', () => { + it('should return Vec4(g, b, a, r)', () => expect(v.gbar).toBeVec(v[1], v[2], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.gbar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbag', () => { + it('should return Vec4(g, b, a, g)', () => expect(v.gbag).toBeVec(v[1], v[2], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.gbag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbab', () => { + it('should return Vec4(g, b, a, b)', () => expect(v.gbab).toBeVec(v[1], v[2], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.gbab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbaa', () => { + it('should return Vec4(g, b, a, a)', () => expect(v.gbaa).toBeVec(v[1], v[2], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.gbaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().garr', () => { + it('should return Vec4(g, a, r, r)', () => expect(v.garr).toBeVec(v[1], v[3], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.garr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().garg', () => { + it('should return Vec4(g, a, r, g)', () => expect(v.garg).toBeVec(v[1], v[3], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.garg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().garb', () => { + it('should return Vec4(g, a, r, b)', () => expect(v.garb).toBeVec(v[1], v[3], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.garb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gara', () => { + it('should return Vec4(g, a, r, a)', () => expect(v.gara).toBeVec(v[1], v[3], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.gara; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gagr', () => { + it('should return Vec4(g, a, g, r)', () => expect(v.gagr).toBeVec(v[1], v[3], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.gagr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gagg', () => { + it('should return Vec4(g, a, g, g)', () => expect(v.gagg).toBeVec(v[1], v[3], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.gagg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gagb', () => { + it('should return Vec4(g, a, g, b)', () => expect(v.gagb).toBeVec(v[1], v[3], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.gagb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gaga', () => { + it('should return Vec4(g, a, g, a)', () => expect(v.gaga).toBeVec(v[1], v[3], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.gaga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gabr', () => { + it('should return Vec4(g, a, b, r)', () => expect(v.gabr).toBeVec(v[1], v[3], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.gabr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gabg', () => { + it('should return Vec4(g, a, b, g)', () => expect(v.gabg).toBeVec(v[1], v[3], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.gabg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gabb', () => { + it('should return Vec4(g, a, b, b)', () => expect(v.gabb).toBeVec(v[1], v[3], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.gabb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gaba', () => { + it('should return Vec4(g, a, b, a)', () => expect(v.gaba).toBeVec(v[1], v[3], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.gaba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gaar', () => { + it('should return Vec4(g, a, a, r)', () => expect(v.gaar).toBeVec(v[1], v[3], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.gaar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gaag', () => { + it('should return Vec4(g, a, a, g)', () => expect(v.gaag).toBeVec(v[1], v[3], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.gaag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gaab', () => { + it('should return Vec4(g, a, a, b)', () => expect(v.gaab).toBeVec(v[1], v[3], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.gaab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gaaa', () => { + it('should return Vec4(g, a, a, a)', () => expect(v.gaaa).toBeVec(v[1], v[3], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.gaaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brrr', () => { + it('should return Vec4(b, r, r, r)', () => expect(v.brrr).toBeVec(v[2], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.brrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brrg', () => { + it('should return Vec4(b, r, r, g)', () => expect(v.brrg).toBeVec(v[2], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.brrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brrb', () => { + it('should return Vec4(b, r, r, b)', () => expect(v.brrb).toBeVec(v[2], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.brrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brra', () => { + it('should return Vec4(b, r, r, a)', () => expect(v.brra).toBeVec(v[2], v[0], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.brra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brgr', () => { + it('should return Vec4(b, r, g, r)', () => expect(v.brgr).toBeVec(v[2], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.brgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brgg', () => { + it('should return Vec4(b, r, g, g)', () => expect(v.brgg).toBeVec(v[2], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.brgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brgb', () => { + it('should return Vec4(b, r, g, b)', () => expect(v.brgb).toBeVec(v[2], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.brgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brga', () => { + it('should return Vec4(b, r, g, a)', () => expect(v.brga).toBeVec(v[2], v[0], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.brga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brbr', () => { + it('should return Vec4(b, r, b, r)', () => expect(v.brbr).toBeVec(v[2], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.brbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brbg', () => { + it('should return Vec4(b, r, b, g)', () => expect(v.brbg).toBeVec(v[2], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.brbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brbb', () => { + it('should return Vec4(b, r, b, b)', () => expect(v.brbb).toBeVec(v[2], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.brbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brba', () => { + it('should return Vec4(b, r, b, a)', () => expect(v.brba).toBeVec(v[2], v[0], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.brba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brar', () => { + it('should return Vec4(b, r, a, r)', () => expect(v.brar).toBeVec(v[2], v[0], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.brar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brag', () => { + it('should return Vec4(b, r, a, g)', () => expect(v.brag).toBeVec(v[2], v[0], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.brag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brab', () => { + it('should return Vec4(b, r, a, b)', () => expect(v.brab).toBeVec(v[2], v[0], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.brab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().braa', () => { + it('should return Vec4(b, r, a, a)', () => expect(v.braa).toBeVec(v[2], v[0], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.braa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgrr', () => { + it('should return Vec4(b, g, r, r)', () => expect(v.bgrr).toBeVec(v[2], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.bgrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgrg', () => { + it('should return Vec4(b, g, r, g)', () => expect(v.bgrg).toBeVec(v[2], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.bgrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgrb', () => { + it('should return Vec4(b, g, r, b)', () => expect(v.bgrb).toBeVec(v[2], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.bgrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgra', () => { + it('should return Vec4(b, g, r, a)', () => expect(v.bgra).toBeVec(v[2], v[1], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.bgra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bggr', () => { + it('should return Vec4(b, g, g, r)', () => expect(v.bggr).toBeVec(v[2], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.bggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bggg', () => { + it('should return Vec4(b, g, g, g)', () => expect(v.bggg).toBeVec(v[2], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.bggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bggb', () => { + it('should return Vec4(b, g, g, b)', () => expect(v.bggb).toBeVec(v[2], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.bggb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgga', () => { + it('should return Vec4(b, g, g, a)', () => expect(v.bgga).toBeVec(v[2], v[1], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.bgga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgbr', () => { + it('should return Vec4(b, g, b, r)', () => expect(v.bgbr).toBeVec(v[2], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.bgbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgbg', () => { + it('should return Vec4(b, g, b, g)', () => expect(v.bgbg).toBeVec(v[2], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.bgbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgbb', () => { + it('should return Vec4(b, g, b, b)', () => expect(v.bgbb).toBeVec(v[2], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.bgbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgba', () => { + it('should return Vec4(b, g, b, a)', () => expect(v.bgba).toBeVec(v[2], v[1], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.bgba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgar', () => { + it('should return Vec4(b, g, a, r)', () => expect(v.bgar).toBeVec(v[2], v[1], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.bgar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgag', () => { + it('should return Vec4(b, g, a, g)', () => expect(v.bgag).toBeVec(v[2], v[1], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.bgag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgab', () => { + it('should return Vec4(b, g, a, b)', () => expect(v.bgab).toBeVec(v[2], v[1], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.bgab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgaa', () => { + it('should return Vec4(b, g, a, a)', () => expect(v.bgaa).toBeVec(v[2], v[1], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.bgaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbrr', () => { + it('should return Vec4(b, b, r, r)', () => expect(v.bbrr).toBeVec(v[2], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.bbrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbrg', () => { + it('should return Vec4(b, b, r, g)', () => expect(v.bbrg).toBeVec(v[2], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.bbrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbrb', () => { + it('should return Vec4(b, b, r, b)', () => expect(v.bbrb).toBeVec(v[2], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.bbrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbra', () => { + it('should return Vec4(b, b, r, a)', () => expect(v.bbra).toBeVec(v[2], v[2], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.bbra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbgr', () => { + it('should return Vec4(b, b, g, r)', () => expect(v.bbgr).toBeVec(v[2], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.bbgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbgg', () => { + it('should return Vec4(b, b, g, g)', () => expect(v.bbgg).toBeVec(v[2], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.bbgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbgb', () => { + it('should return Vec4(b, b, g, b)', () => expect(v.bbgb).toBeVec(v[2], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.bbgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbga', () => { + it('should return Vec4(b, b, g, a)', () => expect(v.bbga).toBeVec(v[2], v[2], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.bbga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbbr', () => { + it('should return Vec4(b, b, b, r)', () => expect(v.bbbr).toBeVec(v[2], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.bbbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbbg', () => { + it('should return Vec4(b, b, b, g)', () => expect(v.bbbg).toBeVec(v[2], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.bbbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbbb', () => { + it('should return Vec4(b, b, b, b)', () => expect(v.bbbb).toBeVec(v[2], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.bbbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbba', () => { + it('should return Vec4(b, b, b, a)', () => expect(v.bbba).toBeVec(v[2], v[2], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.bbba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbar', () => { + it('should return Vec4(b, b, a, r)', () => expect(v.bbar).toBeVec(v[2], v[2], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.bbar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbag', () => { + it('should return Vec4(b, b, a, g)', () => expect(v.bbag).toBeVec(v[2], v[2], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.bbag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbab', () => { + it('should return Vec4(b, b, a, b)', () => expect(v.bbab).toBeVec(v[2], v[2], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.bbab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbaa', () => { + it('should return Vec4(b, b, a, a)', () => expect(v.bbaa).toBeVec(v[2], v[2], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.bbaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().barr', () => { + it('should return Vec4(b, a, r, r)', () => expect(v.barr).toBeVec(v[2], v[3], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.barr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().barg', () => { + it('should return Vec4(b, a, r, g)', () => expect(v.barg).toBeVec(v[2], v[3], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.barg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().barb', () => { + it('should return Vec4(b, a, r, b)', () => expect(v.barb).toBeVec(v[2], v[3], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.barb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bara', () => { + it('should return Vec4(b, a, r, a)', () => expect(v.bara).toBeVec(v[2], v[3], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.bara; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bagr', () => { + it('should return Vec4(b, a, g, r)', () => expect(v.bagr).toBeVec(v[2], v[3], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.bagr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bagg', () => { + it('should return Vec4(b, a, g, g)', () => expect(v.bagg).toBeVec(v[2], v[3], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.bagg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bagb', () => { + it('should return Vec4(b, a, g, b)', () => expect(v.bagb).toBeVec(v[2], v[3], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.bagb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().baga', () => { + it('should return Vec4(b, a, g, a)', () => expect(v.baga).toBeVec(v[2], v[3], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.baga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().babr', () => { + it('should return Vec4(b, a, b, r)', () => expect(v.babr).toBeVec(v[2], v[3], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.babr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().babg', () => { + it('should return Vec4(b, a, b, g)', () => expect(v.babg).toBeVec(v[2], v[3], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.babg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().babb', () => { + it('should return Vec4(b, a, b, b)', () => expect(v.babb).toBeVec(v[2], v[3], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.babb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().baba', () => { + it('should return Vec4(b, a, b, a)', () => expect(v.baba).toBeVec(v[2], v[3], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.baba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().baar', () => { + it('should return Vec4(b, a, a, r)', () => expect(v.baar).toBeVec(v[2], v[3], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.baar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().baag', () => { + it('should return Vec4(b, a, a, g)', () => expect(v.baag).toBeVec(v[2], v[3], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.baag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().baab', () => { + it('should return Vec4(b, a, a, b)', () => expect(v.baab).toBeVec(v[2], v[3], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.baab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().baaa', () => { + it('should return Vec4(b, a, a, a)', () => expect(v.baaa).toBeVec(v[2], v[3], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.baaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arrr', () => { + it('should return Vec4(a, r, r, r)', () => expect(v.arrr).toBeVec(v[3], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.arrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arrg', () => { + it('should return Vec4(a, r, r, g)', () => expect(v.arrg).toBeVec(v[3], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.arrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arrb', () => { + it('should return Vec4(a, r, r, b)', () => expect(v.arrb).toBeVec(v[3], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.arrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arra', () => { + it('should return Vec4(a, r, r, a)', () => expect(v.arra).toBeVec(v[3], v[0], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.arra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().argr', () => { + it('should return Vec4(a, r, g, r)', () => expect(v.argr).toBeVec(v[3], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.argr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().argg', () => { + it('should return Vec4(a, r, g, g)', () => expect(v.argg).toBeVec(v[3], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.argg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().argb', () => { + it('should return Vec4(a, r, g, b)', () => expect(v.argb).toBeVec(v[3], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.argb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arga', () => { + it('should return Vec4(a, r, g, a)', () => expect(v.arga).toBeVec(v[3], v[0], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.arga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arbr', () => { + it('should return Vec4(a, r, b, r)', () => expect(v.arbr).toBeVec(v[3], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.arbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arbg', () => { + it('should return Vec4(a, r, b, g)', () => expect(v.arbg).toBeVec(v[3], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.arbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arbb', () => { + it('should return Vec4(a, r, b, b)', () => expect(v.arbb).toBeVec(v[3], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.arbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arba', () => { + it('should return Vec4(a, r, b, a)', () => expect(v.arba).toBeVec(v[3], v[0], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.arba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arar', () => { + it('should return Vec4(a, r, a, r)', () => expect(v.arar).toBeVec(v[3], v[0], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.arar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arag', () => { + it('should return Vec4(a, r, a, g)', () => expect(v.arag).toBeVec(v[3], v[0], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.arag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arab', () => { + it('should return Vec4(a, r, a, b)', () => expect(v.arab).toBeVec(v[3], v[0], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.arab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().araa', () => { + it('should return Vec4(a, r, a, a)', () => expect(v.araa).toBeVec(v[3], v[0], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.araa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agrr', () => { + it('should return Vec4(a, g, r, r)', () => expect(v.agrr).toBeVec(v[3], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.agrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agrg', () => { + it('should return Vec4(a, g, r, g)', () => expect(v.agrg).toBeVec(v[3], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.agrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agrb', () => { + it('should return Vec4(a, g, r, b)', () => expect(v.agrb).toBeVec(v[3], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.agrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agra', () => { + it('should return Vec4(a, g, r, a)', () => expect(v.agra).toBeVec(v[3], v[1], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.agra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aggr', () => { + it('should return Vec4(a, g, g, r)', () => expect(v.aggr).toBeVec(v[3], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.aggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aggg', () => { + it('should return Vec4(a, g, g, g)', () => expect(v.aggg).toBeVec(v[3], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.aggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aggb', () => { + it('should return Vec4(a, g, g, b)', () => expect(v.aggb).toBeVec(v[3], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.aggb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agga', () => { + it('should return Vec4(a, g, g, a)', () => expect(v.agga).toBeVec(v[3], v[1], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.agga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agbr', () => { + it('should return Vec4(a, g, b, r)', () => expect(v.agbr).toBeVec(v[3], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.agbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agbg', () => { + it('should return Vec4(a, g, b, g)', () => expect(v.agbg).toBeVec(v[3], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.agbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agbb', () => { + it('should return Vec4(a, g, b, b)', () => expect(v.agbb).toBeVec(v[3], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.agbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agba', () => { + it('should return Vec4(a, g, b, a)', () => expect(v.agba).toBeVec(v[3], v[1], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.agba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agar', () => { + it('should return Vec4(a, g, a, r)', () => expect(v.agar).toBeVec(v[3], v[1], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.agar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agag', () => { + it('should return Vec4(a, g, a, g)', () => expect(v.agag).toBeVec(v[3], v[1], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.agag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agab', () => { + it('should return Vec4(a, g, a, b)', () => expect(v.agab).toBeVec(v[3], v[1], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.agab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agaa', () => { + it('should return Vec4(a, g, a, a)', () => expect(v.agaa).toBeVec(v[3], v[1], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.agaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abrr', () => { + it('should return Vec4(a, b, r, r)', () => expect(v.abrr).toBeVec(v[3], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.abrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abrg', () => { + it('should return Vec4(a, b, r, g)', () => expect(v.abrg).toBeVec(v[3], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.abrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abrb', () => { + it('should return Vec4(a, b, r, b)', () => expect(v.abrb).toBeVec(v[3], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.abrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abra', () => { + it('should return Vec4(a, b, r, a)', () => expect(v.abra).toBeVec(v[3], v[2], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.abra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abgr', () => { + it('should return Vec4(a, b, g, r)', () => expect(v.abgr).toBeVec(v[3], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.abgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abgg', () => { + it('should return Vec4(a, b, g, g)', () => expect(v.abgg).toBeVec(v[3], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.abgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abgb', () => { + it('should return Vec4(a, b, g, b)', () => expect(v.abgb).toBeVec(v[3], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.abgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abga', () => { + it('should return Vec4(a, b, g, a)', () => expect(v.abga).toBeVec(v[3], v[2], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.abga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abbr', () => { + it('should return Vec4(a, b, b, r)', () => expect(v.abbr).toBeVec(v[3], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.abbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abbg', () => { + it('should return Vec4(a, b, b, g)', () => expect(v.abbg).toBeVec(v[3], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.abbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abbb', () => { + it('should return Vec4(a, b, b, b)', () => expect(v.abbb).toBeVec(v[3], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.abbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abba', () => { + it('should return Vec4(a, b, b, a)', () => expect(v.abba).toBeVec(v[3], v[2], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.abba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abar', () => { + it('should return Vec4(a, b, a, r)', () => expect(v.abar).toBeVec(v[3], v[2], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.abar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abag', () => { + it('should return Vec4(a, b, a, g)', () => expect(v.abag).toBeVec(v[3], v[2], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.abag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abab', () => { + it('should return Vec4(a, b, a, b)', () => expect(v.abab).toBeVec(v[3], v[2], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.abab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abaa', () => { + it('should return Vec4(a, b, a, a)', () => expect(v.abaa).toBeVec(v[3], v[2], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.abaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aarr', () => { + it('should return Vec4(a, a, r, r)', () => expect(v.aarr).toBeVec(v[3], v[3], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.aarr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aarg', () => { + it('should return Vec4(a, a, r, g)', () => expect(v.aarg).toBeVec(v[3], v[3], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.aarg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aarb', () => { + it('should return Vec4(a, a, r, b)', () => expect(v.aarb).toBeVec(v[3], v[3], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.aarb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aara', () => { + it('should return Vec4(a, a, r, a)', () => expect(v.aara).toBeVec(v[3], v[3], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.aara; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aagr', () => { + it('should return Vec4(a, a, g, r)', () => expect(v.aagr).toBeVec(v[3], v[3], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.aagr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aagg', () => { + it('should return Vec4(a, a, g, g)', () => expect(v.aagg).toBeVec(v[3], v[3], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.aagg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aagb', () => { + it('should return Vec4(a, a, g, b)', () => expect(v.aagb).toBeVec(v[3], v[3], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.aagb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aaga', () => { + it('should return Vec4(a, a, g, a)', () => expect(v.aaga).toBeVec(v[3], v[3], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.aaga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aabr', () => { + it('should return Vec4(a, a, b, r)', () => expect(v.aabr).toBeVec(v[3], v[3], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.aabr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aabg', () => { + it('should return Vec4(a, a, b, g)', () => expect(v.aabg).toBeVec(v[3], v[3], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.aabg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aabb', () => { + it('should return Vec4(a, a, b, b)', () => expect(v.aabb).toBeVec(v[3], v[3], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.aabb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aaba', () => { + it('should return Vec4(a, a, b, a)', () => expect(v.aaba).toBeVec(v[3], v[3], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.aaba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aaar', () => { + it('should return Vec4(a, a, a, r)', () => expect(v.aaar).toBeVec(v[3], v[3], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.aaar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aaag', () => { + it('should return Vec4(a, a, a, g)', () => expect(v.aaag).toBeVec(v[3], v[3], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.aaag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aaab', () => { + it('should return Vec4(a, a, a, b)', () => expect(v.aaab).toBeVec(v[3], v[3], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.aaab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aaaa', () => { + it('should return Vec4(a, a, a, a)', () => expect(v.aaaa).toBeVec(v[3], v[3], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.aaaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + // [/Swizzle Autogen] +}); diff --git a/tests/f32/Vec4.spec.ts b/tests/f32/Vec4.spec.ts new file mode 100644 index 00000000..19a3d75a --- /dev/null +++ b/tests/f32/Vec4.spec.ts @@ -0,0 +1,702 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Vec4 } from '#gl-matrix'; + +import type { Vec4Like } from '#gl-matrix/types'; + +describe('Vec4', () => { + describe('constructor', () => { + it('should return Vec4(0, 0, 0, 0) if called with no arguments', () => expect(new Vec4()).toBeVec(0, 0, 0, 0)); + + it('should return Vec4(x, y, z, w) if called with (x, y, z, w)', () => { + expect(new Vec4(1, 2, 3, 4)).toBeVec(1, 2, 3, 4); + expect(new Vec4(-3, 4.4, -5.6, 7.8)).toBeVec(-3, 4.4, -5.6, 7.8); + }); + + it('should return Vec4(x, x, x) if called with (x)', () => { + expect(new Vec4(1)).toBeVec(1, 1, 1, 1); + expect(new Vec4(-2.3)).toBeVec(-2.3, -2.3, -2.3, -2.3); + }); + + it('should return Vec4(x, y, z, w) if called with ([x, y, z, w])', () => { + expect(new Vec4([1, 2, 3, 4])).toBeVec(1, 2, 3, 4); + expect(new Vec4([-3, 4.4, -5.6, 7.8])).toBeVec(-3, 4.4, -5.6, 7.8); + }); + + it('should return Vec4(x, y, z, w) if called with (Vec4(x, y, z, w))', () => { + const v = new Vec4(3.4, 5.6, 7.8, 9); + expect(new Vec4(v)).toBeVec(v); + }); + + it('should return Vec4(x, y, z, w) if called with (Float32Array([x, y, z, w]))', () => { + const arr = new Float32Array([1.2, 3.4, 5.6, 7.8]); + expect(new Vec4(arr)).toBeVec(arr); + }); + }); + + describe('static', () => { + let out: Vec4Like; + let vecA: Vec4Like; + let vecB: Vec4Like; + let result: Vec4Like | number; + + beforeEach(() => { + vecA = new Vec4(1, 2, 3, 4); + vecB = new Vec4(5, 6, 7, 8); + out = new Vec4(0, 0, 0, 0); + }); + + describe('create', () => { + beforeEach(() => { result = Vec4.create(); }); + + it('should return a 4 element array initialized to 0s', () => expect(result).toBeVec(0, 0, 0, 0)); + }); + + describe('clone', () => { + beforeEach(() => { result = Vec4.clone(vecA); }); + + it('should return a 4 element array initialized to the values in vecA', () => expect(result).toBeVec(vecA)); + }); + + describe('fromValues', () => { + beforeEach(() => { result = Vec4.fromValues(1, 2, 3, 4); }); + + it('should return a 4 element array initialized to the values passed', () => expect(result).toBeVec(1, 2, 3, 4)); + }); + + describe('copy', () => { + beforeEach(() => { result = Vec4.copy(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3, 4)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('set', () => { + beforeEach(() => { result = Vec4.set(out, 1, 2, 3, 4); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3, 4)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('add', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.add(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(6, 8, 10, 12)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.add(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(6, 8, 10, 12)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec4.add(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(6, 8, 10, 12)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('subtract', () => { + it('should have an alias called `sub`', () => expect(Vec4.sub).toEqual(Vec4.subtract)); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.subtract(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(-4, -4, -4, -4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.subtract(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(-4, -4, -4, -4)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec4.subtract(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(-4, -4, -4, -4)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('multiply', () => { + it('should have an alias called `mul`', () => expect(Vec4.mul).toEqual(Vec4.multiply)); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.multiply(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(5, 12, 21, 32)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.multiply(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(5, 12, 21, 32)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec4.multiply(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(5, 12, 21, 32)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('divide', () => { + it('should have an alias called `div`', () => expect(Vec4.div).toEqual(Vec4.divide)); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.divide(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(0.2, 0.333333, 0.428571, 0.5)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.divide(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(0.2, 0.333333, 0.428571, 0.5)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec4.divide(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(0.2, 0.333333, 0.428571, 0.5)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('ceil', () => { + beforeEach(() => { vecA = [Math.E, Math.PI, Math.SQRT2, Math.SQRT1_2]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.ceil(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(3, 4, 2, 1)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(Math.E, Math.PI, Math.SQRT2, Math.SQRT1_2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.ceil(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 4, 2, 1)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('floor', () => { + beforeEach(() => { vecA = [Math.E, Math.PI, Math.SQRT2, Math.SQRT1_2]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.floor(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(2, 3, 1, 0)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(Math.E, Math.PI, Math.SQRT2, Math.SQRT1_2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.floor(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(2, 3, 1, 0)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('min', () => { + beforeEach(() => { + vecA = [1, 3, 1, 3]; + vecB = [3, 1, 3, 1]; + }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.min(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(1, 1, 1, 1)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 3, 1, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 1, 3, 1)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.min(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 1, 1, 1)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 1, 3, 1)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec4.min(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(1, 1, 1, 1)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 3, 1, 3)); + }); + }); + + describe('max', () => { + beforeEach(() => { + vecA = [1, 3, 1, 3]; + vecB = [3, 1, 3, 1]; + }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.max(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(3, 3, 3, 3)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 3, 1, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 1, 3, 1)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.max(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 3, 3, 3)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 1, 3, 1)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec4.max(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(3, 3, 3, 3)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 3, 1, 3)); + }); + }); + + describe('round', () => { + beforeEach(() => { vecA = [Math.E, Math.PI, Math.SQRT2, Math.SQRT1_2]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.round(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(3, 3, 1, 1)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(Math.E, Math.PI, Math.SQRT2, Math.SQRT1_2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.round(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 3, 1, 1)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('scale', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.scale(out, vecA, 2); }); + + it('should place values into out', () => expect(out).toBeVec(2, 4, 6, 8)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.scale(vecA, vecA, 2); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(2, 4, 6, 8)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('scaleAndAdd', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.scaleAndAdd(out, vecA, vecB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(3.5, 5, 6.5, 8)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.scaleAndAdd(vecA, vecA, vecB, 0.5); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3.5, 5, 6.5, 8)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec4.scaleAndAdd(vecB, vecA, vecB, 0.5); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(3.5, 5, 6.5, 8)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('distance', () => { + beforeEach(() => { result = Vec4.distance(vecA, vecB); }); + + it('should have an alias called `dist`', () => expect(Vec4.dist).toEqual(Vec4.distance)); + it('should return the distance', () => expect(result).toBeCloseTo(8)); + }); + + describe('squaredDistance', () => { + beforeEach(() => { result = Vec4.squaredDistance(vecA, vecB); }); + + it('should have an alias called `sqrDist`', () => expect(Vec4.sqrDist).toEqual(Vec4.squaredDistance)); + it('should return the squared distance', () => expect(result).toEqual(64)); + }); + + describe('length', () => { + beforeEach(() => { result = Vec4.len(vecA); }); + + it('should have an alias called `len`', () => expect(Vec4.len).toEqual(Vec4.length)); + it('should return the length', () => expect(result).toBeCloseTo(5.477225)); + }); + + describe('squaredLength', () => { + beforeEach(() => { result = Vec4.squaredLength(vecA); }); + + it('should have an alias called `sqrLen`', () => expect(Vec4.sqrLen).toEqual(Vec4.squaredLength)); + it('should return the squared length', () => expect(result).toEqual(30)); + }); + + describe('negate', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.negate(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(-1, -2, -3, -4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.negate(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(-1, -2, -3, -4)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('inverse', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.inverse(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 1 / 2, 1 / 3, 1 / 4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.inverse(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 1 / 2, 1 / 3, 1 / 4)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('abs', () => { + beforeEach(() => { vecA = [-1, -2, -3, -4]; }); + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.abs(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3, 4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(-1, -2, -3, -4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.abs(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('normalize', () => { + beforeEach(() => { vecA = [5, 0, 0, 0]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.normalize(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 0, 0, 0)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(5, 0, 0, 0)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.normalize(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 0, 0, 0)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('dot', () => { + beforeEach(() => { result = Vec4.dot(vecA, vecB); }); + + it('should return the dot product', () => expect(result).toEqual(70)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('lerp', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.lerp(out, vecA, vecB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(3, 4, 5, 6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.lerp(vecA, vecA, vecB, 0.5); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 4, 5, 6)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec4.lerp(vecB, vecA, vecB, 0.5); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(3, 4, 5, 6)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + }); + + /* + describe('random', () => { + describe('with no scale', () => { + beforeEach(() => { result = Vec4.random(out); }); + + it('should result in a unit length vector', () => expect(Vec4.len(out)).toBeCloseTo(1.0)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('with a scale', () => { + beforeEach(() => { result = Vec4.random(out, 5.0); }); + + it('should result in a unit length vector', () => expect(Vec4.len(out)).toBeCloseTo(5.0)); + it('should return out', () => expect(result).toBe(out)); + }); + });*/ + + describe('cross', () => { + let vecC: Vec4Like; + + beforeEach(() => { + vecA = new Vec4(1, 0, 0, 0); + vecB = new Vec4(0, 1, 0, 0); + vecC = [0, 0, 1, 0]; + }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.cross(out, vecA, vecB, vecC); }); + + it('should place values into out', () => expect(out).toBeVec(0, 0, 0, -1)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 0, 0, 0)); + it('should not modify vecB', () => expect(vecB).toBeVec(0, 1, 0, 0)); + it('should not modify vecC', () => expect(vecC).toBeVec(0, 0, 1, 0)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.cross(vecA, vecA, vecB, vecC); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(0, 0, 0, -1)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(0, 1, 0, 0)); + it('should not modify vecC', () => expect(vecC).toBeVec(0, 0, 1, 0)); + }); + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec4.cross(vecB, vecA, vecB, vecC); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(0, 0, 0, -1)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 0, 0, 0)); + it('should not modify vecC', () => expect(vecC).toBeVec(0, 0, 1, 0)); + }); + describe('when vecC is the output vector', () => { + beforeEach(() => { result = Vec4.cross(vecC, vecA, vecB, vecC); }); + + it('should place values into vecC', () => expect(vecC).toBeVec(0, 0, 0, -1)); + it('should return vecC', () => expect(result).toBe(vecC)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 0, 0, 0)); + it('should not modify vecB', () => expect(vecB).toBeVec(0, 1, 0, 0)); + }); + }); + + /* + describe('forEach', () => { + let vecArray; + + beforeEach(() => { + vecArray = [ + 1, 2, 3, 4, + 5, 6, 7, 8, + 0, 0, 0, 0 + ]; + }); + + describe('when performing operations that take no extra arguments', () => { + beforeEach(() => { result = Vec4.forEach(vecArray, 0, 0, 0, Vec4.normalize); }); + + it('should update all values', () => { + expect(vecArray).toBeEqualish([ + 0.182574, 0.365148, 0.547722, 0.730296, + 0.379049, 0.454858, 0.530668, 0.606478, + 0, 0, 0, 0 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + }); + + describe('when performing operations that takes one extra arguments', () => { + beforeEach(() => { result = Vec4.forEach(vecArray, 0, 0, 0, Vec4.add, vecA); }); + + it('should update all values', () => { + expect(vecArray).toBeEqualish([ + 2, 4, 6, 8, + 6, 8, 10, 12, + 1, 2, 3, 4 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + + describe('when specifying an offset', () => { + beforeEach(() => { result = Vec4.forEach(vecArray, 0, 4, 0, Vec4.add, vecA); }); + + it('should update all values except the first vector', () => { + expect(vecArray).toBeEqualish([ + 1, 2, 3, 4, + 6, 8, 10, 12, + 1, 2, 3, 4 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + + describe('when specifying a count', () => { + beforeEach(() => { result = Vec4.forEach(vecArray, 0, 0, 2, Vec4.add, vecA); }); + + it('should update all values except the last vector', () => { + expect(vecArray).toBeEqualish([ + 2, 4, 6, 8, + 6, 8, 10, 12, + 0, 0, 0, 0 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + + describe('when specifying a stride', () => { + beforeEach(() => { result = Vec4.forEach(vecArray, 8, 0, 0, Vec4.add, vecA); }); + + it('should update all values except the second vector', () => { + expect(vecArray).toBeEqualish([ + 2, 4, 6, 8, + 5, 6, 7, 8, + 1, 2, 3, 4 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + + describe('when calling a function that does not modify the out variable', () => { + beforeEach(() => { result = vec3.forEach(vecArray, 0, 0, 0, function(out, vec) {}); }); + + it('values should remain unchanged', () => { + expect(vecArray).toBeEqualish([ + 1, 2, 3, 4, + 5, 6, 7, 8, + 0, 0, 0, 0 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + }); + });*/ + + describe('str', () => { + it('should return a string representation of the vector', + () => expect(Vec4.str(vecA)).toEqual('Vec4(1, 2, 3, 4)')); + }); + + describe('exactEquals', () => { + let vecC: Vec4Like, r0: boolean, r1: boolean; + + beforeEach(() => { + vecA = [0, 1, 2, 3]; + vecB = [0, 1, 2, 3]; + vecC = [1, 2, 3, 4]; + r0 = Vec4.exactEquals(vecA, vecB); + r1 = Vec4.exactEquals(vecA, vecC); + }); + + it('should return true for identical vectors', () => expect(r0).toBe(true)); + it('should return false for different vectors', () => expect(r1).toBe(false)); + it('should not modify vecA', () => expect(vecA).toBeVec(0, 1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(0, 1, 2, 3)); + }); + + describe('equals', () => { + let vecC: Vec4Like, vecD: Vec4Like, r0: boolean, r1: boolean, r2: boolean; + + beforeEach(() => { + vecA = [0, 1, 2, 3]; + vecB = [0, 1, 2, 3]; + vecC = [1, 2, 3, 4]; + vecD = [1e-16, 1, 2, 3]; + r0 = Vec4.equals(vecA, vecB); + r1 = Vec4.equals(vecA, vecC); + r2 = Vec4.equals(vecA, vecD); + }); + + it('should return true for identical vectors', () => expect(r0).toBe(true)); + it('should return false for different vectors', () => expect(r1).toBe(false)); + it('should return true for close but not identical vectors', () => expect(r2).toBe(true)); + it('should not modify vecA', () => expect(vecA).toBeVec(0, 1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(0, 1, 2, 3)); + }); + + describe('zero', () => { + beforeEach(() => { + vecA = [1, 2, 3, 4]; + result = Vec4.zero(vecA); + }); + + it('should result in a 4 element vector with zeros', () => expect(result).toBeVec(0, 0, 0, 0)); + }); + }); +}); diff --git a/tests/f32/util.spec.ts b/tests/f32/util.spec.ts new file mode 100644 index 00000000..30043e51 --- /dev/null +++ b/tests/f32/util.spec.ts @@ -0,0 +1,19 @@ +import { expect, describe, it } from 'vitest'; + +import { toDegree, toRadian } from '#gl-matrix/util'; + +describe('Common', () => { + describe('toRadian', () => { + it('should return a value of 0 when passed 0', () => expect(toRadian(0)).toBeCloseTo(0)); + it('should return a value of Math.PI/2 when passed 90', () => expect(toRadian(90)).toBeCloseTo(Math.PI / 2)); + it('should return a value of Math.PI when passed 180', () => expect(toRadian(180)).toBeCloseTo(Math.PI)); + it('should return a value of Math.PI*2 when passed 360', () => expect(toRadian(360)).toBeCloseTo(Math.PI * 2)); + }); + + describe('toDegree', () => { + it('should return a value of 0 when passed 0', () => expect(toDegree(0)).toBeCloseTo(0)); + it('should return a value of 90 when passed Math.PI/2', () => expect(toDegree(Math.PI / 2)).toBeCloseTo(90)); + it('should return a value of 180 when passed Math.PI', () => expect(toDegree(Math.PI)).toBeCloseTo(180)); + it('should return a value of 360 when passed Math.PI*2', () => expect(toDegree(Math.PI * 2)).toBeCloseTo(360)); + }); +}); diff --git a/tests/f64/Mat2.spec.ts b/tests/f64/Mat2.spec.ts new file mode 100644 index 00000000..a064fd9e --- /dev/null +++ b/tests/f64/Mat2.spec.ts @@ -0,0 +1,400 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Mat2 } from '#gl-matrix/f64'; + +import type { FloatArray, Mat2Like, Vec2Like } from '#gl-matrix/types'; + +describe('Mat2', () => { + describe('constructor', () => { + it('should return an identity Mat2 if called with no arguments', () => { + expect(new Mat2()).toBeVec( + 1, 0, + 0, 1); + }); + + it('should return Mat2(m0, m1, ...m8) if called with (m0, m1, ...m8)', () => { + expect(new Mat2( + 1, 2, + 3, 4)).toBeVec( + 1, 2, + 3, 4); + }); + + it('should return Mat2(x, x, x, ...) if called with (x)', () => { + expect(new Mat2(1)).toBeVec( + 1, 1, + 1, 1); + }); + + it('should return Mat2(m0, m1, ...m8) if called with ([m0, m1, ...m8])', () => { + expect(new Mat2([ + 1, 2, + 3, 4])).toBeVec( + 1, 2, + 3, 4); + }); + + it('should return Mat2(m0, m1, ...m8) if called with (Mat4(m0, m1, ...m9))', () => { + const v = new Mat2( + 1, 2, + 3, 4); + expect(new Mat2(v)).toBeVec(v); + }); + + it('should return Mat2(m0, m1, ...m8) if called with (Float64Array([m0, m1, ...m8]))', () => { + const arr = new Float64Array([ + 1, 2, + 3, 4]); + expect(new Mat2(arr)).toBeVec(arr); + }); + }); + + describe('static', () => { + let out: Mat2Like, matA: Mat2Like, matB: Mat2Like, identity: Mat2Like, + result: [Mat2Like, Readonly, Mat2Like] | FloatArray | Mat2Like | null | number | string; + + beforeEach(() => { + matA = new Float64Array([1, 2, 3, 4]); + matB = new Float64Array([5, 6, 7, 8]); + out = new Float64Array([0, 0, 0, 0]); + identity = new Float64Array([1, 0, 0, 1]); + }); + + describe('create', () => { + beforeEach(() => { result = Mat2.create(); }); + + it('should return a 4 element array initialized to a 2x2 identity matrix', + () => expect(result).toBeVec(identity)); + }); + + describe('clone', () => { + beforeEach(() => { result = Mat2.clone(matA); }); + + it('should return a 4 element array initialized to the values in matA', () => expect(result).toBeVec(matA)); + }); + + describe('copy', () => { + beforeEach(() => { result = Mat2.copy(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec(matA)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('identity', () => { + beforeEach(() => { result = Mat2.identity(out); }); + + it('should place values into out', () => expect(result).toBeVec(identity)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('transpose', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2.transpose(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 3, 2, 4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2.transpose(matA, matA); }); + + it('should place values into matA', () => expect(matA).toBeVec(1, 3, 2, 4)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('invert', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2.invert(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec(-2, 1, 1.5, -0.5)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2.invert(matA, matA); }); + + it('should place values into matA', () => expect(matA).toBeVec(-2, 1, 1.5, -0.5)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('adjoint', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2.adjoint(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec(4, -2, -3, 1)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2.adjoint(matA, matA); }); + + it('should place values into matA', () => expect(matA).toBeVec(4, -2, -3, 1)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('determinant', () => { + beforeEach(() => { result = Mat2.determinant(matA); }); + + it('should return the determinant', () => expect(result).toEqual(-2)); + }); + + describe('multiply', () => { + it('should have an alias called `mul`', () => expect(Mat2.mul).toEqual(Mat2.multiply)); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2.multiply(out, matA, matB); }); + + it('should place values into out', () => expect(out).toBeVec(23, 34, 31, 46)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + it('should not modify matB', () => expect(matB).toBeVec(5, 6, 7, 8)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2.multiply(matA, matA, matB); }); + + it('should place values into matA', () => expect(matA).toBeVec(23, 34, 31, 46)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(5, 6, 7, 8)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat2.multiply(matB, matA, matB); }); + + it('should place values into matB', () => expect(matB).toBeVec(23, 34, 31, 46)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('rotate', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2.rotate(out, matA, Math.PI * 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(3, 4, -1, -2)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2.rotate(matA, matA, Math.PI * 0.5); }); + + it('should place values into matA', () => expect(matA).toBeVec(3, 4, -1, -2)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('scale', () => { + let vecA: Vec2Like; + + beforeEach(() => { vecA = [2, 3]; }); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2.scale(out, matA, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(2, 4, 9, 12)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2.scale(matA, matA, vecA); }); + + it('should place values into matA', () => expect(matA).toBeVec(2, 4, 9, 12)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('str', () => { + beforeEach(() => { result = Mat2.str(matA); }); + + it('should return a string representation of the matrix', () => expect(result).toEqual('Mat2(1, 2, 3, 4)')); + }); + + describe('frob', () => { + beforeEach(() => { result = Mat2.frob(matA); }); + it('should return the Frobenius Norm of the matrix', + () => expect(result).toEqual(Math.sqrt(Math.pow(1, 2) + Math.pow(2, 2) + Math.pow(3, 2) + Math.pow(4, 2)))); + }); + + describe('LDU', () => { + let L: Mat2, D: Mat2, U: Mat2, L_result: Mat2, D_result: Mat2, U_result: Mat2; + + beforeEach(() => { + L = Mat2.create(); + D = Mat2.create(); + U = Mat2.create(); + result = Mat2.LDU(L, D, U, [4, 3, 6, 3]); + L_result = Mat2.create(); L_result[2] = 1.5; + D_result = Mat2.create(); + U_result = Mat2.create(); + U_result[0] = 4; U_result[1] = 3; U_result[3] = -1.5; + }); + + it('should return a lower triangular, a diagonal and an upper triangular matrix', () => { + // @ts-expect-error Not null + expect(result[0]).toBeVec(L_result); + // @ts-expect-error Not null + expect(result[1]).toBeVec(D_result); + // @ts-expect-error Not null + expect(result[2]).toBeVec(U_result); + }); + }); + + describe('add', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2.add(out, matA, matB); }); + + it('should place values into out', () => expect(out).toBeVec(6, 8, 10, 12)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + it('should not modify matB', () => expect(matB).toBeVec(5, 6, 7, 8)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2.add(matA, matA, matB); }); + + it('should place values into matA', () => expect(matA).toBeVec(6, 8, 10, 12)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(5, 6, 7, 8)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat2.add(matB, matA, matB); }); + + it('should place values into matB', () => expect(matB).toBeVec(6, 8, 10, 12)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('subtract', () => { + it('should have an alias called `sub`', () => expect(Mat2.sub).toEqual(Mat2.subtract)); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2.subtract(out, matA, matB); }); + + it('should place values into out', () => expect(out).toBeVec(-4, -4, -4, -4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + it('should not modify matB', () => expect(matB).toBeVec(5, 6, 7, 8)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2.subtract(matA, matA, matB); }); + + it('should place values into matA', () => expect(matA).toBeVec(-4, -4, -4, -4)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(5, 6, 7, 8)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat2.subtract(matB, matA, matB); }); + + it('should place values into matB', () => expect(matB).toBeVec(-4, -4, -4, -4)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('fromValues', () => { + beforeEach(() => { result = Mat2.fromValues(1, 2, 3, 4); }); + + it('should return a 4 element array initialized to the values passed', () => expect(result).toBeVec(1, 2, 3, 4)); + }); + + describe('set', () => { + beforeEach(() => { result = Mat2.set(out, 1, 2, 3, 4); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3, 4)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('multiplyScalar', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2.multiplyScalar(out, matA, 2); }); + + it('should place values into out', () => expect(out).toBeVec(2, 4, 6, 8)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2.multiplyScalar(matA, matA, 2); }); + + it('should place values into matA', () => expect(matA).toBeVec(2, 4, 6, 8)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('multiplyScalarAndAdd', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2.multiplyScalarAndAdd(out, matA, matB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(3.5, 5, 6.5, 8)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + it('should not modify matB', () => expect(matB).toBeVec(5, 6, 7, 8)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2.multiplyScalarAndAdd(matA, matA, matB, 0.5); }); + + it('should place values into matA', () => expect(matA).toBeVec(3.5, 5, 6.5, 8)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(5, 6, 7, 8)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat2.multiplyScalarAndAdd(matB, matA, matB, 0.5); }); + + it('should place values into matB', () => expect(matB).toBeVec(3.5, 5, 6.5, 8)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('exactEquals', () => { + let matC: Mat2Like, r0: boolean, r1: boolean; + + beforeEach(() => { + matA = [0, 1, 2, 3]; + matB = [0, 1, 2, 3]; + matC = [1, 2, 3, 4]; + r0 = Mat2.exactEquals(matA, matB); + r1 = Mat2.exactEquals(matA, matC); + }); + + it('should return true for identical matrices', () => expect(r0).toBe(true)); + it('should return false for different matrices', () => expect(r1).toBe(false)); + it('should not modify matA', () => expect(matA).toBeVec(0, 1, 2, 3)); + it('should not modify matB', () => expect(matB).toBeVec(0, 1, 2, 3)); + }); + + describe('equals', () => { + let matC: Mat2Like, matD: Mat2Like, r0: boolean, r1: boolean, r2: boolean; + + beforeEach(() => { + matA = [0, 1, 2, 3]; + matB = [0, 1, 2, 3]; + matC = [1, 2, 3, 4]; + matD = [1e-16, 1, 2, 3]; + r0 = Mat2.equals(matA, matB); + r1 = Mat2.equals(matA, matC); + r2 = Mat2.equals(matA, matD); + }); + + it('should return true for identical matrices', () => expect(r0).toBe(true)); + it('should return false for different matrices', () => expect(r1).toBe(false)); + it('should return true for close but not identical matrices', () => expect(r2).toBe(true)); + it('should not modify matA', () => expect(matA).toBeVec(0, 1, 2, 3)); + it('should not modify matB', () => expect(matB).toBeVec(0, 1, 2, 3)); + }); + }); +}); diff --git a/tests/f64/Mat2d.spec.ts b/tests/f64/Mat2d.spec.ts new file mode 100644 index 00000000..409c04cb --- /dev/null +++ b/tests/f64/Mat2d.spec.ts @@ -0,0 +1,390 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Mat2d } from '#gl-matrix/f64'; + +import type { Mat2dLike, Vec2Like } from '#gl-matrix/types'; + +describe('Mat2d', () => { + describe('constructor', () => { + it('should return an identity Mat2d if called with no arguments', () => { + expect(new Mat2d()).toBeVec( + 1, 0, + 0, 1, + 0, 0); + }); + + it('should return Mat2d(m0, m1, ...m5) if called with (m0, m1, ...m5)', () => { + expect(new Mat2d( + 1, 2, + 3, 4, + 5, 6)).toBeVec( + 1, 2, + 3, 4, + 5, 6); + }); + + it('should return Mat2d(x, x, x, ...) if called with (x)', () => { + expect(new Mat2d(1)).toBeVec( + 1, 1, + 1, 1, + 1, 1); + }); + + it('should return Mat2d(m0, m1, ...m8) if called with ([m0, m1, ...m8])', () => { + expect(new Mat2d([ + 1, 2, + 3, 4, + 5, 6])).toBeVec( + 1, 2, + 3, 4, + 5, 6); + }); + + it('should return Mat2d(m0, m1, ...m8) if called with (Mat2d(m0, m1, ...m9))', () => { + const v = new Mat2d( + 1, 2, + 3, 4, + 5, 6); + expect(new Mat2d(v)).toBeVec(v); + }); + + it('should return Mat2d(m0, m1, ...m8) if called with (Float64Array([m0, m1, ...m8]))', () => { + const arr = new Float64Array([ + 1, 2, + 3, 4, + 5, 6]); + expect(new Mat2d(arr)).toBeVec(arr); + }); + }); + + describe('static', () => { + let out: Mat2dLike, matA: Mat2dLike, matB: Mat2dLike, oldA: Mat2dLike, oldB: Mat2dLike, + identity: Mat2dLike, result: Mat2dLike | null | number | string; + + beforeEach(() => { + matA = new Float64Array([1, 2, + 3, 4, + 5, 6]); + + oldA = new Float64Array([1, 2, + 3, 4, + 5, 6]); + + matB = new Float64Array([7, 8, + 9, 10, + 11, 12]); + + oldB = new Float64Array([7, 8, + 9, 10, + 11, 12]); + + out = new Float64Array([0, 0, + 0, 0, + 0, 0]); + + identity = new Float64Array([1, 0, + 0, 1, + 0, 0]); + }); + + describe('create', () => { + beforeEach(() => { result = Mat2d.create(); }); + + it('should return a 6 element array initialized to a 2x3 identity matrix', + () => expect(result).toBeVec(identity)); + }); + + describe('clone', () => { + beforeEach(() => { result = Mat2d.clone(matA); }); + + it('should return a 6 element array initialized to the values in matA', () => expect(result).toBeVec(matA)); + }); + + describe('copy', () => { + beforeEach(() => { result = Mat2d.copy(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec(matA)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('identity', () => { + beforeEach(() => { result = Mat2d.identity(out); }); + + it('should place values into out', () => expect(result).toBeVec(identity)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('invert', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2d.invert(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec(-2, 1, 1.5, -0.5, 1, -2)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(oldA)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2d.invert(matA, matA); }); + + it('should place values into matA', () => expect(matA).toBeVec(-2, 1, 1.5, -0.5, 1, -2)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('determinant', () => { + beforeEach(() => { result = Mat2d.determinant(matA); }); + + it('should return the determinant', () => expect(result).toEqual(-2)); + }); + + describe('multiply', () => { + it('should have an alias called `mul`', () => expect(Mat2d.mul).toEqual(Mat2d.multiply)); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2d.multiply(out, matA, matB); }); + + it('should place values into out', () => expect(out).toBeVec(31, 46, 39, 58, 52, 76)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(oldA)); + it('should not modify matB', () => expect(matB).toBeVec(oldB)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2d.multiply(matA, matA, matB); }); + + it('should place values into matA', () => expect(matA).toBeVec(31, 46, 39, 58, 52, 76)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(oldB)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat2d.multiply(matB, matA, matB); }); + + it('should place values into matB', () => expect(matB).toBeVec(31, 46, 39, 58, 52, 76)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(oldA)); + }); + }); + + describe('rotate', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2d.rotate(out, matA, Math.PI * 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(3, 4, -1, -2, 5, 6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(oldA)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2d.rotate(matA, matA, Math.PI * 0.5); }); + + it('should place values into matA', () => expect(matA).toBeVec(3, 4, -1, -2, 5, 6)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('scale', () => { + let vecA: Vec2Like; + beforeEach(() => { vecA = [2, 3]; }); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2d.scale(out, matA, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(2, 4, 9, 12, 5, 6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(oldA)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2d.scale(matA, matA, vecA); }); + + it('should place values into matA', () => expect(matA).toBeVec(2, 4, 9, 12, 5, 6)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('translate', () => { + let vecA: Vec2Like; + beforeEach(() => { vecA = [2, 3]; }); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2d.translate(out, matA, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3, 4, 16, 22)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(oldA)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2d.translate(matA, matA, vecA); }); + + it('should place values into matA', () => expect(matA).toBeVec(1, 2, 3, 4, 16, 22)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('str', () => { + beforeEach(() => { result = Mat2d.str(matA); }); + + it('should return a string representation of the matrix', + () => expect(result).toEqual('Mat2d(1, 2, 3, 4, 5, 6)')); + }); + + describe('frob', () => { + beforeEach(() => { result = Mat2d.frob(matA); }); + + it('should return the Frobenius Norm of the matrix', () => expect(result).toEqual(Math.sqrt(Math.pow(1, 2) + + Math.pow(2, 2) + Math.pow(3, 2) + Math.pow(4, 2) + Math.pow(5, 2) + Math.pow(6, 2) + 1))); + }); + + describe('add', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2d.add(out, matA, matB); }); + + it('should place values into out', () => expect(out).toBeVec(8, 10, 12, 14, 16, 18)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(oldA)); + it('should not modify matB', () => expect(matB).toBeVec(oldB)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2d.add(matA, matA, matB); }); + + it('should place values into matA', () => expect(matA).toBeVec(8, 10, 12, 14, 16, 18)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(oldB)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat2d.add(matB, matA, matB); }); + + it('should place values into matB', () => expect(matB).toBeVec(8, 10, 12, 14, 16, 18)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(oldA)); + }); + }); + + describe('subtract', () => { + it('should have an alias called `sub`', () => expect(Mat2d.sub).toEqual(Mat2d.subtract)); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2d.subtract(out, matA, matB); }); + + it('should place values into out', () => expect(out).toBeVec(-6, -6, -6, -6, -6, -6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(oldA)); + it('should not modify matB', () => expect(matB).toBeVec(oldB)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2d.subtract(matA, matA, matB); }); + + it('should place values into matA', () => expect(matA).toBeVec(-6, -6, -6, -6, -6, -6)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(oldB)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat2d.subtract(matB, matA, matB); }); + + it('should place values into matB', () => expect(matB).toBeVec(-6, -6, -6, -6, -6, -6)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(oldA)); + }); + }); + + describe('fromValues', () => { + beforeEach(() => { result = Mat2d.fromValues(1, 2, 3, 4, 5, 6); }); + + it('should return a 6 element array initialized to the values passed', + () => expect(result).toBeVec(1, 2, 3, 4, 5, 6)); + }); + + describe('set', () => { + beforeEach(() => { result = Mat2d.set(out, 1, 2, 3, 4, 5, 6); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3, 4, 5, 6)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('multiplyScalar', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2d.multiplyScalar(out, matA, 2); }); + + it('should place values into out', () => expect(out).toBeVec(2, 4, 6, 8, 10, 12)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2d.multiplyScalar(matA, matA, 2); }); + + it('should place values into matA', () => expect(matA).toBeVec(2, 4, 6, 8, 10, 12)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('multiplyScalarAndAdd', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat2d.multiplyScalarAndAdd(out, matA, matB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(4.5, 6, 7.5, 9, 10.5, 12)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6)); + it('should not modify matB', () => expect(matB).toBeVec(7, 8, 9, 10, 11, 12)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat2d.multiplyScalarAndAdd(matA, matA, matB, 0.5); }); + + it('should place values into matA', () => expect(matA).toBeVec(4.5, 6, 7.5, 9, 10.5, 12)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(7, 8, 9, 10, 11, 12)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat2d.multiplyScalarAndAdd(matB, matA, matB, 0.5); }); + + it('should place values into matB', () => expect(matB).toBeVec(4.5, 6, 7.5, 9, 10.5, 12)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6)); + }); + }); + + describe('exactEquals', () => { + let matC: Mat2dLike, r0: boolean, r1: boolean; + beforeEach(() => { + matA = [0, 1, 2, 3, 4, 5]; + matB = [0, 1, 2, 3, 4, 5]; + matC = [1, 2, 3, 4, 5, 6]; + r0 = Mat2d.exactEquals(matA, matB); + r1 = Mat2d.exactEquals(matA, matC); + }); + + it('should return true for identical matrices', () => expect(r0).toBe(true)); + it('should return false for different matrices', () => expect(r1).toBe(false)); + it('should not modify matA', () => expect(matA).toBeVec(0, 1, 2, 3, 4, 5)); + it('should not modify matB', () => expect(matB).toBeVec(0, 1, 2, 3, 4, 5)); + }); + + describe('equals', () => { + let matC: Mat2dLike, matD: Mat2dLike, r0: boolean, r1: boolean, r2: boolean; + + beforeEach(() => { + matA = [0, 1, 2, 3, 4, 5]; + matB = [0, 1, 2, 3, 4, 5]; + matC = [1, 2, 3, 4, 5, 6]; + matD = [1e-16, 1, 2, 3, 4, 5]; + r0 = Mat2d.equals(matA, matB); + r1 = Mat2d.equals(matA, matC); + r2 = Mat2d.equals(matA, matD); + }); + + it('should return true for identical matrices', () => expect(r0).toBe(true)); + it('should return false for different matrices', () => expect(r1).toBe(false)); + it('should return true for close but not identical matrices', () => expect(r2).toBe(true)); + it('should not modify matA', () => expect(matA).toBeVec(0, 1, 2, 3, 4, 5)); + it('should not modify matB', () => expect(matB).toBeVec(0, 1, 2, 3, 4, 5)); + }); + }); +}); diff --git a/tests/f64/Mat3.spec.ts b/tests/f64/Mat3.spec.ts new file mode 100644 index 00000000..ac9835b6 --- /dev/null +++ b/tests/f64/Mat3.spec.ts @@ -0,0 +1,581 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Mat3, Mat4, Vec3 } from '#gl-matrix/f64'; + +import type { Mat3Like, Mat4Like, Vec4Like } from '#gl-matrix/types'; + +describe('Mat3', () => { + describe('constructor', () => { + it('should return an identity Mat3 if called with no arguments', () => { + expect(new Mat3()).toBeVec( + 1, 0, 0, + 0, 1, 0, + 0, 0, 1); + }); + + it('should return Mat3(m0, m1, ...m8) if called with (m0, m1, ...m8)', () => { + expect(new Mat3( + 1, 2, 3, + 4, 5, 6, + 7, 8, 9)).toBeVec( + 1, 2, 3, + 4, 5, 6, + 7, 8, 9); + }); + + it('should return Mat3(x, x, x, ...) if called with (x)', () => { + expect(new Mat3(1)).toBeVec( + 1, 1, 1, + 1, 1, 1, + 1, 1, 1); + }); + + it('should return Mat3(m0, m1, ...m8) if called with ([m0, m1, ...m8])', () => { + expect(new Mat3([ + 1, 2, 3, + 4, 5, 6, + 7, 8, 9])).toBeVec( + 1, 2, 3, + 4, 5, 6, + 7, 8, 9); + }); + + it('should return Mat3(m0, m1, ...m8) if called with (Mat3(m0, m1, ...m9))', () => { + const v = new Mat3( + 1, 2, 3, + 4, 5, 6, + 7, 8, 9); + expect(new Mat3(v)).toBeVec(v); + }); + + it('should return Mat3(m0, m1, ...m8) if called with (Float64Array([m0, m1, ...m8]))', () => { + const arr = new Float64Array([ + 1, 2, 3, + 4, 5, 6, + 7, 8, 9]); + expect(new Mat3(arr)).toBeVec(arr); + }); + }); + + describe('static', () => { + let out: Mat3Like, matA: Mat3Like, matB: Mat3Like, mat4: Mat4Like, identity: Mat3Like, + result: Mat3Like | null | number | string; + + beforeEach(() => { + matA = new Float64Array([1, 0, 0, + 0, 1, 0, + 1, 2, 1]); + + matB = new Float64Array([1, 0, 0, + 0, 1, 0, + 3, 4, 1]); + + out = new Float64Array([0, 0, 0, + 0, 0, 0, + 0, 0, 0]); + + identity = new Float64Array([1, 0, 0, + 0, 1, 0, + 0, 0, 1]); + }); + + describe('normalFromMat4', () => { + beforeEach(() => { + mat4 = new Float64Array([1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1]); + result = Mat3.normalFromMat4(out, mat4); + }); + + it('should return out', () => expect(result).toBe(out)); + + describe('with translation and rotation', () => { + beforeEach(() => { + Mat4.translate(mat4, mat4, [2, 4, 6]); + Mat4.rotateX(mat4, mat4, Math.PI / 2); + + result = Mat3.normalFromMat4(out, mat4); + }); + + it('should give rotated matrix', () => { + expect(result).toBeVec( + 1, 0, 0, + 0, 0, 1, + 0, -1, 0); + }); + + describe('and scale', () => { + beforeEach(() => { + Mat4.scale(mat4, mat4, [2, 3, 4]); + + result = Mat3.normalFromMat4(out, mat4); + }); + + it('should give rotated matrix', () => { + expect(result).toBeVec( + 0.5, 0, 0, + 0, 0, 0.333333, + 0, -0.25, 0); + }); + }); + }); + }); + + describe('fromQuat', () => { + let q: Vec4Like; + + beforeEach(() => { + q = [0, -0.7071067811865475, 0, 0.7071067811865475]; + result = Mat3.fromQuat(out, q); + }); + + it('should return out', () => expect(result).toBe(out)); + + it('should rotate a vector the same as the original quat', () => { + const vecOut = new Vec3(); + Vec3.transformQuat(vecOut, [0, 0, -1], q); + expect(Vec3.transformMat3([0, 0, 0], [0, 0, -1], out)).toBeVec(vecOut); + }); + + it('should rotate a vector by PI/2 radians', + () => expect(Vec3.transformMat3([0, 0, 0], [0, 0, -1], out)).toBeVec(1, 0, 0)); + }); + + describe('fromMat4', () => { + beforeEach(() => { + result = Mat3.fromMat4(out, [ + 1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16]); + }); + + it('should return out', () => expect(result).toBe(out)); + + it('should calculate proper Mat3', () => { + expect(out).toBeVec( + 1, 2, 3, + 5, 6, 7, + 9, 10, 11); + }); + }); + + describe('scale', () => { + beforeEach(() => { result = Mat3.scale(out, matA, [2, 2]); }); + + it('should return out', () => expect(result).toBe(out)); + it('should place proper values in out', () => { + expect(out).toBeVec( + 2, 0, 0, + 0, 2, 0, + 1, 2, 1); + }); + }); + + describe('create', () => { + beforeEach(() => { result = Mat3.create(); }); + + it('should return a 9 element array initialized to a 3x3 identity matrix', + () => expect(result).toBeVec(identity)); + }); + + describe('clone', () => { + beforeEach(() => { result = Mat3.clone(matA); }); + + it('should return a 9 element array initialized to the values in matA', () => expect(result).toBeVec(matA)); + }); + + describe('copy', () => { + beforeEach(() => { result = Mat3.copy(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec(matA)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('identity', () => { + beforeEach(() => { result = Mat3.identity(out); }); + + it('should place values into out', () => expect(result).toBeVec(identity)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('transpose', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat3.transpose(out, matA); }); + + it('should place values into out', () => { + expect(out).toBeVec( + 1, 0, 1, + 0, 1, 2, + 0, 0, 1 + ); + }); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => { + expect(matA).toBeVec( + 1, 0, 0, + 0, 1, 0, + 1, 2, 1 + ); + }); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat3.transpose(matA, matA); }); + + it('should place values into matA', () => { + expect(matA).toBeVec( + 1, 0, 1, + 0, 1, 2, + 0, 0, 1 + ); + }); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('invert', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat3.invert(out, matA); }); + + it('should place values into out', () => { + expect(out).toBeVec( + 1, 0, 0, + 0, 1, 0, + -1, -2, 1 + ); + }); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => { + expect(matA).toBeVec( + 1, 0, 0, + 0, 1, 0, + 1, 2, 1 + ); + }); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat3.invert(matA, matA); }); + + it('should place values into matA', () => { + expect(matA).toBeVec( + 1, 0, 0, + 0, 1, 0, + -1, -2, 1 + ); + }); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('adjoint', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat3.adjoint(out, matA); }); + + it('should place values into out', () => { + expect(out).toBeVec( + 1, 0, 0, + 0, 1, 0, + -1, -2, 1 + ); + }); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => { + expect(matA).toBeVec( + 1, 0, 0, + 0, 1, 0, + 1, 2, 1 + ); + }); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat3.adjoint(matA, matA); }); + + it('should place values into matA', () => { + expect(matA).toBeVec( + 1, 0, 0, + 0, 1, 0, + -1, -2, 1 + ); + }); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('determinant', () => { + beforeEach(() => { result = Mat3.determinant(matA); }); + + it('should return the determinant', () => expect(result).toEqual(1)); + }); + + describe('multiply', () => { + it('should have an alias called `mul`', () => expect(Mat3.mul).toEqual(Mat3.multiply)); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat3.multiply(out, matA, matB); }); + + it('should place values into out', () => { + expect(out).toBeVec( + 1, 0, 0, + 0, 1, 0, + 4, 6, 1 + ); + }); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => { + expect(matA).toBeVec( + 1, 0, 0, + 0, 1, 0, + 1, 2, 1 + ); + }); + it('should not modify matB', () => { + expect(matB).toBeVec( + 1, 0, 0, + 0, 1, 0, + 3, 4, 1 + ); + }); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat3.multiply(matA, matA, matB); }); + + it('should place values into matA', () => { + expect(matA).toBeVec( + 1, 0, 0, + 0, 1, 0, + 4, 6, 1 + ); + }); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => { + expect(matB).toBeVec( + 1, 0, 0, + 0, 1, 0, + 3, 4, 1 + ); + }); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat3.multiply(matB, matA, matB); }); + + it('should place values into matB', () => { + expect(matB).toBeVec( + 1, 0, 0, + 0, 1, 0, + 4, 6, 1 + ); + }); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => { + expect(matA).toBeVec( + 1, 0, 0, + 0, 1, 0, + 1, 2, 1 + ); + }); + }); + }); + + describe('str', () => { + beforeEach(() => { result = Mat3.str(matA); }); + + it('should return a string representation of the matrix', + () => expect(result).toEqual('Mat3(1, 0, 0, 0, 1, 0, 1, 2, 1)')); + }); + + describe('frob', () => { + beforeEach(() => { result = Mat3.frob(matA); }); + + it('should return the Frobenius Norm of the matrix', () => expect(result).toEqual(Math.sqrt(Math.pow(1, 2) + + Math.pow(0, 2) + Math.pow(0, 2) + Math.pow(0, 2) + Math.pow(1, 2) + Math.pow(0, 2) + Math.pow(1, 2) + + Math.pow(2, 2) + Math.pow(1, 2)))); + }); + + describe('add', () => { + beforeEach(() => { + matA = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + matB = [10, 11, 12, 13, 14, 15, 16, 17, 18]; + }); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat3.add(out, matA, matB); }); + + it('should place values into out', () => expect(out).toBeVec(11, 13, 15, 17, 19, 21, 23, 25, 27)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9)); + it('should not modify matB', () => expect(matB).toBeVec(10, 11, 12, 13, 14, 15, 16, 17, 18)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat3.add(matA, matA, matB); }); + + it('should place values into matA', () => expect(matA).toBeVec(11, 13, 15, 17, 19, 21, 23, 25, 27)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(10, 11, 12, 13, 14, 15, 16, 17, 18)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat3.add(matB, matA, matB); }); + + it('should place values into matB', () => expect(matB).toBeVec(11, 13, 15, 17, 19, 21, 23, 25, 27)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9)); + }); + }); + + describe('subtract', () => { + beforeEach(() => { + matA = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + matB = [10, 11, 12, 13, 14, 15, 16, 17, 18]; + }); + + it('should have an alias called `sub`', () => expect(Mat3.sub).toEqual(Mat3.subtract)); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat3.subtract(out, matA, matB); }); + + it('should place values into out', () => expect(out).toBeVec(-9, -9, -9, -9, -9, -9, -9, -9, -9)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9)); + it('should not modify matB', () => expect(matB).toBeVec(10, 11, 12, 13, 14, 15, 16, 17, 18)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat3.subtract(matA, matA, matB); }); + + it('should place values into matA', () => expect(matA).toBeVec(-9, -9, -9, -9, -9, -9, -9, -9, -9)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(10, 11, 12, 13, 14, 15, 16, 17, 18)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat3.subtract(matB, matA, matB); }); + + it('should place values into matB', () => expect(matB).toBeVec(-9, -9, -9, -9, -9, -9, -9, -9, -9)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9)); + }); + }); + + describe('fromValues', () => { + beforeEach(() => { result = Mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9); }); + + it('should return a 9 element array initialized to the values passed', + () => expect(result).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9)); + }); + + describe('set', () => { + beforeEach(() => { result = Mat3.set(out, 1, 2, 3, 4, 5, 6, 7, 8, 9); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('multiplyScalar', () => { + beforeEach(() => { matA = [1, 2, 3, 4, 5, 6, 7, 8, 9]; }); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat3.multiplyScalar(out, matA, 2); }); + + it('should place values into out', () => expect(out).toBeVec(2, 4, 6, 8, 10, 12, 14, 16, 18)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat3.multiplyScalar(matA, matA, 2); }); + + it('should place values into matA', () => expect(matA).toBeVec(2, 4, 6, 8, 10, 12, 14, 16, 18)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('multiplyScalarAndAdd', () => { + beforeEach(() => { + matA = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + matB = [10, 11, 12, 13, 14, 15, 16, 17, 18]; + }); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat3.multiplyScalarAndAdd(out, matA, matB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(6, 7.5, 9, 10.5, 12, 13.5, 15, 16.5, 18)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9)); + it('should not modify matB', () => expect(matB).toBeVec(10, 11, 12, 13, 14, 15, 16, 17, 18)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat3.multiplyScalarAndAdd(matA, matA, matB, 0.5); }); + + it('should place values into matA', () => expect(matA).toBeVec(6, 7.5, 9, 10.5, 12, 13.5, 15, 16.5, 18)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec(10, 11, 12, 13, 14, 15, 16, 17, 18)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat3.multiplyScalarAndAdd(matB, matA, matB, 0.5); }); + + it('should place values into matB', () => expect(matB).toBeVec(6, 7.5, 9, 10.5, 12, 13.5, 15, 16.5, 18)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9)); + }); + }); + + describe('projection', () => { + beforeEach(() => { result = Mat3.projection(out, 100.0, 200.0); }); + + it('should return out', () => expect(result).toBe(out)); + + it('should give projection matrix', () => { + expect(result).toBeVec( + 0.02, 0, 0, + 0, -0.01, 0, + -1, 1, 1); + }); + }); + + describe('exactEquals', () => { + let matC: Mat3Like, r0: boolean, r1: boolean; + + beforeEach(() => { + matA = [0, 1, 2, 3, 4, 5, 6, 7, 8]; + matB = [0, 1, 2, 3, 4, 5, 6, 7, 8]; + matC = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + r0 = Mat3.exactEquals(matA, matB); + r1 = Mat3.exactEquals(matA, matC); + }); + + it('should return true for identical matrices', () => expect(r0).toBe(true)); + it('should return false for different matrices', () => expect(r1).toBe(false)); + it('should not modify matA', () => expect(matA).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8)); + it('should not modify matB', () => expect(matB).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8)); + }); + + describe('equals', () => { + let matC: Mat3Like, matD: Mat3Like, r0: boolean, r1: boolean, r2: boolean; + + beforeEach(() => { + matA = [0, 1, 2, 3, 4, 5, 6, 7, 8]; + matB = [0, 1, 2, 3, 4, 5, 6, 7, 8]; + matC = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + matD = [1e-16, 1, 2, 3, 4, 5, 6, 7, 8]; + r0 = Mat3.equals(matA, matB); + r1 = Mat3.equals(matA, matC); + r2 = Mat3.equals(matA, matD); + }); + + it('should return true for identical matrices', () => expect(r0).toBe(true)); + it('should return false for different matrices', () => expect(r1).toBe(false)); + it('should return true for close but not identical matrices', () => expect(r2).toBe(true)); + it('should not modify matA', () => expect(matA).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8)); + it('should not modify matB', () => expect(matB).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8)); + }); + }); +}); diff --git a/tests/f64/Mat4.spec.ts b/tests/f64/Mat4.spec.ts new file mode 100644 index 00000000..79f7728c --- /dev/null +++ b/tests/f64/Mat4.spec.ts @@ -0,0 +1,1167 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Mat4, Quat, Vec3 } from '#gl-matrix/f64'; + +import type { FloatArray, Mat4Like, Vec3Like, Vec4Like } from '#gl-matrix/types'; + +describe('Mat4', () => { + describe('constructor', () => { + it('should return an identity Mat4 if called with no arguments', () => { + expect(new Mat4()).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + }); + + it('should return Mat4(m0, m1, ...m15) if called with (m0, m1, ...m15)', () => { + expect(new Mat4( + 1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16)).toBeVec( + 1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16); + }); + + it('should return Mat4(x, x, x) if called with (x)', () => { + expect(new Mat4(1)).toBeVec( + 1, 1, 1, 1, + 1, 1, 1, 1, + 1, 1, 1, 1, + 1, 1, 1, 1); + }); + + it('should return Mat4(m0, m1, ...m15) if called with ([m0, m1, ...m15])', () => { + expect(new Mat4([ + 1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16])).toBeVec( + 1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16); + }); + + it('should return Mat4(m0, m1, ...m15) if called with (Mat4(m0, m1, ...m15))', () => { + const v = new Mat4( + 1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16); + expect(new Mat4(v)).toBeVec(v); + }); + + it('should return Mat4(m0, m1, ...m15) if called with (Float64Array([m0, m1, ...m15]))', () => { + const arr = new Float64Array([ + 1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16]); + expect(new Mat4(arr)).toBeVec(arr); + }); + }); + + describe('static', () => { + let out: Mat4Like, matA: Mat4Like, matB: Mat4Like, identity: Mat4Like, + result: Mat4Like | Vec3Like | Vec4Like | null | number | string; + + beforeEach(() => { + // Attempting to portray a semi-realistic transform matrix + matA = new Float64Array([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + ]); + + matB = new Float64Array([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 4, 5, 6, 1 + ]); + + out = new Float64Array([ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0 + ]); + + identity = new Float64Array([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]); + }); + + describe('create', () => { + beforeEach(() => { result = Mat4.create(); }); + + it('should return a 16 element array initialized to a 4x4 identity matrix', + () => expect(result).toBeVec(identity)); + }); + + describe('clone', () => { + beforeEach(() => { result = Mat4.clone(matA); }); + + it('should return a 16 element array initialized to the values in matA', () => expect(result).toBeVec(matA)); + }); + + describe('copy', () => { + beforeEach(() => { result = Mat4.copy(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec(matA)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('identity', () => { + beforeEach(() => { result = Mat4.identity(out); }); + + it('should place values into out', () => expect(result).toBeVec(identity)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('transpose', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.transpose(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec( + 1, 0, 0, 1, + 0, 1, 0, 2, + 0, 0, 1, 3, + 0, 0, 0, 1 + )); + + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.transpose(matA, matA); }); + + it('should place values into matA', () => expect(matA).toBeVec( + 1, 0, 0, 1, + 0, 1, 0, 2, + 0, 0, 1, 3, + 0, 0, 0, 1 + )); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('invert', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.invert(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + -1, -2, -3, 1 + )); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.invert(matA, matA); }); + + it('should place values into matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + -1, -2, -3, 1 + )); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('adjoint', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.adjoint(out, matA); }); + + it('should place values into out', () => expect(out).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + -1, -2, -3, 1 + )); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.adjoint(matA, matA); }); + + it('should place values into matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + -1, -2, -3, 1 + )); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('determinant', () => { + beforeEach(() => { result = Mat4.determinant(matA); }); + + it('should return the determinant', () => expect(result).toEqual(1)); + }); + + describe('multiply', () => { + it('should have an alias called `mul`', () => expect(Mat4.mul).toEqual(Mat4.multiply)); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.multiply(out, matA, matB); }); + + it('should place values into out', () => expect(out).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 5, 7, 9, 1 + )); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + it('should not modify matB', () => expect(matB).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 4, 5, 6, 1 + )); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.multiply(matA, matA, matB); }); + + it('should place values into matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 5, 7, 9, 1 + )); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', () => expect(matB).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 4, 5, 6, 1 + )); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat4.multiply(matB, matA, matB); }); + + it('should place values into matB', () => expect(matB).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 5, 7, 9, 1 + )); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + }); + }); + + describe('translate', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.translate(out, matA, [4, 5, 6]); }); + + it('should place values into out', () => expect(out).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 5, 7, 9, 1 + )); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.translate(matA, matA, [4, 5, 6]); }); + + it('should place values into matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 5, 7, 9, 1 + )); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('scale', () => { + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.scale(out, matA, [4, 5, 6]); }); + + it('should place values into out', () => expect(out).toBeVec( + 4, 0, 0, 0, + 0, 5, 0, 0, + 0, 0, 6, 0, + 1, 2, 3, 1 + )); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.scale(matA, matA, [4, 5, 6]); }); + + it('should place values into matA', () => expect(matA).toBeVec( + 4, 0, 0, 0, + 0, 5, 0, 0, + 0, 0, 6, 0, + 1, 2, 3, 1 + )); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('rotate', () => { + const rad = Math.PI * 0.5; + const axis: Vec3Like = [1, 0, 0]; + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.rotate(out, matA, rad, axis); }); + + it('should place values into out', () => expect(out).toBeVec( + 1, 0, 0, 0, + 0, Math.cos(rad), Math.sin(rad), 0, + 0, -Math.sin(rad), Math.cos(rad), 0, + 1, 2, 3, 1 + )); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.rotate(matA, matA, rad, axis); }); + + it('should place values into matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, Math.cos(rad), Math.sin(rad), 0, + 0, -Math.sin(rad), Math.cos(rad), 0, + 1, 2, 3, 1 + )); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('rotateX', () => { + const rad = Math.PI * 0.5; + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.rotateX(out, matA, rad); }); + + it('should place values into out', () => expect(out).toBeVec( + 1, 0, 0, 0, + 0, Math.cos(rad), Math.sin(rad), 0, + 0, -Math.sin(rad), Math.cos(rad), 0, + 1, 2, 3, 1 + )); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.rotateX(matA, matA, rad); }); + + it('should place values into matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, Math.cos(rad), Math.sin(rad), 0, + 0, -Math.sin(rad), Math.cos(rad), 0, + 1, 2, 3, 1 + )); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('rotateY', () => { + const rad = Math.PI * 0.5; + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.rotateY(out, matA, rad); }); + + it('should place values into out', () => expect(out).toBeVec( + Math.cos(rad), 0, -Math.sin(rad), 0, + 0, 1, 0, 0, + Math.sin(rad), 0, Math.cos(rad), 0, + 1, 2, 3, 1 + )); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.rotateY(matA, matA, rad); }); + + it('should place values into matA', () => expect(matA).toBeVec( + Math.cos(rad), 0, -Math.sin(rad), 0, + 0, 1, 0, 0, + Math.sin(rad), 0, Math.cos(rad), 0, + 1, 2, 3, 1 + )); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('rotateZ', () => { + const rad = Math.PI * 0.5; + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.rotateZ(out, matA, rad); }); + + it('should place values into out', () => expect(out).toBeVec( + Math.cos(rad), Math.sin(rad), 0, 0, + -Math.sin(rad), Math.cos(rad), 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.rotateZ(matA, matA, rad); }); + + it('should place values into matA', () => expect(matA).toBeVec( + Math.cos(rad), Math.sin(rad), 0, 0, + -Math.sin(rad), Math.cos(rad), 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1 + )); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + // TODO: fromRotationTranslation + + describe('normalFromMat4', () => { + beforeEach(() => { + matA = new Float64Array([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1]); + result = Mat4.normalFromMat4(out, matA); + }); + + it('should return out', () => expect(result).toBe(out)); + + describe('with translation and rotation', () => { + beforeEach(() => { + Mat4.translate(matA, matA, [2, 4, 6]); + Mat4.rotateX(matA, matA, Math.PI / 2); + + result = Mat4.normalFromMat4(out, matA); + }); + + it('should give rotated matrix', () => expect(result).toBeVec( + 1, 0, 0, 0, + 0, 0, 1, 0, + 0, -1, 0, 0, + 0, 0, 0, 1 + )); + + describe('and scale', () => { + beforeEach(() => { + Mat4.scale(matA, matA, [2, 3, 4]); + + result = Mat4.normalFromMat4(out, matA); + }); + + it('should give rotated matrix', () => expect(result).toBeVec( + 0.5, 0, 0, 0, + 0, 0, 0.333333, 0, + 0, -0.25, 0, 0, + 0, 0, 0, 1 + )); + }); + }); + }); + + describe('getTranslation', () => { + describe('from the identity matrix', () => { + beforeEach(() => { + result = Vec3.fromValues(1, 2, 3); + out = Vec3.fromValues(1, 2, 3); + result = Mat4.getTranslation(out, identity); + }); + + it('should place result both in result and out', () => expect(result).toBe(out)); + it('should return the zero vector', () => expect(result).toBeVec(0, 0, 0)); + }); + + describe('from a translation-only matrix', () => { + beforeEach(() => { + result = new Vec3(1, 2, 3); + out = new Vec3(1, 2, 3); + result = Mat4.getTranslation(out, matB); + }); + + it('should return translation vector', () => expect(out).toBeVec(4, 5, 6)); + }); + + describe('from a translation and rotation matrix', () => { + beforeEach(() => { + const q = new Quat(); + const v = new Vec3(5, 6, 7); + Quat.setAxisAngle(q, [0.26726124, 0.534522474, 0.8017837], 0.55); + Mat4.fromRotationTranslation(out, q, v); + + result = new Vec3(); + Mat4.getTranslation(result, out); + }); + + it('should keep the same translation vector, regardless of rotation', () => expect(result).toBeVec(5, 6, 7)); + }); + }); + + describe('getScaling', () => { + describe('from the identity matrix', () => { + beforeEach(() => { + result = new Vec3(1, 2, 3); + out = new Vec3(1, 2, 3); + result = Mat4.getScaling(out, identity); + }); + + it('should place result both in result and out', () => expect(result).toBe(out)); + it('should return the identity vector', () => expect(result).toBeVec(1, 1, 1)); + }); + + describe('from a scale-only matrix', () => { + beforeEach(() => { + const v = new Vec3(4, 5, 6); + result = new Vec3(1, 2, 3); + out = new Vec3(1, 2, 3); + Mat4.fromScaling(matA, v); + result = Mat4.getScaling(out, matA); + }); + + it('should return translation vector', () => expect(out).toBeVec(4, 5, 6)); + }); + + describe('from a translation and rotation matrix', () => { + beforeEach(() => { + let q = Quat.create(); + const v = Vec3.fromValues(5, 6, 7); + q = Quat.setAxisAngle(q, [1, 0, 0], 0.5) as Quat; + Mat4.fromRotationTranslation(out, q, v); + + result = Vec3.fromValues(1, 2, 3); + Mat4.getScaling(result, out); + }); + + it('should return the identity vector', () => expect(result).toBeVec(1, 1, 1)); + }); + + describe('from a translation, rotation and scale matrix', () => { + beforeEach(() => { + let q = Quat.create(); + const t = Vec3.fromValues(1, 2, 3); + const s = Vec3.fromValues(5, 6, 7); + q = Quat.setAxisAngle(q, [0, 1, 0], 0.7) as Quat; + Mat4.fromRotationTranslationScale(out, q, t, s); + result = Vec3.fromValues(5, 6, 7); + Mat4.getScaling(result, out); + }); + + it('should return the same scaling factor when created', () => expect(result).toBeVec(5, 6, 7)); + }); + }); + + describe('getRotation', () => { + describe('from the identity matrix', () => { + beforeEach(() => { + result = Quat.fromValues(1, 2, 3, 4); + out = Quat.fromValues(1, 2, 3, 4); + result = Mat4.getRotation(out, identity); + }); + + it('should place result both in result and out', () => expect(result).toBe(out)); + it('should return the unit quaternion', () => { + const unitQuat = Quat.create(); + Quat.identity(unitQuat); + expect(result).toBeVec(unitQuat); + }); + }); + + describe('from a translation-only matrix', () => { + beforeEach(() => { + result = Quat.fromValues(1, 2, 3, 4); + out = Quat.fromValues(1, 2, 3, 4); + result = Mat4.getRotation(out, matB); + }); + + it('should return the unit quaternion', () => { + const unitQuat = Quat.create(); + Quat.identity(unitQuat); + expect(result).toBeVec(unitQuat); + }); + }); + + describe('from a translation and rotation matrix', () => { + it('should keep the same rotation as when created', () => { + let q = Quat.create(); + const outVec = Vec3.fromValues(5, 6, 7); + const testVec = Vec3.fromValues(1, 5, 2); + const ang = 0.78972; + + Vec3.normalize(testVec, testVec); + q = Quat.setAxisAngle(q, testVec, ang) as Quat; + Mat4.fromRotationTranslation(out, q, outVec); + + result = Quat.fromValues(2, 3, 4, 6); + Mat4.getRotation(result, out); + const outaxis = Vec3.create(); + const outangle = Quat.getAxisAngle(outaxis, result); + + expect(outaxis).toBeVec(testVec); + expect(outangle).toBeCloseTo(ang); + }); + }); + }); + + describe('frustumNO', () => { + it('should have an alias called `frustum`', () => expect(Mat4.frustumNO).toEqual(Mat4.frustum)); + + beforeEach(() => { result = Mat4.frustumNO(out, -1, 1, -1, 1, -1, 1); }); + + it('should place values into out', () => expect(result).toBeVec( + -1, 0, 0, 0, + 0, -1, 0, 0, + 0, 0, 0, -1, + 0, 0, 1, 0 + )); + it('should return out', () => expect(result).toBe(out)); + + describe('with an Infinite far plane', () => { + beforeEach(() => { result = Mat4.frustumNO(out, -1, 1, -1, 1, -1, Infinity); }); + + it('should calculate correct matrix', () => expect(result).toBeVec( + -1, 0, 0, 0, + 0, -1, 0, 0, + 0, 0, -1, -1, + 0, 0, 2, 0 + )); + }); + }); + + describe('frustumZO', () => { + beforeEach(() => { result = Mat4.frustumZO(out, -1, 1, -1, 1, -1, 1); }); + + it('should place values into out', () => expect(result).toBeVec( + -1, 0, 0, 0, + 0, -1, 0, 0, + 0, 0, -0.5, -1, + 0, 0, 0.5, 0 + )); + it('should return out', () => expect(result).toBe(out)); + + describe('with an Infinite far plane', () => { + beforeEach(() => { result = Mat4.frustumZO(out, -1, 1, -1, 1, -1, Infinity); }); + + it('should calculate correct matrix', () => expect(result).toBeVec( + -1, 0, 0, 0, + 0, -1, 0, 0, + 0, 0, -1, -1, + 0, 0, 1, 0 + )); + }); + }); + + describe('perspectiveNO', () => { + it('should have an alias called `perspective`', () => expect(Mat4.perspectiveNO).toEqual(Mat4.perspective)); + + const fovy = Math.PI * 0.5; + beforeEach(() => { result = Mat4.perspectiveNO(out, fovy, 1, 0, 1); }); + + it('should place values into out', () => expect(result).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, -1, -1, + 0, 0, 0, 0 + )); + it('should return out', () => expect(result).toBe(out)); + + describe('with nonzero near, 45deg fovy, and realistic aspect ratio', () => { + beforeEach(() => { result = Mat4.perspectiveNO(out, 45 * Math.PI / 180.0, 640 / 480, 0.1, 200); }); + + it('should calculate correct matrix', () => expect(result).toBeVec( + 1.81066, 0, 0, 0, + 0, 2.414213, 0, 0, + 0, 0, -1.001, -1, + 0, 0, -0.2001, 0 + )); + }); + + describe('with no far plane, 45deg fovy, and realistic aspect ratio', () => { + beforeEach(() => { result = Mat4.perspectiveNO(out, 45 * Math.PI / 180.0, 640 / 480, 0.1); }); + + it('should calculate correct matrix', () => expect(result).toBeVec( + 1.81066, 0, 0, 0, + 0, 2.414213, 0, 0, + 0, 0, -1, -1, + 0, 0, -0.2, 0 + )); + }); + + describe('with infinite far plane, 45deg fovy, and realistic aspect ratio', () => { + beforeEach(() => { result = Mat4.perspectiveNO(out, 45 * Math.PI / 180.0, 640 / 480, 0.1, Infinity); }); + + it('should calculate correct matrix', () => expect(result).toBeVec( + 1.81066, 0, 0, 0, + 0, 2.414213, 0, 0, + 0, 0, -1, -1, + 0, 0, -0.2, 0 + )); + }); + }); + + describe('orthoNO', () => { + beforeEach(() => { result = Mat4.orthoNO(out, -1, 1, -1, 1, -1, 1); }); + + it('should have an alias called `ortho`', () => expect(Mat4.orthoNO).toEqual(Mat4.ortho)); + it('should place values into out', () => expect(result).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, -1, 0, + 0, 0, 0, 1 + )); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('lookAt', () => { + let eye: FloatArray = new Float64Array([0, 0, 1]); + let center: FloatArray = new Float64Array([0, 0, -1]); + let up: FloatArray = new Float64Array([0, 1, 0]); + let view: FloatArray, right: FloatArray; + + beforeEach(() => { + eye = new Float64Array([0, 0, 1]); + center = new Float64Array([0, 0, -1]); + up = new Float64Array([0, 1, 0]); + result = Mat4.lookAt(out, eye, center, up); + }); + + describe('looking down', () => { + beforeEach(() => { + view = new Float64Array([0, -1, 0]); + up = new Float64Array([0, 0, -1]); + right = new Float64Array([1, 0, 0]); + result = Mat4.lookAt(out, [0, 0, 0], view, up); + }); + + it('should transform view into local -Z', () => { + result = Vec3.transformMat4(new Float64Array(3), view, out); + expect(result).toBeVec(0, 0, -1); + }); + + it('should transform up into local +Y', () => { + result = Vec3.transformMat4(new Float64Array(3), up, out); + expect(result).toBeVec(0, 1, 0); + }); + + it('should transform right into local +X', () => { + result = Vec3.transformMat4(new Float64Array(3), right, out); + expect(result).toBeVec(1, 0, 0); + }); + + it('should return out', () => expect(result).toBe(out)); + }); + + describe('#74', () => { + beforeEach(() => { + Mat4.lookAt(out, + new Float64Array([0, 2, 0]), + new Float64Array([0, 0.6, 0]), + new Float64Array([0, 0, -1])); + }); + + it('should transform a point `above` into local +Y', () => { + result = Vec3.transformMat4(new Float64Array(3), [0, 2, -1], out); + expect(result).toBeVec(0, 1, 0); + }); + + it('should transform a point `right of` into local +X', () => { + result = Vec3.transformMat4(new Float64Array(3), [1, 2, 0], out); + expect(result).toBeVec(1, 0, 0); + }); + + it('should transform a point `in front of` into local -Z', () => { + result = Vec3.transformMat4(new Float64Array(3), [0, 1, 0], out); + expect(result).toBeVec(0, 0, -1); + }); + }); + + it('should place values into out', () => expect(result).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, -1, 1 + )); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('targetTo', () => { + let eye: FloatArray = new Float64Array([0, 0, 1]); + let center: FloatArray = new Float64Array([0, 0, -1]); + let up: FloatArray = new Float64Array([0, 1, 0]); + let view: FloatArray, right: FloatArray; + + beforeEach(() => { + eye = new Float64Array([0, 0, 1]); + center = new Float64Array([0, 0, -1]); + up = new Float64Array([0, 1, 0]); + result = Mat4.targetTo(out, eye, center, up); + }); + + describe('looking down', () => { + beforeEach(() => { + view = new Float64Array([0, -1, 0]); + up = new Float64Array([0, 0, -1]); + right = new Float64Array([1, 0, 0]); + result = Mat4.targetTo(out, [0, 0, 0], view, up); + }); + + it('should transform view into local Z', () => { + result = Vec3.transformMat4(new Float64Array(3), view, out); + expect(result).toBeVec(0, 0, 1); + }); + + it('should transform up into local -Y', () => { + result = Vec3.transformMat4(new Float64Array(3), up, out); + expect(result).toBeVec(0, -1, 0); + }); + + it('should transform right into local +X', () => { + result = Vec3.transformMat4(new Float64Array(3), right, out); + expect(result).toBeVec(1, 0, 0); + }); + + it('should return out', () => expect(result).toBe(out)); + + it('scaling should be [1, 1, 1]', () => { + const scaling = Mat4.getScaling(new Float64Array(3), out); + expect(scaling).toBeVec(1, 1, 1); + }); + }); + + describe('#74', () => { + beforeEach(() => { + Mat4.targetTo(out, + new Float64Array([0, 2, 0]), + new Float64Array([0, 0.6, 0]), + new Float64Array([0, 0, -1])); + }); + + it('should transform a point `above` into local +Y', () => { + result = Vec3.transformMat4(new Float64Array(3), [0, 2, -1], out); + expect(result).toBeVec(0, 1, -2); + }); + + it('should transform a point `right of` into local +X', () => { + result = Vec3.transformMat4(new Float64Array(3), [1, 2, 0], out); + expect(result).toBeVec(1, 2, -2); + }); + + it('should transform a point `in front of` into local -Z', () => { + result = Vec3.transformMat4(new Float64Array(3), [0, 1, 0], out); + expect(result).toBeVec(0, 2, -1); + }); + + it('scaling should be [1, 1, 1]', () => { + const scaling = Mat4.getScaling(new Float64Array(3), out); + expect(scaling).toBeVec(1, 1, 1); + }); + }); + + describe('scaling test', () => { + beforeEach(() => { + Mat4.targetTo(out, + new Float64Array([0, 1, 0]), + new Float64Array([0, 0, 1]), + new Float64Array([0, 0, -1])); + }); + + it('scaling should be [1, 1, 1]', () => { + const scaling = Mat4.getScaling(new Float64Array(3), out); + expect(scaling).toBeVec(1, 1, 1); + }); + }); + + it('should place values into out', () => expect(result).toBeVec( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 1, 1 + )); + it('should return out', () => expect(result).toBe(out)); + it('scaling should be [1, 1, 1]', () => { + const scaling = Mat4.getScaling(new Float64Array(3), out); + expect(scaling).toBeVec(1, 1, 1); + }); + }); + + describe('str', () => { + beforeEach(() => { result = Mat4.str(matA); }); + + it('should return a string representation of the matrix', + () => expect(result).toEqual('Mat4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 2, 3, 1)')); + }); + + describe('frob', () => { + beforeEach(() => { result = Mat4.frob(matA); }); + + it('should return the Frobenius Norm of the matrix', () => expect(result).toBeCloseTo(Math.sqrt(Math.pow(1, 2) + + Math.pow(1, 2) + Math.pow(1, 2) + Math.pow(1, 2) + Math.pow(1, 2) + Math.pow(2, 2) + Math.pow(3, 2)))); + }); + + describe('add', () => { + beforeEach(() => { + matA = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + matB = [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]; + }); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.add(out, matA, matB); }); + + it('should place values into out', + () => expect(out).toBeVec(18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); + it('should not modify matB', + () => expect(matB).toBeVec(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.add(matA, matA, matB); }); + + it('should place values into matA', + () => expect(matA).toBeVec(18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', + () => expect(matB).toBeVec(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat4.add(matB, matA, matB); }); + + it('should place values into matB', + () => expect(matB).toBeVec(18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); + }); + }); + + describe('subtract', () => { + beforeEach(() => { + matA = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + matB = [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]; + }); + + it('should have an alias called `sub`', () => expect(Mat4.sub).toEqual(Mat4.subtract)); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.subtract(out, matA, matB); }); + + it('should place values into out', + () => expect(out).toBeVec(-16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); + it('should not modify matB', + () => expect(matB).toBeVec(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.subtract(matA, matA, matB); }); + + it('should place values into matA', + () => expect(matA).toBeVec(-16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', + () => expect(matB).toBeVec(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat4.subtract(matB, matA, matB); }); + + it('should place values into matB', + () => expect(matB).toBeVec(-16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); + }); + }); + + describe('fromValues', () => { + beforeEach(() => { result = Mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); }); + + it('should return a 16 element array initialized to the values passed', + () => expect(result).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); + }); + + describe('set', () => { + beforeEach(() => { result = Mat4.set(out, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); }); + + it('should place values into out', + () => expect(out).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('multiplyScalar', () => { + beforeEach(() => { matA = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; }); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.multiplyScalar(out, matA, 2); }); + + it('should place values into out', + () => expect(out).toBeVec(2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.multiplyScalar(matA, matA, 2); }); + + it('should place values into matA', + () => expect(matA).toBeVec(2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32)); + it('should return matA', () => expect(result).toBe(matA)); + }); + }); + + describe('multiplyScalarAndAdd', () => { + beforeEach(() => { + matA = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + matB = [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]; + }); + + describe('with a separate output matrix', () => { + beforeEach(() => { result = Mat4.multiplyScalarAndAdd(out, matA, matB, 0.5); }); + + it('should place values into out', + () => expect(out).toBeVec(9.5, 11, 12.5, 14, 15.5, 17, 18.5, 20, 21.5, 23, 24.5, 26, 27.5, 29, 30.5, 32)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); + it('should not modify matB', + () => expect(matB).toBeVec(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)); + }); + + describe('when matA is the output matrix', () => { + beforeEach(() => { result = Mat4.multiplyScalarAndAdd(matA, matA, matB, 0.5); }); + + it('should place values into matA', + () => expect(matA).toBeVec(9.5, 11, 12.5, 14, 15.5, 17, 18.5, 20, 21.5, 23, 24.5, 26, 27.5, 29, 30.5, 32)); + it('should return matA', () => expect(result).toBe(matA)); + it('should not modify matB', + () => expect(matB).toBeVec(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)); + }); + + describe('when matB is the output matrix', () => { + beforeEach(() => { result = Mat4.multiplyScalarAndAdd(matB, matA, matB, 0.5); }); + + it('should place values into matB', + () => expect(matB).toBeVec(9.5, 11, 12.5, 14, 15.5, 17, 18.5, 20, 21.5, 23, 24.5, 26, 27.5, 29, 30.5, 32)); + it('should return matB', () => expect(result).toBe(matB)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); + }); + }); + + describe('exactEquals', () => { + let matC: Mat4Like, r0: boolean, r1: boolean; + + beforeEach(() => { + matA = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; + matB = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; + matC = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + r0 = Mat4.exactEquals(matA, matB); + r1 = Mat4.exactEquals(matA, matC); + }); + + it('should return true for identical matrices', () => expect(r0).toBe(true)); + it('should return false for different matrices', () => expect(r1).toBe(false)); + it('should not modify matA', () => expect(matA).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)); + it('should not modify matB', () => expect(matB).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)); + }); + + describe('equals', () => { + let matC: Mat4Like, matD: Mat4Like, r0: boolean, r1: boolean, r2: boolean; + + beforeEach(() => { + matA = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; + matB = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; + matC = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + matD = [1e-16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; + r0 = Mat4.equals(matA, matB); + r1 = Mat4.equals(matA, matC); + r2 = Mat4.equals(matA, matD); + }); + + it('should return true for identical matrices', () => expect(r0).toBe(true)); + it('should return false for different matrices', () => expect(r1).toBe(false)); + it('should return true for close but not identical matrices', () => expect(r2).toBe(true)); + it('should not modify matA', () => expect(matA).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)); + it('should not modify matB', () => expect(matB).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)); + }); + }); +}); diff --git a/tests/f64/Quat.spec.ts b/tests/f64/Quat.spec.ts new file mode 100644 index 00000000..848293cd --- /dev/null +++ b/tests/f64/Quat.spec.ts @@ -0,0 +1,753 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Quat, Vec3 } from '#gl-matrix/f64'; + +import type { Vec3Like, Vec4Like, QuatLike } from '#gl-matrix/types'; + +describe('Quat', () => { + describe('constructor', () => { + it('should return Quat(0, 0, 0, 1) if called with no arguments', () => expect(new Quat()).toBeVec(0, 0, 0, 1)); + + it('should return Quat(x, y, z, w) if called with (x, y, z, w)', () => { + expect(new Quat(1, 2, 3, 4)).toBeVec(1, 2, 3, 4); + expect(new Quat(-3, 4.4, -5.6, 7.8)).toBeVec(-3, 4.4, -5.6, 7.8); + }); + + it('should return Quat(x, x, x, x) if called with (x)', () => { + expect(new Quat(1)).toBeVec(1, 1, 1, 1); + expect(new Quat(-2.3)).toBeVec(-2.3, -2.3, -2.3, -2.3); + }); + + it('should return Quat(x, y, z, w) if called with ([x, y, z, w])', () => { + expect(new Quat([1, 2, 3, 4])).toBeVec(1, 2, 3, 4); + expect(new Quat([-3, 4.4, -5.6, 7.8])).toBeVec(-3, 4.4, -5.6, 7.8); + }); + + it('should return Quat(x, y, z, w) if called with (Quat(x, y, z, w))', () => { + const v = new Quat(3.4, 5.6, 7.8, 9); + expect(new Quat(v)).toBeVec(v); + }); + + it('should return Quat(x, y, z, w) if called with (Float64Array([x, y, z, w]))', () => { + const arr = new Float64Array([1.2, 3.4, 5.6, 7.8]); + expect(new Quat(arr)).toBeVec(arr); + }); + }); + + describe('static', () => { + let out: Quat; + let quatA: QuatLike; + let quatB: QuatLike; + let result: Vec4Like | number | string; + let vec: Vec3Like; + + const id = new Quat(0, 0, 0, 1); + const deg90 = Math.PI / 2; + + beforeEach(() => { + quatA = new Quat(1, 2, 3, 4); + quatB = new Quat(5, 6, 7, 8); + out = new Quat(0, 0, 0, 0); + vec = [1, 1, -1]; + }); + + describe('slerp', () => { + describe('the normal case', () => { + beforeEach(() => { result = Quat.slerp(out, [0, 0, 0, 1], [0, 1, 0, 0], 0.5); }); + + it('should return out', () => expect(result).toBe(out)); + it('should calculate proper quat', () => expect(result).toBeVec(0, 0.707106, 0, 0.707106)); + }); + + describe('where a == b', () => { + beforeEach(() => { result = Quat.slerp(out, [0, 0, 0, 1], [0, 0, 0, 1], 0.5); }); + + it('should return out', () => expect(result).toBe(out)); + it('should calculate proper quat', () => expect(result).toBeVec(0, 0, 0, 1)); + }); + + describe('where theta == 180deg', () => { + beforeEach(() => { + Quat.rotateX(quatA, [1, 0, 0, 0], Math.PI); // 180 deg + result = Quat.slerp(out, [1, 0, 0, 0], quatA, 1); + }); + + it('should calculate proper quat', () => expect(result).toBeVec(0, 0, 0, -1)); + }); + + describe('where a == -b', () => { + beforeEach(() => { result = Quat.slerp(out, [1, 0, 0, 0], [-1, 0, 0, 0], 0.5); }); + + it('should return out', () => expect(result).toBe(out)); + it('should calculate proper quat', () => expect(result).toBeVec(1, 0, 0, 0)); + }); + }); + + describe('pow', () => { + describe('identity quat', () => { + beforeEach(() => { result = Quat.pow(out, id, 2.1 /* random number */); }); + + it('should return out', () => expect(result).toBe(out)); + it('should be the identity', () => expect(result).toBeVec(id)); + }); + + describe('power of one', () => { + beforeEach(() => { + Quat.normalize(quatA, quatA); + + result = Quat.pow(out, quatA, 1); + }); + + it('should be the identity', () => expect(result).toBeVec(quatA)); + it('should be normalized', () => expect(Quat.length(result as Vec4Like)).toBeCloseTo(1)); + }); + + describe('squared', () => { + beforeEach(() => { + Quat.normalize(quatA, quatA); + + result = Quat.pow(out, quatA, 2); + }); + + it('should be the square', () => { + const reference = Quat.multiply(Quat.create(), quatA, quatA); + expect(result).toBeVec(reference); + }); + + it('should be normalized', () => expect(Quat.length(result as Vec4Like)).toBeCloseTo(1)); + }); + + describe('conjugate', () => { + beforeEach(() => { + Quat.normalize(quatA, quatA); + + result = Quat.pow(out, quatA, -1); + }); + + it('should be the conjugate', () => { + const reference = Quat.conjugate(Quat.create(), quatA); + expect(result).toBeVec(reference); + }); + it('should be normalized', () => expect(Quat.length(result as Vec4Like)).toBeCloseTo(1)); + }); + + describe('reversible', () => { + beforeEach(() => { + Quat.normalize(quatA, quatA); + + const b = 2.1; // random number + result = Quat.pow(out, quatA, b); + result = Quat.pow(out, result, 1 / b); + }); + + it('should be reverted', () => expect(result).toBeVec(quatA)); + it('should be normalized', () => expect(Quat.length(result as Vec4Like)).toBeCloseTo(1)); + }); + }); + + describe('rotateX', () => { + beforeEach(() => { result = Quat.rotateX(out, id, deg90); }); + + it('should return out', () => expect(result).toBe(out)); + it('should transform vec accordingly', () => { + Vec3.transformQuat(vec, [0, 0, -1], out); + expect(vec).toBeVec(0, 1, 0); + }); + }); + + describe('rotateY', () => { + beforeEach(() => { result = Quat.rotateY(out, id, deg90); }); + + it('should return out', () => expect(result).toBe(out)); + it('should transform vec accordingly', () => { + Vec3.transformQuat(vec, [0, 0, -1], out); + expect(vec).toBeVec(-1, 0, 0); + }); + }); + + describe('rotateZ', () => { + beforeEach(() => { result = Quat.rotateZ(out, id, deg90); }); + + it('should return out', () => expect(result).toBe(out)); + it('should transform vec accordingly', () => { + Vec3.transformQuat(vec, [0, 1, 0], out); + expect(vec).toBeVec(-1, 0, 0); + }); + }); + + /* + describe('fromMat3', () => { + let matr; + + describe('legacy', () => { + beforeEach(() => { + matr = [ 1, 0, 0, + 0, 0, -1, + 0, 1, 0 ]; + result = Quat.fromMat3(out, matr); + }); + + it('should set dest to the correct value', () => expect(result).toBeVec(-0.707106, 0, 0, 0.707106)); + }); + + describe('where trace > 0', () => { + beforeEach(() => { + matr = [ 1, 0, 0, + 0, 0, -1, + 0, 1, 0 ]; + result = Quat.fromMat3(out, matr); + }); + + it('should return out', () => expect(result).toBe(out)); + + it('should produce the correct transformation', + () => expect(Vec3.transformQuat([], [0,1,0], out)).toBeVec(0,0,-1)); + }); + + describe('from a normal matrix looking `backward`', () => { + beforeEach(() => { + matr = mat3.create(); + mat3.transpose(matr, mat3.invert(matr, mat3.fromMat4(matr, mat4.lookAt( + mat4.create(), [0, 0, 0], [0, 0, 1], [0, 1, 0])))); + result = Quat.fromMat3(out, matr); + }); + + it('should return out', () => expect(result).toBe(out)); + + it('should produce the same transformation as the given matrix', () => expect(Vec3.transformQuat([], [3,2,-1], + Quat.normalize(out, out))).toBeEqualish(Vec3.transformMat3([], [3,2,-1], matr))); + }); + + describe('from a normal matrix looking `left` and `upside down`', () => { + beforeEach(() => { + matr = mat3.create(); + mat3.transpose(matr, mat3.invert(matr, mat3.fromMat4(matr, mat4.lookAt( + mat4.create(), [0, 0, 0], [-1, 0, 0], [0, -1, 0])))); + result = Quat.fromMat3(out, matr); + }); + + it('should return out', () => expect(result).toBe(out)); + + it('should produce the same transformation as the given matrix', () => expect(Vec3.transformQuat([], [3,2,-1], + Quat.normalize(out, out))).toBeEqualish(Vec3.transformMat3([], [3,2,-1], matr))); + }); + + describe('from a normal matrix looking `upside down`', () => { + beforeEach(() => { + matr = mat3.create(); + mat3.transpose(matr, mat3.invert(matr, mat3.fromMat4(matr, mat4.lookAt( + mat4.create(), [0, 0, 0], [0, 0, -1], [0, -1, 0])))); + result = Quat.fromMat3(out, matr); + }); + + it('should return out', () => expect(result).toBe(out)); + + it('should produce the same transformation as the given matrix', () => expect(Vec3.transformQuat([], [3,2,-1], + Quat.normalize(out, out))).toBeEqualish(Vec3.transformMat3([], [3,2,-1], matr))); + }); + });*/ + + describe('fromEuler', () => { + describe('legacy', () => { + beforeEach(() => { result = Quat.fromEuler(out, -90, 0, 0); }); + + it('should set dest to the correct value', () => expect(result).toBeVec(-0.707106, 0, 0, 0.707106)); + }); + + describe('where trace > 0', () => { + beforeEach(() => { result = Quat.fromEuler(out, -90, 0, 0); }); + + it('should return out', () => expect(result).toBe(out)); + + it('should produce the correct transformation', + () => expect(Vec3.transformQuat([0, 0, 0], [0, 1, 0], out)).toBeVec(0, 0, -1)); + }); + }); + + /* + describe('setAxes', () => { + let r; + beforeEach(() => { r = Vec3.create(); }); + + describe('looking left', () => { + let view, up, right; + + beforeEach(() => { + view = [-1, 0, 0]; + up = [ 0, 1, 0]; + right= [ 0, 0,-1]; + result = Quat.setAxes([], view, right, up); + }); + + it('should transform local view into world left', () => { + r = Vec3.transformQuat([], [0,0,-1], result); + expect(r).toBeVec(1, 0, 0); + }); + + it('should transform local right into world front', () => { + r = Vec3.transformQuat([], [1,0,0], result); + expect(r).toBeVec(0, 0, 1); + }); + }); + + describe('given opengl defaults', () => { + let view, up, right; + + beforeEach(() => { + view = [0, 0, -1]; + up = [0, 1, 0]; + right= [1, 0, 0]; + result = Quat.setAxes(out, view, right, up); + }); + + it('should return out', () => expect(result).toBe(out)); + it('should produce identity', () => expect(out).toBeVec(0, 0, 0, 1)); + }); + + describe('legacy example', () => { + let view, up, right; + + beforeEach(() => { + right= [1, 0, 0]; + up = [0, 0, 1]; + view = [0, -1, 0]; + result = Quat.setAxes(out, view, right, up); + }); + + it('should set correct quat4 values', () => expect(result).toBeVec(0.707106, 0, 0, 0.707106)); + }); + });*/ + + describe('rotationTo', () => { + let r: Vec3; + + beforeEach(() => { r = Vec3.create(); }); + + describe('at right angle', () => { + beforeEach(() => { result = Quat.rotationTo(out, [0, 1, 0], [1, 0, 0]); }); + + it('should return out', () => expect(result).toBe(out)); + it('should calculate proper quaternion', () => expect(out).toBeVec(0, 0, -0.707106, 0.707106)); + }); + + describe('when vectors are parallel', () => { + beforeEach(() => { result = Quat.rotationTo(out, [0, 1, 0], [0, 1, 0]); }); + + it('should return out', () => expect(result).toBe(out)); + it('multiplying A should produce B', () => expect(Vec3.transformQuat(r, [0, 1, 0], out)).toBeVec(0, 1, 0)); + }); + + describe('when vectors are opposed X', () => { + beforeEach(() => { result = Quat.rotationTo(out, [1, 0, 0], [-1, 0, 0]); }); + + it('should return out', () => expect(result).toBe(out)); + it('multiplying A should produce B', () => expect(Vec3.transformQuat(r, [1, 0, 0], out)).toBeVec(-1, 0, 0)); + }); + + describe('when vectors are opposed Y', () => { + beforeEach(() => { result = Quat.rotationTo(out, [0, 1, 0], [0, -1, 0]); }); + + it('should return out', () => expect(result).toBe(out)); + it('multiplying A should produce B', () => expect(Vec3.transformQuat(r, [0, 1, 0], out)).toBeVec(0, -1, 0)); + }); + + describe('when vectors are opposed Z', () => { + beforeEach(() => { result = Quat.rotationTo(out, [0, 0, 1], [0, 0, -1]); }); + + it('should return out', () => expect(result).toBe(out)); + it('multiplying A should produce B', () => expect(Vec3.transformQuat(r, [0, 0, 1], out)).toBeVec(0, 0, -1)); + }); + }); + + describe('create', () => { + beforeEach(() => { result = Quat.create(); }); + + it('should return a 4 element array initialized to an identity quaternion', + () => expect(result).toBeVec(0, 0, 0, 1)); + }); + + describe('clone', () => { + beforeEach(() => { result = Quat.clone(quatA); }); + + it('should return a 4 element array initialized to the values in quatA', () => expect(result).toBeVec(quatA)); + }); + + describe('fromValues', () => { + beforeEach(() => { result = Quat.fromValues(1, 2, 3, 4); }); + + it('should return a 4 element array initialized to the values passed', () => expect(result).toBeVec(1, 2, 3, 4)); + }); + + describe('copy', () => { + beforeEach(() => { result = Quat.copy(out, quatA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3, 4)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('set', () => { + beforeEach(() => { result = Quat.set(out, 1, 2, 3, 4); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3, 4)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('identity', () => { + beforeEach(() => { result = Quat.identity(out); }); + + it('should place values into out', () => expect(result).toBeVec(0, 0, 0, 1)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('setAxisAngle', () => { + beforeEach(() => { result = Quat.setAxisAngle(out, [1, 0, 0], Math.PI * 0.5); }); + + it('should place values into out', () => expect(result).toBeVec(0.707106, 0, 0, 0.707106)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('getAxisAngle', () => { + let angle: number; + + describe('for a quaternion representing no rotation', () => { + beforeEach(() => { result = Quat.setAxisAngle(out, [0, 1, 0], 0.0); angle = Quat.getAxisAngle(vec, out); }); + + it('should return a multiple of 2*PI as the angle component', + () => expect(angle % (Math.PI * 2.0)).toBeCloseTo(0.0)); + }); + + describe('for a simple rotation about X axis', () => { + beforeEach(() => { result = Quat.setAxisAngle(out, [1, 0, 0], 0.7778); angle = Quat.getAxisAngle(vec, out); }); + + it('should return the same provided angle', () => expect(angle).toBeCloseTo(0.7778)); + it('should return the X axis as the angle', () => expect(vec).toBeVec(1, 0, 0)); + }); + + describe('for a simple rotation about Y axis', () => { + beforeEach(() => { + result = Quat.setAxisAngle(out, [0, 1, 0], 0.879546); + angle = Quat.getAxisAngle(vec, out); + }); + + it('should return the same provided angle', () => expect(angle).toBeCloseTo(0.879546)); + it('should return the X axis as the angle', () => expect(vec).toBeVec(0, 1, 0)); + }); + + describe('for a simple rotation about Z axis', () => { + beforeEach(() => { + result = Quat.setAxisAngle(out, [0, 0, 1], 0.123456); + angle = Quat.getAxisAngle(vec, out); + }); + + it('should return the same provided angle', () => expect(angle).toBeCloseTo(0.123456)); + it('should return the X axis as the angle', () => expect(vec).toBeVec(0, 0, 1)); + }); + + describe('for a slightly irregular axis and right angle', () => { + beforeEach(() => { + result = Quat.setAxisAngle(out, [0.707106, 0, 0.707106], Math.PI * 0.5); + angle = Quat.getAxisAngle(vec, out); + }); + + it('should place values into vec', () => expect(vec).toBeVec(0.707106, 0, 0.707106)); + it('should return a numeric angle', () => expect(angle).toBeCloseTo(Math.PI * 0.5)); + }); + + describe('for a very irregular axis and negative input angle', () => { + beforeEach(() => { + quatA = Quat.setAxisAngle(quatA, [0.65538555, 0.49153915, 0.57346237], 8.8888) as Quat; + angle = Quat.getAxisAngle(vec, quatA); + quatB = Quat.setAxisAngle(quatB, vec, angle) as Quat; + }); + + it('should return an angle between 0 and 2*PI', () => { + expect(angle).toBeGreaterThan(0.0); + expect(angle).toBeLessThan(Math.PI * 2.0); + }); + it('should create the same quaternion from axis and angle extracted', () => expect(quatA).toBeVec(quatB)); + }); + }); + + describe('getAngle', () => { + describe('from itself', () => { + beforeEach(() => { Quat.normalize(quatA, quatA); }); + + it('should be zero', () => expect(Quat.getAngle(quatA, quatA)).toBeCloseTo(0)); + }); + + describe('from rotated', () => { + beforeEach(() => { + Quat.normalize(quatA, quatA); + Quat.rotateX(quatB, quatA, Math.PI / 4); + }); + + it('should be 45 degrees', () => expect(Quat.getAngle(quatA, quatB)).toBeCloseTo(Math.PI / 4)); + }); + + describe('compare with axisAngle', () => { + beforeEach(() => { + Quat.normalize(quatA, quatA); + Quat.normalize(quatB, quatB); + }); + + it('should be equalish', () => { + // compute reference value as axisAngle of quatA^{-1} * quatB + const quatAInv = Quat.conjugate(Quat.create(), quatA); + const quatAB = Quat.multiply(quatAInv, quatAInv, quatB); + const dummy = Vec3.create(); + const reference = Quat.getAxisAngle(dummy, quatAB); + + expect(Quat.getAngle(quatA, quatB)).toBeCloseTo(reference); + }); + }); + }); + + describe('add', () => { + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat.add(out, quatA, quatB); }); + + it('should place values into out', () => expect(out).toBeVec(6, 8, 10, 12)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + it('should not modify quatB', () => expect(quatB).toBeVec(5, 6, 7, 8)); + }); + + describe('when quatA is the output quaternion', () => { + beforeEach(() => { result = Quat.add(quatA, quatA, quatB); }); + + it('should place values into quatA', () => expect(quatA).toBeVec(6, 8, 10, 12)); + it('should return quatA', () => expect(result).toBe(quatA)); + it('should not modify quatB', () => expect(quatB).toBeVec(5, 6, 7, 8)); + }); + + describe('when quatB is the output quaternion', () => { + beforeEach(() => { result = Quat.add(quatB, quatA, quatB); }); + + it('should place values into quatB', () => expect(quatB).toBeVec(6, 8, 10, 12)); + it('should return quatB', () => expect(result).toBe(quatB)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('multiply', () => { + it('should have an alias called `mul`', () => expect(Quat.mul).toEqual(Quat.multiply)); + + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat.multiply(out, quatA, quatB); }); + + it('should place values into out', () => expect(out).toBeVec(24, 48, 48, -6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + it('should not modify quatB', () => expect(quatB).toBeVec(5, 6, 7, 8)); + }); + + describe('when quatA is the output quaternion', () => { + beforeEach(() => { result = Quat.multiply(quatA, quatA, quatB); }); + + it('should place values into quatA', () => expect(quatA).toBeVec(24, 48, 48, -6)); + it('should return quatA', () => expect(result).toBe(quatA)); + it('should not modify quatB', () => expect(quatB).toBeVec(5, 6, 7, 8)); + }); + + describe('when quatB is the output quaternion', () => { + beforeEach(() => { result = Quat.multiply(quatB, quatA, quatB); }); + + it('should place values into quatB', () => expect(quatB).toBeVec(24, 48, 48, -6)); + it('should return quatB', () => expect(result).toBe(quatB)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('scale', () => { + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat.scale(out, quatA, 2); }); + + it('should place values into out', () => expect(out).toBeVec(2, 4, 6, 8)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + }); + + describe('when quatA is the output quaternion', () => { + beforeEach(() => { result = Quat.scale(quatA, quatA, 2); }); + + it('should place values into quatA', () => expect(quatA).toBeVec(2, 4, 6, 8)); + it('should return quatA', () => expect(result).toBe(quatA)); + }); + }); + + describe('length', () => { + beforeEach(() => { result = Quat.len(quatA); }); + + it('should have an alias called `len`', () => expect(Quat.len).toEqual(Quat.length)); + it('should return the length', () => expect(result).toBeCloseTo(5.477225)); + }); + + describe('squaredLength', () => { + beforeEach(() => { result = Quat.squaredLength(quatA); }); + + it('should have an alias called `sqrLen``', () => expect(Quat.sqrLen).toEqual(Quat.squaredLength)); + it('should return the squared length', () => expect(result).toEqual(30)); + }); + + describe('normalize', () => { + beforeEach(() => { quatA = [5, 0, 0, 0]; }); + + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat.normalize(out, quatA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 0, 0, 0)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quatA', () => expect(quatA).toBeVec(5, 0, 0, 0)); + }); + + describe('when quatA is the output quaternion', () => { + beforeEach(() => { result = Quat.normalize(quatA, quatA); }); + + it('should place values into quatA', () => expect(quatA).toBeVec(1, 0, 0, 0)); + it('should return quatA', () => expect(result).toBe(quatA)); + }); + }); + + describe('lerp', () => { + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat.lerp(out, quatA, quatB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(3, 4, 5, 6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + it('should not modify quatB', () => expect(quatB).toBeVec(5, 6, 7, 8)); + }); + + describe('when quatA is the output quaternion', () => { + beforeEach(() => { result = Quat.lerp(quatA, quatA, quatB, 0.5); }); + + it('should place values into quatA', () => expect(quatA).toBeVec(3, 4, 5, 6)); + it('should return quatA', () => expect(result).toBe(quatA)); + it('should not modify quatB', () => expect(quatB).toBeVec(5, 6, 7, 8)); + }); + + describe('when quatB is the output quaternion', () => { + beforeEach(() => { result = Quat.lerp(quatB, quatA, quatB, 0.5); }); + + it('should place values into quatB', () => expect(quatB).toBeVec(3, 4, 5, 6)); + it('should return quatB', () => expect(result).toBe(quatB)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('slerp', () => { + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat.slerp(out, quatA, quatB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(3, 4, 5, 6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + it('should not modify quatB', () => expect(quatB).toBeVec(5, 6, 7, 8)); + }); + + describe('when quatA is the output quaternion', () => { + beforeEach(() => { result = Quat.slerp(quatA, quatA, quatB, 0.5); }); + + it('should place values into quatA', () => expect(quatA).toBeVec(3, 4, 5, 6)); + it('should return quatA', () => expect(result).toBe(quatA)); + it('should not modify quatB', () => expect(quatB).toBeVec(5, 6, 7, 8)); + }); + + describe('when quatB is the output quaternion', () => { + beforeEach(() => { result = Quat.slerp(quatB, quatA, quatB, 0.5); }); + + it('should place values into quatB', () => expect(quatB).toBeVec(3, 4, 5, 6)); + it('should return quatB', () => expect(result).toBe(quatB)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + }); + }); + + /* + describe('random', () => { + beforeEach(() => { result = Quat.random(out); }); + + it('should result in a normalized quaternion', () => { + let copy = Quat.clone(out); + expect(Quat.normalize(out, out)).toBeVec(copy); + }); + it('should return out', () => expect(result).toBe(out)); + });*/ + + describe('invert', () => { + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat.invert(out, quatA); }); + + it('should place values into out', () => expect(out).toBeVec(-0.033333, -0.066666, -0.1, 0.133333)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + }); + + describe('when quatA is the output quaternion', () => { + beforeEach(() => { result = Quat.invert(quatA, quatA); }); + + it('should place values into quatA', () => expect(quatA).toBeVec(-0.033333, -0.066666, -0.1, 0.133333)); + it('should return quatA', () => expect(result).toBe(quatA)); + }); + }); + + describe('conjugate', () => { + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat.conjugate(out, quatA); }); + + it('should place values into out', () => expect(out).toBeVec(-1, -2, -3, 4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quatA', () => expect(quatA).toBeVec(1, 2, 3, 4)); + }); + + describe('when quatA is the output quaternion', () => { + beforeEach(() => { result = Quat.conjugate(quatA, quatA); }); + + it('should place values into quatA', () => expect(quatA).toBeVec(-1, -2, -3, 4)); + it('should return quatA', () => expect(result).toBe(quatA)); + }); + }); + + describe('str', () => { + beforeEach(() => { result = Quat.str(quatA); }); + + it('should return a string representation of the quaternion', () => expect(result).toEqual('Quat(1, 2, 3, 4)')); + }); + + describe('exactEquals', () => { + let quatC: Vec4Like, r0: boolean, r1: boolean; + + beforeEach(() => { + quatA = [0, 1, 2, 3]; + quatB = [0, 1, 2, 3]; + quatC = [1, 2, 3, 4]; + r0 = Quat.exactEquals(quatA, quatB); + r1 = Quat.exactEquals(quatA, quatC); + }); + + it('should return true for identical quaternions', () => expect(r0).toBe(true)); + it('should return false for different quaternions', () => expect(r1).toBe(false)); + it('should not modify quatA', () => expect(quatA).toBeVec(0, 1, 2, 3)); + it('should not modify quatB', () => expect(quatB).toBeVec(0, 1, 2, 3)); + }); + + describe('equals', () => { + let quatC: Vec4Like, quatD: Vec4Like, r0: boolean, r1: boolean, r2: boolean; + + beforeEach(() => { + quatA = [0, 1, 2, 3]; + quatB = [0, 1, 2, 3]; + quatC = [1, 2, 3, 4]; + quatD = [1e-16, 1, 2, 3]; + r0 = Quat.equals(quatA, quatB); + r1 = Quat.equals(quatA, quatC); + r2 = Quat.equals(quatA, quatD); + }); + + it('should return true for identical quaternions', () => expect(r0).toBe(true)); + it('should return false for different quaternions', () => expect(r1).toBe(false)); + it('should return true for close but not identical quaternions', () => expect(r2).toBe(true)); + it('should not modify quatA', () => expect(quatA).toBeVec(0, 1, 2, 3)); + it('should not modify quatB', () => expect(quatB).toBeVec(0, 1, 2, 3)); + }); + }); +}); diff --git a/tests/f64/Quat2.spec.ts b/tests/f64/Quat2.spec.ts new file mode 100644 index 00000000..3c01a056 --- /dev/null +++ b/tests/f64/Quat2.spec.ts @@ -0,0 +1,791 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Mat4, Quat, Quat2, Vec3 } from '#gl-matrix/f64'; + +import type { QuatLike, Quat2Like, Vec3Like, Vec4Like } from '#gl-matrix/types'; + +describe('Quat2', () => { + describe('constructor', () => { + it('should return Quat2(0, 0, 0, 1, 0, 0, 0, 0) if called with no arguments', () => { + expect(new Quat2()).toBeVec(0, 0, 0, 1, 0, 0, 0, 0); + }); + + it('should return Quat(x, y, z, w, x2, y2, z2, w2) if called with (x, y, z, w, x2, y2, z2, w2)', () => { + expect(new Quat2(1, 2, 3, 4, 5, 6, 7, 8)).toBeVec(1, 2, 3, 4, 5, 6, 7, 8); + expect(new Quat2(-3, 4.4, -5.6, 7.8, 9.0, -10.11, 12.13, -14.15)).toBeVec( + -3, 4.4, -5.6, 7.8, 9.0, -10.11, 12.13, -14.15); + }); + + it('should return Quat(x, x, x, x, x, x, x, x) if called with (x)', () => { + expect(new Quat2(1)).toBeVec(1, 1, 1, 1, 1, 1, 1, 1); + expect(new Quat2(-2.3)).toBeVec(-2.3, -2.3, -2.3, -2.3, -2.3, -2.3, -2.3, -2.3); + }); + + it('should return Quat(x, y, z, w) if called with ([x, y, z, w])', () => { + expect(new Quat2([1, 2, 3, 4, 5, 6, 7, 8])).toBeVec(1, 2, 3, 4, 5, 6, 7, 8); + expect(new Quat2([-3, 4.4, -5.6, 7.8, 9.0, -10.11, 12.13, -14.15])).toBeVec( + -3, 4.4, -5.6, 7.8, 9.0, -10.11, 12.13, -14.15); + }); + + it('should return Quat(x, y, z, w, x2, y2, z2, w2) if called with (Quat(x, y, z, w, x2, y2, z2, w2))', () => { + const v = new Quat2(1, 2, 3, 4, 5, 6, 7, 8); + expect(new Quat2(v)).toBeVec(v); + }); + + it('should return Quat(x, y, z, w, x2, y2, z2, w2) if called with (Float64Array([x, y, z, w, x2, y2, z2, w2]))', + () => { + const arr = new Float64Array([1.2, 3.4, 5.6, 7.8, 9.10, 11.12, 13.14, 15.16]); + expect(new Quat2(arr)).toBeVec(arr); + }); + }); + + describe('static', () => { + let out: Quat2; + let outVec: Vec3; + let quat2A: Quat2Like; + let quat2B: Quat2Like; + let result: Vec4Like | Quat2Like | number | string; + let resultVec: Vec3Like; + let outQuat: QuatLike; + let vec: Vec3Like; + + beforeEach(() => { + quat2A = new Quat2(1, 2, 3, 4, 2, 5, 6, -2); + quat2B = new Quat2(5, 6, 7, 8, 9, 8, 6, -4); + out = new Quat2(); + outVec = new Vec3(); + outQuat = new Quat(); + vec = new Vec3(1, 1, -1); + }); + + describe('translate', () => { + const matrixA = Mat4.create(), matOut = Mat4.create(), quatOut = Quat2.create(); + + beforeEach(() => { + // quat2A only seems to work when created using this function? + quat2B = Quat2.fromRotationTranslation(quat2A, [1, 2, 3, 4], [-5, 4, 10]); + Quat2.normalize(quat2A, quat2A); + Mat4.fromQuat2(matrixA, quat2A); + }); + + describe('with a separate output quaternion', () => { + beforeEach(() => { + result = Quat2.translate(out, quat2A, vec); + // Same thing with a matrix + Mat4.translate(matOut, matrixA, vec); + Quat2.fromMat4(quatOut, matOut); + }); + + it('should place values into out', () => expect(out).toBeQuat2(quatOut)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(quat2B)); + it('should not modify vec', () => expect(vec).toBeVec(1, 1, -1)); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { + result = Quat2.translate(quat2A, quat2A, vec); + // Same thing with a matrix + Mat4.translate(matOut, matrixA, vec); + Quat2.fromMat4(quatOut, matOut); + }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(quatOut)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + }); + }); + + describe('rotateAroundAxis', () => { + const matrixA = new Mat4(); + const matOut = new Mat4(); + const ax: Vec3Like = [1, 4, 2]; + + beforeEach(() => { + // quat2A only seems to work when created using this function? + Quat2.fromRotationTranslation(quat2A, [1, 2, 3, 4], [-5, 4, 10]); + Quat2.normalize(quat2A, quat2A); + Mat4.fromQuat2(matrixA, quat2A); + }); + + describe('with a separate output quaternion', () => { + beforeEach(() => { + result = Quat2.rotateAroundAxis(out, quat2A, ax, 5); + + // Same thing with a matrix + Mat4.rotate(matOut, matrixA, 5, ax); + Quat2.fromMat4(quat2B, matOut); + }); + + it('should place values into out', () => expect(out).toBeQuat2(quat2B)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2( + 0.18257418583505536, 0.3651483716701107, 0.5477225575051661, 0.7302967433402214, + -2.556038601690775, 3.742770809618635, 2.37346441585572, -3.0124740662784135 + )); + it('should not modify ax', () => expect(ax).toBeVec(1, 4, 2)); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { + result = Quat2.rotateAroundAxis(quat2A, quat2A, ax, 5); + // Same thing with a matrix + + Mat4.rotate(matOut, matrixA, 5, ax); + Quat2.fromMat4(quat2B, matOut); + }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(quat2B)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + it('should not modify ax', () => expect(ax).toBeVec(1, 4, 2)); + }); + }); + + describe('rotateByQuatAppend', () => { + const correctResult = Quat2.create(); + const rotationQuat = Quat2.create(); + + beforeEach(() => { + rotationQuat[0] = 2; + rotationQuat[1] = 5; + rotationQuat[2] = 2; + rotationQuat[3] = -10; + Quat2.multiply(correctResult, quat2A, rotationQuat); + }); + + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat2.rotateByQuatAppend(out, quat2A, [2, 5, 2, -10]); }); + + it('should place values into out', () => expect(out).toBeQuat2(correctResult)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + it('should not modify the rotation quaternion', () => expect(rotationQuat).toBeQuat2(2, 5, 2, -10, 0, 0, 0, 0)); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { result = Quat2.rotateByQuatAppend(quat2A, quat2A, [2, 5, 2, -10]); }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(correctResult)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + it('should not modify the rotation quaternion', () => expect(rotationQuat).toBeQuat2(2, 5, 2, -10, 0, 0, 0, 0)); + }); + }); + + describe('rotateByQuatPrepend', () => { + const correctResult = Quat2.create(); + const rotationQuat = Quat2.create(); + + beforeEach(() => { + rotationQuat[0] = 2; + rotationQuat[1] = 5; + rotationQuat[2] = 2; + rotationQuat[3] = -10; + Quat2.multiply(correctResult, rotationQuat, quat2A); + }); + + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat2.rotateByQuatPrepend(out, Quat2.getReal(outQuat, rotationQuat), quat2A); }); + + it('should place values into out', () => expect(out).toBeQuat2(correctResult)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + it('should not modify the rotation quaternion', () => expect(rotationQuat).toBeQuat2(2, 5, 2, -10, 0, 0, 0, 0)); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { result = Quat2.rotateByQuatPrepend(quat2A, Quat2.getReal(outQuat, rotationQuat), quat2A); }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(correctResult)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + it('should not modify the rotation quaternion', () => expect(rotationQuat).toBeQuat2(2, 5, 2, -10, 0, 0, 0, 0)); + }); + }); + + describe('rotateX', () => { + const matrixA = Mat4.create(), matOut = Mat4.create(), quatOut = Quat2.create(); + + beforeEach(() => { + // quat2A only seems to work when created using this function? + quat2B = Quat2.fromRotationTranslation(quat2A, [1, 2, 3, 4], [-5, 4, 10]) as Quat2; + Quat2.normalize(quat2A, quat2A); + Mat4.fromQuat2(matrixA, quat2A); + }); + + describe('with a separate output quaternion', () => { + beforeEach(() => { + result = Quat2.rotateX(out, quat2A, 5); + // Same thing with a matrix + Mat4.rotateX(matOut, matrixA, 5); + Quat2.fromMat4(quatOut, matOut); + }); + + it('should place values into out', () => expect(out).toBeQuat2(quatOut)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(quat2B)); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { + result = Quat2.rotateX(quat2A, quat2A, 5); + // Same thing with a matrix + Mat4.rotateX(matOut, matrixA, 5); + Quat2.fromMat4(quatOut, matOut); + }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(quatOut)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + }); + }); + + describe('rotateY', () => { + const matrixA = Mat4.create(), matOut = Mat4.create(), quatOut = Quat2.create(); + + beforeEach(() => { + // quat2A only seems to work when created using this function? + quat2B = Quat2.fromRotationTranslation(quat2A, [1, 2, 3, 4], [5, 4, -10]) as Quat2; + Quat2.normalize(quat2A, quat2A); + Mat4.fromQuat2(matrixA, quat2A); + }); + + describe('with a separate output quaternion', () => { + beforeEach(() => { + result = Quat2.rotateY(out, quat2A, -2); + // Same thing with a matrix + Mat4.rotateY(matOut, matrixA, -2); + Quat2.fromMat4(quatOut, matOut); + }); + + it('should place values into out', () => expect(out).toBeQuat2(quatOut)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(quat2B)); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { + result = Quat2.rotateY(quat2A, quat2A, -2); + // Same thing with a matrix + Mat4.rotateY(matOut, matrixA, -2); + Quat2.fromMat4(quatOut, matOut); + }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(quatOut)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + }); + }); + + describe('rotateZ', () => { + const matrixA = Mat4.create(), matOut = Mat4.create(), quatOut = Quat2.create(); + + beforeEach(() => { + // quat2A only seems to work when created using this function? + quat2B = Quat2.fromRotationTranslation(quat2A, [1, 0, 3, -4], [0, -4, -10]) as Quat2; + Quat2.normalize(quat2A, quat2A); + Mat4.fromQuat2(matrixA, quat2A); + }); + + describe('with a separate output quaternion', () => { + beforeEach(() => { + result = Quat2.rotateZ(out, quat2A, 1); + // Same thing with a matrix + Mat4.rotateZ(matOut, matrixA, 1); + Quat2.fromMat4(quatOut, matOut); + }); + + it('should place values into out', () => expect(out).toBeQuat2(quatOut)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(quat2B)); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { + result = Quat2.rotateZ(quat2A, quat2A, 1); + // Same thing with a matrix + Mat4.rotateZ(matOut, matrixA, 1); + Quat2.fromMat4(quatOut, matOut); + }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(quatOut)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + }); + }); + + describe('from/toMat4', () => { + let matRes = Mat4.create(); + const matOut = Mat4.create(); + const rotationQuat = Quat.create(); + + describe('quat to matrix and back', () => { + beforeEach(() => { + Quat.normalize(rotationQuat, [1, 2, 3, 4]); + + Quat2.fromRotationTranslation(quat2A, rotationQuat, [1, -5, 3]); + matRes = Mat4.fromQuat2(matOut, quat2A) as Mat4; + + result = Quat2.fromMat4(out, matRes); + }); + + it('should return out', () => expect(result).toBe(out)); + it('should return matOut', () => expect(matRes).toBe(matOut)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(0.18257418, 0.36514836, 0.54772257, 0.73029673, + -1.5518806, -1.82574184, 1.73445473, 0)); + it('should be equal to the starting dual quat', () => expect(quat2A).toBeQuat2(result as Quat2Like)); + }); + }); + + describe('create', () => { + beforeEach(() => { result = Quat2.create(); }); + + it('should return 2 4 element arrays initialized to an identity dual quaternion', + () => expect(result).toBeQuat2(0, 0, 0, 1, 0, 0, 0, 0)); + }); + + describe('clone', () => { + beforeEach(() => { result = Quat2.clone(quat2A); }); + + it('should return 2 4 element arrays initialized to the values in quat2A', + () => expect(result).toBeQuat2(quat2A)); + }); + + describe('fromValues', () => { + beforeEach(() => { result = Quat2.fromValues(1, 2, 3, 4, 5, 7, 8, -2); }); + + it('should return 2 4 element arrays initialized to the values passedd to the values passed', + () => expect(result).toBeQuat2(1, 2, 3, 4, 5, 7, 8, -2)); + }); + + describe('copy', () => { + beforeEach(() => { result = Quat2.copy(out, quat2A); }); + + it('should place values into out', () => expect(out).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('set', () => { + beforeEach(() => { result = Quat2.set(out, 1, 2, 3, 4, 2, 5, 6, -2); }); + + it('should place values into out', () => expect(out).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('identity', () => { + beforeEach(() => { result = Quat2.identity(out); }); + + it('should place values into out', () => expect(result).toBeQuat2(0, 0, 0, 1, 0, 0, 0, 0)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('add', () => { + describe('with a separate output dual quaternion', () => { + beforeEach(() => { result = Quat2.add(out, quat2A, quat2B); }); + + it('should place values into out', () => expect(out).toBeQuat2(6, 8, 10, 12, 11, 13, 12, -6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + it('should not modify quat2B', () => expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4)); + }); + + describe('when quat2A is the output dual quaternion', () => { + beforeEach(() => { result = Quat2.add(quat2A, quat2A, quat2B); }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(6, 8, 10, 12, 11, 13, 12, -6)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + it('should not modify quat2B', () => expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4)); + }); + + describe('when quat2B is the output dual quaternion', () => { + beforeEach(() => { result = Quat2.add(quat2B, quat2A, quat2B); }); + + it('should place values into quat2B', () => expect(quat2B).toBeQuat2(6, 8, 10, 12, 11, 13, 12, -6)); + it('should return quat2B', () => expect(result).toBe(quat2B)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + }); + }); + + describe('multiply', () => { + it('should have an alias called `mul`', () => expect(Quat2.mul).toEqual(Quat2.multiply)); + + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat2.multiply(out, quat2A, quat2B); }); + + it('should place values into out', () => expect(out).toBeQuat2(24, 48, 48, -6, 25, 89, 23, -157)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + it('should not modify quat2B', () => expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4)); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { result = Quat2.multiply(quat2A, quat2A, quat2B); }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(24, 48, 48, -6, 25, 89, 23, -157)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + it('should not modify quat2B', () => expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4)); + }); + + describe('when quat2B is the output quaternion', () => { + beforeEach(() => { result = Quat2.multiply(quat2B, quat2A, quat2B); }); + + it('should place values into quat2B', () => expect(quat2B).toBeQuat2(24, 48, 48, -6, 25, 89, 23, -157)); + it('should return quat2B', () => expect(result).toBe(quat2B)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + }); + + describe('same as matrix multiplication', () => { + const matrixA = Mat4.create(), matrixB = Mat4.create(); + const matOut = Mat4.create(), quatOut = Quat2.create(); + + beforeEach(() => { + // quat2A and quat2B only seem to work when created using this function? + Quat2.fromRotationTranslation(quat2A, [1, 2, 3, 4], [-5, 4, 10]); + Quat2.normalize(quat2A, quat2A); + Mat4.fromQuat2(matrixA, quat2A); + + Quat2.fromRotationTranslation(quat2B, [5, 6, 7, 8], [9, 8, 6]); + Quat2.normalize(quat2B, quat2B); + Mat4.fromQuat2(matrixB, quat2B); + }); + + it('the matrices should be equal to the dual quaternions', () => { + const testQuat = Quat2.create(); + Quat2.fromMat4(testQuat, matrixA); + expect(testQuat).toBeQuat2(...quat2A); + + Quat2.fromMat4(testQuat, matrixB); + expect(testQuat).toBeQuat2(...quat2B); + }); + + it('should be equal to the matrix multiplication', () => { + Quat2.multiply(out, quat2A, quat2B); + Mat4.mul(matOut, matrixA, matrixB); + Quat2.fromMat4(quatOut, matOut); + expect(out).toBeQuat2(quatOut); + }); + }); + }); + + describe('scale', () => { + describe('with a separate output dual quaternion', () => { + beforeEach(() => { result = Quat2.scale(out, quat2A, 2); }); + + it('should place values into out', () => expect(out).toBeQuat2(2, 4, 6, 8, 4, 10, 12, -4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + }); + + describe('when quat2A is the output dual quaternion', () => { + beforeEach(() => { result = Quat2.scale(quat2A, quat2A, 2); }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(2, 4, 6, 8, 4, 10, 12, -4)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + }); + }); + + describe('length', () => { + beforeEach(() => { result = Quat2.length(quat2A); }); + + it('should have an alias called `len`', () => expect(Quat2.len).toEqual(Quat2.length)); + it('should return the length', () => expect(result).toBeCloseTo(5.477225)); + }); + + describe('squaredLength', () => { + beforeEach(() => { result = Quat2.squaredLength(quat2A); }); + + it('should have an alias called `sqrLen`', () => expect(Quat2.sqrLen).toEqual(Quat2.squaredLength)); + it('should return the squared length', () => expect(result).toBeCloseTo(30)); + }); + + describe('fromRotation', () => { + beforeEach(() => { result = Quat2.fromRotation(out, [1, 2, 3, 4]); }); + + it('should place values into out', () => expect(out).toBeQuat2(1, 2, 3, 4, 0, 0, 0, 0)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify the quaternion', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + }); + + describe('fromTranslation', () => { + beforeEach(() => { vec = [1, 2, 3]; result = Quat2.fromTranslation(out, vec); }); + + it('should place values into out', () => expect(out).toBeQuat2(0, 0, 0, 1, 0.5, 1, 1.5, 0)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify the vector', () => expect(vec).toBeVec(1, 2, 3)); + }); + + describe('fromRotationTranslation', () => { + beforeEach(() => { + vec = [1, 2, 3]; + result = Quat2.fromRotationTranslation(out, [1, 2, 3, 4], vec); + }); + + it('should place values into out', () => expect(out).toBeQuat2(1, 2, 3, 4, 2, 4, 6, -7)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify the quaternion', () => expect(Quat2.getReal(outQuat, quat2A)).toBeVec(1, 2, 3, 4)); + it('should not modify the vector', () => expect(vec).toBeVec(1, 2, 3)); + it('should have a translation that can be retrieved with getTranslation', () => { + const t: Vec3Like = [0, 0, 0]; + Quat2.normalize(out, out); + Quat2.getTranslation(t, out); + + expect(t).toBeVec(1, 2, 3); + }); + }); + + describe('fromRotationTranslationValues', () => { + beforeEach(() => { result = Quat2.fromRotationTranslationValues(1, 2, 3, 4, 1, 2, 3); }); + + it('should return the correct result', () => expect(result).toBeQuat2(1, 2, 3, 4, 2, 4, 6, -7)); + it('should have a translation that can be retrieved with getTranslation', () => { + const t: Vec3Like = [0, 0, 0]; + + Quat2.normalize(result as Quat2Like, result as Quat2Like); + Quat2.getTranslation(t, result as Quat2Like); + expect(t).toBeVec(1, 2, 3); + }); + }); + + describe('getTranslation', () => { + describe('without a real part', () => { + beforeEach(() => { + Quat2.fromTranslation(out, [1, 2, 3]); + resultVec = Quat2.getTranslation(outVec, out); + }); + + describe('not normalized', () => { + it('should return the same translation value', () => expect(outVec).toBeVec(1, 2, 3)); + it('should return out', () => expect(outVec).toBe(resultVec)); + }); + + describe('normalized', () => { + it('should return the same translation value', () => { + Quat2.normalize(outVec, outVec); + expect(outVec).toBeVec(1, 2, 3); + }); + }); + }); + + describe('with a real part', () => { + beforeEach(() => { + Quat2.fromRotationTranslation(out, [2, 4, 6, 2], [1, 2, 3]); + resultVec = Quat2.getTranslation(outVec, out); + }); + + describe('not normalized', () => { + it('should not return the same translation value', () => expect(outVec).not.toBeVec(1, 2, 3)); + it('should return out', () => expect(outVec).toBe(resultVec)); + }); + + describe('normalized', () => { + it('should return the same translation value', () => { + Quat2.normalize(out, out); + Quat2.getTranslation(outVec, out); + expect(outVec).toBeVec(1, 2, 3); + }); + }); + }); + }); + + describe('normalize', () => { + describe('when it is normalizing quat2A', () => { + beforeEach(() => { + quat2A = [1, 2, 3, 4, 2, 5, 6, -2]; + Quat2.normalize(out, quat2A); + }); + + it('both parts should have been normalized', () => expect(out).toBeQuat2(1 / 5.4772255, 2 / 5.4772255, + 3 / 5.4772255, 4 / 5.4772255, 0.231260, 0.6450954, 0.693781, -0.9006993)); + }); + + beforeEach(() => { quat2A = [5, 0, 0, 0, 0, 0, 0, 0]; }); + + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat2.normalize(out, quat2A); }); + + it('should place values into out', () => expect(out).toBeQuat2(1, 0, 0, 0, 0, 0, 0, 0)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(5, 0, 0, 0, 0, 0, 0, 0)); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { result = Quat2.normalize(quat2A, quat2A); }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(1, 0, 0, 0, 0, 0, 0, 0)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + }); + + describe('when it contains a translation', () => { + beforeEach(() => { + Quat2.set(out, 5, 0, 0, 0, 1, 2, 3, 5); + Quat2.normalize(out, out); + }); + + it('both parts should have been normalized', () => expect(out).toBeQuat2(1, 0, 0, 0, 0, 0.4, 0.6, 1)); + }); + }); + + describe('lerp', () => { + describe('with a separate output quaternion', () => { + beforeEach(() => { result = Quat2.lerp(out, quat2A, quat2B, 0.7); }); + + it('should place values into out', () => expect(out).toBeQuat2(3.8, 4.8, 5.8, 6.8, 6.9, 7.1, 6.0, -3.4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + it('should not modify quat2B', () => expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4)); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { result = Quat2.lerp(quat2A, quat2A, quat2B, 0.5); }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(3, 4, 5, 6, 5.5, 6.5, 6, -3)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + it('should not modify quat2B', () => expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4)); + }); + + describe('when quat2B is the output quaternion', () => { + beforeEach(() => { result = Quat2.lerp(quat2B, quat2A, quat2B, 0.5); }); + + it('should place values into quat2B', () => expect(quat2B).toBeQuat2(3, 4, 5, 6, 5.5, 6.5, 6, -3)); + it('should return quat2B', () => expect(result).toBe(quat2B)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + }); + + describe('shortest path', () => { + beforeEach(() => { result = Quat2.lerp(out, [1, 2, 3, -4, 2, 5, 6, -2], [5, -6, 7, 8, 9, 8, 6, -4], 0.4); }); + + it('should pick the shorter path', () => expect(out).toBeQuat2(-1.4, 3.6, -1, -5.6, -2.4, -0.2, 1.2, 0.4)); + }); + }); + + describe('dot', () => { + describe('with a separate output dual quaternion', () => { + beforeEach(() => { result = Quat2.dot(quat2A, quat2B); }); + + it('should return the dot product', () => expect(result).toBe(70)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + it('should not modify quat2B', () => expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4)); + }); + }); + + describe('invert', () => { + describe('with a separate output dual quaternion', () => { + beforeEach(() => { result = Quat2.invert(out, quat2A); }); + + it('should place values into out', () => expect(out).toBeQuat2( + -0.0333333333, -0.06666666666, -0.1, 0.13333333333, -2 / 30, -5 / 30, -6 / 30, -2 / 30)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + it('the real part should be equal to a inverted quaternion', () => { + Quat.invert(outQuat, [1, 2, 3, 4]); + expect(Quat2.getReal(outQuat, out)).toBeVec(...outQuat); + }); + }); + + describe('when quat2A is the output quaternion', () => { + beforeEach(() => { result = Quat2.invert(quat2A, quat2A); }); + + it('should place values into quat2A', () => expect(quat2A).toBeVec( + -0.0333333333, -0.06666666666, -0.1, 0.13333333333, -2 / 30, -5 / 30, -6 / 30, -2 / 30)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + }); + }); + + describe('get real/dual', () => { + describe('get real', () => { + beforeEach(() => { result = Quat2.getReal(outQuat, quat2A); }); + + it('should place values into out', () => expect(outQuat).toBeVec(1, 2, 3, 4)); + it('should return out', () => expect(result).toBe(outQuat)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + }); + + describe('get dual', () => { + beforeEach(() => { result = Quat2.getDual(outQuat, quat2A); }); + + it('should place values into out', () => expect(outQuat).toBeVec(2, 5, 6, -2)); + it('should return out', () => expect(result).toBe(outQuat)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + }); + }); + + describe('set real/dual', () => { + describe('set real', () => { + beforeEach(() => { + outQuat = [4, 6, 8, -100]; + result = Quat2.setReal(quat2A, outQuat); + }); + + it('should place values into out', () => expect(quat2A).toBeQuat2(4, 6, 8, -100, 2, 5, 6, -2)); + it('should return out', () => expect(result).toBe(quat2A)); + it('should not modify outQuat', () => expect(outQuat).toBeVec(4, 6, 8, -100)); + }); + + describe('set dual', () => { + beforeEach(() => { + outQuat = [4.3, 6, 8, -100]; + result = Quat2.setDual(quat2A, outQuat); + }); + + it('should place values into out', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 4.3, 6, 8, -100)); + it('should return out', () => expect(result).toBe(quat2A)); + it('should not modify outQuat', () => expect(outQuat).toBeVec(4.3, 6, 8, -100)); + }); + }); + + describe('conjugate', () => { + describe('with a separate output dual quaternion', () => { + beforeEach(() => { result = Quat2.conjugate(out, quat2A); }); + + it('should place values into out', () => expect(out).toBeQuat2(-1, -2, -3, 4, -2, -5, -6, -2)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify quat2A', () => expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2)); + }); + + describe('when quat2A is the output dual quaternion', () => { + beforeEach(() => { result = Quat2.conjugate(quat2A, quat2A); }); + + it('should place values into quat2A', () => expect(quat2A).toBeQuat2(-1, -2, -3, 4, -2, -5, -6, -2)); + it('should return quat2A', () => expect(result).toBe(quat2A)); + }); + }); + + describe('str', () => { + beforeEach(() => { result = Quat2.str(quat2A); }); + + it('should return a string representation of the quaternion', + () => expect(result).toEqual('Quat2(1, 2, 3, 4, 2, 5, 6, -2)')); + }); + + describe('exactEquals', () => { + let quat2C: Quat2Like, r0: boolean, r1: boolean; + + beforeEach(() => { + quat2A = [0, 1, 2, 3, 4, 5, 6, 7]; + quat2B = [0, 1, 2, 3, 4, 5, 6, 7]; + quat2C = [1, 2, 3, 4, 5, 6, 7, 8]; + r0 = Quat2.exactEquals(quat2A, quat2B); + r1 = Quat2.exactEquals(quat2A, quat2C); + }); + + it('should return true for identical quaternions', () => expect(r0).toBe(true)); + it('should return false for different quaternions', () => expect(r1).toBe(false)); + it('should not modify quat2A', () => expect(quat2A).toBeVec(0, 1, 2, 3, 4, 5, 6, 7)); + it('should not modify quat2B', () => expect(quat2B).toBeVec(0, 1, 2, 3, 4, 5, 6, 7)); + }); + + describe('equals', () => { + let quat2C: Quat2Like, quat2D: Quat2Like, r0: boolean, r1: boolean, r2: boolean; + + beforeEach(() => { + quat2A = [0, 1, 2, 3, 4, 5, 6, 7]; + quat2B = [0, 1, 2, 3, 4, 5, 6, 7]; + quat2C = [1, 2, 3, 4, 5, 6, 7, 8]; + quat2D = [1e-16, 1, 2, 3, 4, 5, 6, 7]; + r0 = Quat2.equals(quat2A, quat2B); + r1 = Quat2.equals(quat2A, quat2C); + r2 = Quat2.equals(quat2A, quat2D); + }); + + it('should return true for identical dual quaternions', () => expect(r0).toBe(true)); + it('should return false for different dual quaternions', () => expect(r1).toBe(false)); + it('should return true for close but not identical quaternions', () => expect(r2).toBe(true)); + it('should not modify quat2A', () => expect(quat2A).toBeVec(0, 1, 2, 3, 4, 5, 6, 7)); + it('should not modify quat2B', () => expect(quat2B).toBeVec(0, 1, 2, 3, 4, 5, 6, 7)); + }); + }); +}); diff --git a/tests/f64/Vec2-swizzle.spec.ts b/tests/f64/Vec2-swizzle.spec.ts new file mode 100644 index 00000000..428b15c2 --- /dev/null +++ b/tests/f64/Vec2-swizzle.spec.ts @@ -0,0 +1,521 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Vec2 } from '#gl-matrix/f64'; +import { EnableSwizzlesF64 } from '#gl-matrix/swizzle/f64'; + +describe('Vec2 Swizzles', () => { + EnableSwizzlesF64(); + + let v: Vec2; + beforeEach(() => { v = new Vec2(1, 2); }); + + // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should + // not be modified by hand. + // [Swizzle Autogen] + + describe('Vec2().xx', () => { + it('should return Vec2(x, x)', () => expect(v.xx).toBeVec(v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xy', () => { + it('should return Vec2(x, y)', () => expect(v.xy).toBeVec(v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yx', () => { + it('should return Vec2(y, x)', () => expect(v.yx).toBeVec(v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yy', () => { + it('should return Vec2(y, y)', () => expect(v.yy).toBeVec(v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xxx', () => { + it('should return Vec3(x, x, x)', () => expect(v.xxx).toBeVec(v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xxy', () => { + it('should return Vec3(x, x, y)', () => expect(v.xxy).toBeVec(v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xyx', () => { + it('should return Vec3(x, y, x)', () => expect(v.xyx).toBeVec(v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xyy', () => { + it('should return Vec3(x, y, y)', () => expect(v.xyy).toBeVec(v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yxx', () => { + it('should return Vec3(y, x, x)', () => expect(v.yxx).toBeVec(v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yxy', () => { + it('should return Vec3(y, x, y)', () => expect(v.yxy).toBeVec(v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yyx', () => { + it('should return Vec3(y, y, x)', () => expect(v.yyx).toBeVec(v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yyy', () => { + it('should return Vec3(y, y, y)', () => expect(v.yyy).toBeVec(v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xxxx', () => { + it('should return Vec4(x, x, x, x)', () => expect(v.xxxx).toBeVec(v[0], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xxxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xxxy', () => { + it('should return Vec4(x, x, x, y)', () => expect(v.xxxy).toBeVec(v[0], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xxxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xxyx', () => { + it('should return Vec4(x, x, y, x)', () => expect(v.xxyx).toBeVec(v[0], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xxyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xxyy', () => { + it('should return Vec4(x, x, y, y)', () => expect(v.xxyy).toBeVec(v[0], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xxyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xyxx', () => { + it('should return Vec4(x, y, x, x)', () => expect(v.xyxx).toBeVec(v[0], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xyxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xyxy', () => { + it('should return Vec4(x, y, x, y)', () => expect(v.xyxy).toBeVec(v[0], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xyxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xyyx', () => { + it('should return Vec4(x, y, y, x)', () => expect(v.xyyx).toBeVec(v[0], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xyyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().xyyy', () => { + it('should return Vec4(x, y, y, y)', () => expect(v.xyyy).toBeVec(v[0], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xyyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yxxx', () => { + it('should return Vec4(y, x, x, x)', () => expect(v.yxxx).toBeVec(v[1], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yxxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yxxy', () => { + it('should return Vec4(y, x, x, y)', () => expect(v.yxxy).toBeVec(v[1], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yxxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yxyx', () => { + it('should return Vec4(y, x, y, x)', () => expect(v.yxyx).toBeVec(v[1], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yxyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yxyy', () => { + it('should return Vec4(y, x, y, y)', () => expect(v.yxyy).toBeVec(v[1], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yxyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yyxx', () => { + it('should return Vec4(y, y, x, x)', () => expect(v.yyxx).toBeVec(v[1], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yyxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yyxy', () => { + it('should return Vec4(y, y, x, y)', () => expect(v.yyxy).toBeVec(v[1], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yyxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yyyx', () => { + it('should return Vec4(y, y, y, x)', () => expect(v.yyyx).toBeVec(v[1], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yyyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().yyyy', () => { + it('should return Vec4(y, y, y, y)', () => expect(v.yyyy).toBeVec(v[1], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yyyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rr', () => { + it('should return Vec2(r, r)', () => expect(v.rr).toBeVec(v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rg', () => { + it('should return Vec2(r, g)', () => expect(v.rg).toBeVec(v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().gr', () => { + it('should return Vec2(g, r)', () => expect(v.gr).toBeVec(v[1], v[0])); + it('should be return a copy', () => { + const sw = v.gr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().gg', () => { + it('should return Vec2(g, g)', () => expect(v.gg).toBeVec(v[1], v[1])); + it('should be return a copy', () => { + const sw = v.gg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rrr', () => { + it('should return Vec3(r, r, r)', () => expect(v.rrr).toBeVec(v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rrg', () => { + it('should return Vec3(r, r, g)', () => expect(v.rrg).toBeVec(v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rgr', () => { + it('should return Vec3(r, g, r)', () => expect(v.rgr).toBeVec(v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rgg', () => { + it('should return Vec3(r, g, g)', () => expect(v.rgg).toBeVec(v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().grr', () => { + it('should return Vec3(g, r, r)', () => expect(v.grr).toBeVec(v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.grr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().grg', () => { + it('should return Vec3(g, r, g)', () => expect(v.grg).toBeVec(v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.grg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().ggr', () => { + it('should return Vec3(g, g, r)', () => expect(v.ggr).toBeVec(v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.ggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().ggg', () => { + it('should return Vec3(g, g, g)', () => expect(v.ggg).toBeVec(v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.ggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rrrr', () => { + it('should return Vec4(r, r, r, r)', () => expect(v.rrrr).toBeVec(v[0], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rrrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rrrg', () => { + it('should return Vec4(r, r, r, g)', () => expect(v.rrrg).toBeVec(v[0], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rrrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rrgr', () => { + it('should return Vec4(r, r, g, r)', () => expect(v.rrgr).toBeVec(v[0], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rrgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rrgg', () => { + it('should return Vec4(r, r, g, g)', () => expect(v.rrgg).toBeVec(v[0], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rrgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rgrr', () => { + it('should return Vec4(r, g, r, r)', () => expect(v.rgrr).toBeVec(v[0], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rgrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rgrg', () => { + it('should return Vec4(r, g, r, g)', () => expect(v.rgrg).toBeVec(v[0], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rgrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rggr', () => { + it('should return Vec4(r, g, g, r)', () => expect(v.rggr).toBeVec(v[0], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().rggg', () => { + it('should return Vec4(r, g, g, g)', () => expect(v.rggg).toBeVec(v[0], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().grrr', () => { + it('should return Vec4(g, r, r, r)', () => expect(v.grrr).toBeVec(v[1], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.grrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().grrg', () => { + it('should return Vec4(g, r, r, g)', () => expect(v.grrg).toBeVec(v[1], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.grrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().grgr', () => { + it('should return Vec4(g, r, g, r)', () => expect(v.grgr).toBeVec(v[1], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.grgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().grgg', () => { + it('should return Vec4(g, r, g, g)', () => expect(v.grgg).toBeVec(v[1], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.grgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().ggrr', () => { + it('should return Vec4(g, g, r, r)', () => expect(v.ggrr).toBeVec(v[1], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.ggrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().ggrg', () => { + it('should return Vec4(g, g, r, g)', () => expect(v.ggrg).toBeVec(v[1], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.ggrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().gggr', () => { + it('should return Vec4(g, g, g, r)', () => expect(v.gggr).toBeVec(v[1], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.gggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec2().gggg', () => { + it('should return Vec4(g, g, g, g)', () => expect(v.gggg).toBeVec(v[1], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.gggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + // [/Swizzle Autogen] +}); diff --git a/tests/f64/Vec2.spec.ts b/tests/f64/Vec2.spec.ts new file mode 100644 index 00000000..9ae1dcaa --- /dev/null +++ b/tests/f64/Vec2.spec.ts @@ -0,0 +1,801 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Vec2 } from '#gl-matrix/f64'; + +import type { Mat2Like, Mat2dLike, Vec2Like, Vec3Like } from '#gl-matrix/types'; + +describe('Vec2', () => { + let vecA: Vec2; + let vecB: Vec2; + let out: Vec2; + + beforeEach(() => { + vecA = new Vec2(1, 2); + vecB = new Vec2([3, 4]); + out = new Vec2(); + }); + + describe('constructor', () => { + it('should return Vec2(0, 0) if called with no arguments', () => expect(new Vec2()).toBeVec(0, 0)); + + it('should return Vec2(x, y) if called with (x, y)', () => { + expect(new Vec2(1, 2)).toBeVec(1, 2); + expect(new Vec2(-3, 4.4)).toBeVec(-3, 4.4); + }); + + it('should return Vec2(x, x) if called with (x)', () => { + expect(new Vec2(1)).toBeVec(1, 1); + expect(new Vec2(-2.3)).toBeVec(-2.3, -2.3); + }); + + it('should return Vec2(x, y) if called with ([x, y])', () => { + expect(new Vec2([1, 2])).toBeVec(1, 2); + expect(new Vec2([-3, 4.4])).toBeVec(-3, 4.4); + }); + + it('should return Vec2(x, y) if called with (Vec2(x, y))', () => { + const v = new Vec2(3.4, 5.6); + expect(new Vec2(v)).toBeVec(v); + }); + + it('should return Vec2(x, y) if called with (Float64Array([x, y]))', () => { + const arr = new Float64Array([1.2, 3.4]); + expect(new Vec2(arr)).toBeVec(arr); + }); + }); + + describe('static methods', () => { + describe('create', () => { + it('should return Vec2(0, 0)', () => expect(Vec2.create()).toBeVec(0, 0)); + }); + + describe('add', () => { + let result: Vec2Like; + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.add(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(4, 6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.add(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(4, 6)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec2.add(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(4, 6)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + + describe('with raw array as the output', () => { + const outArray: Vec2Like = [0, 0]; + beforeEach(() => { result = Vec2.add(outArray, vecA, vecB); }); + + it('should place values into out', () => expect(outArray).toBeVec(4, 6)); + it('should return out', () => expect(result).toBe(outArray)); + }); + + describe('with raw arrays as the inputs', () => { + beforeEach(() => { result = Vec2.add(out, [1, 2], [3, 4]); }); + + it('should place values into out', () => expect(out).toBeVec(4, 6)); + it('should return out', () => expect(result).toBe(out)); + }); + }); + }); + + describe('static', () => { + let out: Vec2Like, vecA: Vec2Like, vecB: Vec2Like, result: Vec2Like | number; + + beforeEach(() => { + vecA = new Vec2(1, 2); + vecB = new Vec2(3, 4); + out = new Vec2(0, 0); + }); + + describe('create', () => { + beforeEach(() => { result = Vec2.create(); }); + + it('should return a 2 element array initialized to 0s', () => expect(result).toBeVec(0, 0)); + }); + + describe('clone', () => { + beforeEach(() => { result = Vec2.clone(vecA); }); + + it('should return a 2 element array initialized to the values in vecA', () => expect(result).toBeVec(vecA)); + }); + + describe('fromValues', () => { + beforeEach(() => { result = Vec2.fromValues(1, 2); }); + + it('should return a 2 element array initialized to the values passed', () => expect(result).toBeVec(1, 2)); + }); + + describe('copy', () => { + beforeEach(() => { result = Vec2.copy(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('set', () => { + beforeEach(() => { result = Vec2.set(out, 1, 2); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('add', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.add(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(4, 6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.add(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(4, 6)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec2.add(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(4, 6)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + }); + + describe('subtract', () => { + it('should have an alias called `sub`', () => expect(Vec2.sub).toEqual(Vec2.subtract)); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.subtract(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(-2, -2)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.subtract(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(-2, -2)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec2.subtract(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(-2, -2)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + }); + + describe('multiply', () => { + it('should have an alias called `mul`', () => expect(Vec2.mul).toEqual(Vec2.multiply)); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.multiply(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(3, 8)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.multiply(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 8)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec2.multiply(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(3, 8)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + }); + + describe('divide', () => { + it('should have an alias called `div`', () => expect(Vec2.div).toEqual(Vec2.divide)); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.divide(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(0.3333333, 0.5)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.divide(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(0.3333333, 0.5)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec2.divide(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(0.3333333, 0.5)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + }); + + describe('ceil', () => { + beforeEach(() => { vecA = [Math.E, Math.PI]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.ceil(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(3, 4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(Math.E, Math.PI)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.ceil(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 4)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('floor', () => { + beforeEach(() => { vecA = [Math.E, Math.PI]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.floor(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(2, 3)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(Math.E, Math.PI)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.floor(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(2, 3)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('min', () => { + beforeEach(() => { vecA = [1, 4]; vecB = [3, 2]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.min(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 4)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.min(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 2)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 2)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec2.min(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(1, 2)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 4)); + }); + }); + + describe('max', () => { + beforeEach(() => { vecA = [1, 4]; vecB = [3, 2]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.max(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(3, 4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 4)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.max(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 4)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 2)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec2.max(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(3, 4)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 4)); + }); + }); + + describe('round', () => { + beforeEach(() => { vecA = [Math.E, Math.PI]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.round(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(3, 3)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(Math.E, Math.PI)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.round(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 3)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('scale', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.scale(out, vecA, 2); }); + + it('should place values into out', () => expect(out).toBeVec(2, 4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.scale(vecA, vecA, 2); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(2, 4)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('scaleAndAdd', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.scaleAndAdd(out, vecA, vecB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(2.5, 4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.scaleAndAdd(vecA, vecA, vecB, 0.5); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(2.5, 4)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec2.scaleAndAdd(vecB, vecA, vecB, 0.5); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(2.5, 4)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + }); + + describe('distance', () => { + beforeEach(() => { result = Vec2.distance(vecA, vecB); }); + + it('should have an alias called `dist`', () => expect(Vec2.dist).toEqual(Vec2.distance)); + it('should return the distance', () => expect(result).toBeCloseTo(2.828427)); + }); + + describe('squaredDistance', () => { + beforeEach(() => { result = Vec2.squaredDistance(vecA, vecB); }); + + it('should have an alias called `sqrDist`', () => expect(Vec2.sqrDist).toEqual(Vec2.squaredDistance)); + it('should return the squared distance', () => expect(result).toEqual(8)); + }); + + describe('length', () => { + beforeEach(() => { result = Vec2.len(vecA); }); + + it('should have an alias called `len`', () => expect(Vec2.len).toEqual(Vec2.length)); + it('should return the length', () => expect(result).toBeCloseTo(2.236067)); + }); + + describe('squaredLength', () => { + beforeEach(() => { result = Vec2.squaredLength(vecA); }); + + it('should have an alias called `sqrLen`', () => expect(Vec2.sqrLen).toEqual(Vec2.squaredLength)); + it('should return the squared length', () => expect(result).toEqual(5)); + }); + + describe('negate', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.negate(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(-1, -2)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.negate(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(-1, -2)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('inverse', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.inverse(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 1 / 2)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.inverse(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 1 / 2)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('abs', () => { + beforeEach(() => { vecA = [-1, -2]; }); + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.abs(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(-1, -2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.abs(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 2)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('normalize', () => { + beforeEach(() => { vecA = [5, 0]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.normalize(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 0)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(5, 0)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.normalize(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 0)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('dot', () => { + beforeEach(() => { result = Vec2.dot(vecA, vecB); }); + + it('should return the dot product', () => expect(result).toEqual(11)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('cross', () => { + let out3: Vec3Like; + + beforeEach(() => { + out3 = [0, 0, 0]; + result = Vec2.cross(out3 as unknown as Vec2Like, vecA, vecB); + }); + + it('should place values into out', () => expect(out3).toBeVec(0, 0, -2)); + it('should return out', () => expect(result).toBe(out3)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('lerp', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.lerp(out, vecA, vecB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(2, 3)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.lerp(vecA, vecA, vecB, 0.5); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(2, 3)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 4)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec2.lerp(vecB, vecA, vecB, 0.5); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(2, 3)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + }); + + /* + describe('random', () => { + describe('with no scale', () => { + beforeEach(() => { result = Vec2.random(out); }); + + it('should result in a unit length vector', () => expect(Vec2.len(out)).toBeCloseTo(1.0)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('with a scale', () => { + beforeEach(() => { result = Vec2.random(out, 5.0); }); + + it('should result in a unit length vector', () => expect(Vec2.len(out)).toBeCloseTo(5.0)); + it('should return out', () => expect(result).toBe(out)); + }); + });*/ + + describe('transformMat2', () => { + let matA: Mat2Like; + + beforeEach(() => { matA = [1, 2, 3, 4]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.transformMat2(out, vecA, matA); }); + + it('should place values into out', () => expect(out).toBeVec(7, 10)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.transformMat2(vecA, vecA, matA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(7, 10)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('transformMat2d', () => { + let matA: Mat2dLike; + + beforeEach(() => { matA = [1, 2, 3, 4, 5, 6]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec2.transformMat2d(out, vecA, matA); }); + + it('should place values into out', () => expect(out).toBeVec(12, 16)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec2.transformMat2d(vecA, vecA, matA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(12, 16)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify matA', () => expect(matA).toBeVec(1, 2, 3, 4, 5, 6)); + }); + }); + + /* + describe('forEach', () => { + let vecArray; + + beforeEach(() => { + vecArray = [ + 1, 2, + 3, 4, + 0, 0 + ]; + }); + + describe('when performing operations that take no extra arguments', () => { + beforeEach(() => { result = Vec2.forEach(vecArray, 0, 0, 0, Vec2.normalize); }); + + it('should update all values', () => { + expect(vecArray).toBeEqualish([ + 0.447214, 0.894427, + 0.6, 0.8, + 0, 0 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + }); + + describe('when performing operations that takes one extra arguments', () => { + beforeEach(() => { result = Vec2.forEach(vecArray, 0, 0, 0, Vec2.add, vecA); }); + + it('should update all values', () => { + expect(vecArray).toBeEqualish([ + 2, 4, + 4, 6, + 1, 2 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + + describe('when specifying an offset', () => { + beforeEach(() => { result = Vec2.forEach(vecArray, 0, 2, 0, Vec2.add, vecA); }); + + it('should update all values except the first vector', () => { + expect(vecArray).toBeEqualish([ + 1, 2, + 4, 6, + 1, 2 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + + describe('when specifying a count', () => { + beforeEach(() => { result = Vec2.forEach(vecArray, 0, 0, 2, Vec2.add, vecA); }); + + it('should update all values except the last vector', () => { + expect(vecArray).toBeEqualish([ + 2, 4, + 4, 6, + 0, 0 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + + describe('when specifying a stride', () => { + beforeEach(() => { result = Vec2.forEach(vecArray, 4, 0, 0, Vec2.add, vecA); }); + + it('should update all values except the second vector', () => { + expect(vecArray).toBeEqualish([ + 2, 4, + 3, 4, + 1, 2 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2)); + }); + + describe('when calling a function that does not modify the out variable', () => { + beforeEach(() => { result = Vec2.forEach(vecArray, 0, 0, 0, function(out, vec) {}); }); + + it('values should remain unchanged', () => { + expect(vecArray).toBeEqualish([ + 1, 2, + 3, 4, + 0, 0, + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + }); + });*/ + + describe('rotate', () => { + describe('rotation around world origin [0, 0, 0]', () => { + beforeEach(() => { + vecA = [0, 1]; + vecB = [0, 0]; + result = Vec2.rotate(out, vecA, vecB, Math.PI); + }); + + it('should return the rotated vector', () => expect(result).toBeVec(0, -1)); + }); + + describe('rotation around an arbitrary origin', () => { + beforeEach(() => { + vecA = [6, -5]; + vecB = [0, -5]; + result = Vec2.rotate(out, vecA, vecB, Math.PI); + }); + + it('should return the rotated vector', () => expect(result).toBeVec(-6, -5)); + }); + }); + + describe('angle', () => { + beforeEach(() => { + vecA = [1, 0]; + vecB = [1, 2]; + result = Vec2.angle(vecA, vecB); + }); + + it('should return the angle', () => expect(result).toBeCloseTo(1.10714)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 0)); + it('should not modify vecB', () => expect(vecB).toBeVec(1, 2)); + }); + + describe('str', () => { + it('should return a string representation of the vector', () => expect(Vec2.str(vecA)).toEqual('Vec2(1, 2)')); + }); + + describe('exactEquals', () => { + let vecC: Vec2Like, r0: boolean, r1: boolean; + + beforeEach(() => { + vecA = [0, 1]; + vecB = [0, 1]; + vecC = [1, 2]; + r0 = Vec2.exactEquals(vecA, vecB); + r1 = Vec2.exactEquals(vecA, vecC); + }); + + it('should return true for identical vectors', () => expect(r0).toBe(true)); + it('should return false for different vectors', () => expect(r1).toBe(false)); + it('should not modify vecA', () => expect(vecA).toBeVec(0, 1)); + it('should not modify vecB', () => expect(vecB).toBeVec(0, 1)); + }); + + describe('equals', () => { + let vecC: Vec2Like, vecD: Vec2Like, r0: boolean, r1: boolean, r2: boolean; + + beforeEach(() => { + vecA = [0, 1]; + vecB = [0, 1]; + vecC = [1, 2]; + vecD = [1e-16, 1]; + r0 = Vec2.equals(vecA, vecB); + r1 = Vec2.equals(vecA, vecC); + r2 = Vec2.equals(vecA, vecD); + }); + + it('should return true for identical vectors', () => expect(r0).toBe(true)); + it('should return false for different vectors', () => expect(r1).toBe(false)); + it('should return true for close but not identical vectors', () => expect(r2).toBe(true)); + it('should not modify vecA', () => expect(vecA).toBeVec(0, 1)); + it('should not modify vecB', () => expect(vecB).toBeVec(0, 1)); + }); + + describe('zero', () => { + beforeEach(() => { + vecA = [1, 2]; + result = Vec2.zero(vecA); + }); + + it('should result in a 2 element vector with zeros', () => expect(result).toBeVec(0, 0)); + }); + }); +}); diff --git a/tests/f64/Vec3-swizzle.spec.ts b/tests/f64/Vec3-swizzle.spec.ts new file mode 100644 index 00000000..9c21af43 --- /dev/null +++ b/tests/f64/Vec3-swizzle.spec.ts @@ -0,0 +1,2123 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Vec3 } from '#gl-matrix/f64'; +import { EnableSwizzlesF64 } from '#gl-matrix/swizzle/f64'; + +describe('Vec3 Swizzles', () => { + EnableSwizzlesF64(); + + let v: Vec3; + beforeEach(() => { v = new Vec3(1, 2, 3); }); + + // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should + // not be modified by hand. + // [Swizzle Autogen] + + describe('Vec3().xx', () => { + it('should return Vec2(x, x)', () => expect(v.xx).toBeVec(v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xy', () => { + it('should return Vec2(x, y)', () => expect(v.xy).toBeVec(v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xz', () => { + it('should return Vec2(x, z)', () => expect(v.xz).toBeVec(v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yx', () => { + it('should return Vec2(y, x)', () => expect(v.yx).toBeVec(v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yy', () => { + it('should return Vec2(y, y)', () => expect(v.yy).toBeVec(v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yz', () => { + it('should return Vec2(y, z)', () => expect(v.yz).toBeVec(v[1], v[2])); + it('should be return a copy', () => { + const sw = v.yz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zx', () => { + it('should return Vec2(z, x)', () => expect(v.zx).toBeVec(v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zy', () => { + it('should return Vec2(z, y)', () => expect(v.zy).toBeVec(v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zz', () => { + it('should return Vec2(z, z)', () => expect(v.zz).toBeVec(v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxx', () => { + it('should return Vec3(x, x, x)', () => expect(v.xxx).toBeVec(v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxy', () => { + it('should return Vec3(x, x, y)', () => expect(v.xxy).toBeVec(v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxz', () => { + it('should return Vec3(x, x, z)', () => expect(v.xxz).toBeVec(v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyx', () => { + it('should return Vec3(x, y, x)', () => expect(v.xyx).toBeVec(v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyy', () => { + it('should return Vec3(x, y, y)', () => expect(v.xyy).toBeVec(v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyz', () => { + it('should return Vec3(x, y, z)', () => expect(v.xyz).toBeVec(v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.xyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzx', () => { + it('should return Vec3(x, z, x)', () => expect(v.xzx).toBeVec(v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.xzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzy', () => { + it('should return Vec3(x, z, y)', () => expect(v.xzy).toBeVec(v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.xzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzz', () => { + it('should return Vec3(x, z, z)', () => expect(v.xzz).toBeVec(v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.xzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxx', () => { + it('should return Vec3(y, x, x)', () => expect(v.yxx).toBeVec(v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxy', () => { + it('should return Vec3(y, x, y)', () => expect(v.yxy).toBeVec(v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxz', () => { + it('should return Vec3(y, x, z)', () => expect(v.yxz).toBeVec(v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.yxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyx', () => { + it('should return Vec3(y, y, x)', () => expect(v.yyx).toBeVec(v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyy', () => { + it('should return Vec3(y, y, y)', () => expect(v.yyy).toBeVec(v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyz', () => { + it('should return Vec3(y, y, z)', () => expect(v.yyz).toBeVec(v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.yyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzx', () => { + it('should return Vec3(y, z, x)', () => expect(v.yzx).toBeVec(v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.yzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzy', () => { + it('should return Vec3(y, z, y)', () => expect(v.yzy).toBeVec(v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.yzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzz', () => { + it('should return Vec3(y, z, z)', () => expect(v.yzz).toBeVec(v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.yzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxx', () => { + it('should return Vec3(z, x, x)', () => expect(v.zxx).toBeVec(v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.zxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxy', () => { + it('should return Vec3(z, x, y)', () => expect(v.zxy).toBeVec(v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.zxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxz', () => { + it('should return Vec3(z, x, z)', () => expect(v.zxz).toBeVec(v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.zxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyx', () => { + it('should return Vec3(z, y, x)', () => expect(v.zyx).toBeVec(v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.zyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyy', () => { + it('should return Vec3(z, y, y)', () => expect(v.zyy).toBeVec(v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.zyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyz', () => { + it('should return Vec3(z, y, z)', () => expect(v.zyz).toBeVec(v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.zyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzx', () => { + it('should return Vec3(z, z, x)', () => expect(v.zzx).toBeVec(v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzy', () => { + it('should return Vec3(z, z, y)', () => expect(v.zzy).toBeVec(v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzz', () => { + it('should return Vec3(z, z, z)', () => expect(v.zzz).toBeVec(v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxxx', () => { + it('should return Vec4(x, x, x, x)', () => expect(v.xxxx).toBeVec(v[0], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xxxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxxy', () => { + it('should return Vec4(x, x, x, y)', () => expect(v.xxxy).toBeVec(v[0], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xxxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxxz', () => { + it('should return Vec4(x, x, x, z)', () => expect(v.xxxz).toBeVec(v[0], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xxxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxyx', () => { + it('should return Vec4(x, x, y, x)', () => expect(v.xxyx).toBeVec(v[0], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xxyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxyy', () => { + it('should return Vec4(x, x, y, y)', () => expect(v.xxyy).toBeVec(v[0], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xxyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxyz', () => { + it('should return Vec4(x, x, y, z)', () => expect(v.xxyz).toBeVec(v[0], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.xxyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxzx', () => { + it('should return Vec4(x, x, z, x)', () => expect(v.xxzx).toBeVec(v[0], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.xxzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxzy', () => { + it('should return Vec4(x, x, z, y)', () => expect(v.xxzy).toBeVec(v[0], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.xxzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xxzz', () => { + it('should return Vec4(x, x, z, z)', () => expect(v.xxzz).toBeVec(v[0], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.xxzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyxx', () => { + it('should return Vec4(x, y, x, x)', () => expect(v.xyxx).toBeVec(v[0], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xyxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyxy', () => { + it('should return Vec4(x, y, x, y)', () => expect(v.xyxy).toBeVec(v[0], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xyxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyxz', () => { + it('should return Vec4(x, y, x, z)', () => expect(v.xyxz).toBeVec(v[0], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xyxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyyx', () => { + it('should return Vec4(x, y, y, x)', () => expect(v.xyyx).toBeVec(v[0], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xyyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyyy', () => { + it('should return Vec4(x, y, y, y)', () => expect(v.xyyy).toBeVec(v[0], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xyyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyyz', () => { + it('should return Vec4(x, y, y, z)', () => expect(v.xyyz).toBeVec(v[0], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.xyyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyzx', () => { + it('should return Vec4(x, y, z, x)', () => expect(v.xyzx).toBeVec(v[0], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.xyzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyzy', () => { + it('should return Vec4(x, y, z, y)', () => expect(v.xyzy).toBeVec(v[0], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.xyzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xyzz', () => { + it('should return Vec4(x, y, z, z)', () => expect(v.xyzz).toBeVec(v[0], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.xyzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzxx', () => { + it('should return Vec4(x, z, x, x)', () => expect(v.xzxx).toBeVec(v[0], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xzxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzxy', () => { + it('should return Vec4(x, z, x, y)', () => expect(v.xzxy).toBeVec(v[0], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xzxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzxz', () => { + it('should return Vec4(x, z, x, z)', () => expect(v.xzxz).toBeVec(v[0], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xzxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzyx', () => { + it('should return Vec4(x, z, y, x)', () => expect(v.xzyx).toBeVec(v[0], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xzyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzyy', () => { + it('should return Vec4(x, z, y, y)', () => expect(v.xzyy).toBeVec(v[0], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xzyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzyz', () => { + it('should return Vec4(x, z, y, z)', () => expect(v.xzyz).toBeVec(v[0], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.xzyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzzx', () => { + it('should return Vec4(x, z, z, x)', () => expect(v.xzzx).toBeVec(v[0], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.xzzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzzy', () => { + it('should return Vec4(x, z, z, y)', () => expect(v.xzzy).toBeVec(v[0], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.xzzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().xzzz', () => { + it('should return Vec4(x, z, z, z)', () => expect(v.xzzz).toBeVec(v[0], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.xzzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxxx', () => { + it('should return Vec4(y, x, x, x)', () => expect(v.yxxx).toBeVec(v[1], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yxxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxxy', () => { + it('should return Vec4(y, x, x, y)', () => expect(v.yxxy).toBeVec(v[1], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yxxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxxz', () => { + it('should return Vec4(y, x, x, z)', () => expect(v.yxxz).toBeVec(v[1], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.yxxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxyx', () => { + it('should return Vec4(y, x, y, x)', () => expect(v.yxyx).toBeVec(v[1], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yxyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxyy', () => { + it('should return Vec4(y, x, y, y)', () => expect(v.yxyy).toBeVec(v[1], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yxyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxyz', () => { + it('should return Vec4(y, x, y, z)', () => expect(v.yxyz).toBeVec(v[1], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.yxyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxzx', () => { + it('should return Vec4(y, x, z, x)', () => expect(v.yxzx).toBeVec(v[1], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.yxzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxzy', () => { + it('should return Vec4(y, x, z, y)', () => expect(v.yxzy).toBeVec(v[1], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.yxzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yxzz', () => { + it('should return Vec4(y, x, z, z)', () => expect(v.yxzz).toBeVec(v[1], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.yxzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyxx', () => { + it('should return Vec4(y, y, x, x)', () => expect(v.yyxx).toBeVec(v[1], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yyxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyxy', () => { + it('should return Vec4(y, y, x, y)', () => expect(v.yyxy).toBeVec(v[1], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yyxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyxz', () => { + it('should return Vec4(y, y, x, z)', () => expect(v.yyxz).toBeVec(v[1], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.yyxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyyx', () => { + it('should return Vec4(y, y, y, x)', () => expect(v.yyyx).toBeVec(v[1], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yyyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyyy', () => { + it('should return Vec4(y, y, y, y)', () => expect(v.yyyy).toBeVec(v[1], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yyyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyyz', () => { + it('should return Vec4(y, y, y, z)', () => expect(v.yyyz).toBeVec(v[1], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.yyyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyzx', () => { + it('should return Vec4(y, y, z, x)', () => expect(v.yyzx).toBeVec(v[1], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.yyzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyzy', () => { + it('should return Vec4(y, y, z, y)', () => expect(v.yyzy).toBeVec(v[1], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.yyzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yyzz', () => { + it('should return Vec4(y, y, z, z)', () => expect(v.yyzz).toBeVec(v[1], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.yyzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzxx', () => { + it('should return Vec4(y, z, x, x)', () => expect(v.yzxx).toBeVec(v[1], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yzxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzxy', () => { + it('should return Vec4(y, z, x, y)', () => expect(v.yzxy).toBeVec(v[1], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yzxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzxz', () => { + it('should return Vec4(y, z, x, z)', () => expect(v.yzxz).toBeVec(v[1], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.yzxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzyx', () => { + it('should return Vec4(y, z, y, x)', () => expect(v.yzyx).toBeVec(v[1], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yzyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzyy', () => { + it('should return Vec4(y, z, y, y)', () => expect(v.yzyy).toBeVec(v[1], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yzyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzyz', () => { + it('should return Vec4(y, z, y, z)', () => expect(v.yzyz).toBeVec(v[1], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.yzyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzzx', () => { + it('should return Vec4(y, z, z, x)', () => expect(v.yzzx).toBeVec(v[1], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.yzzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzzy', () => { + it('should return Vec4(y, z, z, y)', () => expect(v.yzzy).toBeVec(v[1], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.yzzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().yzzz', () => { + it('should return Vec4(y, z, z, z)', () => expect(v.yzzz).toBeVec(v[1], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.yzzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxxx', () => { + it('should return Vec4(z, x, x, x)', () => expect(v.zxxx).toBeVec(v[2], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.zxxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxxy', () => { + it('should return Vec4(z, x, x, y)', () => expect(v.zxxy).toBeVec(v[2], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.zxxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxxz', () => { + it('should return Vec4(z, x, x, z)', () => expect(v.zxxz).toBeVec(v[2], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.zxxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxyx', () => { + it('should return Vec4(z, x, y, x)', () => expect(v.zxyx).toBeVec(v[2], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.zxyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxyy', () => { + it('should return Vec4(z, x, y, y)', () => expect(v.zxyy).toBeVec(v[2], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.zxyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxyz', () => { + it('should return Vec4(z, x, y, z)', () => expect(v.zxyz).toBeVec(v[2], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.zxyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxzx', () => { + it('should return Vec4(z, x, z, x)', () => expect(v.zxzx).toBeVec(v[2], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zxzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxzy', () => { + it('should return Vec4(z, x, z, y)', () => expect(v.zxzy).toBeVec(v[2], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zxzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zxzz', () => { + it('should return Vec4(z, x, z, z)', () => expect(v.zxzz).toBeVec(v[2], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zxzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyxx', () => { + it('should return Vec4(z, y, x, x)', () => expect(v.zyxx).toBeVec(v[2], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.zyxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyxy', () => { + it('should return Vec4(z, y, x, y)', () => expect(v.zyxy).toBeVec(v[2], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.zyxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyxz', () => { + it('should return Vec4(z, y, x, z)', () => expect(v.zyxz).toBeVec(v[2], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.zyxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyyx', () => { + it('should return Vec4(z, y, y, x)', () => expect(v.zyyx).toBeVec(v[2], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.zyyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyyy', () => { + it('should return Vec4(z, y, y, y)', () => expect(v.zyyy).toBeVec(v[2], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.zyyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyyz', () => { + it('should return Vec4(z, y, y, z)', () => expect(v.zyyz).toBeVec(v[2], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.zyyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyzx', () => { + it('should return Vec4(z, y, z, x)', () => expect(v.zyzx).toBeVec(v[2], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zyzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyzy', () => { + it('should return Vec4(z, y, z, y)', () => expect(v.zyzy).toBeVec(v[2], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zyzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zyzz', () => { + it('should return Vec4(z, y, z, z)', () => expect(v.zyzz).toBeVec(v[2], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zyzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzxx', () => { + it('should return Vec4(z, z, x, x)', () => expect(v.zzxx).toBeVec(v[2], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.zzxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzxy', () => { + it('should return Vec4(z, z, x, y)', () => expect(v.zzxy).toBeVec(v[2], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.zzxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzxz', () => { + it('should return Vec4(z, z, x, z)', () => expect(v.zzxz).toBeVec(v[2], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.zzxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzyx', () => { + it('should return Vec4(z, z, y, x)', () => expect(v.zzyx).toBeVec(v[2], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.zzyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzyy', () => { + it('should return Vec4(z, z, y, y)', () => expect(v.zzyy).toBeVec(v[2], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.zzyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzyz', () => { + it('should return Vec4(z, z, y, z)', () => expect(v.zzyz).toBeVec(v[2], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.zzyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzzx', () => { + it('should return Vec4(z, z, z, x)', () => expect(v.zzzx).toBeVec(v[2], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zzzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzzy', () => { + it('should return Vec4(z, z, z, y)', () => expect(v.zzzy).toBeVec(v[2], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zzzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().zzzz', () => { + it('should return Vec4(z, z, z, z)', () => expect(v.zzzz).toBeVec(v[2], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zzzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rr', () => { + it('should return Vec2(r, r)', () => expect(v.rr).toBeVec(v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rg', () => { + it('should return Vec2(r, g)', () => expect(v.rg).toBeVec(v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rb', () => { + it('should return Vec2(r, b)', () => expect(v.rb).toBeVec(v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gr', () => { + it('should return Vec2(g, r)', () => expect(v.gr).toBeVec(v[1], v[0])); + it('should be return a copy', () => { + const sw = v.gr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gg', () => { + it('should return Vec2(g, g)', () => expect(v.gg).toBeVec(v[1], v[1])); + it('should be return a copy', () => { + const sw = v.gg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gb', () => { + it('should return Vec2(g, b)', () => expect(v.gb).toBeVec(v[1], v[2])); + it('should be return a copy', () => { + const sw = v.gb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().br', () => { + it('should return Vec2(b, r)', () => expect(v.br).toBeVec(v[2], v[0])); + it('should be return a copy', () => { + const sw = v.br; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bg', () => { + it('should return Vec2(b, g)', () => expect(v.bg).toBeVec(v[2], v[1])); + it('should be return a copy', () => { + const sw = v.bg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bb', () => { + it('should return Vec2(b, b)', () => expect(v.bb).toBeVec(v[2], v[2])); + it('should be return a copy', () => { + const sw = v.bb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrr', () => { + it('should return Vec3(r, r, r)', () => expect(v.rrr).toBeVec(v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrg', () => { + it('should return Vec3(r, r, g)', () => expect(v.rrg).toBeVec(v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrb', () => { + it('should return Vec3(r, r, b)', () => expect(v.rrb).toBeVec(v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rgr', () => { + it('should return Vec3(r, g, r)', () => expect(v.rgr).toBeVec(v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rgg', () => { + it('should return Vec3(r, g, g)', () => expect(v.rgg).toBeVec(v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rgb', () => { + it('should return Vec3(r, g, b)', () => expect(v.rgb).toBeVec(v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.rgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbr', () => { + it('should return Vec3(r, b, r)', () => expect(v.rbr).toBeVec(v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.rbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbg', () => { + it('should return Vec3(r, b, g)', () => expect(v.rbg).toBeVec(v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.rbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbb', () => { + it('should return Vec3(r, b, b)', () => expect(v.rbb).toBeVec(v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.rbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grr', () => { + it('should return Vec3(g, r, r)', () => expect(v.grr).toBeVec(v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.grr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grg', () => { + it('should return Vec3(g, r, g)', () => expect(v.grg).toBeVec(v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.grg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grb', () => { + it('should return Vec3(g, r, b)', () => expect(v.grb).toBeVec(v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.grb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().ggr', () => { + it('should return Vec3(g, g, r)', () => expect(v.ggr).toBeVec(v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.ggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().ggg', () => { + it('should return Vec3(g, g, g)', () => expect(v.ggg).toBeVec(v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.ggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().ggb', () => { + it('should return Vec3(g, g, b)', () => expect(v.ggb).toBeVec(v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.ggb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbr', () => { + it('should return Vec3(g, b, r)', () => expect(v.gbr).toBeVec(v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.gbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbg', () => { + it('should return Vec3(g, b, g)', () => expect(v.gbg).toBeVec(v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.gbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbb', () => { + it('should return Vec3(g, b, b)', () => expect(v.gbb).toBeVec(v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.gbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brr', () => { + it('should return Vec3(b, r, r)', () => expect(v.brr).toBeVec(v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.brr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brg', () => { + it('should return Vec3(b, r, g)', () => expect(v.brg).toBeVec(v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.brg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brb', () => { + it('should return Vec3(b, r, b)', () => expect(v.brb).toBeVec(v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.brb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bgr', () => { + it('should return Vec3(b, g, r)', () => expect(v.bgr).toBeVec(v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.bgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bgg', () => { + it('should return Vec3(b, g, g)', () => expect(v.bgg).toBeVec(v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.bgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bgb', () => { + it('should return Vec3(b, g, b)', () => expect(v.bgb).toBeVec(v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.bgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbr', () => { + it('should return Vec3(b, b, r)', () => expect(v.bbr).toBeVec(v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.bbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbg', () => { + it('should return Vec3(b, b, g)', () => expect(v.bbg).toBeVec(v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.bbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbb', () => { + it('should return Vec3(b, b, b)', () => expect(v.bbb).toBeVec(v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.bbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrrr', () => { + it('should return Vec4(r, r, r, r)', () => expect(v.rrrr).toBeVec(v[0], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rrrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrrg', () => { + it('should return Vec4(r, r, r, g)', () => expect(v.rrrg).toBeVec(v[0], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rrrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrrb', () => { + it('should return Vec4(r, r, r, b)', () => expect(v.rrrb).toBeVec(v[0], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rrrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrgr', () => { + it('should return Vec4(r, r, g, r)', () => expect(v.rrgr).toBeVec(v[0], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rrgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrgg', () => { + it('should return Vec4(r, r, g, g)', () => expect(v.rrgg).toBeVec(v[0], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rrgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrgb', () => { + it('should return Vec4(r, r, g, b)', () => expect(v.rrgb).toBeVec(v[0], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.rrgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrbr', () => { + it('should return Vec4(r, r, b, r)', () => expect(v.rrbr).toBeVec(v[0], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.rrbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrbg', () => { + it('should return Vec4(r, r, b, g)', () => expect(v.rrbg).toBeVec(v[0], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.rrbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rrbb', () => { + it('should return Vec4(r, r, b, b)', () => expect(v.rrbb).toBeVec(v[0], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.rrbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rgrr', () => { + it('should return Vec4(r, g, r, r)', () => expect(v.rgrr).toBeVec(v[0], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rgrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rgrg', () => { + it('should return Vec4(r, g, r, g)', () => expect(v.rgrg).toBeVec(v[0], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rgrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rgrb', () => { + it('should return Vec4(r, g, r, b)', () => expect(v.rgrb).toBeVec(v[0], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rgrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rggr', () => { + it('should return Vec4(r, g, g, r)', () => expect(v.rggr).toBeVec(v[0], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rggg', () => { + it('should return Vec4(r, g, g, g)', () => expect(v.rggg).toBeVec(v[0], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rggb', () => { + it('should return Vec4(r, g, g, b)', () => expect(v.rggb).toBeVec(v[0], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.rggb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rgbr', () => { + it('should return Vec4(r, g, b, r)', () => expect(v.rgbr).toBeVec(v[0], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.rgbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rgbg', () => { + it('should return Vec4(r, g, b, g)', () => expect(v.rgbg).toBeVec(v[0], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.rgbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rgbb', () => { + it('should return Vec4(r, g, b, b)', () => expect(v.rgbb).toBeVec(v[0], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.rgbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbrr', () => { + it('should return Vec4(r, b, r, r)', () => expect(v.rbrr).toBeVec(v[0], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rbrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbrg', () => { + it('should return Vec4(r, b, r, g)', () => expect(v.rbrg).toBeVec(v[0], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rbrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbrb', () => { + it('should return Vec4(r, b, r, b)', () => expect(v.rbrb).toBeVec(v[0], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rbrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbgr', () => { + it('should return Vec4(r, b, g, r)', () => expect(v.rbgr).toBeVec(v[0], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rbgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbgg', () => { + it('should return Vec4(r, b, g, g)', () => expect(v.rbgg).toBeVec(v[0], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rbgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbgb', () => { + it('should return Vec4(r, b, g, b)', () => expect(v.rbgb).toBeVec(v[0], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.rbgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbbr', () => { + it('should return Vec4(r, b, b, r)', () => expect(v.rbbr).toBeVec(v[0], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.rbbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbbg', () => { + it('should return Vec4(r, b, b, g)', () => expect(v.rbbg).toBeVec(v[0], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.rbbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().rbbb', () => { + it('should return Vec4(r, b, b, b)', () => expect(v.rbbb).toBeVec(v[0], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.rbbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grrr', () => { + it('should return Vec4(g, r, r, r)', () => expect(v.grrr).toBeVec(v[1], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.grrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grrg', () => { + it('should return Vec4(g, r, r, g)', () => expect(v.grrg).toBeVec(v[1], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.grrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grrb', () => { + it('should return Vec4(g, r, r, b)', () => expect(v.grrb).toBeVec(v[1], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.grrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grgr', () => { + it('should return Vec4(g, r, g, r)', () => expect(v.grgr).toBeVec(v[1], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.grgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grgg', () => { + it('should return Vec4(g, r, g, g)', () => expect(v.grgg).toBeVec(v[1], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.grgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grgb', () => { + it('should return Vec4(g, r, g, b)', () => expect(v.grgb).toBeVec(v[1], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.grgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grbr', () => { + it('should return Vec4(g, r, b, r)', () => expect(v.grbr).toBeVec(v[1], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.grbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grbg', () => { + it('should return Vec4(g, r, b, g)', () => expect(v.grbg).toBeVec(v[1], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.grbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().grbb', () => { + it('should return Vec4(g, r, b, b)', () => expect(v.grbb).toBeVec(v[1], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.grbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().ggrr', () => { + it('should return Vec4(g, g, r, r)', () => expect(v.ggrr).toBeVec(v[1], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.ggrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().ggrg', () => { + it('should return Vec4(g, g, r, g)', () => expect(v.ggrg).toBeVec(v[1], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.ggrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().ggrb', () => { + it('should return Vec4(g, g, r, b)', () => expect(v.ggrb).toBeVec(v[1], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.ggrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gggr', () => { + it('should return Vec4(g, g, g, r)', () => expect(v.gggr).toBeVec(v[1], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.gggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gggg', () => { + it('should return Vec4(g, g, g, g)', () => expect(v.gggg).toBeVec(v[1], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.gggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gggb', () => { + it('should return Vec4(g, g, g, b)', () => expect(v.gggb).toBeVec(v[1], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.gggb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().ggbr', () => { + it('should return Vec4(g, g, b, r)', () => expect(v.ggbr).toBeVec(v[1], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.ggbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().ggbg', () => { + it('should return Vec4(g, g, b, g)', () => expect(v.ggbg).toBeVec(v[1], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.ggbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().ggbb', () => { + it('should return Vec4(g, g, b, b)', () => expect(v.ggbb).toBeVec(v[1], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.ggbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbrr', () => { + it('should return Vec4(g, b, r, r)', () => expect(v.gbrr).toBeVec(v[1], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.gbrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbrg', () => { + it('should return Vec4(g, b, r, g)', () => expect(v.gbrg).toBeVec(v[1], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.gbrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbrb', () => { + it('should return Vec4(g, b, r, b)', () => expect(v.gbrb).toBeVec(v[1], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.gbrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbgr', () => { + it('should return Vec4(g, b, g, r)', () => expect(v.gbgr).toBeVec(v[1], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.gbgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbgg', () => { + it('should return Vec4(g, b, g, g)', () => expect(v.gbgg).toBeVec(v[1], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.gbgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbgb', () => { + it('should return Vec4(g, b, g, b)', () => expect(v.gbgb).toBeVec(v[1], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.gbgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbbr', () => { + it('should return Vec4(g, b, b, r)', () => expect(v.gbbr).toBeVec(v[1], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.gbbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbbg', () => { + it('should return Vec4(g, b, b, g)', () => expect(v.gbbg).toBeVec(v[1], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.gbbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().gbbb', () => { + it('should return Vec4(g, b, b, b)', () => expect(v.gbbb).toBeVec(v[1], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.gbbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brrr', () => { + it('should return Vec4(b, r, r, r)', () => expect(v.brrr).toBeVec(v[2], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.brrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brrg', () => { + it('should return Vec4(b, r, r, g)', () => expect(v.brrg).toBeVec(v[2], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.brrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brrb', () => { + it('should return Vec4(b, r, r, b)', () => expect(v.brrb).toBeVec(v[2], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.brrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brgr', () => { + it('should return Vec4(b, r, g, r)', () => expect(v.brgr).toBeVec(v[2], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.brgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brgg', () => { + it('should return Vec4(b, r, g, g)', () => expect(v.brgg).toBeVec(v[2], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.brgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brgb', () => { + it('should return Vec4(b, r, g, b)', () => expect(v.brgb).toBeVec(v[2], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.brgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brbr', () => { + it('should return Vec4(b, r, b, r)', () => expect(v.brbr).toBeVec(v[2], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.brbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brbg', () => { + it('should return Vec4(b, r, b, g)', () => expect(v.brbg).toBeVec(v[2], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.brbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().brbb', () => { + it('should return Vec4(b, r, b, b)', () => expect(v.brbb).toBeVec(v[2], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.brbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bgrr', () => { + it('should return Vec4(b, g, r, r)', () => expect(v.bgrr).toBeVec(v[2], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.bgrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bgrg', () => { + it('should return Vec4(b, g, r, g)', () => expect(v.bgrg).toBeVec(v[2], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.bgrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bgrb', () => { + it('should return Vec4(b, g, r, b)', () => expect(v.bgrb).toBeVec(v[2], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.bgrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bggr', () => { + it('should return Vec4(b, g, g, r)', () => expect(v.bggr).toBeVec(v[2], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.bggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bggg', () => { + it('should return Vec4(b, g, g, g)', () => expect(v.bggg).toBeVec(v[2], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.bggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bggb', () => { + it('should return Vec4(b, g, g, b)', () => expect(v.bggb).toBeVec(v[2], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.bggb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bgbr', () => { + it('should return Vec4(b, g, b, r)', () => expect(v.bgbr).toBeVec(v[2], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.bgbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bgbg', () => { + it('should return Vec4(b, g, b, g)', () => expect(v.bgbg).toBeVec(v[2], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.bgbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bgbb', () => { + it('should return Vec4(b, g, b, b)', () => expect(v.bgbb).toBeVec(v[2], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.bgbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbrr', () => { + it('should return Vec4(b, b, r, r)', () => expect(v.bbrr).toBeVec(v[2], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.bbrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbrg', () => { + it('should return Vec4(b, b, r, g)', () => expect(v.bbrg).toBeVec(v[2], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.bbrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbrb', () => { + it('should return Vec4(b, b, r, b)', () => expect(v.bbrb).toBeVec(v[2], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.bbrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbgr', () => { + it('should return Vec4(b, b, g, r)', () => expect(v.bbgr).toBeVec(v[2], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.bbgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbgg', () => { + it('should return Vec4(b, b, g, g)', () => expect(v.bbgg).toBeVec(v[2], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.bbgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbgb', () => { + it('should return Vec4(b, b, g, b)', () => expect(v.bbgb).toBeVec(v[2], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.bbgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbbr', () => { + it('should return Vec4(b, b, b, r)', () => expect(v.bbbr).toBeVec(v[2], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.bbbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbbg', () => { + it('should return Vec4(b, b, b, g)', () => expect(v.bbbg).toBeVec(v[2], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.bbbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec3().bbbb', () => { + it('should return Vec4(b, b, b, b)', () => expect(v.bbbb).toBeVec(v[2], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.bbbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + // [/Swizzle Autogen] +}); diff --git a/tests/f64/Vec3.spec.ts b/tests/f64/Vec3.spec.ts new file mode 100644 index 00000000..b5474f7f --- /dev/null +++ b/tests/f64/Vec3.spec.ts @@ -0,0 +1,730 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Mat4, Vec3 } from '#gl-matrix/f64'; + +import type { Mat4Like, Vec3Like } from '#gl-matrix/types'; + +describe('Vec3', () => { + describe('constructor', () => { + it('should return Vec3(0, 0, 0) if called with no arguments', () => expect(new Vec3()).toBeVec(0, 0, 0)); + + it('should return Vec3(x, y, z) if called with (x, y, z)', () => { + expect(new Vec3(1, 2, 3)).toBeVec(1, 2, 3); + expect(new Vec3(-3, 4.4, -5.6)).toBeVec(-3, 4.4, -5.6); + }); + + it('should return Vec3(x, x, x) if called with (x)', () => { + expect(new Vec3(1)).toBeVec(1, 1, 1); + expect(new Vec3(-2.3)).toBeVec(-2.3, -2.3, -2.3); + }); + + it('should return Vec3(x, y, z) if called with ([x, y, z])', () => { + expect(new Vec3([1, 2, 3])).toBeVec(1, 2, 3); + expect(new Vec3([-3, 4.4, -5.6])).toBeVec(-3, 4.4, -5.6); + }); + + it('should return Vec3(x, y, z) if called with (Vec3(x, y, z))', () => { + const v = new Vec3(3.4, 5.6, 7.8); + expect(new Vec3(v)).toBeVec(v); + }); + + it('should return Vec3(x, y, z) if called with (Float64Array([x, y, z]))', () => { + const arr = new Float64Array([1.2, 3.4, 5.6]); + expect(new Vec3(arr)).toBeVec(arr); + }); + }); + + describe('static', () => { + let out: Vec3Like; + let vecA: Vec3Like; + let vecB: Vec3Like; + let result: Vec3Like; + + beforeEach(() => { + vecA = new Vec3(1, 2, 3); + vecB = new Vec3(4, 5, 6); + out = new Vec3(0, 0, 0); + }); + + describe('rotateX', () => { + describe('rotation around world origin [0, 0, 0]', () => { + beforeEach(() => { + vecA = [0, 1, 0]; + vecB = [0, 0, 0]; + result = Vec3.rotateX(out, vecA, vecB, Math.PI); + }); + + it('should return the rotated vector', () => expect(result).toBeVec(0, -1, 0)); + }); + + describe('rotation around an arbitrary origin', () => { + beforeEach(() => { + vecA = [2, 7, 0]; + vecB = [2, 5, 0]; + result = Vec3.rotateX(out, vecA, vecB, Math.PI); + }); + + it('should return the rotated vector', () => expect(result).toBeVec(2, 3, 0)); + }); + }); + + describe('rotateY', () => { + describe('rotation around world origin [0, 0, 0]', () => { + beforeEach(() => { + vecA = [1, 0, 0]; + vecB = [0, 0, 0]; + result = Vec3.rotateY(out, vecA, vecB, Math.PI); + }); + + it('should return the rotated vector', () => expect(result).toBeVec(-1, 0, 0)); + }); + describe('rotation around an arbitrary origin', () => { + beforeEach(() => { + vecA = [-2, 3, 10]; + vecB = [-4, 3, 10]; + result = Vec3.rotateY(out, vecA, vecB, Math.PI); + }); + + it('should return the rotated vector', () => expect(result).toBeVec(-6, 3, 10)); + }); + }); + + describe('rotateZ', () => { + describe('rotation around world origin [0, 0, 0]', () => { + beforeEach(() => { + vecA = [0, 1, 0]; + vecB = [0, 0, 0]; + result = Vec3.rotateZ(out, vecA, vecB, Math.PI); + }); + + it('should return the rotated vector', () => expect(result).toBeVec(0, -1, 0)); + }); + describe('rotation around an arbitrary origin', () => { + beforeEach(() => { + vecA = [0, 6, -5]; + vecB = [0, 0, -5]; + result = Vec3.rotateZ(out, vecA, vecB, Math.PI); + }); + + it('should return the rotated vector', () => expect(result).toBeVec(0, -6, -5)); + }); + }); + + describe('transformMat4', () => { + let matr : Mat4Like; + + describe('with an identity', () => { + beforeEach(() => { + matr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; + result = Vec3.transformMat4(out, vecA, matr); + }); + + it('should produce the input', () => expect(out).toBeVec(1, 2, 3)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('with a lookAt', () => { + beforeEach(() => { + matr = Mat4.lookAt(new Mat4(), [5, 6, 7], [2, 6, 7], [0, 1, 0]); + result = Vec3.transformMat4(out, vecA, matr); + }); + + it('should rotate and translate the input', () => expect(out).toBeVec(4, -4, -4)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('with a perspective matrix (#92)', () => { + it('should transform a point from perspective(pi/2, 4/3, 1, 100)', () => { + matr = [ + 0.750, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, -1.02, -1, + 0, 0, -2.02, 0]; + result = Vec3.transformMat4([0, 0, 0], [10, 20, 30], matr); + expect(result).toBeVec(-0.25, -0.666666, 1.087333); + }); + }); + }); + + /* + describe('transformMat3', () => { + let matr; + + describe('with an identity', () => { + beforeEach(() => { + matr = [1, 0, 0, 0, 1, 0, 0, 0, 1 ]; + result = Vec3.transformMat3(out, vecA, matr); + }); + + it('should produce the input', () => expect(out).toBeVec(1, 2, 3)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('with 90deg about X', () => { + beforeEach(() => { result = Vec3.transformMat3(out, [0,1,0], [1,0,0,0,0,1,0,-1,0]); }); + + it('should produce correct output', () => expect(out).toBeVec(0,0,1)); + }); + + describe('with 90deg about Y', () => { + beforeEach(() => { result = Vec3.transformMat3(out, [1,0,0], [0,0,-1,0,1,0,1,0,0]); }); + + it('should produce correct output', () => expect(out).toBeVec(0,0,-1)); + }); + + describe('with 90deg about Z', () => { + beforeEach(() => { result = Vec3.transformMat3(out, [1,0,0], [0,1,0,-1,0,0,0,0,1]); }); + + it('should produce correct output', () => expect(out).toBeVec(0,1,0)); + }); + + describe('with a lookAt normal matrix', () => { + beforeEach(() => { + matr = mat4.lookAt(mat4.create(), [5, 6, 7], [2, 6, 7], [0, 1, 0]); + let n = mat3.create(); + matr = mat3.transpose(n, mat3.invert(n, mat3.fromMat4(n, matr))); + + result = Vec3.transformMat3(out, [1,0,0], matr); + }); + + it('should rotate the input', () => expect(out).toBeVec( 0,0,1 )); + it('should return out', () => expect(result).toBe(out)); + }); + });*/ + + describe('transformQuat', () => { + beforeEach(() => { + result = Vec3.transformQuat(out, vecA, + [0.18257418567011074, 0.3651483713402215, 0.5477225570103322, 0.730296742680443]); + }); + + it('should rotate the input vector', () => expect(out).toBeVec(1, 2, 3)); + it('should return out', () => expect(result).not.toBe([1, 2, 3, 4])); + }); + + describe('create', () => { + beforeEach(() => { result = Vec3.create(); }); + + it('should return a 3 element array initialized to 0s', () => expect(result).toBeVec(0, 0, 0)); + }); + + describe('clone', () => { + beforeEach(() => { result = Vec3.clone(vecA); }); + + it('should return a 3 element array initialized to the values in vecA', () => expect(result).toBeVec(vecA)); + }); + + describe('fromValues', () => { + beforeEach(() => { result = Vec3.fromValues(1, 2, 3); }); + + it('should return a 3 element array initialized to the values passed', () => expect(result).toBeVec(1, 2, 3)); + }); + + describe('copy', () => { + beforeEach(() => { result = Vec3.copy(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('set', () => { + beforeEach(() => { result = Vec3.set(out, 1, 2, 3); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('add', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.add(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(5, 7, 9)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.add(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(5, 7, 9)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec3.add(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(5, 7, 9)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + }); + }); + + describe('subtract', () => { + it('should have an alias called `sub`', () => expect(Vec3.sub).toEqual(Vec3.subtract)); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.subtract(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(-3, -3, -3)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.subtract(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(-3, -3, -3)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec3.subtract(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(-3, -3, -3)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + }); + }); + + describe('multiply', () => { + it('should have an alias called `mul`', () => expect(Vec3.mul).toEqual(Vec3.multiply)); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.multiply(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(4, 10, 18)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.multiply(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(4, 10, 18)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec3.multiply(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(4, 10, 18)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + }); + }); + + describe('divide', () => { + it('should have an alias called `div`', () => expect(Vec3.div).toEqual(Vec3.divide)); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.divide(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(0.25, 0.4, 0.5)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.divide(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(0.25, 0.4, 0.5)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec3.divide(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(0.25, 0.4, 0.5)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + }); + }); + + describe('ceil', () => { + beforeEach(() => { vecA = [Math.E, Math.PI, Math.SQRT2]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.ceil(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(3, 4, 2)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(Math.E, Math.PI, Math.SQRT2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.ceil(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 4, 2)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('floor', () => { + beforeEach(() => { vecA = [Math.E, Math.PI, Math.SQRT2]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.floor(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(2, 3, 1)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(Math.E, Math.PI, Math.SQRT2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.floor(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(2, 3, 1)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('min', () => { + beforeEach(() => { vecA = [1, 3, 1]; vecB = [3, 1, 3]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.min(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(1, 1, 1)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 3, 1)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 1, 3)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.min(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 1, 1)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 1, 3)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec3.min(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(1, 1, 1)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 3, 1)); + }); + }); + + describe('max', () => { + beforeEach(() => { vecA = [1, 3, 1]; vecB = [3, 1, 3]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.max(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(3, 3, 3)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 3, 1)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 1, 3)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.max(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 3, 3)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 1, 3)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec3.max(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(3, 3, 3)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 3, 1)); + }); + }); + + /* + describe('round', () => { + beforeEach(() => { vecA = [Math.E, Math.PI, Math.SQRT2]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.round(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(3, 3, 1)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(Math.E, Math.PI, Math.SQRT2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.round(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 3, 1)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + });*/ + + describe('scale', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.scale(out, vecA, 2); }); + + it('should place values into out', () => expect(out).toBeVec(2, 4, 6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.scale(vecA, vecA, 2); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(2, 4, 6)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('scaleAndAdd', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.scaleAndAdd(out, vecA, vecB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(3, 4.5, 6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.scaleAndAdd(vecA, vecA, vecB, 0.5); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 4.5, 6)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec3.scaleAndAdd(vecB, vecA, vecB, 0.5); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(3, 4.5, 6)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + }); + }); + + describe('distance', () => { + it('should have an alias called `dist`', () => expect(Vec3.dist).toEqual(Vec3.distance)); + it('should return the distance', () => expect(Vec3.distance(vecA, vecB)).toBeCloseTo(5.196152)); + }); + + describe('squaredDistance', () => { + it('should have an alias called `sqrDist`', () => expect(Vec3.sqrDist).toEqual(Vec3.squaredDistance)); + it('should return the squared distance', () => expect(Vec3.squaredDistance(vecA, vecB)).toEqual(27)); + }); + + describe('length', () => { + it('should have an alias called `len`', () => expect(Vec3.len).toEqual(Vec3.length)); + it('should return the length', () => expect(Vec3.len(vecA)).toBeCloseTo(3.741657)); + }); + + describe('squaredLength', () => { + it('should have an alias called `sqrLen`', () => expect(Vec3.sqrLen).toEqual(Vec3.squaredLength)); + it('should return the squared length', () => expect(Vec3.squaredLength(vecA)).toEqual(14)); + }); + + describe('negate', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.negate(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(-1, -2, -3)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.negate(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(-1, -2, -3)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('inverse', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.inverse(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 1 / 2, 1 / 3)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.inverse(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 1 / 2, 1 / 3)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('abs', () => { + beforeEach(() => { vecA = [-1, -2, -3]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.abs(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(-1, -2, -3)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.abs(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 2, 3)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('normalize', () => { + beforeEach(() => { vecA = [5, 0, 0]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.normalize(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 0, 0)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(5, 0, 0)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.normalize(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 0, 0)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('dot', () => { + let value: number; + beforeEach(() => { value = Vec3.dot(vecA, vecB); }); + + it('should return the dot product', () => expect(value).toEqual(32)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('cross', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.cross(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(-3, 6, -3)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.cross(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(-3, 6, -3)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec3.cross(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(-3, 6, -3)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + }); + }); + + describe('lerp', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec3.lerp(out, vecA, vecB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(2.5, 3.5, 4.5)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec3.lerp(vecA, vecA, vecB, 0.5); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(2.5, 3.5, 4.5)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec3.lerp(vecB, vecA, vecB, 0.5); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(2.5, 3.5, 4.5)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + }); + }); + + describe('angle', () => { + let value: number; + + beforeEach(() => { value = Vec3.angle(vecA, vecB); }); + + it('should return the angle', () => expect(value).toBeCloseTo(0.225726)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(4, 5, 6)); + }); + + describe('str', () => { + it('should return a string representation of the vector', () => expect(Vec3.str(vecA)).toEqual('Vec3(1, 2, 3)')); + }); + + describe('exactEquals', () => { + let vecC: Vec3Like, r0: boolean, r1: boolean; + + beforeEach(() => { + vecA = [0, 1, 2]; + vecB = [0, 1, 2]; + vecC = [1, 2, 3]; + r0 = Vec3.exactEquals(vecA, vecB); + r1 = Vec3.exactEquals(vecA, vecC); + }); + + it('should return true for identical vectors', () => expect(r0).toBe(true)); + it('should return false for different vectors', () => expect(r1).toBe(false)); + it('should not modify vecA', () => expect(vecA).toBeVec(0, 1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(0, 1, 2)); + }); + + describe('equals', () => { + let vecC: Vec3Like, + vecD: Vec3Like, + r0: boolean, + r1: boolean, + r2: boolean; + + beforeEach(() => { + vecA = [0, 1, 2]; + vecB = [0, 1, 2]; + vecC = [1, 2, 3]; + vecD = [1e-16, 1, 2]; + r0 = Vec3.equals(vecA, vecB); + r1 = Vec3.equals(vecA, vecC); + r2 = Vec3.equals(vecA, vecD); + }); + + it('should return true for identical vectors', () => expect(r0).toBe(true)); + it('should return false for different vectors', () => expect(r1).toBe(false)); + it('should return true for close but not identical vectors', () => expect(r2).toBe(true)); + it('should not modify vecA', () => expect(vecA).toBeVec(0, 1, 2)); + it('should not modify vecB', () => expect(vecB).toBeVec(0, 1, 2)); + }); + + describe('zero', () => { + beforeEach(() => { + vecA = [1, 2, 3]; + result = Vec3.zero(vecA); + }); + + it('should result in a 3 element vector with zeros', () => expect(result).toBeVec(0, 0, 0)); + }); + }); +}); diff --git a/tests/f64/Vec4-swizzle.spec.ts b/tests/f64/Vec4-swizzle.spec.ts new file mode 100644 index 00000000..d989ac14 --- /dev/null +++ b/tests/f64/Vec4-swizzle.spec.ts @@ -0,0 +1,6065 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Vec4 } from '#gl-matrix/f64'; +import { EnableSwizzlesF64 } from '#gl-matrix/swizzle/f64'; + +describe('Vec4 Swizzles', () => { + EnableSwizzlesF64(); + + let v: Vec4; + beforeEach(() => { v = new Vec4(1, 2, 3); }); + + // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should + // not be modified by hand. + // [Swizzle Autogen] + + describe('Vec4().xx', () => { + it('should return Vec2(x, x)', () => expect(v.xx).toBeVec(v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xy', () => { + it('should return Vec2(x, y)', () => expect(v.xy).toBeVec(v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xz', () => { + it('should return Vec2(x, z)', () => expect(v.xz).toBeVec(v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xw', () => { + it('should return Vec2(x, w)', () => expect(v.xw).toBeVec(v[0], v[3])); + it('should be return a copy', () => { + const sw = v.xw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yx', () => { + it('should return Vec2(y, x)', () => expect(v.yx).toBeVec(v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yy', () => { + it('should return Vec2(y, y)', () => expect(v.yy).toBeVec(v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yz', () => { + it('should return Vec2(y, z)', () => expect(v.yz).toBeVec(v[1], v[2])); + it('should be return a copy', () => { + const sw = v.yz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yw', () => { + it('should return Vec2(y, w)', () => expect(v.yw).toBeVec(v[1], v[3])); + it('should be return a copy', () => { + const sw = v.yw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zx', () => { + it('should return Vec2(z, x)', () => expect(v.zx).toBeVec(v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zy', () => { + it('should return Vec2(z, y)', () => expect(v.zy).toBeVec(v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zz', () => { + it('should return Vec2(z, z)', () => expect(v.zz).toBeVec(v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zw', () => { + it('should return Vec2(z, w)', () => expect(v.zw).toBeVec(v[2], v[3])); + it('should be return a copy', () => { + const sw = v.zw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wx', () => { + it('should return Vec2(w, x)', () => expect(v.wx).toBeVec(v[3], v[0])); + it('should be return a copy', () => { + const sw = v.wx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wy', () => { + it('should return Vec2(w, y)', () => expect(v.wy).toBeVec(v[3], v[1])); + it('should be return a copy', () => { + const sw = v.wy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wz', () => { + it('should return Vec2(w, z)', () => expect(v.wz).toBeVec(v[3], v[2])); + it('should be return a copy', () => { + const sw = v.wz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ww', () => { + it('should return Vec2(w, w)', () => expect(v.ww).toBeVec(v[3], v[3])); + it('should be return a copy', () => { + const sw = v.ww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxx', () => { + it('should return Vec3(x, x, x)', () => expect(v.xxx).toBeVec(v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxy', () => { + it('should return Vec3(x, x, y)', () => expect(v.xxy).toBeVec(v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxz', () => { + it('should return Vec3(x, x, z)', () => expect(v.xxz).toBeVec(v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxw', () => { + it('should return Vec3(x, x, w)', () => expect(v.xxw).toBeVec(v[0], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.xxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyx', () => { + it('should return Vec3(x, y, x)', () => expect(v.xyx).toBeVec(v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyy', () => { + it('should return Vec3(x, y, y)', () => expect(v.xyy).toBeVec(v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyz', () => { + it('should return Vec3(x, y, z)', () => expect(v.xyz).toBeVec(v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.xyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyw', () => { + it('should return Vec3(x, y, w)', () => expect(v.xyw).toBeVec(v[0], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.xyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzx', () => { + it('should return Vec3(x, z, x)', () => expect(v.xzx).toBeVec(v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.xzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzy', () => { + it('should return Vec3(x, z, y)', () => expect(v.xzy).toBeVec(v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.xzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzz', () => { + it('should return Vec3(x, z, z)', () => expect(v.xzz).toBeVec(v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.xzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzw', () => { + it('should return Vec3(x, z, w)', () => expect(v.xzw).toBeVec(v[0], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.xzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwx', () => { + it('should return Vec3(x, w, x)', () => expect(v.xwx).toBeVec(v[0], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.xwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwy', () => { + it('should return Vec3(x, w, y)', () => expect(v.xwy).toBeVec(v[0], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.xwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwz', () => { + it('should return Vec3(x, w, z)', () => expect(v.xwz).toBeVec(v[0], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.xwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xww', () => { + it('should return Vec3(x, w, w)', () => expect(v.xww).toBeVec(v[0], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.xww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxx', () => { + it('should return Vec3(y, x, x)', () => expect(v.yxx).toBeVec(v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxy', () => { + it('should return Vec3(y, x, y)', () => expect(v.yxy).toBeVec(v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxz', () => { + it('should return Vec3(y, x, z)', () => expect(v.yxz).toBeVec(v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.yxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxw', () => { + it('should return Vec3(y, x, w)', () => expect(v.yxw).toBeVec(v[1], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.yxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyx', () => { + it('should return Vec3(y, y, x)', () => expect(v.yyx).toBeVec(v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyy', () => { + it('should return Vec3(y, y, y)', () => expect(v.yyy).toBeVec(v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyz', () => { + it('should return Vec3(y, y, z)', () => expect(v.yyz).toBeVec(v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.yyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyw', () => { + it('should return Vec3(y, y, w)', () => expect(v.yyw).toBeVec(v[1], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.yyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzx', () => { + it('should return Vec3(y, z, x)', () => expect(v.yzx).toBeVec(v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.yzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzy', () => { + it('should return Vec3(y, z, y)', () => expect(v.yzy).toBeVec(v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.yzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzz', () => { + it('should return Vec3(y, z, z)', () => expect(v.yzz).toBeVec(v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.yzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzw', () => { + it('should return Vec3(y, z, w)', () => expect(v.yzw).toBeVec(v[1], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.yzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywx', () => { + it('should return Vec3(y, w, x)', () => expect(v.ywx).toBeVec(v[1], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.ywx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywy', () => { + it('should return Vec3(y, w, y)', () => expect(v.ywy).toBeVec(v[1], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.ywy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywz', () => { + it('should return Vec3(y, w, z)', () => expect(v.ywz).toBeVec(v[1], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.ywz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yww', () => { + it('should return Vec3(y, w, w)', () => expect(v.yww).toBeVec(v[1], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.yww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxx', () => { + it('should return Vec3(z, x, x)', () => expect(v.zxx).toBeVec(v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.zxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxy', () => { + it('should return Vec3(z, x, y)', () => expect(v.zxy).toBeVec(v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.zxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxz', () => { + it('should return Vec3(z, x, z)', () => expect(v.zxz).toBeVec(v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.zxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxw', () => { + it('should return Vec3(z, x, w)', () => expect(v.zxw).toBeVec(v[2], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.zxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyx', () => { + it('should return Vec3(z, y, x)', () => expect(v.zyx).toBeVec(v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.zyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyy', () => { + it('should return Vec3(z, y, y)', () => expect(v.zyy).toBeVec(v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.zyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyz', () => { + it('should return Vec3(z, y, z)', () => expect(v.zyz).toBeVec(v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.zyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyw', () => { + it('should return Vec3(z, y, w)', () => expect(v.zyw).toBeVec(v[2], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.zyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzx', () => { + it('should return Vec3(z, z, x)', () => expect(v.zzx).toBeVec(v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzy', () => { + it('should return Vec3(z, z, y)', () => expect(v.zzy).toBeVec(v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzz', () => { + it('should return Vec3(z, z, z)', () => expect(v.zzz).toBeVec(v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzw', () => { + it('should return Vec3(z, z, w)', () => expect(v.zzw).toBeVec(v[2], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.zzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwx', () => { + it('should return Vec3(z, w, x)', () => expect(v.zwx).toBeVec(v[2], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.zwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwy', () => { + it('should return Vec3(z, w, y)', () => expect(v.zwy).toBeVec(v[2], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.zwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwz', () => { + it('should return Vec3(z, w, z)', () => expect(v.zwz).toBeVec(v[2], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.zwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zww', () => { + it('should return Vec3(z, w, w)', () => expect(v.zww).toBeVec(v[2], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.zww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxx', () => { + it('should return Vec3(w, x, x)', () => expect(v.wxx).toBeVec(v[3], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.wxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxy', () => { + it('should return Vec3(w, x, y)', () => expect(v.wxy).toBeVec(v[3], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.wxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxz', () => { + it('should return Vec3(w, x, z)', () => expect(v.wxz).toBeVec(v[3], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.wxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxw', () => { + it('should return Vec3(w, x, w)', () => expect(v.wxw).toBeVec(v[3], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.wxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyx', () => { + it('should return Vec3(w, y, x)', () => expect(v.wyx).toBeVec(v[3], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.wyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyy', () => { + it('should return Vec3(w, y, y)', () => expect(v.wyy).toBeVec(v[3], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.wyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyz', () => { + it('should return Vec3(w, y, z)', () => expect(v.wyz).toBeVec(v[3], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.wyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyw', () => { + it('should return Vec3(w, y, w)', () => expect(v.wyw).toBeVec(v[3], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.wyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzx', () => { + it('should return Vec3(w, z, x)', () => expect(v.wzx).toBeVec(v[3], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.wzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzy', () => { + it('should return Vec3(w, z, y)', () => expect(v.wzy).toBeVec(v[3], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.wzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzz', () => { + it('should return Vec3(w, z, z)', () => expect(v.wzz).toBeVec(v[3], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.wzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzw', () => { + it('should return Vec3(w, z, w)', () => expect(v.wzw).toBeVec(v[3], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.wzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwx', () => { + it('should return Vec3(w, w, x)', () => expect(v.wwx).toBeVec(v[3], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.wwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwy', () => { + it('should return Vec3(w, w, y)', () => expect(v.wwy).toBeVec(v[3], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.wwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwz', () => { + it('should return Vec3(w, w, z)', () => expect(v.wwz).toBeVec(v[3], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.wwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().www', () => { + it('should return Vec3(w, w, w)', () => expect(v.www).toBeVec(v[3], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.www; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxxx', () => { + it('should return Vec4(x, x, x, x)', () => expect(v.xxxx).toBeVec(v[0], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xxxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxxy', () => { + it('should return Vec4(x, x, x, y)', () => expect(v.xxxy).toBeVec(v[0], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xxxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxxz', () => { + it('should return Vec4(x, x, x, z)', () => expect(v.xxxz).toBeVec(v[0], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xxxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxxw', () => { + it('should return Vec4(x, x, x, w)', () => expect(v.xxxw).toBeVec(v[0], v[0], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.xxxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxyx', () => { + it('should return Vec4(x, x, y, x)', () => expect(v.xxyx).toBeVec(v[0], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xxyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxyy', () => { + it('should return Vec4(x, x, y, y)', () => expect(v.xxyy).toBeVec(v[0], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xxyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxyz', () => { + it('should return Vec4(x, x, y, z)', () => expect(v.xxyz).toBeVec(v[0], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.xxyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxyw', () => { + it('should return Vec4(x, x, y, w)', () => expect(v.xxyw).toBeVec(v[0], v[0], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.xxyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxzx', () => { + it('should return Vec4(x, x, z, x)', () => expect(v.xxzx).toBeVec(v[0], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.xxzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxzy', () => { + it('should return Vec4(x, x, z, y)', () => expect(v.xxzy).toBeVec(v[0], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.xxzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxzz', () => { + it('should return Vec4(x, x, z, z)', () => expect(v.xxzz).toBeVec(v[0], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.xxzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxzw', () => { + it('should return Vec4(x, x, z, w)', () => expect(v.xxzw).toBeVec(v[0], v[0], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.xxzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxwx', () => { + it('should return Vec4(x, x, w, x)', () => expect(v.xxwx).toBeVec(v[0], v[0], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.xxwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxwy', () => { + it('should return Vec4(x, x, w, y)', () => expect(v.xxwy).toBeVec(v[0], v[0], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.xxwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxwz', () => { + it('should return Vec4(x, x, w, z)', () => expect(v.xxwz).toBeVec(v[0], v[0], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.xxwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xxww', () => { + it('should return Vec4(x, x, w, w)', () => expect(v.xxww).toBeVec(v[0], v[0], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.xxww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyxx', () => { + it('should return Vec4(x, y, x, x)', () => expect(v.xyxx).toBeVec(v[0], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xyxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyxy', () => { + it('should return Vec4(x, y, x, y)', () => expect(v.xyxy).toBeVec(v[0], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xyxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyxz', () => { + it('should return Vec4(x, y, x, z)', () => expect(v.xyxz).toBeVec(v[0], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xyxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyxw', () => { + it('should return Vec4(x, y, x, w)', () => expect(v.xyxw).toBeVec(v[0], v[1], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.xyxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyyx', () => { + it('should return Vec4(x, y, y, x)', () => expect(v.xyyx).toBeVec(v[0], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xyyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyyy', () => { + it('should return Vec4(x, y, y, y)', () => expect(v.xyyy).toBeVec(v[0], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xyyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyyz', () => { + it('should return Vec4(x, y, y, z)', () => expect(v.xyyz).toBeVec(v[0], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.xyyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyyw', () => { + it('should return Vec4(x, y, y, w)', () => expect(v.xyyw).toBeVec(v[0], v[1], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.xyyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyzx', () => { + it('should return Vec4(x, y, z, x)', () => expect(v.xyzx).toBeVec(v[0], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.xyzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyzy', () => { + it('should return Vec4(x, y, z, y)', () => expect(v.xyzy).toBeVec(v[0], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.xyzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyzz', () => { + it('should return Vec4(x, y, z, z)', () => expect(v.xyzz).toBeVec(v[0], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.xyzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyzw', () => { + it('should return Vec4(x, y, z, w)', () => expect(v.xyzw).toBeVec(v[0], v[1], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.xyzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xywx', () => { + it('should return Vec4(x, y, w, x)', () => expect(v.xywx).toBeVec(v[0], v[1], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.xywx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xywy', () => { + it('should return Vec4(x, y, w, y)', () => expect(v.xywy).toBeVec(v[0], v[1], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.xywy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xywz', () => { + it('should return Vec4(x, y, w, z)', () => expect(v.xywz).toBeVec(v[0], v[1], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.xywz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xyww', () => { + it('should return Vec4(x, y, w, w)', () => expect(v.xyww).toBeVec(v[0], v[1], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.xyww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzxx', () => { + it('should return Vec4(x, z, x, x)', () => expect(v.xzxx).toBeVec(v[0], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xzxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzxy', () => { + it('should return Vec4(x, z, x, y)', () => expect(v.xzxy).toBeVec(v[0], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xzxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzxz', () => { + it('should return Vec4(x, z, x, z)', () => expect(v.xzxz).toBeVec(v[0], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xzxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzxw', () => { + it('should return Vec4(x, z, x, w)', () => expect(v.xzxw).toBeVec(v[0], v[2], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.xzxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzyx', () => { + it('should return Vec4(x, z, y, x)', () => expect(v.xzyx).toBeVec(v[0], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xzyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzyy', () => { + it('should return Vec4(x, z, y, y)', () => expect(v.xzyy).toBeVec(v[0], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xzyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzyz', () => { + it('should return Vec4(x, z, y, z)', () => expect(v.xzyz).toBeVec(v[0], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.xzyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzyw', () => { + it('should return Vec4(x, z, y, w)', () => expect(v.xzyw).toBeVec(v[0], v[2], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.xzyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzzx', () => { + it('should return Vec4(x, z, z, x)', () => expect(v.xzzx).toBeVec(v[0], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.xzzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzzy', () => { + it('should return Vec4(x, z, z, y)', () => expect(v.xzzy).toBeVec(v[0], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.xzzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzzz', () => { + it('should return Vec4(x, z, z, z)', () => expect(v.xzzz).toBeVec(v[0], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.xzzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzzw', () => { + it('should return Vec4(x, z, z, w)', () => expect(v.xzzw).toBeVec(v[0], v[2], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.xzzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzwx', () => { + it('should return Vec4(x, z, w, x)', () => expect(v.xzwx).toBeVec(v[0], v[2], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.xzwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzwy', () => { + it('should return Vec4(x, z, w, y)', () => expect(v.xzwy).toBeVec(v[0], v[2], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.xzwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzwz', () => { + it('should return Vec4(x, z, w, z)', () => expect(v.xzwz).toBeVec(v[0], v[2], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.xzwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xzww', () => { + it('should return Vec4(x, z, w, w)', () => expect(v.xzww).toBeVec(v[0], v[2], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.xzww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwxx', () => { + it('should return Vec4(x, w, x, x)', () => expect(v.xwxx).toBeVec(v[0], v[3], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.xwxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwxy', () => { + it('should return Vec4(x, w, x, y)', () => expect(v.xwxy).toBeVec(v[0], v[3], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.xwxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwxz', () => { + it('should return Vec4(x, w, x, z)', () => expect(v.xwxz).toBeVec(v[0], v[3], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.xwxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwxw', () => { + it('should return Vec4(x, w, x, w)', () => expect(v.xwxw).toBeVec(v[0], v[3], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.xwxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwyx', () => { + it('should return Vec4(x, w, y, x)', () => expect(v.xwyx).toBeVec(v[0], v[3], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.xwyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwyy', () => { + it('should return Vec4(x, w, y, y)', () => expect(v.xwyy).toBeVec(v[0], v[3], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.xwyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwyz', () => { + it('should return Vec4(x, w, y, z)', () => expect(v.xwyz).toBeVec(v[0], v[3], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.xwyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwyw', () => { + it('should return Vec4(x, w, y, w)', () => expect(v.xwyw).toBeVec(v[0], v[3], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.xwyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwzx', () => { + it('should return Vec4(x, w, z, x)', () => expect(v.xwzx).toBeVec(v[0], v[3], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.xwzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwzy', () => { + it('should return Vec4(x, w, z, y)', () => expect(v.xwzy).toBeVec(v[0], v[3], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.xwzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwzz', () => { + it('should return Vec4(x, w, z, z)', () => expect(v.xwzz).toBeVec(v[0], v[3], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.xwzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwzw', () => { + it('should return Vec4(x, w, z, w)', () => expect(v.xwzw).toBeVec(v[0], v[3], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.xwzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwwx', () => { + it('should return Vec4(x, w, w, x)', () => expect(v.xwwx).toBeVec(v[0], v[3], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.xwwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwwy', () => { + it('should return Vec4(x, w, w, y)', () => expect(v.xwwy).toBeVec(v[0], v[3], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.xwwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwwz', () => { + it('should return Vec4(x, w, w, z)', () => expect(v.xwwz).toBeVec(v[0], v[3], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.xwwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().xwww', () => { + it('should return Vec4(x, w, w, w)', () => expect(v.xwww).toBeVec(v[0], v[3], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.xwww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxxx', () => { + it('should return Vec4(y, x, x, x)', () => expect(v.yxxx).toBeVec(v[1], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yxxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxxy', () => { + it('should return Vec4(y, x, x, y)', () => expect(v.yxxy).toBeVec(v[1], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yxxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxxz', () => { + it('should return Vec4(y, x, x, z)', () => expect(v.yxxz).toBeVec(v[1], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.yxxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxxw', () => { + it('should return Vec4(y, x, x, w)', () => expect(v.yxxw).toBeVec(v[1], v[0], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.yxxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxyx', () => { + it('should return Vec4(y, x, y, x)', () => expect(v.yxyx).toBeVec(v[1], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yxyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxyy', () => { + it('should return Vec4(y, x, y, y)', () => expect(v.yxyy).toBeVec(v[1], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yxyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxyz', () => { + it('should return Vec4(y, x, y, z)', () => expect(v.yxyz).toBeVec(v[1], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.yxyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxyw', () => { + it('should return Vec4(y, x, y, w)', () => expect(v.yxyw).toBeVec(v[1], v[0], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.yxyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxzx', () => { + it('should return Vec4(y, x, z, x)', () => expect(v.yxzx).toBeVec(v[1], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.yxzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxzy', () => { + it('should return Vec4(y, x, z, y)', () => expect(v.yxzy).toBeVec(v[1], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.yxzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxzz', () => { + it('should return Vec4(y, x, z, z)', () => expect(v.yxzz).toBeVec(v[1], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.yxzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxzw', () => { + it('should return Vec4(y, x, z, w)', () => expect(v.yxzw).toBeVec(v[1], v[0], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.yxzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxwx', () => { + it('should return Vec4(y, x, w, x)', () => expect(v.yxwx).toBeVec(v[1], v[0], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.yxwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxwy', () => { + it('should return Vec4(y, x, w, y)', () => expect(v.yxwy).toBeVec(v[1], v[0], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.yxwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxwz', () => { + it('should return Vec4(y, x, w, z)', () => expect(v.yxwz).toBeVec(v[1], v[0], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.yxwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yxww', () => { + it('should return Vec4(y, x, w, w)', () => expect(v.yxww).toBeVec(v[1], v[0], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.yxww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyxx', () => { + it('should return Vec4(y, y, x, x)', () => expect(v.yyxx).toBeVec(v[1], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yyxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyxy', () => { + it('should return Vec4(y, y, x, y)', () => expect(v.yyxy).toBeVec(v[1], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yyxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyxz', () => { + it('should return Vec4(y, y, x, z)', () => expect(v.yyxz).toBeVec(v[1], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.yyxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyxw', () => { + it('should return Vec4(y, y, x, w)', () => expect(v.yyxw).toBeVec(v[1], v[1], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.yyxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyyx', () => { + it('should return Vec4(y, y, y, x)', () => expect(v.yyyx).toBeVec(v[1], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yyyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyyy', () => { + it('should return Vec4(y, y, y, y)', () => expect(v.yyyy).toBeVec(v[1], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yyyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyyz', () => { + it('should return Vec4(y, y, y, z)', () => expect(v.yyyz).toBeVec(v[1], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.yyyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyyw', () => { + it('should return Vec4(y, y, y, w)', () => expect(v.yyyw).toBeVec(v[1], v[1], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.yyyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyzx', () => { + it('should return Vec4(y, y, z, x)', () => expect(v.yyzx).toBeVec(v[1], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.yyzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyzy', () => { + it('should return Vec4(y, y, z, y)', () => expect(v.yyzy).toBeVec(v[1], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.yyzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyzz', () => { + it('should return Vec4(y, y, z, z)', () => expect(v.yyzz).toBeVec(v[1], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.yyzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyzw', () => { + it('should return Vec4(y, y, z, w)', () => expect(v.yyzw).toBeVec(v[1], v[1], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.yyzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yywx', () => { + it('should return Vec4(y, y, w, x)', () => expect(v.yywx).toBeVec(v[1], v[1], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.yywx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yywy', () => { + it('should return Vec4(y, y, w, y)', () => expect(v.yywy).toBeVec(v[1], v[1], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.yywy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yywz', () => { + it('should return Vec4(y, y, w, z)', () => expect(v.yywz).toBeVec(v[1], v[1], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.yywz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yyww', () => { + it('should return Vec4(y, y, w, w)', () => expect(v.yyww).toBeVec(v[1], v[1], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.yyww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzxx', () => { + it('should return Vec4(y, z, x, x)', () => expect(v.yzxx).toBeVec(v[1], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.yzxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzxy', () => { + it('should return Vec4(y, z, x, y)', () => expect(v.yzxy).toBeVec(v[1], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.yzxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzxz', () => { + it('should return Vec4(y, z, x, z)', () => expect(v.yzxz).toBeVec(v[1], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.yzxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzxw', () => { + it('should return Vec4(y, z, x, w)', () => expect(v.yzxw).toBeVec(v[1], v[2], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.yzxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzyx', () => { + it('should return Vec4(y, z, y, x)', () => expect(v.yzyx).toBeVec(v[1], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.yzyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzyy', () => { + it('should return Vec4(y, z, y, y)', () => expect(v.yzyy).toBeVec(v[1], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.yzyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzyz', () => { + it('should return Vec4(y, z, y, z)', () => expect(v.yzyz).toBeVec(v[1], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.yzyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzyw', () => { + it('should return Vec4(y, z, y, w)', () => expect(v.yzyw).toBeVec(v[1], v[2], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.yzyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzzx', () => { + it('should return Vec4(y, z, z, x)', () => expect(v.yzzx).toBeVec(v[1], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.yzzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzzy', () => { + it('should return Vec4(y, z, z, y)', () => expect(v.yzzy).toBeVec(v[1], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.yzzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzzz', () => { + it('should return Vec4(y, z, z, z)', () => expect(v.yzzz).toBeVec(v[1], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.yzzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzzw', () => { + it('should return Vec4(y, z, z, w)', () => expect(v.yzzw).toBeVec(v[1], v[2], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.yzzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzwx', () => { + it('should return Vec4(y, z, w, x)', () => expect(v.yzwx).toBeVec(v[1], v[2], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.yzwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzwy', () => { + it('should return Vec4(y, z, w, y)', () => expect(v.yzwy).toBeVec(v[1], v[2], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.yzwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzwz', () => { + it('should return Vec4(y, z, w, z)', () => expect(v.yzwz).toBeVec(v[1], v[2], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.yzwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().yzww', () => { + it('should return Vec4(y, z, w, w)', () => expect(v.yzww).toBeVec(v[1], v[2], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.yzww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywxx', () => { + it('should return Vec4(y, w, x, x)', () => expect(v.ywxx).toBeVec(v[1], v[3], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.ywxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywxy', () => { + it('should return Vec4(y, w, x, y)', () => expect(v.ywxy).toBeVec(v[1], v[3], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.ywxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywxz', () => { + it('should return Vec4(y, w, x, z)', () => expect(v.ywxz).toBeVec(v[1], v[3], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.ywxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywxw', () => { + it('should return Vec4(y, w, x, w)', () => expect(v.ywxw).toBeVec(v[1], v[3], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.ywxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywyx', () => { + it('should return Vec4(y, w, y, x)', () => expect(v.ywyx).toBeVec(v[1], v[3], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.ywyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywyy', () => { + it('should return Vec4(y, w, y, y)', () => expect(v.ywyy).toBeVec(v[1], v[3], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.ywyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywyz', () => { + it('should return Vec4(y, w, y, z)', () => expect(v.ywyz).toBeVec(v[1], v[3], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.ywyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywyw', () => { + it('should return Vec4(y, w, y, w)', () => expect(v.ywyw).toBeVec(v[1], v[3], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.ywyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywzx', () => { + it('should return Vec4(y, w, z, x)', () => expect(v.ywzx).toBeVec(v[1], v[3], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.ywzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywzy', () => { + it('should return Vec4(y, w, z, y)', () => expect(v.ywzy).toBeVec(v[1], v[3], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.ywzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywzz', () => { + it('should return Vec4(y, w, z, z)', () => expect(v.ywzz).toBeVec(v[1], v[3], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.ywzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywzw', () => { + it('should return Vec4(y, w, z, w)', () => expect(v.ywzw).toBeVec(v[1], v[3], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.ywzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywwx', () => { + it('should return Vec4(y, w, w, x)', () => expect(v.ywwx).toBeVec(v[1], v[3], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.ywwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywwy', () => { + it('should return Vec4(y, w, w, y)', () => expect(v.ywwy).toBeVec(v[1], v[3], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.ywwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywwz', () => { + it('should return Vec4(y, w, w, z)', () => expect(v.ywwz).toBeVec(v[1], v[3], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.ywwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ywww', () => { + it('should return Vec4(y, w, w, w)', () => expect(v.ywww).toBeVec(v[1], v[3], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.ywww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxxx', () => { + it('should return Vec4(z, x, x, x)', () => expect(v.zxxx).toBeVec(v[2], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.zxxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxxy', () => { + it('should return Vec4(z, x, x, y)', () => expect(v.zxxy).toBeVec(v[2], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.zxxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxxz', () => { + it('should return Vec4(z, x, x, z)', () => expect(v.zxxz).toBeVec(v[2], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.zxxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxxw', () => { + it('should return Vec4(z, x, x, w)', () => expect(v.zxxw).toBeVec(v[2], v[0], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.zxxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxyx', () => { + it('should return Vec4(z, x, y, x)', () => expect(v.zxyx).toBeVec(v[2], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.zxyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxyy', () => { + it('should return Vec4(z, x, y, y)', () => expect(v.zxyy).toBeVec(v[2], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.zxyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxyz', () => { + it('should return Vec4(z, x, y, z)', () => expect(v.zxyz).toBeVec(v[2], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.zxyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxyw', () => { + it('should return Vec4(z, x, y, w)', () => expect(v.zxyw).toBeVec(v[2], v[0], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.zxyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxzx', () => { + it('should return Vec4(z, x, z, x)', () => expect(v.zxzx).toBeVec(v[2], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zxzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxzy', () => { + it('should return Vec4(z, x, z, y)', () => expect(v.zxzy).toBeVec(v[2], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zxzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxzz', () => { + it('should return Vec4(z, x, z, z)', () => expect(v.zxzz).toBeVec(v[2], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zxzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxzw', () => { + it('should return Vec4(z, x, z, w)', () => expect(v.zxzw).toBeVec(v[2], v[0], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.zxzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxwx', () => { + it('should return Vec4(z, x, w, x)', () => expect(v.zxwx).toBeVec(v[2], v[0], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.zxwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxwy', () => { + it('should return Vec4(z, x, w, y)', () => expect(v.zxwy).toBeVec(v[2], v[0], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.zxwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxwz', () => { + it('should return Vec4(z, x, w, z)', () => expect(v.zxwz).toBeVec(v[2], v[0], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.zxwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zxww', () => { + it('should return Vec4(z, x, w, w)', () => expect(v.zxww).toBeVec(v[2], v[0], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.zxww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyxx', () => { + it('should return Vec4(z, y, x, x)', () => expect(v.zyxx).toBeVec(v[2], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.zyxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyxy', () => { + it('should return Vec4(z, y, x, y)', () => expect(v.zyxy).toBeVec(v[2], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.zyxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyxz', () => { + it('should return Vec4(z, y, x, z)', () => expect(v.zyxz).toBeVec(v[2], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.zyxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyxw', () => { + it('should return Vec4(z, y, x, w)', () => expect(v.zyxw).toBeVec(v[2], v[1], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.zyxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyyx', () => { + it('should return Vec4(z, y, y, x)', () => expect(v.zyyx).toBeVec(v[2], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.zyyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyyy', () => { + it('should return Vec4(z, y, y, y)', () => expect(v.zyyy).toBeVec(v[2], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.zyyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyyz', () => { + it('should return Vec4(z, y, y, z)', () => expect(v.zyyz).toBeVec(v[2], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.zyyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyyw', () => { + it('should return Vec4(z, y, y, w)', () => expect(v.zyyw).toBeVec(v[2], v[1], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.zyyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyzx', () => { + it('should return Vec4(z, y, z, x)', () => expect(v.zyzx).toBeVec(v[2], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zyzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyzy', () => { + it('should return Vec4(z, y, z, y)', () => expect(v.zyzy).toBeVec(v[2], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zyzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyzz', () => { + it('should return Vec4(z, y, z, z)', () => expect(v.zyzz).toBeVec(v[2], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zyzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyzw', () => { + it('should return Vec4(z, y, z, w)', () => expect(v.zyzw).toBeVec(v[2], v[1], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.zyzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zywx', () => { + it('should return Vec4(z, y, w, x)', () => expect(v.zywx).toBeVec(v[2], v[1], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.zywx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zywy', () => { + it('should return Vec4(z, y, w, y)', () => expect(v.zywy).toBeVec(v[2], v[1], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.zywy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zywz', () => { + it('should return Vec4(z, y, w, z)', () => expect(v.zywz).toBeVec(v[2], v[1], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.zywz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zyww', () => { + it('should return Vec4(z, y, w, w)', () => expect(v.zyww).toBeVec(v[2], v[1], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.zyww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzxx', () => { + it('should return Vec4(z, z, x, x)', () => expect(v.zzxx).toBeVec(v[2], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.zzxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzxy', () => { + it('should return Vec4(z, z, x, y)', () => expect(v.zzxy).toBeVec(v[2], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.zzxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzxz', () => { + it('should return Vec4(z, z, x, z)', () => expect(v.zzxz).toBeVec(v[2], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.zzxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzxw', () => { + it('should return Vec4(z, z, x, w)', () => expect(v.zzxw).toBeVec(v[2], v[2], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.zzxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzyx', () => { + it('should return Vec4(z, z, y, x)', () => expect(v.zzyx).toBeVec(v[2], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.zzyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzyy', () => { + it('should return Vec4(z, z, y, y)', () => expect(v.zzyy).toBeVec(v[2], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.zzyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzyz', () => { + it('should return Vec4(z, z, y, z)', () => expect(v.zzyz).toBeVec(v[2], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.zzyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzyw', () => { + it('should return Vec4(z, z, y, w)', () => expect(v.zzyw).toBeVec(v[2], v[2], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.zzyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzzx', () => { + it('should return Vec4(z, z, z, x)', () => expect(v.zzzx).toBeVec(v[2], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zzzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzzy', () => { + it('should return Vec4(z, z, z, y)', () => expect(v.zzzy).toBeVec(v[2], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zzzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzzz', () => { + it('should return Vec4(z, z, z, z)', () => expect(v.zzzz).toBeVec(v[2], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zzzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzzw', () => { + it('should return Vec4(z, z, z, w)', () => expect(v.zzzw).toBeVec(v[2], v[2], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.zzzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzwx', () => { + it('should return Vec4(z, z, w, x)', () => expect(v.zzwx).toBeVec(v[2], v[2], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.zzwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzwy', () => { + it('should return Vec4(z, z, w, y)', () => expect(v.zzwy).toBeVec(v[2], v[2], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.zzwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzwz', () => { + it('should return Vec4(z, z, w, z)', () => expect(v.zzwz).toBeVec(v[2], v[2], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.zzwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zzww', () => { + it('should return Vec4(z, z, w, w)', () => expect(v.zzww).toBeVec(v[2], v[2], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.zzww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwxx', () => { + it('should return Vec4(z, w, x, x)', () => expect(v.zwxx).toBeVec(v[2], v[3], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.zwxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwxy', () => { + it('should return Vec4(z, w, x, y)', () => expect(v.zwxy).toBeVec(v[2], v[3], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.zwxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwxz', () => { + it('should return Vec4(z, w, x, z)', () => expect(v.zwxz).toBeVec(v[2], v[3], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.zwxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwxw', () => { + it('should return Vec4(z, w, x, w)', () => expect(v.zwxw).toBeVec(v[2], v[3], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.zwxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwyx', () => { + it('should return Vec4(z, w, y, x)', () => expect(v.zwyx).toBeVec(v[2], v[3], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.zwyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwyy', () => { + it('should return Vec4(z, w, y, y)', () => expect(v.zwyy).toBeVec(v[2], v[3], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.zwyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwyz', () => { + it('should return Vec4(z, w, y, z)', () => expect(v.zwyz).toBeVec(v[2], v[3], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.zwyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwyw', () => { + it('should return Vec4(z, w, y, w)', () => expect(v.zwyw).toBeVec(v[2], v[3], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.zwyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwzx', () => { + it('should return Vec4(z, w, z, x)', () => expect(v.zwzx).toBeVec(v[2], v[3], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.zwzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwzy', () => { + it('should return Vec4(z, w, z, y)', () => expect(v.zwzy).toBeVec(v[2], v[3], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.zwzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwzz', () => { + it('should return Vec4(z, w, z, z)', () => expect(v.zwzz).toBeVec(v[2], v[3], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.zwzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwzw', () => { + it('should return Vec4(z, w, z, w)', () => expect(v.zwzw).toBeVec(v[2], v[3], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.zwzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwwx', () => { + it('should return Vec4(z, w, w, x)', () => expect(v.zwwx).toBeVec(v[2], v[3], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.zwwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwwy', () => { + it('should return Vec4(z, w, w, y)', () => expect(v.zwwy).toBeVec(v[2], v[3], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.zwwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwwz', () => { + it('should return Vec4(z, w, w, z)', () => expect(v.zwwz).toBeVec(v[2], v[3], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.zwwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().zwww', () => { + it('should return Vec4(z, w, w, w)', () => expect(v.zwww).toBeVec(v[2], v[3], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.zwww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxxx', () => { + it('should return Vec4(w, x, x, x)', () => expect(v.wxxx).toBeVec(v[3], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.wxxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxxy', () => { + it('should return Vec4(w, x, x, y)', () => expect(v.wxxy).toBeVec(v[3], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.wxxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxxz', () => { + it('should return Vec4(w, x, x, z)', () => expect(v.wxxz).toBeVec(v[3], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.wxxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxxw', () => { + it('should return Vec4(w, x, x, w)', () => expect(v.wxxw).toBeVec(v[3], v[0], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.wxxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxyx', () => { + it('should return Vec4(w, x, y, x)', () => expect(v.wxyx).toBeVec(v[3], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.wxyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxyy', () => { + it('should return Vec4(w, x, y, y)', () => expect(v.wxyy).toBeVec(v[3], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.wxyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxyz', () => { + it('should return Vec4(w, x, y, z)', () => expect(v.wxyz).toBeVec(v[3], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.wxyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxyw', () => { + it('should return Vec4(w, x, y, w)', () => expect(v.wxyw).toBeVec(v[3], v[0], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.wxyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxzx', () => { + it('should return Vec4(w, x, z, x)', () => expect(v.wxzx).toBeVec(v[3], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.wxzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxzy', () => { + it('should return Vec4(w, x, z, y)', () => expect(v.wxzy).toBeVec(v[3], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.wxzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxzz', () => { + it('should return Vec4(w, x, z, z)', () => expect(v.wxzz).toBeVec(v[3], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.wxzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxzw', () => { + it('should return Vec4(w, x, z, w)', () => expect(v.wxzw).toBeVec(v[3], v[0], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.wxzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxwx', () => { + it('should return Vec4(w, x, w, x)', () => expect(v.wxwx).toBeVec(v[3], v[0], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.wxwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxwy', () => { + it('should return Vec4(w, x, w, y)', () => expect(v.wxwy).toBeVec(v[3], v[0], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.wxwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxwz', () => { + it('should return Vec4(w, x, w, z)', () => expect(v.wxwz).toBeVec(v[3], v[0], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.wxwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wxww', () => { + it('should return Vec4(w, x, w, w)', () => expect(v.wxww).toBeVec(v[3], v[0], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.wxww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyxx', () => { + it('should return Vec4(w, y, x, x)', () => expect(v.wyxx).toBeVec(v[3], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.wyxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyxy', () => { + it('should return Vec4(w, y, x, y)', () => expect(v.wyxy).toBeVec(v[3], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.wyxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyxz', () => { + it('should return Vec4(w, y, x, z)', () => expect(v.wyxz).toBeVec(v[3], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.wyxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyxw', () => { + it('should return Vec4(w, y, x, w)', () => expect(v.wyxw).toBeVec(v[3], v[1], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.wyxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyyx', () => { + it('should return Vec4(w, y, y, x)', () => expect(v.wyyx).toBeVec(v[3], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.wyyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyyy', () => { + it('should return Vec4(w, y, y, y)', () => expect(v.wyyy).toBeVec(v[3], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.wyyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyyz', () => { + it('should return Vec4(w, y, y, z)', () => expect(v.wyyz).toBeVec(v[3], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.wyyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyyw', () => { + it('should return Vec4(w, y, y, w)', () => expect(v.wyyw).toBeVec(v[3], v[1], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.wyyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyzx', () => { + it('should return Vec4(w, y, z, x)', () => expect(v.wyzx).toBeVec(v[3], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.wyzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyzy', () => { + it('should return Vec4(w, y, z, y)', () => expect(v.wyzy).toBeVec(v[3], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.wyzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyzz', () => { + it('should return Vec4(w, y, z, z)', () => expect(v.wyzz).toBeVec(v[3], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.wyzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyzw', () => { + it('should return Vec4(w, y, z, w)', () => expect(v.wyzw).toBeVec(v[3], v[1], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.wyzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wywx', () => { + it('should return Vec4(w, y, w, x)', () => expect(v.wywx).toBeVec(v[3], v[1], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.wywx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wywy', () => { + it('should return Vec4(w, y, w, y)', () => expect(v.wywy).toBeVec(v[3], v[1], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.wywy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wywz', () => { + it('should return Vec4(w, y, w, z)', () => expect(v.wywz).toBeVec(v[3], v[1], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.wywz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wyww', () => { + it('should return Vec4(w, y, w, w)', () => expect(v.wyww).toBeVec(v[3], v[1], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.wyww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzxx', () => { + it('should return Vec4(w, z, x, x)', () => expect(v.wzxx).toBeVec(v[3], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.wzxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzxy', () => { + it('should return Vec4(w, z, x, y)', () => expect(v.wzxy).toBeVec(v[3], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.wzxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzxz', () => { + it('should return Vec4(w, z, x, z)', () => expect(v.wzxz).toBeVec(v[3], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.wzxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzxw', () => { + it('should return Vec4(w, z, x, w)', () => expect(v.wzxw).toBeVec(v[3], v[2], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.wzxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzyx', () => { + it('should return Vec4(w, z, y, x)', () => expect(v.wzyx).toBeVec(v[3], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.wzyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzyy', () => { + it('should return Vec4(w, z, y, y)', () => expect(v.wzyy).toBeVec(v[3], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.wzyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzyz', () => { + it('should return Vec4(w, z, y, z)', () => expect(v.wzyz).toBeVec(v[3], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.wzyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzyw', () => { + it('should return Vec4(w, z, y, w)', () => expect(v.wzyw).toBeVec(v[3], v[2], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.wzyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzzx', () => { + it('should return Vec4(w, z, z, x)', () => expect(v.wzzx).toBeVec(v[3], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.wzzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzzy', () => { + it('should return Vec4(w, z, z, y)', () => expect(v.wzzy).toBeVec(v[3], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.wzzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzzz', () => { + it('should return Vec4(w, z, z, z)', () => expect(v.wzzz).toBeVec(v[3], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.wzzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzzw', () => { + it('should return Vec4(w, z, z, w)', () => expect(v.wzzw).toBeVec(v[3], v[2], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.wzzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzwx', () => { + it('should return Vec4(w, z, w, x)', () => expect(v.wzwx).toBeVec(v[3], v[2], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.wzwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzwy', () => { + it('should return Vec4(w, z, w, y)', () => expect(v.wzwy).toBeVec(v[3], v[2], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.wzwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzwz', () => { + it('should return Vec4(w, z, w, z)', () => expect(v.wzwz).toBeVec(v[3], v[2], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.wzwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wzww', () => { + it('should return Vec4(w, z, w, w)', () => expect(v.wzww).toBeVec(v[3], v[2], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.wzww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwxx', () => { + it('should return Vec4(w, w, x, x)', () => expect(v.wwxx).toBeVec(v[3], v[3], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.wwxx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwxy', () => { + it('should return Vec4(w, w, x, y)', () => expect(v.wwxy).toBeVec(v[3], v[3], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.wwxy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwxz', () => { + it('should return Vec4(w, w, x, z)', () => expect(v.wwxz).toBeVec(v[3], v[3], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.wwxz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwxw', () => { + it('should return Vec4(w, w, x, w)', () => expect(v.wwxw).toBeVec(v[3], v[3], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.wwxw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwyx', () => { + it('should return Vec4(w, w, y, x)', () => expect(v.wwyx).toBeVec(v[3], v[3], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.wwyx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwyy', () => { + it('should return Vec4(w, w, y, y)', () => expect(v.wwyy).toBeVec(v[3], v[3], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.wwyy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwyz', () => { + it('should return Vec4(w, w, y, z)', () => expect(v.wwyz).toBeVec(v[3], v[3], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.wwyz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwyw', () => { + it('should return Vec4(w, w, y, w)', () => expect(v.wwyw).toBeVec(v[3], v[3], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.wwyw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwzx', () => { + it('should return Vec4(w, w, z, x)', () => expect(v.wwzx).toBeVec(v[3], v[3], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.wwzx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwzy', () => { + it('should return Vec4(w, w, z, y)', () => expect(v.wwzy).toBeVec(v[3], v[3], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.wwzy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwzz', () => { + it('should return Vec4(w, w, z, z)', () => expect(v.wwzz).toBeVec(v[3], v[3], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.wwzz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwzw', () => { + it('should return Vec4(w, w, z, w)', () => expect(v.wwzw).toBeVec(v[3], v[3], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.wwzw; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwwx', () => { + it('should return Vec4(w, w, w, x)', () => expect(v.wwwx).toBeVec(v[3], v[3], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.wwwx; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwwy', () => { + it('should return Vec4(w, w, w, y)', () => expect(v.wwwy).toBeVec(v[3], v[3], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.wwwy; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwwz', () => { + it('should return Vec4(w, w, w, z)', () => expect(v.wwwz).toBeVec(v[3], v[3], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.wwwz; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().wwww', () => { + it('should return Vec4(w, w, w, w)', () => expect(v.wwww).toBeVec(v[3], v[3], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.wwww; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rr', () => { + it('should return Vec2(r, r)', () => expect(v.rr).toBeVec(v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rg', () => { + it('should return Vec2(r, g)', () => expect(v.rg).toBeVec(v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rb', () => { + it('should return Vec2(r, b)', () => expect(v.rb).toBeVec(v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ra', () => { + it('should return Vec2(r, a)', () => expect(v.ra).toBeVec(v[0], v[3])); + it('should be return a copy', () => { + const sw = v.ra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gr', () => { + it('should return Vec2(g, r)', () => expect(v.gr).toBeVec(v[1], v[0])); + it('should be return a copy', () => { + const sw = v.gr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gg', () => { + it('should return Vec2(g, g)', () => expect(v.gg).toBeVec(v[1], v[1])); + it('should be return a copy', () => { + const sw = v.gg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gb', () => { + it('should return Vec2(g, b)', () => expect(v.gb).toBeVec(v[1], v[2])); + it('should be return a copy', () => { + const sw = v.gb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ga', () => { + it('should return Vec2(g, a)', () => expect(v.ga).toBeVec(v[1], v[3])); + it('should be return a copy', () => { + const sw = v.ga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().br', () => { + it('should return Vec2(b, r)', () => expect(v.br).toBeVec(v[2], v[0])); + it('should be return a copy', () => { + const sw = v.br; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bg', () => { + it('should return Vec2(b, g)', () => expect(v.bg).toBeVec(v[2], v[1])); + it('should be return a copy', () => { + const sw = v.bg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bb', () => { + it('should return Vec2(b, b)', () => expect(v.bb).toBeVec(v[2], v[2])); + it('should be return a copy', () => { + const sw = v.bb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ba', () => { + it('should return Vec2(b, a)', () => expect(v.ba).toBeVec(v[2], v[3])); + it('should be return a copy', () => { + const sw = v.ba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ar', () => { + it('should return Vec2(a, r)', () => expect(v.ar).toBeVec(v[3], v[0])); + it('should be return a copy', () => { + const sw = v.ar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ag', () => { + it('should return Vec2(a, g)', () => expect(v.ag).toBeVec(v[3], v[1])); + it('should be return a copy', () => { + const sw = v.ag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ab', () => { + it('should return Vec2(a, b)', () => expect(v.ab).toBeVec(v[3], v[2])); + it('should be return a copy', () => { + const sw = v.ab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aa', () => { + it('should return Vec2(a, a)', () => expect(v.aa).toBeVec(v[3], v[3])); + it('should be return a copy', () => { + const sw = v.aa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrr', () => { + it('should return Vec3(r, r, r)', () => expect(v.rrr).toBeVec(v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrg', () => { + it('should return Vec3(r, r, g)', () => expect(v.rrg).toBeVec(v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrb', () => { + it('should return Vec3(r, r, b)', () => expect(v.rrb).toBeVec(v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rra', () => { + it('should return Vec3(r, r, a)', () => expect(v.rra).toBeVec(v[0], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.rra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgr', () => { + it('should return Vec3(r, g, r)', () => expect(v.rgr).toBeVec(v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgg', () => { + it('should return Vec3(r, g, g)', () => expect(v.rgg).toBeVec(v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgb', () => { + it('should return Vec3(r, g, b)', () => expect(v.rgb).toBeVec(v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.rgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rga', () => { + it('should return Vec3(r, g, a)', () => expect(v.rga).toBeVec(v[0], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.rga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbr', () => { + it('should return Vec3(r, b, r)', () => expect(v.rbr).toBeVec(v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.rbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbg', () => { + it('should return Vec3(r, b, g)', () => expect(v.rbg).toBeVec(v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.rbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbb', () => { + it('should return Vec3(r, b, b)', () => expect(v.rbb).toBeVec(v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.rbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rba', () => { + it('should return Vec3(r, b, a)', () => expect(v.rba).toBeVec(v[0], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.rba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rar', () => { + it('should return Vec3(r, a, r)', () => expect(v.rar).toBeVec(v[0], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.rar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rag', () => { + it('should return Vec3(r, a, g)', () => expect(v.rag).toBeVec(v[0], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.rag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rab', () => { + it('should return Vec3(r, a, b)', () => expect(v.rab).toBeVec(v[0], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.rab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().raa', () => { + it('should return Vec3(r, a, a)', () => expect(v.raa).toBeVec(v[0], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.raa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grr', () => { + it('should return Vec3(g, r, r)', () => expect(v.grr).toBeVec(v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.grr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grg', () => { + it('should return Vec3(g, r, g)', () => expect(v.grg).toBeVec(v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.grg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grb', () => { + it('should return Vec3(g, r, b)', () => expect(v.grb).toBeVec(v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.grb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gra', () => { + it('should return Vec3(g, r, a)', () => expect(v.gra).toBeVec(v[1], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.gra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggr', () => { + it('should return Vec3(g, g, r)', () => expect(v.ggr).toBeVec(v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.ggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggg', () => { + it('should return Vec3(g, g, g)', () => expect(v.ggg).toBeVec(v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.ggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggb', () => { + it('should return Vec3(g, g, b)', () => expect(v.ggb).toBeVec(v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.ggb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gga', () => { + it('should return Vec3(g, g, a)', () => expect(v.gga).toBeVec(v[1], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.gga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbr', () => { + it('should return Vec3(g, b, r)', () => expect(v.gbr).toBeVec(v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.gbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbg', () => { + it('should return Vec3(g, b, g)', () => expect(v.gbg).toBeVec(v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.gbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbb', () => { + it('should return Vec3(g, b, b)', () => expect(v.gbb).toBeVec(v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.gbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gba', () => { + it('should return Vec3(g, b, a)', () => expect(v.gba).toBeVec(v[1], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.gba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gar', () => { + it('should return Vec3(g, a, r)', () => expect(v.gar).toBeVec(v[1], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.gar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gag', () => { + it('should return Vec3(g, a, g)', () => expect(v.gag).toBeVec(v[1], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.gag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gab', () => { + it('should return Vec3(g, a, b)', () => expect(v.gab).toBeVec(v[1], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.gab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gaa', () => { + it('should return Vec3(g, a, a)', () => expect(v.gaa).toBeVec(v[1], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.gaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brr', () => { + it('should return Vec3(b, r, r)', () => expect(v.brr).toBeVec(v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.brr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brg', () => { + it('should return Vec3(b, r, g)', () => expect(v.brg).toBeVec(v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.brg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brb', () => { + it('should return Vec3(b, r, b)', () => expect(v.brb).toBeVec(v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.brb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bra', () => { + it('should return Vec3(b, r, a)', () => expect(v.bra).toBeVec(v[2], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.bra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgr', () => { + it('should return Vec3(b, g, r)', () => expect(v.bgr).toBeVec(v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.bgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgg', () => { + it('should return Vec3(b, g, g)', () => expect(v.bgg).toBeVec(v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.bgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgb', () => { + it('should return Vec3(b, g, b)', () => expect(v.bgb).toBeVec(v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.bgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bga', () => { + it('should return Vec3(b, g, a)', () => expect(v.bga).toBeVec(v[2], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.bga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbr', () => { + it('should return Vec3(b, b, r)', () => expect(v.bbr).toBeVec(v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.bbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbg', () => { + it('should return Vec3(b, b, g)', () => expect(v.bbg).toBeVec(v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.bbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbb', () => { + it('should return Vec3(b, b, b)', () => expect(v.bbb).toBeVec(v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.bbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bba', () => { + it('should return Vec3(b, b, a)', () => expect(v.bba).toBeVec(v[2], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.bba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bar', () => { + it('should return Vec3(b, a, r)', () => expect(v.bar).toBeVec(v[2], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.bar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bag', () => { + it('should return Vec3(b, a, g)', () => expect(v.bag).toBeVec(v[2], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.bag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bab', () => { + it('should return Vec3(b, a, b)', () => expect(v.bab).toBeVec(v[2], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.bab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().baa', () => { + it('should return Vec3(b, a, a)', () => expect(v.baa).toBeVec(v[2], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.baa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arr', () => { + it('should return Vec3(a, r, r)', () => expect(v.arr).toBeVec(v[3], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.arr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arg', () => { + it('should return Vec3(a, r, g)', () => expect(v.arg).toBeVec(v[3], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.arg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arb', () => { + it('should return Vec3(a, r, b)', () => expect(v.arb).toBeVec(v[3], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.arb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ara', () => { + it('should return Vec3(a, r, a)', () => expect(v.ara).toBeVec(v[3], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.ara; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agr', () => { + it('should return Vec3(a, g, r)', () => expect(v.agr).toBeVec(v[3], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.agr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agg', () => { + it('should return Vec3(a, g, g)', () => expect(v.agg).toBeVec(v[3], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.agg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agb', () => { + it('should return Vec3(a, g, b)', () => expect(v.agb).toBeVec(v[3], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.agb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aga', () => { + it('should return Vec3(a, g, a)', () => expect(v.aga).toBeVec(v[3], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.aga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abr', () => { + it('should return Vec3(a, b, r)', () => expect(v.abr).toBeVec(v[3], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.abr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abg', () => { + it('should return Vec3(a, b, g)', () => expect(v.abg).toBeVec(v[3], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.abg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abb', () => { + it('should return Vec3(a, b, b)', () => expect(v.abb).toBeVec(v[3], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.abb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aba', () => { + it('should return Vec3(a, b, a)', () => expect(v.aba).toBeVec(v[3], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.aba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aar', () => { + it('should return Vec3(a, a, r)', () => expect(v.aar).toBeVec(v[3], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.aar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aag', () => { + it('should return Vec3(a, a, g)', () => expect(v.aag).toBeVec(v[3], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.aag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aab', () => { + it('should return Vec3(a, a, b)', () => expect(v.aab).toBeVec(v[3], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.aab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aaa', () => { + it('should return Vec3(a, a, a)', () => expect(v.aaa).toBeVec(v[3], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.aaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrrr', () => { + it('should return Vec4(r, r, r, r)', () => expect(v.rrrr).toBeVec(v[0], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rrrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrrg', () => { + it('should return Vec4(r, r, r, g)', () => expect(v.rrrg).toBeVec(v[0], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rrrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrrb', () => { + it('should return Vec4(r, r, r, b)', () => expect(v.rrrb).toBeVec(v[0], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rrrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrra', () => { + it('should return Vec4(r, r, r, a)', () => expect(v.rrra).toBeVec(v[0], v[0], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.rrra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrgr', () => { + it('should return Vec4(r, r, g, r)', () => expect(v.rrgr).toBeVec(v[0], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rrgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrgg', () => { + it('should return Vec4(r, r, g, g)', () => expect(v.rrgg).toBeVec(v[0], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rrgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrgb', () => { + it('should return Vec4(r, r, g, b)', () => expect(v.rrgb).toBeVec(v[0], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.rrgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrga', () => { + it('should return Vec4(r, r, g, a)', () => expect(v.rrga).toBeVec(v[0], v[0], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.rrga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrbr', () => { + it('should return Vec4(r, r, b, r)', () => expect(v.rrbr).toBeVec(v[0], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.rrbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrbg', () => { + it('should return Vec4(r, r, b, g)', () => expect(v.rrbg).toBeVec(v[0], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.rrbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrbb', () => { + it('should return Vec4(r, r, b, b)', () => expect(v.rrbb).toBeVec(v[0], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.rrbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrba', () => { + it('should return Vec4(r, r, b, a)', () => expect(v.rrba).toBeVec(v[0], v[0], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.rrba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrar', () => { + it('should return Vec4(r, r, a, r)', () => expect(v.rrar).toBeVec(v[0], v[0], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.rrar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrag', () => { + it('should return Vec4(r, r, a, g)', () => expect(v.rrag).toBeVec(v[0], v[0], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.rrag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rrab', () => { + it('should return Vec4(r, r, a, b)', () => expect(v.rrab).toBeVec(v[0], v[0], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.rrab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rraa', () => { + it('should return Vec4(r, r, a, a)', () => expect(v.rraa).toBeVec(v[0], v[0], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.rraa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgrr', () => { + it('should return Vec4(r, g, r, r)', () => expect(v.rgrr).toBeVec(v[0], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rgrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgrg', () => { + it('should return Vec4(r, g, r, g)', () => expect(v.rgrg).toBeVec(v[0], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rgrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgrb', () => { + it('should return Vec4(r, g, r, b)', () => expect(v.rgrb).toBeVec(v[0], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rgrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgra', () => { + it('should return Vec4(r, g, r, a)', () => expect(v.rgra).toBeVec(v[0], v[1], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.rgra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rggr', () => { + it('should return Vec4(r, g, g, r)', () => expect(v.rggr).toBeVec(v[0], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rggg', () => { + it('should return Vec4(r, g, g, g)', () => expect(v.rggg).toBeVec(v[0], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rggb', () => { + it('should return Vec4(r, g, g, b)', () => expect(v.rggb).toBeVec(v[0], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.rggb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgga', () => { + it('should return Vec4(r, g, g, a)', () => expect(v.rgga).toBeVec(v[0], v[1], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.rgga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgbr', () => { + it('should return Vec4(r, g, b, r)', () => expect(v.rgbr).toBeVec(v[0], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.rgbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgbg', () => { + it('should return Vec4(r, g, b, g)', () => expect(v.rgbg).toBeVec(v[0], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.rgbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgbb', () => { + it('should return Vec4(r, g, b, b)', () => expect(v.rgbb).toBeVec(v[0], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.rgbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgba', () => { + it('should return Vec4(r, g, b, a)', () => expect(v.rgba).toBeVec(v[0], v[1], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.rgba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgar', () => { + it('should return Vec4(r, g, a, r)', () => expect(v.rgar).toBeVec(v[0], v[1], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.rgar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgag', () => { + it('should return Vec4(r, g, a, g)', () => expect(v.rgag).toBeVec(v[0], v[1], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.rgag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgab', () => { + it('should return Vec4(r, g, a, b)', () => expect(v.rgab).toBeVec(v[0], v[1], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.rgab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rgaa', () => { + it('should return Vec4(r, g, a, a)', () => expect(v.rgaa).toBeVec(v[0], v[1], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.rgaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbrr', () => { + it('should return Vec4(r, b, r, r)', () => expect(v.rbrr).toBeVec(v[0], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rbrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbrg', () => { + it('should return Vec4(r, b, r, g)', () => expect(v.rbrg).toBeVec(v[0], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rbrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbrb', () => { + it('should return Vec4(r, b, r, b)', () => expect(v.rbrb).toBeVec(v[0], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rbrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbra', () => { + it('should return Vec4(r, b, r, a)', () => expect(v.rbra).toBeVec(v[0], v[2], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.rbra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbgr', () => { + it('should return Vec4(r, b, g, r)', () => expect(v.rbgr).toBeVec(v[0], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.rbgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbgg', () => { + it('should return Vec4(r, b, g, g)', () => expect(v.rbgg).toBeVec(v[0], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.rbgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbgb', () => { + it('should return Vec4(r, b, g, b)', () => expect(v.rbgb).toBeVec(v[0], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.rbgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbga', () => { + it('should return Vec4(r, b, g, a)', () => expect(v.rbga).toBeVec(v[0], v[2], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.rbga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbbr', () => { + it('should return Vec4(r, b, b, r)', () => expect(v.rbbr).toBeVec(v[0], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.rbbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbbg', () => { + it('should return Vec4(r, b, b, g)', () => expect(v.rbbg).toBeVec(v[0], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.rbbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbbb', () => { + it('should return Vec4(r, b, b, b)', () => expect(v.rbbb).toBeVec(v[0], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.rbbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbba', () => { + it('should return Vec4(r, b, b, a)', () => expect(v.rbba).toBeVec(v[0], v[2], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.rbba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbar', () => { + it('should return Vec4(r, b, a, r)', () => expect(v.rbar).toBeVec(v[0], v[2], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.rbar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbag', () => { + it('should return Vec4(r, b, a, g)', () => expect(v.rbag).toBeVec(v[0], v[2], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.rbag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbab', () => { + it('should return Vec4(r, b, a, b)', () => expect(v.rbab).toBeVec(v[0], v[2], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.rbab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rbaa', () => { + it('should return Vec4(r, b, a, a)', () => expect(v.rbaa).toBeVec(v[0], v[2], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.rbaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rarr', () => { + it('should return Vec4(r, a, r, r)', () => expect(v.rarr).toBeVec(v[0], v[3], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.rarr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rarg', () => { + it('should return Vec4(r, a, r, g)', () => expect(v.rarg).toBeVec(v[0], v[3], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.rarg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rarb', () => { + it('should return Vec4(r, a, r, b)', () => expect(v.rarb).toBeVec(v[0], v[3], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.rarb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rara', () => { + it('should return Vec4(r, a, r, a)', () => expect(v.rara).toBeVec(v[0], v[3], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.rara; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ragr', () => { + it('should return Vec4(r, a, g, r)', () => expect(v.ragr).toBeVec(v[0], v[3], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.ragr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ragg', () => { + it('should return Vec4(r, a, g, g)', () => expect(v.ragg).toBeVec(v[0], v[3], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.ragg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ragb', () => { + it('should return Vec4(r, a, g, b)', () => expect(v.ragb).toBeVec(v[0], v[3], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.ragb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().raga', () => { + it('should return Vec4(r, a, g, a)', () => expect(v.raga).toBeVec(v[0], v[3], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.raga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rabr', () => { + it('should return Vec4(r, a, b, r)', () => expect(v.rabr).toBeVec(v[0], v[3], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.rabr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rabg', () => { + it('should return Vec4(r, a, b, g)', () => expect(v.rabg).toBeVec(v[0], v[3], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.rabg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().rabb', () => { + it('should return Vec4(r, a, b, b)', () => expect(v.rabb).toBeVec(v[0], v[3], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.rabb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().raba', () => { + it('should return Vec4(r, a, b, a)', () => expect(v.raba).toBeVec(v[0], v[3], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.raba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().raar', () => { + it('should return Vec4(r, a, a, r)', () => expect(v.raar).toBeVec(v[0], v[3], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.raar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().raag', () => { + it('should return Vec4(r, a, a, g)', () => expect(v.raag).toBeVec(v[0], v[3], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.raag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().raab', () => { + it('should return Vec4(r, a, a, b)', () => expect(v.raab).toBeVec(v[0], v[3], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.raab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().raaa', () => { + it('should return Vec4(r, a, a, a)', () => expect(v.raaa).toBeVec(v[0], v[3], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.raaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grrr', () => { + it('should return Vec4(g, r, r, r)', () => expect(v.grrr).toBeVec(v[1], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.grrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grrg', () => { + it('should return Vec4(g, r, r, g)', () => expect(v.grrg).toBeVec(v[1], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.grrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grrb', () => { + it('should return Vec4(g, r, r, b)', () => expect(v.grrb).toBeVec(v[1], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.grrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grra', () => { + it('should return Vec4(g, r, r, a)', () => expect(v.grra).toBeVec(v[1], v[0], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.grra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grgr', () => { + it('should return Vec4(g, r, g, r)', () => expect(v.grgr).toBeVec(v[1], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.grgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grgg', () => { + it('should return Vec4(g, r, g, g)', () => expect(v.grgg).toBeVec(v[1], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.grgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grgb', () => { + it('should return Vec4(g, r, g, b)', () => expect(v.grgb).toBeVec(v[1], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.grgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grga', () => { + it('should return Vec4(g, r, g, a)', () => expect(v.grga).toBeVec(v[1], v[0], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.grga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grbr', () => { + it('should return Vec4(g, r, b, r)', () => expect(v.grbr).toBeVec(v[1], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.grbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grbg', () => { + it('should return Vec4(g, r, b, g)', () => expect(v.grbg).toBeVec(v[1], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.grbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grbb', () => { + it('should return Vec4(g, r, b, b)', () => expect(v.grbb).toBeVec(v[1], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.grbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grba', () => { + it('should return Vec4(g, r, b, a)', () => expect(v.grba).toBeVec(v[1], v[0], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.grba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grar', () => { + it('should return Vec4(g, r, a, r)', () => expect(v.grar).toBeVec(v[1], v[0], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.grar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grag', () => { + it('should return Vec4(g, r, a, g)', () => expect(v.grag).toBeVec(v[1], v[0], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.grag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().grab', () => { + it('should return Vec4(g, r, a, b)', () => expect(v.grab).toBeVec(v[1], v[0], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.grab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().graa', () => { + it('should return Vec4(g, r, a, a)', () => expect(v.graa).toBeVec(v[1], v[0], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.graa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggrr', () => { + it('should return Vec4(g, g, r, r)', () => expect(v.ggrr).toBeVec(v[1], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.ggrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggrg', () => { + it('should return Vec4(g, g, r, g)', () => expect(v.ggrg).toBeVec(v[1], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.ggrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggrb', () => { + it('should return Vec4(g, g, r, b)', () => expect(v.ggrb).toBeVec(v[1], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.ggrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggra', () => { + it('should return Vec4(g, g, r, a)', () => expect(v.ggra).toBeVec(v[1], v[1], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.ggra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gggr', () => { + it('should return Vec4(g, g, g, r)', () => expect(v.gggr).toBeVec(v[1], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.gggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gggg', () => { + it('should return Vec4(g, g, g, g)', () => expect(v.gggg).toBeVec(v[1], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.gggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gggb', () => { + it('should return Vec4(g, g, g, b)', () => expect(v.gggb).toBeVec(v[1], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.gggb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggga', () => { + it('should return Vec4(g, g, g, a)', () => expect(v.ggga).toBeVec(v[1], v[1], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.ggga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggbr', () => { + it('should return Vec4(g, g, b, r)', () => expect(v.ggbr).toBeVec(v[1], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.ggbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggbg', () => { + it('should return Vec4(g, g, b, g)', () => expect(v.ggbg).toBeVec(v[1], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.ggbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggbb', () => { + it('should return Vec4(g, g, b, b)', () => expect(v.ggbb).toBeVec(v[1], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.ggbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggba', () => { + it('should return Vec4(g, g, b, a)', () => expect(v.ggba).toBeVec(v[1], v[1], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.ggba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggar', () => { + it('should return Vec4(g, g, a, r)', () => expect(v.ggar).toBeVec(v[1], v[1], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.ggar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggag', () => { + it('should return Vec4(g, g, a, g)', () => expect(v.ggag).toBeVec(v[1], v[1], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.ggag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggab', () => { + it('should return Vec4(g, g, a, b)', () => expect(v.ggab).toBeVec(v[1], v[1], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.ggab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().ggaa', () => { + it('should return Vec4(g, g, a, a)', () => expect(v.ggaa).toBeVec(v[1], v[1], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.ggaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbrr', () => { + it('should return Vec4(g, b, r, r)', () => expect(v.gbrr).toBeVec(v[1], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.gbrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbrg', () => { + it('should return Vec4(g, b, r, g)', () => expect(v.gbrg).toBeVec(v[1], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.gbrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbrb', () => { + it('should return Vec4(g, b, r, b)', () => expect(v.gbrb).toBeVec(v[1], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.gbrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbra', () => { + it('should return Vec4(g, b, r, a)', () => expect(v.gbra).toBeVec(v[1], v[2], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.gbra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbgr', () => { + it('should return Vec4(g, b, g, r)', () => expect(v.gbgr).toBeVec(v[1], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.gbgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbgg', () => { + it('should return Vec4(g, b, g, g)', () => expect(v.gbgg).toBeVec(v[1], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.gbgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbgb', () => { + it('should return Vec4(g, b, g, b)', () => expect(v.gbgb).toBeVec(v[1], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.gbgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbga', () => { + it('should return Vec4(g, b, g, a)', () => expect(v.gbga).toBeVec(v[1], v[2], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.gbga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbbr', () => { + it('should return Vec4(g, b, b, r)', () => expect(v.gbbr).toBeVec(v[1], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.gbbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbbg', () => { + it('should return Vec4(g, b, b, g)', () => expect(v.gbbg).toBeVec(v[1], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.gbbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbbb', () => { + it('should return Vec4(g, b, b, b)', () => expect(v.gbbb).toBeVec(v[1], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.gbbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbba', () => { + it('should return Vec4(g, b, b, a)', () => expect(v.gbba).toBeVec(v[1], v[2], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.gbba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbar', () => { + it('should return Vec4(g, b, a, r)', () => expect(v.gbar).toBeVec(v[1], v[2], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.gbar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbag', () => { + it('should return Vec4(g, b, a, g)', () => expect(v.gbag).toBeVec(v[1], v[2], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.gbag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbab', () => { + it('should return Vec4(g, b, a, b)', () => expect(v.gbab).toBeVec(v[1], v[2], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.gbab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gbaa', () => { + it('should return Vec4(g, b, a, a)', () => expect(v.gbaa).toBeVec(v[1], v[2], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.gbaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().garr', () => { + it('should return Vec4(g, a, r, r)', () => expect(v.garr).toBeVec(v[1], v[3], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.garr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().garg', () => { + it('should return Vec4(g, a, r, g)', () => expect(v.garg).toBeVec(v[1], v[3], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.garg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().garb', () => { + it('should return Vec4(g, a, r, b)', () => expect(v.garb).toBeVec(v[1], v[3], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.garb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gara', () => { + it('should return Vec4(g, a, r, a)', () => expect(v.gara).toBeVec(v[1], v[3], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.gara; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gagr', () => { + it('should return Vec4(g, a, g, r)', () => expect(v.gagr).toBeVec(v[1], v[3], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.gagr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gagg', () => { + it('should return Vec4(g, a, g, g)', () => expect(v.gagg).toBeVec(v[1], v[3], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.gagg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gagb', () => { + it('should return Vec4(g, a, g, b)', () => expect(v.gagb).toBeVec(v[1], v[3], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.gagb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gaga', () => { + it('should return Vec4(g, a, g, a)', () => expect(v.gaga).toBeVec(v[1], v[3], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.gaga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gabr', () => { + it('should return Vec4(g, a, b, r)', () => expect(v.gabr).toBeVec(v[1], v[3], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.gabr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gabg', () => { + it('should return Vec4(g, a, b, g)', () => expect(v.gabg).toBeVec(v[1], v[3], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.gabg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gabb', () => { + it('should return Vec4(g, a, b, b)', () => expect(v.gabb).toBeVec(v[1], v[3], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.gabb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gaba', () => { + it('should return Vec4(g, a, b, a)', () => expect(v.gaba).toBeVec(v[1], v[3], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.gaba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gaar', () => { + it('should return Vec4(g, a, a, r)', () => expect(v.gaar).toBeVec(v[1], v[3], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.gaar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gaag', () => { + it('should return Vec4(g, a, a, g)', () => expect(v.gaag).toBeVec(v[1], v[3], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.gaag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gaab', () => { + it('should return Vec4(g, a, a, b)', () => expect(v.gaab).toBeVec(v[1], v[3], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.gaab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().gaaa', () => { + it('should return Vec4(g, a, a, a)', () => expect(v.gaaa).toBeVec(v[1], v[3], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.gaaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brrr', () => { + it('should return Vec4(b, r, r, r)', () => expect(v.brrr).toBeVec(v[2], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.brrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brrg', () => { + it('should return Vec4(b, r, r, g)', () => expect(v.brrg).toBeVec(v[2], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.brrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brrb', () => { + it('should return Vec4(b, r, r, b)', () => expect(v.brrb).toBeVec(v[2], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.brrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brra', () => { + it('should return Vec4(b, r, r, a)', () => expect(v.brra).toBeVec(v[2], v[0], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.brra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brgr', () => { + it('should return Vec4(b, r, g, r)', () => expect(v.brgr).toBeVec(v[2], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.brgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brgg', () => { + it('should return Vec4(b, r, g, g)', () => expect(v.brgg).toBeVec(v[2], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.brgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brgb', () => { + it('should return Vec4(b, r, g, b)', () => expect(v.brgb).toBeVec(v[2], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.brgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brga', () => { + it('should return Vec4(b, r, g, a)', () => expect(v.brga).toBeVec(v[2], v[0], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.brga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brbr', () => { + it('should return Vec4(b, r, b, r)', () => expect(v.brbr).toBeVec(v[2], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.brbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brbg', () => { + it('should return Vec4(b, r, b, g)', () => expect(v.brbg).toBeVec(v[2], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.brbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brbb', () => { + it('should return Vec4(b, r, b, b)', () => expect(v.brbb).toBeVec(v[2], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.brbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brba', () => { + it('should return Vec4(b, r, b, a)', () => expect(v.brba).toBeVec(v[2], v[0], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.brba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brar', () => { + it('should return Vec4(b, r, a, r)', () => expect(v.brar).toBeVec(v[2], v[0], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.brar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brag', () => { + it('should return Vec4(b, r, a, g)', () => expect(v.brag).toBeVec(v[2], v[0], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.brag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().brab', () => { + it('should return Vec4(b, r, a, b)', () => expect(v.brab).toBeVec(v[2], v[0], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.brab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().braa', () => { + it('should return Vec4(b, r, a, a)', () => expect(v.braa).toBeVec(v[2], v[0], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.braa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgrr', () => { + it('should return Vec4(b, g, r, r)', () => expect(v.bgrr).toBeVec(v[2], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.bgrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgrg', () => { + it('should return Vec4(b, g, r, g)', () => expect(v.bgrg).toBeVec(v[2], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.bgrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgrb', () => { + it('should return Vec4(b, g, r, b)', () => expect(v.bgrb).toBeVec(v[2], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.bgrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgra', () => { + it('should return Vec4(b, g, r, a)', () => expect(v.bgra).toBeVec(v[2], v[1], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.bgra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bggr', () => { + it('should return Vec4(b, g, g, r)', () => expect(v.bggr).toBeVec(v[2], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.bggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bggg', () => { + it('should return Vec4(b, g, g, g)', () => expect(v.bggg).toBeVec(v[2], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.bggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bggb', () => { + it('should return Vec4(b, g, g, b)', () => expect(v.bggb).toBeVec(v[2], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.bggb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgga', () => { + it('should return Vec4(b, g, g, a)', () => expect(v.bgga).toBeVec(v[2], v[1], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.bgga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgbr', () => { + it('should return Vec4(b, g, b, r)', () => expect(v.bgbr).toBeVec(v[2], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.bgbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgbg', () => { + it('should return Vec4(b, g, b, g)', () => expect(v.bgbg).toBeVec(v[2], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.bgbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgbb', () => { + it('should return Vec4(b, g, b, b)', () => expect(v.bgbb).toBeVec(v[2], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.bgbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgba', () => { + it('should return Vec4(b, g, b, a)', () => expect(v.bgba).toBeVec(v[2], v[1], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.bgba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgar', () => { + it('should return Vec4(b, g, a, r)', () => expect(v.bgar).toBeVec(v[2], v[1], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.bgar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgag', () => { + it('should return Vec4(b, g, a, g)', () => expect(v.bgag).toBeVec(v[2], v[1], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.bgag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgab', () => { + it('should return Vec4(b, g, a, b)', () => expect(v.bgab).toBeVec(v[2], v[1], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.bgab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bgaa', () => { + it('should return Vec4(b, g, a, a)', () => expect(v.bgaa).toBeVec(v[2], v[1], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.bgaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbrr', () => { + it('should return Vec4(b, b, r, r)', () => expect(v.bbrr).toBeVec(v[2], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.bbrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbrg', () => { + it('should return Vec4(b, b, r, g)', () => expect(v.bbrg).toBeVec(v[2], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.bbrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbrb', () => { + it('should return Vec4(b, b, r, b)', () => expect(v.bbrb).toBeVec(v[2], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.bbrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbra', () => { + it('should return Vec4(b, b, r, a)', () => expect(v.bbra).toBeVec(v[2], v[2], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.bbra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbgr', () => { + it('should return Vec4(b, b, g, r)', () => expect(v.bbgr).toBeVec(v[2], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.bbgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbgg', () => { + it('should return Vec4(b, b, g, g)', () => expect(v.bbgg).toBeVec(v[2], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.bbgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbgb', () => { + it('should return Vec4(b, b, g, b)', () => expect(v.bbgb).toBeVec(v[2], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.bbgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbga', () => { + it('should return Vec4(b, b, g, a)', () => expect(v.bbga).toBeVec(v[2], v[2], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.bbga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbbr', () => { + it('should return Vec4(b, b, b, r)', () => expect(v.bbbr).toBeVec(v[2], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.bbbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbbg', () => { + it('should return Vec4(b, b, b, g)', () => expect(v.bbbg).toBeVec(v[2], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.bbbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbbb', () => { + it('should return Vec4(b, b, b, b)', () => expect(v.bbbb).toBeVec(v[2], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.bbbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbba', () => { + it('should return Vec4(b, b, b, a)', () => expect(v.bbba).toBeVec(v[2], v[2], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.bbba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbar', () => { + it('should return Vec4(b, b, a, r)', () => expect(v.bbar).toBeVec(v[2], v[2], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.bbar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbag', () => { + it('should return Vec4(b, b, a, g)', () => expect(v.bbag).toBeVec(v[2], v[2], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.bbag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbab', () => { + it('should return Vec4(b, b, a, b)', () => expect(v.bbab).toBeVec(v[2], v[2], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.bbab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bbaa', () => { + it('should return Vec4(b, b, a, a)', () => expect(v.bbaa).toBeVec(v[2], v[2], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.bbaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().barr', () => { + it('should return Vec4(b, a, r, r)', () => expect(v.barr).toBeVec(v[2], v[3], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.barr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().barg', () => { + it('should return Vec4(b, a, r, g)', () => expect(v.barg).toBeVec(v[2], v[3], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.barg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().barb', () => { + it('should return Vec4(b, a, r, b)', () => expect(v.barb).toBeVec(v[2], v[3], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.barb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bara', () => { + it('should return Vec4(b, a, r, a)', () => expect(v.bara).toBeVec(v[2], v[3], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.bara; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bagr', () => { + it('should return Vec4(b, a, g, r)', () => expect(v.bagr).toBeVec(v[2], v[3], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.bagr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bagg', () => { + it('should return Vec4(b, a, g, g)', () => expect(v.bagg).toBeVec(v[2], v[3], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.bagg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().bagb', () => { + it('should return Vec4(b, a, g, b)', () => expect(v.bagb).toBeVec(v[2], v[3], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.bagb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().baga', () => { + it('should return Vec4(b, a, g, a)', () => expect(v.baga).toBeVec(v[2], v[3], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.baga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().babr', () => { + it('should return Vec4(b, a, b, r)', () => expect(v.babr).toBeVec(v[2], v[3], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.babr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().babg', () => { + it('should return Vec4(b, a, b, g)', () => expect(v.babg).toBeVec(v[2], v[3], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.babg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().babb', () => { + it('should return Vec4(b, a, b, b)', () => expect(v.babb).toBeVec(v[2], v[3], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.babb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().baba', () => { + it('should return Vec4(b, a, b, a)', () => expect(v.baba).toBeVec(v[2], v[3], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.baba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().baar', () => { + it('should return Vec4(b, a, a, r)', () => expect(v.baar).toBeVec(v[2], v[3], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.baar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().baag', () => { + it('should return Vec4(b, a, a, g)', () => expect(v.baag).toBeVec(v[2], v[3], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.baag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().baab', () => { + it('should return Vec4(b, a, a, b)', () => expect(v.baab).toBeVec(v[2], v[3], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.baab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().baaa', () => { + it('should return Vec4(b, a, a, a)', () => expect(v.baaa).toBeVec(v[2], v[3], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.baaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arrr', () => { + it('should return Vec4(a, r, r, r)', () => expect(v.arrr).toBeVec(v[3], v[0], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.arrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arrg', () => { + it('should return Vec4(a, r, r, g)', () => expect(v.arrg).toBeVec(v[3], v[0], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.arrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arrb', () => { + it('should return Vec4(a, r, r, b)', () => expect(v.arrb).toBeVec(v[3], v[0], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.arrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arra', () => { + it('should return Vec4(a, r, r, a)', () => expect(v.arra).toBeVec(v[3], v[0], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.arra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().argr', () => { + it('should return Vec4(a, r, g, r)', () => expect(v.argr).toBeVec(v[3], v[0], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.argr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().argg', () => { + it('should return Vec4(a, r, g, g)', () => expect(v.argg).toBeVec(v[3], v[0], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.argg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().argb', () => { + it('should return Vec4(a, r, g, b)', () => expect(v.argb).toBeVec(v[3], v[0], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.argb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arga', () => { + it('should return Vec4(a, r, g, a)', () => expect(v.arga).toBeVec(v[3], v[0], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.arga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arbr', () => { + it('should return Vec4(a, r, b, r)', () => expect(v.arbr).toBeVec(v[3], v[0], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.arbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arbg', () => { + it('should return Vec4(a, r, b, g)', () => expect(v.arbg).toBeVec(v[3], v[0], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.arbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arbb', () => { + it('should return Vec4(a, r, b, b)', () => expect(v.arbb).toBeVec(v[3], v[0], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.arbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arba', () => { + it('should return Vec4(a, r, b, a)', () => expect(v.arba).toBeVec(v[3], v[0], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.arba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arar', () => { + it('should return Vec4(a, r, a, r)', () => expect(v.arar).toBeVec(v[3], v[0], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.arar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arag', () => { + it('should return Vec4(a, r, a, g)', () => expect(v.arag).toBeVec(v[3], v[0], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.arag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().arab', () => { + it('should return Vec4(a, r, a, b)', () => expect(v.arab).toBeVec(v[3], v[0], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.arab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().araa', () => { + it('should return Vec4(a, r, a, a)', () => expect(v.araa).toBeVec(v[3], v[0], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.araa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agrr', () => { + it('should return Vec4(a, g, r, r)', () => expect(v.agrr).toBeVec(v[3], v[1], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.agrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agrg', () => { + it('should return Vec4(a, g, r, g)', () => expect(v.agrg).toBeVec(v[3], v[1], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.agrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agrb', () => { + it('should return Vec4(a, g, r, b)', () => expect(v.agrb).toBeVec(v[3], v[1], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.agrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agra', () => { + it('should return Vec4(a, g, r, a)', () => expect(v.agra).toBeVec(v[3], v[1], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.agra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aggr', () => { + it('should return Vec4(a, g, g, r)', () => expect(v.aggr).toBeVec(v[3], v[1], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.aggr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aggg', () => { + it('should return Vec4(a, g, g, g)', () => expect(v.aggg).toBeVec(v[3], v[1], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.aggg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aggb', () => { + it('should return Vec4(a, g, g, b)', () => expect(v.aggb).toBeVec(v[3], v[1], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.aggb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agga', () => { + it('should return Vec4(a, g, g, a)', () => expect(v.agga).toBeVec(v[3], v[1], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.agga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agbr', () => { + it('should return Vec4(a, g, b, r)', () => expect(v.agbr).toBeVec(v[3], v[1], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.agbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agbg', () => { + it('should return Vec4(a, g, b, g)', () => expect(v.agbg).toBeVec(v[3], v[1], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.agbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agbb', () => { + it('should return Vec4(a, g, b, b)', () => expect(v.agbb).toBeVec(v[3], v[1], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.agbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agba', () => { + it('should return Vec4(a, g, b, a)', () => expect(v.agba).toBeVec(v[3], v[1], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.agba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agar', () => { + it('should return Vec4(a, g, a, r)', () => expect(v.agar).toBeVec(v[3], v[1], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.agar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agag', () => { + it('should return Vec4(a, g, a, g)', () => expect(v.agag).toBeVec(v[3], v[1], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.agag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agab', () => { + it('should return Vec4(a, g, a, b)', () => expect(v.agab).toBeVec(v[3], v[1], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.agab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().agaa', () => { + it('should return Vec4(a, g, a, a)', () => expect(v.agaa).toBeVec(v[3], v[1], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.agaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abrr', () => { + it('should return Vec4(a, b, r, r)', () => expect(v.abrr).toBeVec(v[3], v[2], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.abrr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abrg', () => { + it('should return Vec4(a, b, r, g)', () => expect(v.abrg).toBeVec(v[3], v[2], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.abrg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abrb', () => { + it('should return Vec4(a, b, r, b)', () => expect(v.abrb).toBeVec(v[3], v[2], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.abrb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abra', () => { + it('should return Vec4(a, b, r, a)', () => expect(v.abra).toBeVec(v[3], v[2], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.abra; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abgr', () => { + it('should return Vec4(a, b, g, r)', () => expect(v.abgr).toBeVec(v[3], v[2], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.abgr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abgg', () => { + it('should return Vec4(a, b, g, g)', () => expect(v.abgg).toBeVec(v[3], v[2], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.abgg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abgb', () => { + it('should return Vec4(a, b, g, b)', () => expect(v.abgb).toBeVec(v[3], v[2], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.abgb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abga', () => { + it('should return Vec4(a, b, g, a)', () => expect(v.abga).toBeVec(v[3], v[2], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.abga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abbr', () => { + it('should return Vec4(a, b, b, r)', () => expect(v.abbr).toBeVec(v[3], v[2], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.abbr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abbg', () => { + it('should return Vec4(a, b, b, g)', () => expect(v.abbg).toBeVec(v[3], v[2], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.abbg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abbb', () => { + it('should return Vec4(a, b, b, b)', () => expect(v.abbb).toBeVec(v[3], v[2], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.abbb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abba', () => { + it('should return Vec4(a, b, b, a)', () => expect(v.abba).toBeVec(v[3], v[2], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.abba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abar', () => { + it('should return Vec4(a, b, a, r)', () => expect(v.abar).toBeVec(v[3], v[2], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.abar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abag', () => { + it('should return Vec4(a, b, a, g)', () => expect(v.abag).toBeVec(v[3], v[2], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.abag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abab', () => { + it('should return Vec4(a, b, a, b)', () => expect(v.abab).toBeVec(v[3], v[2], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.abab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().abaa', () => { + it('should return Vec4(a, b, a, a)', () => expect(v.abaa).toBeVec(v[3], v[2], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.abaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aarr', () => { + it('should return Vec4(a, a, r, r)', () => expect(v.aarr).toBeVec(v[3], v[3], v[0], v[0])); + it('should be return a copy', () => { + const sw = v.aarr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aarg', () => { + it('should return Vec4(a, a, r, g)', () => expect(v.aarg).toBeVec(v[3], v[3], v[0], v[1])); + it('should be return a copy', () => { + const sw = v.aarg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aarb', () => { + it('should return Vec4(a, a, r, b)', () => expect(v.aarb).toBeVec(v[3], v[3], v[0], v[2])); + it('should be return a copy', () => { + const sw = v.aarb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aara', () => { + it('should return Vec4(a, a, r, a)', () => expect(v.aara).toBeVec(v[3], v[3], v[0], v[3])); + it('should be return a copy', () => { + const sw = v.aara; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aagr', () => { + it('should return Vec4(a, a, g, r)', () => expect(v.aagr).toBeVec(v[3], v[3], v[1], v[0])); + it('should be return a copy', () => { + const sw = v.aagr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aagg', () => { + it('should return Vec4(a, a, g, g)', () => expect(v.aagg).toBeVec(v[3], v[3], v[1], v[1])); + it('should be return a copy', () => { + const sw = v.aagg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aagb', () => { + it('should return Vec4(a, a, g, b)', () => expect(v.aagb).toBeVec(v[3], v[3], v[1], v[2])); + it('should be return a copy', () => { + const sw = v.aagb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aaga', () => { + it('should return Vec4(a, a, g, a)', () => expect(v.aaga).toBeVec(v[3], v[3], v[1], v[3])); + it('should be return a copy', () => { + const sw = v.aaga; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aabr', () => { + it('should return Vec4(a, a, b, r)', () => expect(v.aabr).toBeVec(v[3], v[3], v[2], v[0])); + it('should be return a copy', () => { + const sw = v.aabr; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aabg', () => { + it('should return Vec4(a, a, b, g)', () => expect(v.aabg).toBeVec(v[3], v[3], v[2], v[1])); + it('should be return a copy', () => { + const sw = v.aabg; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aabb', () => { + it('should return Vec4(a, a, b, b)', () => expect(v.aabb).toBeVec(v[3], v[3], v[2], v[2])); + it('should be return a copy', () => { + const sw = v.aabb; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aaba', () => { + it('should return Vec4(a, a, b, a)', () => expect(v.aaba).toBeVec(v[3], v[3], v[2], v[3])); + it('should be return a copy', () => { + const sw = v.aaba; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aaar', () => { + it('should return Vec4(a, a, a, r)', () => expect(v.aaar).toBeVec(v[3], v[3], v[3], v[0])); + it('should be return a copy', () => { + const sw = v.aaar; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aaag', () => { + it('should return Vec4(a, a, a, g)', () => expect(v.aaag).toBeVec(v[3], v[3], v[3], v[1])); + it('should be return a copy', () => { + const sw = v.aaag; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aaab', () => { + it('should return Vec4(a, a, a, b)', () => expect(v.aaab).toBeVec(v[3], v[3], v[3], v[2])); + it('should be return a copy', () => { + const sw = v.aaab; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + describe('Vec4().aaaa', () => { + it('should return Vec4(a, a, a, a)', () => expect(v.aaaa).toBeVec(v[3], v[3], v[3], v[3])); + it('should be return a copy', () => { + const sw = v.aaaa; + sw[0] += 1; + expect(v[0]).not.toEqual(sw[0]); + }); + }); + + // [/Swizzle Autogen] +}); diff --git a/tests/f64/Vec4.spec.ts b/tests/f64/Vec4.spec.ts new file mode 100644 index 00000000..11a46e41 --- /dev/null +++ b/tests/f64/Vec4.spec.ts @@ -0,0 +1,702 @@ +import { expect, describe, it, beforeEach } from 'vitest'; + +import { Vec4 } from '#gl-matrix/f64'; + +import type { Vec4Like } from '#gl-matrix/types'; + +describe('Vec4', () => { + describe('constructor', () => { + it('should return Vec4(0, 0, 0, 0) if called with no arguments', () => expect(new Vec4()).toBeVec(0, 0, 0, 0)); + + it('should return Vec4(x, y, z, w) if called with (x, y, z, w)', () => { + expect(new Vec4(1, 2, 3, 4)).toBeVec(1, 2, 3, 4); + expect(new Vec4(-3, 4.4, -5.6, 7.8)).toBeVec(-3, 4.4, -5.6, 7.8); + }); + + it('should return Vec4(x, x, x) if called with (x)', () => { + expect(new Vec4(1)).toBeVec(1, 1, 1, 1); + expect(new Vec4(-2.3)).toBeVec(-2.3, -2.3, -2.3, -2.3); + }); + + it('should return Vec4(x, y, z, w) if called with ([x, y, z, w])', () => { + expect(new Vec4([1, 2, 3, 4])).toBeVec(1, 2, 3, 4); + expect(new Vec4([-3, 4.4, -5.6, 7.8])).toBeVec(-3, 4.4, -5.6, 7.8); + }); + + it('should return Vec4(x, y, z, w) if called with (Vec4(x, y, z, w))', () => { + const v = new Vec4(3.4, 5.6, 7.8, 9); + expect(new Vec4(v)).toBeVec(v); + }); + + it('should return Vec4(x, y, z, w) if called with (Float64Array([x, y, z, w]))', () => { + const arr = new Float64Array([1.2, 3.4, 5.6, 7.8]); + expect(new Vec4(arr)).toBeVec(arr); + }); + }); + + describe('static', () => { + let out: Vec4Like; + let vecA: Vec4Like; + let vecB: Vec4Like; + let result: Vec4Like | number; + + beforeEach(() => { + vecA = new Vec4(1, 2, 3, 4); + vecB = new Vec4(5, 6, 7, 8); + out = new Vec4(0, 0, 0, 0); + }); + + describe('create', () => { + beforeEach(() => { result = Vec4.create(); }); + + it('should return a 4 element array initialized to 0s', () => expect(result).toBeVec(0, 0, 0, 0)); + }); + + describe('clone', () => { + beforeEach(() => { result = Vec4.clone(vecA); }); + + it('should return a 4 element array initialized to the values in vecA', () => expect(result).toBeVec(vecA)); + }); + + describe('fromValues', () => { + beforeEach(() => { result = Vec4.fromValues(1, 2, 3, 4); }); + + it('should return a 4 element array initialized to the values passed', () => expect(result).toBeVec(1, 2, 3, 4)); + }); + + describe('copy', () => { + beforeEach(() => { result = Vec4.copy(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3, 4)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('set', () => { + beforeEach(() => { result = Vec4.set(out, 1, 2, 3, 4); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3, 4)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('add', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.add(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(6, 8, 10, 12)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.add(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(6, 8, 10, 12)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec4.add(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(6, 8, 10, 12)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('subtract', () => { + it('should have an alias called `sub`', () => expect(Vec4.sub).toEqual(Vec4.subtract)); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.subtract(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(-4, -4, -4, -4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.subtract(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(-4, -4, -4, -4)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec4.subtract(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(-4, -4, -4, -4)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('multiply', () => { + it('should have an alias called `mul`', () => expect(Vec4.mul).toEqual(Vec4.multiply)); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.multiply(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(5, 12, 21, 32)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.multiply(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(5, 12, 21, 32)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec4.multiply(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(5, 12, 21, 32)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('divide', () => { + it('should have an alias called `div`', () => expect(Vec4.div).toEqual(Vec4.divide)); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.divide(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(0.2, 0.333333, 0.428571, 0.5)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.divide(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(0.2, 0.333333, 0.428571, 0.5)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec4.divide(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(0.2, 0.333333, 0.428571, 0.5)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('ceil', () => { + beforeEach(() => { vecA = [Math.E, Math.PI, Math.SQRT2, Math.SQRT1_2]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.ceil(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(3, 4, 2, 1)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(Math.E, Math.PI, Math.SQRT2, Math.SQRT1_2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.ceil(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 4, 2, 1)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('floor', () => { + beforeEach(() => { vecA = [Math.E, Math.PI, Math.SQRT2, Math.SQRT1_2]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.floor(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(2, 3, 1, 0)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(Math.E, Math.PI, Math.SQRT2, Math.SQRT1_2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.floor(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(2, 3, 1, 0)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('min', () => { + beforeEach(() => { + vecA = [1, 3, 1, 3]; + vecB = [3, 1, 3, 1]; + }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.min(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(1, 1, 1, 1)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 3, 1, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 1, 3, 1)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.min(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 1, 1, 1)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 1, 3, 1)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec4.min(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(1, 1, 1, 1)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 3, 1, 3)); + }); + }); + + describe('max', () => { + beforeEach(() => { + vecA = [1, 3, 1, 3]; + vecB = [3, 1, 3, 1]; + }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.max(out, vecA, vecB); }); + + it('should place values into out', () => expect(out).toBeVec(3, 3, 3, 3)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 3, 1, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 1, 3, 1)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.max(vecA, vecA, vecB); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 3, 3, 3)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(3, 1, 3, 1)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec4.max(vecB, vecA, vecB); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(3, 3, 3, 3)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 3, 1, 3)); + }); + }); + + describe('round', () => { + beforeEach(() => { vecA = [Math.E, Math.PI, Math.SQRT2, Math.SQRT1_2]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.round(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(3, 3, 1, 1)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(Math.E, Math.PI, Math.SQRT2, Math.SQRT1_2)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.round(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 3, 1, 1)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('scale', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.scale(out, vecA, 2); }); + + it('should place values into out', () => expect(out).toBeVec(2, 4, 6, 8)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.scale(vecA, vecA, 2); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(2, 4, 6, 8)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('scaleAndAdd', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.scaleAndAdd(out, vecA, vecB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(3.5, 5, 6.5, 8)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.scaleAndAdd(vecA, vecA, vecB, 0.5); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3.5, 5, 6.5, 8)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec4.scaleAndAdd(vecB, vecA, vecB, 0.5); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(3.5, 5, 6.5, 8)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + }); + + describe('distance', () => { + beforeEach(() => { result = Vec4.distance(vecA, vecB); }); + + it('should have an alias called `dist`', () => expect(Vec4.dist).toEqual(Vec4.distance)); + it('should return the distance', () => expect(result).toBeCloseTo(8)); + }); + + describe('squaredDistance', () => { + beforeEach(() => { result = Vec4.squaredDistance(vecA, vecB); }); + + it('should have an alias called `sqrDist`', () => expect(Vec4.sqrDist).toEqual(Vec4.squaredDistance)); + it('should return the squared distance', () => expect(result).toEqual(64)); + }); + + describe('length', () => { + beforeEach(() => { result = Vec4.len(vecA); }); + + it('should have an alias called `len`', () => expect(Vec4.len).toEqual(Vec4.length)); + it('should return the length', () => expect(result).toBeCloseTo(5.477225)); + }); + + describe('squaredLength', () => { + beforeEach(() => { result = Vec4.squaredLength(vecA); }); + + it('should have an alias called `sqrLen`', () => expect(Vec4.sqrLen).toEqual(Vec4.squaredLength)); + it('should return the squared length', () => expect(result).toEqual(30)); + }); + + describe('negate', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.negate(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(-1, -2, -3, -4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.negate(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(-1, -2, -3, -4)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('inverse', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.inverse(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 1 / 2, 1 / 3, 1 / 4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.inverse(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 1 / 2, 1 / 3, 1 / 4)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('abs', () => { + beforeEach(() => { vecA = [-1, -2, -3, -4]; }); + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.abs(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 2, 3, 4)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(-1, -2, -3, -4)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.abs(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('normalize', () => { + beforeEach(() => { vecA = [5, 0, 0, 0]; }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.normalize(out, vecA); }); + + it('should place values into out', () => expect(out).toBeVec(1, 0, 0, 0)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(5, 0, 0, 0)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.normalize(vecA, vecA); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(1, 0, 0, 0)); + it('should return vecA', () => expect(result).toBe(vecA)); + }); + }); + + describe('dot', () => { + beforeEach(() => { result = Vec4.dot(vecA, vecB); }); + + it('should return the dot product', () => expect(result).toEqual(70)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('lerp', () => { + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.lerp(out, vecA, vecB, 0.5); }); + + it('should place values into out', () => expect(out).toBeVec(3, 4, 5, 6)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.lerp(vecA, vecA, vecB, 0.5); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(3, 4, 5, 6)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(5, 6, 7, 8)); + }); + + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec4.lerp(vecB, vecA, vecB, 0.5); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(3, 4, 5, 6)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + }); + + /* + describe('random', () => { + describe('with no scale', () => { + beforeEach(() => { result = Vec4.random(out); }); + + it('should result in a unit length vector', () => expect(Vec4.len(out)).toBeCloseTo(1.0)); + it('should return out', () => expect(result).toBe(out)); + }); + + describe('with a scale', () => { + beforeEach(() => { result = Vec4.random(out, 5.0); }); + + it('should result in a unit length vector', () => expect(Vec4.len(out)).toBeCloseTo(5.0)); + it('should return out', () => expect(result).toBe(out)); + }); + });*/ + + describe('cross', () => { + let vecC: Vec4Like; + + beforeEach(() => { + vecA = new Vec4(1, 0, 0, 0); + vecB = new Vec4(0, 1, 0, 0); + vecC = [0, 0, 1, 0]; + }); + + describe('with a separate output vector', () => { + beforeEach(() => { result = Vec4.cross(out, vecA, vecB, vecC); }); + + it('should place values into out', () => expect(out).toBeVec(0, 0, 0, -1)); + it('should return out', () => expect(result).toBe(out)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 0, 0, 0)); + it('should not modify vecB', () => expect(vecB).toBeVec(0, 1, 0, 0)); + it('should not modify vecC', () => expect(vecC).toBeVec(0, 0, 1, 0)); + }); + + describe('when vecA is the output vector', () => { + beforeEach(() => { result = Vec4.cross(vecA, vecA, vecB, vecC); }); + + it('should place values into vecA', () => expect(vecA).toBeVec(0, 0, 0, -1)); + it('should return vecA', () => expect(result).toBe(vecA)); + it('should not modify vecB', () => expect(vecB).toBeVec(0, 1, 0, 0)); + it('should not modify vecC', () => expect(vecC).toBeVec(0, 0, 1, 0)); + }); + describe('when vecB is the output vector', () => { + beforeEach(() => { result = Vec4.cross(vecB, vecA, vecB, vecC); }); + + it('should place values into vecB', () => expect(vecB).toBeVec(0, 0, 0, -1)); + it('should return vecB', () => expect(result).toBe(vecB)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 0, 0, 0)); + it('should not modify vecC', () => expect(vecC).toBeVec(0, 0, 1, 0)); + }); + describe('when vecC is the output vector', () => { + beforeEach(() => { result = Vec4.cross(vecC, vecA, vecB, vecC); }); + + it('should place values into vecC', () => expect(vecC).toBeVec(0, 0, 0, -1)); + it('should return vecC', () => expect(result).toBe(vecC)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 0, 0, 0)); + it('should not modify vecB', () => expect(vecB).toBeVec(0, 1, 0, 0)); + }); + }); + + /* + describe('forEach', () => { + let vecArray; + + beforeEach(() => { + vecArray = [ + 1, 2, 3, 4, + 5, 6, 7, 8, + 0, 0, 0, 0 + ]; + }); + + describe('when performing operations that take no extra arguments', () => { + beforeEach(() => { result = Vec4.forEach(vecArray, 0, 0, 0, Vec4.normalize); }); + + it('should update all values', () => { + expect(vecArray).toBeEqualish([ + 0.182574, 0.365148, 0.547722, 0.730296, + 0.379049, 0.454858, 0.530668, 0.606478, + 0, 0, 0, 0 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + }); + + describe('when performing operations that takes one extra arguments', () => { + beforeEach(() => { result = Vec4.forEach(vecArray, 0, 0, 0, Vec4.add, vecA); }); + + it('should update all values', () => { + expect(vecArray).toBeEqualish([ + 2, 4, 6, 8, + 6, 8, 10, 12, + 1, 2, 3, 4 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + + describe('when specifying an offset', () => { + beforeEach(() => { result = Vec4.forEach(vecArray, 0, 4, 0, Vec4.add, vecA); }); + + it('should update all values except the first vector', () => { + expect(vecArray).toBeEqualish([ + 1, 2, 3, 4, + 6, 8, 10, 12, + 1, 2, 3, 4 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + + describe('when specifying a count', () => { + beforeEach(() => { result = Vec4.forEach(vecArray, 0, 0, 2, Vec4.add, vecA); }); + + it('should update all values except the last vector', () => { + expect(vecArray).toBeEqualish([ + 2, 4, 6, 8, + 6, 8, 10, 12, + 0, 0, 0, 0 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + + describe('when specifying a stride', () => { + beforeEach(() => { result = Vec4.forEach(vecArray, 8, 0, 0, Vec4.add, vecA); }); + + it('should update all values except the second vector', () => { + expect(vecArray).toBeEqualish([ + 2, 4, 6, 8, + 5, 6, 7, 8, + 1, 2, 3, 4 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + it('should not modify vecA', () => expect(vecA).toBeVec(1, 2, 3, 4)); + }); + + describe('when calling a function that does not modify the out variable', () => { + beforeEach(() => { result = vec3.forEach(vecArray, 0, 0, 0, function(out, vec) {}); }); + + it('values should remain unchanged', () => { + expect(vecArray).toBeEqualish([ + 1, 2, 3, 4, + 5, 6, 7, 8, + 0, 0, 0, 0 + ]); + }); + it('should return vecArray', () => expect(result).toBe(vecArray)); + }); + });*/ + + describe('str', () => { + it('should return a string representation of the vector', + () => expect(Vec4.str(vecA)).toEqual('Vec4(1, 2, 3, 4)')); + }); + + describe('exactEquals', () => { + let vecC: Vec4Like, r0: boolean, r1: boolean; + + beforeEach(() => { + vecA = [0, 1, 2, 3]; + vecB = [0, 1, 2, 3]; + vecC = [1, 2, 3, 4]; + r0 = Vec4.exactEquals(vecA, vecB); + r1 = Vec4.exactEquals(vecA, vecC); + }); + + it('should return true for identical vectors', () => expect(r0).toBe(true)); + it('should return false for different vectors', () => expect(r1).toBe(false)); + it('should not modify vecA', () => expect(vecA).toBeVec(0, 1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(0, 1, 2, 3)); + }); + + describe('equals', () => { + let vecC: Vec4Like, vecD: Vec4Like, r0: boolean, r1: boolean, r2: boolean; + + beforeEach(() => { + vecA = [0, 1, 2, 3]; + vecB = [0, 1, 2, 3]; + vecC = [1, 2, 3, 4]; + vecD = [1e-16, 1, 2, 3]; + r0 = Vec4.equals(vecA, vecB); + r1 = Vec4.equals(vecA, vecC); + r2 = Vec4.equals(vecA, vecD); + }); + + it('should return true for identical vectors', () => expect(r0).toBe(true)); + it('should return false for different vectors', () => expect(r1).toBe(false)); + it('should return true for close but not identical vectors', () => expect(r2).toBe(true)); + it('should not modify vecA', () => expect(vecA).toBeVec(0, 1, 2, 3)); + it('should not modify vecB', () => expect(vecB).toBeVec(0, 1, 2, 3)); + }); + + describe('zero', () => { + beforeEach(() => { + vecA = [1, 2, 3, 4]; + result = Vec4.zero(vecA); + }); + + it('should result in a 4 element vector with zeros', () => expect(result).toBeVec(0, 0, 0, 0)); + }); + }); +}); diff --git a/tests/f64/util.spec.ts b/tests/f64/util.spec.ts new file mode 100644 index 00000000..30043e51 --- /dev/null +++ b/tests/f64/util.spec.ts @@ -0,0 +1,19 @@ +import { expect, describe, it } from 'vitest'; + +import { toDegree, toRadian } from '#gl-matrix/util'; + +describe('Common', () => { + describe('toRadian', () => { + it('should return a value of 0 when passed 0', () => expect(toRadian(0)).toBeCloseTo(0)); + it('should return a value of Math.PI/2 when passed 90', () => expect(toRadian(90)).toBeCloseTo(Math.PI / 2)); + it('should return a value of Math.PI when passed 180', () => expect(toRadian(180)).toBeCloseTo(Math.PI)); + it('should return a value of Math.PI*2 when passed 360', () => expect(toRadian(360)).toBeCloseTo(Math.PI * 2)); + }); + + describe('toDegree', () => { + it('should return a value of 0 when passed 0', () => expect(toDegree(0)).toBeCloseTo(0)); + it('should return a value of 90 when passed Math.PI/2', () => expect(toDegree(Math.PI / 2)).toBeCloseTo(90)); + it('should return a value of 180 when passed Math.PI', () => expect(toDegree(Math.PI)).toBeCloseTo(180)); + it('should return a value of 360 when passed Math.PI*2', () => expect(toDegree(Math.PI * 2)).toBeCloseTo(360)); + }); +}); diff --git a/tests/mat2.spec.ts b/tests/mat2.spec.ts deleted file mode 100644 index 56ac1ee0..00000000 --- a/tests/mat2.spec.ts +++ /dev/null @@ -1,386 +0,0 @@ -import { expect, describe, it, beforeEach } from 'vitest'; -import "./test-utils" -import { Mat2 } from "../src/mat2" - -describe("Mat2", function() { - describe("constructor", () => { - it("should return an identity Mat2 if called with no arguments", () => { - expect(new Mat2()).toBeVec( - 1, 0, - 0, 1) - }); - - it("should return Mat2(m0, m1, ...m8) if called with (m0, m1, ...m8)", () => { - expect(new Mat2( - 1, 2, - 3, 4)).toBeVec( - 1, 2, - 3, 4); - }); - - it("should return Mat2(x, x, x, ...) if called with (x)", () => { - expect(new Mat2(1)).toBeVec( - 1, 1, - 1, 1); - }); - - it("should return Mat2(m0, m1, ...m8) if called with ([m0, m1, ...m8])", () => { - expect(new Mat2([ - 1, 2, - 3, 4])).toBeVec( - 1, 2, - 3, 4); - }); - - it("should return Mat2(m0, m1, ...m8) if called with (Mat4(m0, m1, ...m9))", () => { - let v = new Mat2( - 1, 2, - 3, 4); - expect(new Mat2(v)).toBeVec(v); - }); - - it("should return Mat2(m0, m1, ...m8) if called with (Float32Array([m0, m1, ...m8]))", () => { - let arr = new Float32Array([ - 1, 2, - 3, 4]); - expect(new Mat2(arr)).toBeVec(arr); - }); - }); - - describe("static", () => { - let out, matA, matB, identity, result; - - beforeEach(function() { - matA = new Float32Array([1, 2, - 3, 4]); - - matB = new Float32Array([5, 6, - 7, 8]); - - out = new Float32Array([0, 0, - 0, 0]); - - identity = new Float32Array([1, 0, - 0, 1]); - }); - - describe("create", function() { - beforeEach(function() { result = Mat2.create(); }); - it("should return a 4 element array initialized to a 2x2 identity matrix", function() { expect(result).toBeVec(identity); }); - }); - - describe("clone", function() { - beforeEach(function() { result = Mat2.clone(matA); }); - it("should return a 4 element array initialized to the values in matA", function() { expect(result).toBeVec(matA); }); - }); - - describe("copy", function() { - beforeEach(function() { result = Mat2.copy(out, matA); }); - it("should place values into out", function() { expect(out).toBeVec(matA); }); - it("should return out", function() { expect(result).toBe(out); }); - }); - - describe("identity", function() { - beforeEach(function() { result = Mat2.identity(out); }); - it("should place values into out", function() { expect(result).toBeVec(identity); }); - it("should return out", function() { expect(result).toBe(out); }); - }); - - describe("transpose", function() { - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat2.transpose(out, matA); }); - - it("should place values into out", function() { expect(out).toBeVec(1, 3, 2, 4); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat2.transpose(matA, matA); }); - - it("should place values into matA", function() { expect(matA).toBeVec(1, 3, 2, 4); }); - it("should return matA", function() { expect(result).toBe(matA); }); - }); - }); - - describe("invert", function() { - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat2.invert(out, matA); }); - - it("should place values into out", function() { expect(out).toBeVec(-2, 1, 1.5, -0.5); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat2.invert(matA, matA); }); - - it("should place values into matA", function() { expect(matA).toBeVec(-2, 1, 1.5, -0.5); }); - it("should return matA", function() { expect(result).toBe(matA); }); - }); - }); - - describe("adjoint", function() { - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat2.adjoint(out, matA); }); - - it("should place values into out", function() { expect(out).toBeVec(4, -2, -3, 1); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat2.adjoint(matA, matA); }); - - it("should place values into matA", function() { expect(matA).toBeVec(4, -2, -3, 1); }); - it("should return matA", function() { expect(result).toBe(matA); }); - }); - }); - - describe("determinant", function() { - beforeEach(function() { result = Mat2.determinant(matA); }); - - it("should return the determinant", function() { expect(result).toEqual(-2); }); - }); - - describe("multiply", function() { - it("should have an alias called 'mul'", function() { expect(Mat2.mul).toEqual(Mat2.multiply); }); - - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat2.multiply(out, matA, matB); }); - - it("should place values into out", function() { expect(out).toBeVec(23, 34, 31, 46); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4); }); - it("should not modify matB", function() { expect(matB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat2.multiply(matA, matA, matB); }); - - it("should place values into matA", function() { expect(matA).toBeVec(23, 34, 31, 46); }); - it("should return matA", function() { expect(result).toBe(matA); }); - it("should not modify matB", function() { expect(matB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when matB is the output matrix", function() { - beforeEach(function() { result = Mat2.multiply(matB, matA, matB); }); - - it("should place values into matB", function() { expect(matB).toBeVec(23, 34, 31, 46); }); - it("should return matB", function() { expect(result).toBe(matB); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4); }); - }); - }); - - describe("rotate", function() { - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat2.rotate(out, matA, Math.PI * 0.5); }); - - it("should place values into out", function() { expect(out).toBeVec(3, 4, -1, -2); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat2.rotate(matA, matA, Math.PI * 0.5); }); - - it("should place values into matA", function() { expect(matA).toBeVec(3, 4, -1, -2); }); - it("should return matA", function() { expect(result).toBe(matA); }); - }); - }); - - describe("scale", function() { - let vecA; - beforeEach(function() { vecA = [2, 3]; }); - - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat2.scale(out, matA, vecA); }); - - it("should place values into out", function() { expect(out).toBeVec(2, 4, 9, 12); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat2.scale(matA, matA, vecA); }); - - it("should place values into matA", function() { expect(matA).toBeVec(2, 4, 9, 12); }); - it("should return matA", function() { expect(result).toBe(matA); }); - }); - }); - - describe("str", function() { - beforeEach(function() { result = Mat2.str(matA); }); - - it("should return a string representation of the matrix", function() { expect(result).toEqual("Mat2(1, 2, 3, 4)"); }); - }); - - describe("frob", function() { - beforeEach(function() { result = Mat2.frob(matA); }); - it("should return the Frobenius Norm of the matrix", function() { expect(result).toEqual( Math.sqrt(Math.pow(1, 2) + Math.pow(2, 2) + Math.pow(3, 2) + Math.pow(4, 2))); }); - }); - - describe("LDU", function() { - let L, D, U, L_result, D_result, U_result; - beforeEach(function() { - L = Mat2.create(); - D = Mat2.create(); - U = Mat2.create(); - result = Mat2.LDU(L, D, U, [4,3,6,3]); - L_result = Mat2.create(); L_result[2] = 1.5; - D_result = Mat2.create(); - U_result = Mat2.create(); - U_result[0] = 4; U_result[1] = 3; U_result[3] = -1.5; - }); - it("should return a lower triangular, a diagonal and an upper triangular matrix", function() { - expect(result[0]).toBeVec(L_result); - expect(result[1]).toBeVec(D_result); - expect(result[2]).toBeVec(U_result); - }); - }); - - describe("add", function() { - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat2.add(out, matA, matB); }); - - it("should place values into out", function() { expect(out).toBeVec(6, 8, 10, 12); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4); }); - it("should not modify matB", function() { expect(matB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat2.add(matA, matA, matB); }); - - it("should place values into matA", function() { expect(matA).toBeVec(6, 8, 10, 12); }); - it("should return matA", function() { expect(result).toBe(matA); }); - it("should not modify matB", function() { expect(matB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when matB is the output matrix", function() { - beforeEach(function() { result = Mat2.add(matB, matA, matB); }); - - it("should place values into matB", function() { expect(matB).toBeVec(6, 8, 10, 12); }); - it("should return matB", function() { expect(result).toBe(matB); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4); }); - }); - }); - - describe("subtract", function() { - it("should have an alias called 'sub'", function() { expect(Mat2.sub).toEqual(Mat2.subtract); }); - - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat2.subtract(out, matA, matB); }); - - it("should place values into out", function() { expect(out).toBeVec(-4, -4, -4, -4); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4); }); - it("should not modify matB", function() { expect(matB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat2.subtract(matA, matA, matB); }); - - it("should place values into matA", function() { expect(matA).toBeVec(-4, -4, -4, -4); }); - it("should return matA", function() { expect(result).toBe(matA); }); - it("should not modify matB", function() { expect(matB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when matB is the output matrix", function() { - beforeEach(function() { result = Mat2.subtract(matB, matA, matB); }); - - it("should place values into matB", function() { expect(matB).toBeVec(-4, -4, -4, -4); }); - it("should return matB", function() { expect(result).toBe(matB); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4); }); - }); - }); - - describe("fromValues", function() { - beforeEach(function() { result = Mat2.fromValues(1, 2, 3, 4); }); - it("should return a 4 element array initialized to the values passed", function() { expect(result).toBeVec(1, 2, 3, 4); }); - }); - - describe("set", function() { - beforeEach(function() { result = Mat2.set(out, 1, 2, 3, 4); }); - it("should place values into out", function() { expect(out).toBeVec(1, 2, 3, 4); }); - it("should return out", function() { expect(result).toBe(out); }); - }); - - describe("multiplyScalar", function() { - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat2.multiplyScalar(out, matA, 2); }); - - it("should place values into out", function() { expect(out).toBeVec(2, 4, 6, 8); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat2.multiplyScalar(matA, matA, 2); }); - - it("should place values into matA", function() { expect(matA).toBeVec(2, 4, 6, 8); }); - it("should return matA", function() { expect(result).toBe(matA); }); - }); - }); - - describe("multiplyScalarAndAdd", function() { - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat2.multiplyScalarAndAdd(out, matA, matB, 0.5); }); - - it("should place values into out", function() { expect(out).toBeVec(3.5, 5, 6.5, 8); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4); }); - it("should not modify matB", function() { expect(matB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat2.multiplyScalarAndAdd(matA, matA, matB, 0.5); }); - - it("should place values into matA", function() { expect(matA).toBeVec(3.5, 5, 6.5, 8); }); - it("should return matA", function() { expect(result).toBe(matA); }); - it("should not modify matB", function() { expect(matB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when matB is the output matrix", function() { - beforeEach(function() { result = Mat2.multiplyScalarAndAdd(matB, matA, matB, 0.5); }); - - it("should place values into matB", function() { expect(matB).toBeVec(3.5, 5, 6.5, 8); }); - it("should return matB", function() { expect(result).toBe(matB); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4); }); - }); - }); - - describe("exactEquals", function() { - let matC, r0, r1, r2; - beforeEach(function() { - matA = [0, 1, 2, 3]; - matB = [0, 1, 2, 3]; - matC = [1, 2, 3, 4]; - r0 = Mat2.exactEquals(matA, matB); - r1 = Mat2.exactEquals(matA, matC); - }); - it("should return true for identical matrices", function() { expect(r0).toBe(true); }); - it("should return false for different matrices", function() { expect(r1).toBe(false); }); - it("should not modify matA", function() { expect(matA).toBeVec(0, 1, 2, 3); }); - it("should not modify matB", function() { expect(matB).toBeVec(0, 1, 2, 3); }); - }); - - describe("equals", function() { - let matC, matD, r0, r1, r2; - beforeEach(function() { - matA = [0, 1, 2, 3]; - matB = [0, 1, 2, 3]; - matC = [1, 2, 3, 4]; - matD = [1e-16, 1, 2, 3]; - r0 = Mat2.equals(matA, matB); - r1 = Mat2.equals(matA, matC); - r2 = Mat2.equals(matA, matD); - }); - it("should return true for identical matrices", function() { expect(r0).toBe(true); }); - it("should return false for different matrices", function() { expect(r1).toBe(false); }); - it("should return true for close but not identical matrices", function() { expect(r2).toBe(true); }); - it("should not modify matA", function() { expect(matA).toBeVec(0, 1, 2, 3); }); - it("should not modify matB", function() { expect(matB).toBeVec(0, 1, 2, 3); }); - }); - }); -}); \ No newline at end of file diff --git a/tests/mat2d.spec.ts b/tests/mat2d.spec.ts deleted file mode 100644 index 781cf0a9..00000000 --- a/tests/mat2d.spec.ts +++ /dev/null @@ -1,374 +0,0 @@ -import { expect, describe, it, beforeEach } from 'vitest'; -import "./test-utils" -import { Mat2d } from "../src/Mat2d" - -describe("Mat2d", function() { - describe("constructor", () => { - it("should return an identity Mat2d if called with no arguments", () => { - expect(new Mat2d()).toBeVec( - 1, 0, - 0, 1, - 0, 0) - }); - - it("should return Mat2d(m0, m1, ...m5) if called with (m0, m1, ...m5)", () => { - expect(new Mat2d( - 1, 2, - 3, 4, - 5, 6)).toBeVec( - 1, 2, - 3, 4, - 5, 6); - }); - - it("should return Mat2d(x, x, x, ...) if called with (x)", () => { - expect(new Mat2d(1)).toBeVec( - 1, 1, - 1, 1, - 1, 1); - }); - - it("should return Mat2d(m0, m1, ...m8) if called with ([m0, m1, ...m8])", () => { - expect(new Mat2d([ - 1, 2, - 3, 4, - 5, 6])).toBeVec( - 1, 2, - 3, 4, - 5, 6); - }); - - it("should return Mat2d(m0, m1, ...m8) if called with (Mat2d(m0, m1, ...m9))", () => { - let v = new Mat2d( - 1, 2, - 3, 4, - 5, 6); - expect(new Mat2d(v)).toBeVec(v); - }); - - it("should return Mat2d(m0, m1, ...m8) if called with (Float32Array([m0, m1, ...m8]))", () => { - let arr = new Float32Array([ - 1, 2, - 3, 4, - 5, 6]); - expect(new Mat2d(arr)).toBeVec(arr); - }); - }); - - describe("static", () => { - let out, matA, matB, oldA, oldB, identity, result; - - beforeEach(function() { - matA = new Float32Array([1, 2, - 3, 4, - 5, 6]); - - oldA = new Float32Array([1, 2, - 3, 4, - 5, 6]); - - matB = new Float32Array([7, 8, - 9, 10, - 11, 12]); - - oldB = new Float32Array([7, 8, - 9, 10, - 11, 12]); - - out = new Float32Array([0, 0, - 0, 0, - 0, 0]); - - identity = new Float32Array([1, 0, - 0, 1, - 0, 0]); - }); - - describe("create", function() { - beforeEach(function() { result = Mat2d.create(); }); - it("should return a 6 element array initialized to a 2x3 identity matrix", function() { expect(result).toBeVec(identity); }); - }); - - describe("clone", function() { - beforeEach(function() { result = Mat2d.clone(matA); }); - it("should return a 6 element array initialized to the values in matA", function() { expect(result).toBeVec(matA); }); - }); - - describe("copy", function() { - beforeEach(function() { result = Mat2d.copy(out, matA); }); - it("should place values into out", function() { expect(out).toBeVec(matA); }); - it("should return out", function() { expect(result).toBe(out); }); - }); - - describe("identity", function() { - beforeEach(function() { result = Mat2d.identity(out); }); - it("should place values into out", function() { expect(result).toBeVec(identity); }); - it("should return out", function() { expect(result).toBe(out); }); - }); - - describe("invert", function() { - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat2d.invert(out, matA); }); - - it("should place values into out", function() { expect(out).toBeVec( -2, 1, 1.5, -0.5, 1, -2 ); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(oldA); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat2d.invert(matA, matA); }); - - it("should place values into matA", function() { expect(matA).toBeVec( -2, 1, 1.5, -0.5, 1, -2 ); }); - it("should return matA", function() { expect(result).toBe(matA); }); - }); - }); - - describe("determinant", function() { - beforeEach(function() { result = Mat2d.determinant(matA); }); - - it("should return the determinant", function() { expect(result).toEqual(-2); }); - }); - - describe("multiply", function() { - it("should have an alias called 'mul'", function() { expect(Mat2d.mul).toEqual(Mat2d.multiply); }); - - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat2d.multiply(out, matA, matB); }); - - it("should place values into out", function() { expect(out).toBeVec(31, 46, 39, 58, 52, 76); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(oldA); }); - it("should not modify matB", function() { expect(matB).toBeVec(oldB); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat2d.multiply(matA, matA, matB); }); - - it("should place values into matA", function() { expect(matA).toBeVec(31, 46, 39, 58, 52, 76); }); - it("should return matA", function() { expect(result).toBe(matA); }); - it("should not modify matB", function() { expect(matB).toBeVec(oldB); }); - }); - - describe("when matB is the output matrix", function() { - beforeEach(function() { result = Mat2d.multiply(matB, matA, matB); }); - - it("should place values into matB", function() { expect(matB).toBeVec(31, 46, 39, 58, 52, 76); }); - it("should return matB", function() { expect(result).toBe(matB); }); - it("should not modify matA", function() { expect(matA).toBeVec(oldA); }); - }); - }); - - describe("rotate", function() { - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat2d.rotate(out, matA, Math.PI * 0.5); }); - - it("should place values into out", function() { expect(out).toBeVec(3, 4, -1, -2, 5, 6); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(oldA); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat2d.rotate(matA, matA, Math.PI * 0.5); }); - - it("should place values into matA", function() { expect(matA).toBeVec(3, 4, -1, -2, 5, 6); }); - it("should return matA", function() { expect(result).toBe(matA); }); - }); - }); - - describe("scale", function() { - let vecA; - beforeEach(function() { vecA = [2, 3]; }); - - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat2d.scale(out, matA, vecA); }); - - it("should place values into out", function() { expect(out).toBeVec(2, 4, 9, 12, 5, 6); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(oldA); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat2d.scale(matA, matA, vecA); }); - - it("should place values into matA", function() { expect(matA).toBeVec(2, 4, 9, 12, 5, 6); }); - it("should return matA", function() { expect(result).toBe(matA); }); - }); - }); - - describe("translate", function() { - let vecA; - beforeEach(function() { vecA = [2, 3]; }); - - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat2d.translate(out, matA, vecA); }); - - it("should place values into out", function() { expect(out).toBeVec(1, 2, 3, 4, 16, 22); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(oldA); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat2d.translate(matA, matA, vecA); }); - - it("should place values into matA", function() { expect(matA).toBeVec(1, 2, 3, 4, 16, 22); }); - it("should return matA", function() { expect(result).toBe(matA); }); - }); - }); - - describe("str", function() { - beforeEach(function() { result = Mat2d.str(matA); }); - - it("should return a string representation of the matrix", function() { expect(result).toEqual("Mat2d(1, 2, 3, 4, 5, 6)"); }); - }); - - describe("frob", function() { - beforeEach(function() { result = Mat2d.frob(matA); }); - it("should return the Frobenius Norm of the matrix", function() { expect(result).toEqual( Math.sqrt(Math.pow(1, 2) + Math.pow(2, 2) + Math.pow(3, 2) + Math.pow(4, 2) + Math.pow(5, 2) + Math.pow(6, 2) + 1)); }); - }); - - describe("add", function() { - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat2d.add(out, matA, matB); }); - - it("should place values into out", function() { expect(out).toBeVec(8, 10, 12, 14, 16, 18); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(oldA); }); - it("should not modify matB", function() { expect(matB).toBeVec(oldB); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat2d.add(matA, matA, matB); }); - - it("should place values into matA", function() { expect(matA).toBeVec(8, 10, 12, 14, 16, 18); }); - it("should return matA", function() { expect(result).toBe(matA); }); - it("should not modify matB", function() { expect(matB).toBeVec(oldB); }); - }); - - describe("when matB is the output matrix", function() { - beforeEach(function() { result = Mat2d.add(matB, matA, matB); }); - - it("should place values into matB", function() { expect(matB).toBeVec(8, 10, 12, 14, 16, 18); }); - it("should return matB", function() { expect(result).toBe(matB); }); - it("should not modify matA", function() { expect(matA).toBeVec(oldA); }); - }); - }); - - describe("subtract", function() { - it("should have an alias called 'sub'", function() { expect(Mat2d.sub).toEqual(Mat2d.subtract); }); - - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat2d.subtract(out, matA, matB); }); - - it("should place values into out", function() { expect(out).toBeVec(-6, -6, -6, -6, -6, -6); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(oldA); }); - it("should not modify matB", function() { expect(matB).toBeVec(oldB); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat2d.subtract(matA, matA, matB); }); - - it("should place values into matA", function() { expect(matA).toBeVec(-6, -6, -6, -6, -6, -6); }); - it("should return matA", function() { expect(result).toBe(matA); }); - it("should not modify matB", function() { expect(matB).toBeVec(oldB); }); - }); - - describe("when matB is the output matrix", function() { - beforeEach(function() { result = Mat2d.subtract(matB, matA, matB); }); - - it("should place values into matB", function() { expect(matB).toBeVec(-6, -6, -6, -6, -6, -6); }); - it("should return matB", function() { expect(result).toBe(matB); }); - it("should not modify matA", function() { expect(matA).toBeVec(oldA); }); - }); - }); - - describe("fromValues", function() { - beforeEach(function() { result = Mat2d.fromValues(1, 2, 3, 4, 5, 6); }); - it("should return a 6 element array initialized to the values passed", function() { expect(result).toBeVec(1, 2, 3, 4, 5, 6); }); - }); - - describe("set", function() { - beforeEach(function() { result = Mat2d.set(out, 1, 2, 3, 4, 5, 6); }); - it("should place values into out", function() { expect(out).toBeVec(1, 2, 3, 4, 5, 6); }); - it("should return out", function() { expect(result).toBe(out); }); - }); - - describe("multiplyScalar", function() { - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat2d.multiplyScalar(out, matA, 2); }); - - it("should place values into out", function() { expect(out).toBeVec(2, 4, 6, 8, 10, 12); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4, 5, 6); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat2d.multiplyScalar(matA, matA, 2); }); - - it("should place values into matA", function() { expect(matA).toBeVec(2, 4, 6, 8, 10, 12); }); - it("should return matA", function() { expect(result).toBe(matA); }); - }); - }); - - describe("multiplyScalarAndAdd", function() { - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat2d.multiplyScalarAndAdd(out, matA, matB, 0.5); }); - - it("should place values into out", function() { expect(out).toBeVec(4.5, 6, 7.5, 9, 10.5, 12); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4, 5, 6); }); - it("should not modify matB", function() { expect(matB).toBeVec(7, 8, 9, 10, 11, 12); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat2d.multiplyScalarAndAdd(matA, matA, matB, 0.5); }); - - it("should place values into matA", function() { expect(matA).toBeVec(4.5, 6, 7.5, 9, 10.5, 12); }); - it("should return matA", function() { expect(result).toBe(matA); }); - it("should not modify matB", function() { expect(matB).toBeVec(7, 8, 9, 10, 11, 12); }); - }); - - describe("when matB is the output matrix", function() { - beforeEach(function() { result = Mat2d.multiplyScalarAndAdd(matB, matA, matB, 0.5); }); - - it("should place values into matB", function() { expect(matB).toBeVec(4.5, 6, 7.5, 9, 10.5, 12); }); - it("should return matB", function() { expect(result).toBe(matB); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4, 5, 6); }); - }); - }); - - describe("exactEquals", function() { - let matC, r0, r1; - beforeEach(function() { - matA = [0, 1, 2, 3, 4, 5]; - matB = [0, 1, 2, 3, 4, 5]; - matC = [1, 2, 3, 4, 5, 6]; - r0 = Mat2d.exactEquals(matA, matB); - r1 = Mat2d.exactEquals(matA, matC); - }); - - it("should return true for identical matrices", function() { expect(r0).toBe(true); }); - it("should return false for different matrices", function() { expect(r1).toBe(false); }); - it("should not modify matA", function() { expect(matA).toBeVec(0, 1, 2, 3, 4, 5); }); - it("should not modify matB", function() { expect(matB).toBeVec(0, 1, 2, 3, 4, 5); }); - }); - - describe("equals", function() { - let matC, matD, r0, r1, r2; - beforeEach(function() { - matA = [0, 1, 2, 3, 4, 5]; - matB = [0, 1, 2, 3, 4, 5]; - matC = [1, 2, 3, 4, 5, 6]; - matD = [1e-16, 1, 2, 3, 4, 5]; - r0 = Mat2d.equals(matA, matB); - r1 = Mat2d.equals(matA, matC); - r2 = Mat2d.equals(matA, matD); - }); - it("should return true for identical matrices", function() { expect(r0).toBe(true); }); - it("should return false for different matrices", function() { expect(r1).toBe(false); }); - it("should return true for close but not identical matrices", function() { expect(r2).toBe(true); }); - it("should not modify matA", function() { expect(matA).toBeVec(0, 1, 2, 3, 4, 5); }); - it("should not modify matB", function() { expect(matB).toBeVec(0, 1, 2, 3, 4, 5); }); - }); - }); -}); \ No newline at end of file diff --git a/tests/mat3.spec.ts b/tests/mat3.spec.ts deleted file mode 100644 index f876e72f..00000000 --- a/tests/mat3.spec.ts +++ /dev/null @@ -1,560 +0,0 @@ -import { expect, describe, it, beforeEach } from 'vitest'; -import "./test-utils" -import { Mat3 } from "../src/mat3" -import { Mat4 } from "../src/mat4" -import { Vec3 } from "../src/vec3" - -describe("Mat3", function() { - describe("constructor", () => { - it("should return an identity Mat3 if called with no arguments", () => { - expect(new Mat3()).toBeVec( - 1, 0, 0, - 0, 1, 0, - 0, 0, 1) - }); - - it("should return Mat3(m0, m1, ...m8) if called with (m0, m1, ...m8)", () => { - expect(new Mat3( - 1, 2, 3, - 4, 5, 6, - 7, 8, 9)).toBeVec( - 1, 2, 3, - 4, 5, 6, - 7, 8, 9); - }); - - it("should return Mat3(x, x, x, ...) if called with (x)", () => { - expect(new Mat3(1)).toBeVec( - 1, 1, 1, - 1, 1, 1, - 1, 1, 1); - }); - - it("should return Mat3(m0, m1, ...m8) if called with ([m0, m1, ...m8])", () => { - expect(new Mat3([ - 1, 2, 3, - 4, 5, 6, - 7, 8, 9])).toBeVec( - 1, 2, 3, - 4, 5, 6, - 7, 8, 9); - }); - - it("should return Mat3(m0, m1, ...m8) if called with (Mat3(m0, m1, ...m9))", () => { - let v = new Mat3( - 1, 2, 3, - 4, 5, 6, - 7, 8, 9); - expect(new Mat3(v)).toBeVec(v); - }); - - it("should return Mat3(m0, m1, ...m8) if called with (Float32Array([m0, m1, ...m8]))", () => { - let arr = new Float32Array([ - 1, 2, 3, - 4, 5, 6, - 7, 8, 9]); - expect(new Mat3(arr)).toBeVec(arr); - }); - }); - - describe("static", () => { - let out, matA, matB, identity, result; - - beforeEach(function() { - matA = new Float32Array([1, 0, 0, - 0, 1, 0, - 1, 2, 1]); - - matB = new Float32Array([1, 0, 0, - 0, 1, 0, - 3, 4, 1]); - - out = new Float32Array([0, 0, 0, - 0, 0, 0, - 0, 0, 0]); - - identity = new Float32Array([1, 0, 0, - 0, 1, 0, - 0, 0, 1]); - }); - - describe("normalFromMat4", function() { - beforeEach(function() { - matA = new Float32Array([1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1]); - result = Mat3.normalFromMat4(out, matA); - }); - - it("should return out", function() { expect(result).toBe(out); }); - - describe("with translation and rotation", function() { - beforeEach(function() { - Mat4.translate(matA, matA, [2, 4, 6]); - Mat4.rotateX(matA, matA, Math.PI / 2); - - result = Mat3.normalFromMat4(out, matA); - }); - - it("should give rotated matrix", function() { - expect(result).toBeVec(1, 0, 0, - 0, 0, 1, - 0,-1, 0); - }); - - describe("and scale", function() { - beforeEach(function() { - Mat4.scale(matA, matA, [2, 3, 4]); - - result = Mat3.normalFromMat4(out, matA); - }); - - it("should give rotated matrix", function() { - expect(result).toBeVec(0.5, 0, 0, - 0, 0, 0.333333, - 0, -0.25, 0); - }); - }); - }); - }); - - describe("fromQuat", function() { - let q; - - beforeEach(function() { - q = [ 0, -0.7071067811865475, 0, 0.7071067811865475 ]; - result = Mat3.fromQuat(out, q); - }); - - it("should return out", function() { expect(result).toBe(out); }); - - it("should rotate a vector the same as the original quat", function() { - let vecOut = new Vec3(); - Vec3.transformQuat(vecOut, [0,0,-1], q); - expect(Vec3.transformMat3([0, 0, 0], [0,0,-1], out)).toBeVec(vecOut); - }); - - it("should rotate a vector by PI/2 radians", function() { - expect(Vec3.transformMat3([0, 0, 0], [0,0,-1], out)).toBeVec(1,0,0); - }); - }); - - describe("fromMat4", function() { - beforeEach(function() { - result = Mat3.fromMat4(out, [ 1, 2, 3, 4, - 5, 6, 7, 8, - 9,10,11,12, - 13,14,15,16]); }); - - it("should return out", function() { expect(result).toBe(out); }); - - it("should calculate proper Mat3", function() { - expect(out).toBeVec( 1, 2, 3, - 5, 6, 7, - 9,10,11); - }); - }); - - describe("scale", function() { - beforeEach(function() { result = Mat3.scale(out, matA, [2,2]); }); - it("should return out", function() { expect(result).toBe(out); }); - it('should place proper values in out', function() { - expect(out).toBeVec( 2, 0, 0, - 0, 2, 0, - 1, 2, 1 ); - }); - }); - - describe("create", function() { - beforeEach(function() { result = Mat3.create(); }); - it("should return a 9 element array initialized to a 3x3 identity matrix", function() { expect(result).toBeVec(identity); }); - }); - - describe("clone", function() { - beforeEach(function() { result = Mat3.clone(matA); }); - it("should return a 9 element array initialized to the values in matA", function() { expect(result).toBeVec(matA); }); - }); - - describe("copy", function() { - beforeEach(function() { result = Mat3.copy(out, matA); }); - it("should place values into out", function() { expect(out).toBeVec(matA); }); - it("should return out", function() { expect(result).toBe(out); }); - }); - - describe("identity", function() { - beforeEach(function() { result = Mat3.identity(out); }); - it("should place values into out", function() { expect(result).toBeVec(identity); }); - it("should return out", function() { expect(result).toBe(out); }); - }); - - describe("transpose", function() { - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat3.transpose(out, matA); }); - - it("should place values into out", function() { - expect(out).toBeVec( - 1, 0, 1, - 0, 1, 2, - 0, 0, 1 - ); - }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { - expect(matA).toBeVec( - 1, 0, 0, - 0, 1, 0, - 1, 2, 1 - ); - }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat3.transpose(matA, matA); }); - - it("should place values into matA", function() { - expect(matA).toBeVec( - 1, 0, 1, - 0, 1, 2, - 0, 0, 1 - ); - }); - it("should return matA", function() { expect(result).toBe(matA); }); - }); - }); - - describe("invert", function() { - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat3.invert(out, matA); }); - - it("should place values into out", function() { - expect(out).toBeVec( - 1, 0, 0, - 0, 1, 0, - -1, -2, 1 - ); - }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { - expect(matA).toBeVec( - 1, 0, 0, - 0, 1, 0, - 1, 2, 1 - ); - }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat3.invert(matA, matA); }); - - it("should place values into matA", function() { - expect(matA).toBeVec( - 1, 0, 0, - 0, 1, 0, - -1, -2, 1 - ); - }); - it("should return matA", function() { expect(result).toBe(matA); }); - }); - }); - - describe("adjoint", function() { - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat3.adjoint(out, matA); }); - - it("should place values into out", function() { - expect(out).toBeVec( - 1, 0, 0, - 0, 1, 0, - -1, -2, 1 - ); - }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { - expect(matA).toBeVec( - 1, 0, 0, - 0, 1, 0, - 1, 2, 1 - ); - }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat3.adjoint(matA, matA); }); - - it("should place values into matA", function() { - expect(matA).toBeVec( - 1, 0, 0, - 0, 1, 0, - -1, -2, 1 - ); - }); - it("should return matA", function() { expect(result).toBe(matA); }); - }); - }); - - describe("determinant", function() { - beforeEach(function() { result = Mat3.determinant(matA); }); - - it("should return the determinant", function() { expect(result).toEqual(1); }); - }); - - describe("multiply", function() { - it("should have an alias called 'mul'", function() { expect(Mat3.mul).toEqual(Mat3.multiply); }); - - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat3.multiply(out, matA, matB); }); - - it("should place values into out", function() { - expect(out).toBeVec( - 1, 0, 0, - 0, 1, 0, - 4, 6, 1 - ); - }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { - expect(matA).toBeVec( - 1, 0, 0, - 0, 1, 0, - 1, 2, 1 - ); - }); - it("should not modify matB", function() { - expect(matB).toBeVec( - 1, 0, 0, - 0, 1, 0, - 3, 4, 1 - ); - }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat3.multiply(matA, matA, matB); }); - - it("should place values into matA", function() { - expect(matA).toBeVec( - 1, 0, 0, - 0, 1, 0, - 4, 6, 1 - ); - }); - it("should return matA", function() { expect(result).toBe(matA); }); - it("should not modify matB", function() { - expect(matB).toBeVec( - 1, 0, 0, - 0, 1, 0, - 3, 4, 1 - ); - }); - }); - - describe("when matB is the output matrix", function() { - beforeEach(function() { result = Mat3.multiply(matB, matA, matB); }); - - it("should place values into matB", function() { - expect(matB).toBeVec( - 1, 0, 0, - 0, 1, 0, - 4, 6, 1 - ); - }); - it("should return matB", function() { expect(result).toBe(matB); }); - it("should not modify matA", function() { - expect(matA).toBeVec( - 1, 0, 0, - 0, 1, 0, - 1, 2, 1 - ); - }); - }); - }); - - describe("str", function() { - beforeEach(function() { result = Mat3.str(matA); }); - - it("should return a string representation of the matrix", function() { expect(result).toEqual("Mat3(1, 0, 0, 0, 1, 0, 1, 2, 1)"); }); - }); - - describe("frob", function() { - beforeEach(function() { result = Mat3.frob(matA); }); - it("should return the Frobenius Norm of the matrix", function() { expect(result).toEqual( Math.sqrt(Math.pow(1, 2) + Math.pow(0, 2) + Math.pow(0, 2) + Math.pow(0, 2) + Math.pow(1, 2) + Math.pow(0, 2) + Math.pow(1, 2) + Math.pow(2, 2) + Math.pow(1, 2))); }); - }); - - describe("add", function() { - beforeEach(function() { - matA = [1, 2, 3, 4, 5, 6, 7, 8, 9]; - matB = [10, 11, 12, 13, 14, 15, 16, 17, 18]; - }); - describe("with a separate output matrix", function() { - beforeEach(function() { - result = Mat3.add(out, matA, matB); - }); - - it("should place values into out", function() { expect(out).toBeVec(11, 13, 15, 17, 19, 21, 23, 25, 27); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9); }); - it("should not modify matB", function() { expect(matB).toBeVec(10, 11, 12, 13, 14, 15, 16, 17, 18); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat3.add(matA, matA, matB); }); - - it("should place values into matA", function() { expect(matA).toBeVec(11, 13, 15, 17, 19, 21, 23, 25, 27); }); - it("should return matA", function() { expect(result).toBe(matA); }); - it("should not modify matB", function() { expect(matB).toBeVec(10, 11, 12, 13, 14, 15, 16, 17, 18); }); - }); - - describe("when matB is the output matrix", function() { - beforeEach(function() { result = Mat3.add(matB, matA, matB); }); - - it("should place values into matB", function() { expect(matB).toBeVec(11, 13, 15, 17, 19, 21, 23, 25, 27); }); - it("should return matB", function() { expect(result).toBe(matB); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9); }); - }); - }); - - describe("subtract", function() { - beforeEach(function() { - matA = [1, 2, 3, 4, 5, 6, 7, 8, 9]; - matB = [10, 11, 12, 13, 14, 15, 16, 17, 18]; - }); - it("should have an alias called 'sub'", function() { expect(Mat3.sub).toEqual(Mat3.subtract); }); - - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat3.subtract(out, matA, matB); }); - - it("should place values into out", function() { expect(out).toBeVec(-9, -9, -9, -9, -9, -9, -9, -9, -9); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9); }); - it("should not modify matB", function() { expect(matB).toBeVec(10, 11, 12, 13, 14, 15, 16, 17, 18); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat3.subtract(matA, matA, matB); }); - - it("should place values into matA", function() { expect(matA).toBeVec(-9, -9, -9, -9, -9, -9, -9, -9, -9); }); - it("should return matA", function() { expect(result).toBe(matA); }); - it("should not modify matB", function() { expect(matB).toBeVec(10, 11, 12, 13, 14, 15, 16, 17, 18); }); - }); - - describe("when matB is the output matrix", function() { - beforeEach(function() { result = Mat3.subtract(matB, matA, matB); }); - - it("should place values into matB", function() { expect(matB).toBeVec(-9, -9, -9, -9, -9, -9, -9, -9, -9); }); - it("should return matB", function() { expect(result).toBe(matB); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9); }); - }); - }); - - describe("fromValues", function() { - beforeEach(function() { result = Mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9); }); - it("should return a 9 element array initialized to the values passed", function() { expect(result).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9); }); - }); - - describe("set", function() { - beforeEach(function() { result = Mat3.set(out, 1, 2, 3, 4, 5, 6, 7, 8, 9); }); - it("should place values into out", function() { expect(out).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9); }); - it("should return out", function() { expect(result).toBe(out); }); - }); - - describe("multiplyScalar", function() { - beforeEach(function() { - matA = [1, 2, 3, 4, 5, 6, 7, 8, 9]; - }); - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat3.multiplyScalar(out, matA, 2); }); - - it("should place values into out", function() { expect(out).toBeVec(2, 4, 6, 8, 10, 12, 14, 16, 18); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat3.multiplyScalar(matA, matA, 2); }); - - it("should place values into matA", function() { expect(matA).toBeVec(2, 4, 6, 8, 10, 12, 14, 16, 18); }); - it("should return matA", function() { expect(result).toBe(matA); }); - }); - }); - - describe("multiplyScalarAndAdd", function() { - beforeEach(function() { - matA = [1, 2, 3, 4, 5, 6, 7, 8, 9]; - matB = [10, 11, 12, 13, 14, 15, 16, 17, 18]; - }); - describe("with a separate output matrix", function() { - beforeEach(function() { result = Mat3.multiplyScalarAndAdd(out, matA, matB, 0.5); }); - - it("should place values into out", function() { expect(out).toBeVec(6, 7.5, 9, 10.5, 12, 13.5, 15, 16.5, 18); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9); }); - it("should not modify matB", function() { expect(matB).toBeVec(10, 11, 12, 13, 14, 15, 16, 17, 18); }); - }); - - describe("when matA is the output matrix", function() { - beforeEach(function() { result = Mat3.multiplyScalarAndAdd(matA, matA, matB, 0.5); }); - - it("should place values into matA", function() { expect(matA).toBeVec(6, 7.5, 9, 10.5, 12, 13.5, 15, 16.5, 18); }); - it("should return matA", function() { expect(result).toBe(matA); }); - it("should not modify matB", function() { expect(matB).toBeVec(10, 11, 12, 13, 14, 15, 16, 17, 18); }); - }); - - describe("when matB is the output matrix", function() { - beforeEach(function() { result = Mat3.multiplyScalarAndAdd(matB, matA, matB, 0.5); }); - - it("should place values into matB", function() { expect(matB).toBeVec(6, 7.5, 9, 10.5, 12, 13.5, 15, 16.5, 18); }); - it("should return matB", function() { expect(result).toBe(matB); }); - it("should not modify matA", function() { expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9); }); - }); - }); - - describe("projection", function() { - beforeEach(function() { - result = Mat3.projection(out, 100.0, 200.0); - }); - - it("should return out", function() { expect(result).toBe(out); }); - - it("should give projection matrix", function() { - expect(result).toBeVec(0.02, 0, 0, - 0, -0.01, 0, - -1, 1, 1); - }); - }); - - describe("exactEquals", function() { - let matC, r0, r1; - beforeEach(function() { - matA = [0, 1, 2, 3, 4, 5, 6, 7, 8]; - matB = [0, 1, 2, 3, 4, 5, 6, 7, 8]; - matC = [1, 2, 3, 4, 5, 6, 7, 8, 9]; - r0 = Mat3.exactEquals(matA, matB); - r1 = Mat3.exactEquals(matA, matC); - }); - - it("should return true for identical matrices", function() { expect(r0).toBe(true); }); - it("should return false for different matrices", function() { expect(r1).toBe(false); }); - it("should not modify matA", function() { expect(matA).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8); }); - it("should not modify matB", function() { expect(matB).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8); }); - }); - - describe("equals", function() { - let matC, matD, r0, r1, r2; - beforeEach(function() { - matA = [0, 1, 2, 3, 4, 5, 6, 7, 8]; - matB = [0, 1, 2, 3, 4, 5, 6, 7, 8]; - matC = [1, 2, 3, 4, 5, 6, 7, 8, 9]; - matD = [1e-16, 1, 2, 3, 4, 5, 6, 7, 8]; - r0 = Mat3.equals(matA, matB); - r1 = Mat3.equals(matA, matC); - r2 = Mat3.equals(matA, matD); - }); - it("should return true for identical matrices", function() { expect(r0).toBe(true); }); - it("should return false for different matrices", function() { expect(r1).toBe(false); }); - it("should return true for close but not identical matrices", function() { expect(r2).toBe(true); }); - it("should not modify matA", function() { expect(matA).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8); }); - it("should not modify matB", function() { expect(matB).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8); }); - }); - }); -}); \ No newline at end of file diff --git a/tests/mat4.spec.ts b/tests/mat4.spec.ts deleted file mode 100644 index c5c77b57..00000000 --- a/tests/mat4.spec.ts +++ /dev/null @@ -1,1182 +0,0 @@ -import { expect, describe, it, beforeEach } from 'vitest'; -import "./test-utils" -import { Mat4, Mat4Like } from "../src/mat4" -import { Vec3, Vec3Like } from "../src/vec3" -import { Quat } from "../src/quat" - -describe("Mat4", () => { - describe("constructor", () => { - it("should return an identity Mat4 if called with no arguments", () => { - expect(new Mat4()).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1); - }); - - it("should return Mat4(m0, m1, ...m15) if called with (m0, m1, ...m15)", () => { - expect(new Mat4( - 1, 2, 3, 4, - 5, 6, 7, 8, - 9, 10, 11, 12, - 13, 14, 15, 16)).toBeVec( - 1, 2, 3, 4, - 5, 6, 7, 8, - 9, 10, 11, 12, - 13, 14, 15, 16); - }); - - it("should return Mat4(x, x, x) if called with (x)", () => { - expect(new Mat4(1)).toBeVec( - 1, 1, 1, 1, - 1, 1, 1, 1, - 1, 1, 1, 1, - 1, 1, 1, 1); - }); - - it("should return Mat4(m0, m1, ...m15) if called with ([m0, m1, ...m15])", () => { - expect(new Mat4([ - 1, 2, 3, 4, - 5, 6, 7, 8, - 9, 10, 11, 12, - 13, 14, 15, 16])).toBeVec( - 1, 2, 3, 4, - 5, 6, 7, 8, - 9, 10, 11, 12, - 13, 14, 15, 16); - }); - - it("should return Mat4(m0, m1, ...m15) if called with (Mat4(m0, m1, ...m15))", () => { - let v = new Mat4( - 1, 2, 3, 4, - 5, 6, 7, 8, - 9, 10, 11, 12, - 13, 14, 15, 16); - expect(new Mat4(v)).toBeVec(v); - }); - - it("should return Mat4(m0, m1, ...m15) if called with (Float32Array([m0, m1, ...m15]))", () => { - let arr = new Float32Array([ - 1, 2, 3, 4, - 5, 6, 7, 8, - 9, 10, 11, 12, - 13, 14, 15, 16]); - expect(new Mat4(arr)).toBeVec(arr); - }); - }); - - describe("static", () => { - let out, matA, matB, identity, result; - - beforeEach(() => { - // Attempting to portray a semi-realistic transform matrix - matA = new Float32Array([1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 1, 2, 3, 1]); - - matB = new Float32Array([1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 4, 5, 6, 1]); - - out = new Float32Array([0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0]); - - identity = new Float32Array([1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1]); - }); - - describe("create", () => { - beforeEach(() => { result = Mat4.create(); }); - it("should return a 16 element array initialized to a 4x4 identity matrix", () => { expect(result).toBeVec(identity); }); - }); - - describe("clone", () => { - beforeEach(() => { result = Mat4.clone(matA); }); - it("should return a 16 element array initialized to the values in matA", () => { expect(result).toBeVec(matA); }); - }); - - describe("copy", () => { - beforeEach(() => { result = Mat4.copy(out, matA); }); - it("should place values into out", () => { expect(out).toBeVec(matA); }); - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("identity", () => { - beforeEach(() => { result = Mat4.identity(out); }); - it("should place values into out", () => { expect(result).toBeVec(identity); }); - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("transpose", () => { - describe("with a separate output matrix", () => { - beforeEach(() => { result = Mat4.transpose(out, matA); }); - - it("should place values into out", () => { - expect(out).toBeVec( - 1, 0, 0, 1, - 0, 1, 0, 2, - 0, 0, 1, 3, - 0, 0, 0, 1 - ); - }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify matA", () => { - expect(matA).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 1, 2, 3, 1 - ); - }); - }); - - describe("when matA is the output matrix", () => { - beforeEach(() => { result = Mat4.transpose(matA, matA); }); - - it("should place values into matA", () => { - expect(matA).toBeVec( - 1, 0, 0, 1, - 0, 1, 0, 2, - 0, 0, 1, 3, - 0, 0, 0, 1 - ); - }); - it("should return matA", () => { expect(result).toBe(matA); }); - }); - }); - - describe("invert", () => { - describe("with a separate output matrix", () => { - beforeEach(() => { result = Mat4.invert(out, matA); }); - - it("should place values into out", () => { - expect(out).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - -1, -2, -3, 1 - ); - }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify matA", () => { - expect(matA).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 1, 2, 3, 1 - ); - }); - }); - - describe("when matA is the output matrix", () => { - beforeEach(() => { result = Mat4.invert(matA, matA); }); - - it("should place values into matA", () => { - expect(matA).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - -1, -2, -3, 1 - ); - }); - it("should return matA", () => { expect(result).toBe(matA); }); - }); - }); - - describe("adjoint", () => { - describe("with a separate output matrix", () => { - beforeEach(() => { result = Mat4.adjoint(out, matA); }); - - it("should place values into out", () => { - expect(out).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - -1, -2, -3, 1 - ); - }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify matA", () => { - expect(matA).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 1, 2, 3, 1 - ); - }); - }); - - describe("when matA is the output matrix", () => { - beforeEach(() => { result = Mat4.adjoint(matA, matA); }); - - it("should place values into matA", () => { - expect(matA).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - -1, -2, -3, 1 - ); - }); - it("should return matA", () => { expect(result).toBe(matA); }); - }); - }); - - describe("determinant", () => { - beforeEach(() => { result = Mat4.determinant(matA); }); - - it("should return the determinant", () => { expect(result).toEqual(1); }); - }); - - describe("multiply", () => { - it("should have an alias called 'mul'", () => { expect(Mat4.mul).toEqual(Mat4.multiply); }); - - describe("with a separate output matrix", () => { - beforeEach(() => { result = Mat4.multiply(out, matA, matB); }); - - it("should place values into out", () => { - expect(out).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 5, 7, 9, 1 - ); - }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify matA", () => { - expect(matA).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 1, 2, 3, 1 - ); - }); - it("should not modify matB", () => { - expect(matB).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 4, 5, 6, 1 - ); - }); - }); - - describe("when matA is the output matrix", () => { - beforeEach(() => { result = Mat4.multiply(matA, matA, matB); }); - - it("should place values into matA", () => { - expect(matA).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 5, 7, 9, 1 - ); - }); - it("should return matA", () => { expect(result).toBe(matA); }); - it("should not modify matB", () => { - expect(matB).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 4, 5, 6, 1 - ); - }); - }); - - describe("when matB is the output matrix", () => { - beforeEach(() => { result = Mat4.multiply(matB, matA, matB); }); - - it("should place values into matB", () => { - expect(matB).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 5, 7, 9, 1 - ); - }); - it("should return matB", () => { expect(result).toBe(matB); }); - it("should not modify matA", () => { - expect(matA).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 1, 2, 3, 1 - ); - }); - }); - }); - - describe("translate", () => { - describe("with a separate output matrix", () => { - beforeEach(() => { result = Mat4.translate(out, matA, [4, 5, 6]); }); - - it("should place values into out", () => { - expect(out).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 5, 7, 9, 1 - ); - }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify matA", () => { - expect(matA).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 1, 2, 3, 1 - ); - }); - }); - - describe("when matA is the output matrix", () => { - beforeEach(() => { result = Mat4.translate(matA, matA, [4, 5, 6]); }); - - it("should place values into matA", () => { - expect(matA).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 5, 7, 9, 1 - ); - }); - it("should return matA", () => { expect(result).toBe(matA); }); - }); - }); - - describe("scale", () => { - describe("with a separate output matrix", () => { - beforeEach(() => { result = Mat4.scale(out, matA, [4, 5, 6]); }); - - it("should place values into out", () => { - expect(out).toBeVec( - 4, 0, 0, 0, - 0, 5, 0, 0, - 0, 0, 6, 0, - 1, 2, 3, 1 - ); - }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify matA", () => { - expect(matA).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 1, 2, 3, 1 - ); - }); - }); - - describe("when matA is the output matrix", () => { - beforeEach(() => { result = Mat4.scale(matA, matA, [4, 5, 6]); }); - - it("should place values into matA", () => { - expect(matA).toBeVec( - 4, 0, 0, 0, - 0, 5, 0, 0, - 0, 0, 6, 0, - 1, 2, 3, 1 - ); - }); - it("should return matA", () => { expect(result).toBe(matA); }); - }); - }); - - describe("rotate", () => { - let rad = Math.PI * 0.5; - let axis: Vec3Like = [1, 0, 0]; - - describe("with a separate output matrix", () => { - beforeEach(() => { result = Mat4.rotate(out, matA, rad, axis); }); - - it("should place values into out", () => { - expect(out).toBeVec( - 1, 0, 0, 0, - 0, Math.cos(rad), Math.sin(rad), 0, - 0, -Math.sin(rad), Math.cos(rad), 0, - 1, 2, 3, 1 - ); - }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify matA", () => { - expect(matA).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 1, 2, 3, 1 - ); - }); - }); - - describe("when matA is the output matrix", () => { - beforeEach(() => { result = Mat4.rotate(matA, matA, rad, axis); }); - - it("should place values into matA", () => { - expect(matA).toBeVec( - 1, 0, 0, 0, - 0, Math.cos(rad), Math.sin(rad), 0, - 0, -Math.sin(rad), Math.cos(rad), 0, - 1, 2, 3, 1 - ); - }); - it("should return matA", () => { expect(result).toBe(matA); }); - }); - }); - - describe("rotateX", () => { - let rad = Math.PI * 0.5; - - describe("with a separate output matrix", () => { - beforeEach(() => { result = Mat4.rotateX(out, matA, rad); }); - - it("should place values into out", () => { - expect(out).toBeVec( - 1, 0, 0, 0, - 0, Math.cos(rad), Math.sin(rad), 0, - 0, -Math.sin(rad), Math.cos(rad), 0, - 1, 2, 3, 1 - ); - }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify matA", () => { - expect(matA).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 1, 2, 3, 1 - ); - }); - }); - - describe("when matA is the output matrix", () => { - beforeEach(() => { result = Mat4.rotateX(matA, matA, rad); }); - - it("should place values into matA", () => { - expect(matA).toBeVec( - 1, 0, 0, 0, - 0, Math.cos(rad), Math.sin(rad), 0, - 0, -Math.sin(rad), Math.cos(rad), 0, - 1, 2, 3, 1 - ); - }); - it("should return matA", () => { expect(result).toBe(matA); }); - }); - }); - - describe("rotateY", () => { - let rad = Math.PI * 0.5; - - describe("with a separate output matrix", () => { - beforeEach(() => { result = Mat4.rotateY(out, matA, rad); }); - - it("should place values into out", () => { - expect(out).toBeVec( - Math.cos(rad), 0, -Math.sin(rad), 0, - 0, 1, 0, 0, - Math.sin(rad), 0, Math.cos(rad), 0, - 1, 2, 3, 1 - ); - }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify matA", () => { - expect(matA).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 1, 2, 3, 1 - ); - }); - }); - - describe("when matA is the output matrix", () => { - beforeEach(() => { result = Mat4.rotateY(matA, matA, rad); }); - - it("should place values into matA", () => { - expect(matA).toBeVec( - Math.cos(rad), 0, -Math.sin(rad), 0, - 0, 1, 0, 0, - Math.sin(rad), 0, Math.cos(rad), 0, - 1, 2, 3, 1 - ); - }); - it("should return matA", () => { expect(result).toBe(matA); }); - }); - }); - - describe("rotateZ", () => { - let rad = Math.PI * 0.5; - - describe("with a separate output matrix", () => { - beforeEach(() => { result = Mat4.rotateZ(out, matA, rad); }); - - it("should place values into out", () => { - expect(out).toBeVec( - Math.cos(rad), Math.sin(rad), 0, 0, - -Math.sin(rad), Math.cos(rad), 0, 0, - 0, 0, 1, 0, - 1, 2, 3, 1 - ); - }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify matA", () => { - expect(matA).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 1, 2, 3, 1 - ); - }); - }); - - describe("when matA is the output matrix", () => { - beforeEach(() => { result = Mat4.rotateZ(matA, matA, rad); }); - - it("should place values into matA", () => { - expect(matA).toBeVec( - Math.cos(rad), Math.sin(rad), 0, 0, - -Math.sin(rad), Math.cos(rad), 0, 0, - 0, 0, 1, 0, - 1, 2, 3, 1 - ); - }); - it("should return matA", () => { expect(result).toBe(matA); }); - }); - }); - - // TODO: fromRotationTranslation - - describe("normalFromMat4", function() { - beforeEach(function() { - matA = new Float32Array([1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1]); - result = Mat4.normalFromMat4(out, matA); - }); - - it("should return out", function() { expect(result).toBe(out); }); - - describe("with translation and rotation", function() { - beforeEach(function() { - Mat4.translate(matA, matA, [2, 4, 6]); - Mat4.rotateX(matA, matA, Math.PI / 2); - - result = Mat4.normalFromMat4(out, matA); - }); - - it("should give rotated matrix", function() { - expect(result).toBeVec(1, 0, 0, 0, - 0, 0, 1, 0, - 0,-1, 0, 0, - 0, 0, 0, 1); - }); - - describe("and scale", function() { - beforeEach(function() { - Mat4.scale(matA, matA, [2, 3, 4]); - - result = Mat4.normalFromMat4(out, matA); - }); - - it("should give rotated matrix", function() { - expect(result).toBeVec(0.5, 0, 0, 0, - 0, 0, 0.333333, 0, - 0, -0.25, 0, 0, - 0, 0, 0, 1); - }); - }); - }); - }); - - describe("getTranslation", () => { - describe("from the identity matrix", () => { - beforeEach(() => { - result = Vec3.fromValues(1, 2, 3); - out = Vec3.fromValues(1, 2, 3); - result = Mat4.getTranslation(out, identity); - }); - it("should place result both in result and out", () => { expect(result).toBe(out); }); - it("should return the zero vector", () => { expect(result).toBeVec(0, 0, 0); }); - }); - - describe("from a translation-only matrix", () => { - beforeEach(() => { - result = new Vec3(1, 2, 3); - out = new Vec3(1, 2, 3); - result = Mat4.getTranslation(out, matB); - }); - it("should return translation vector", () => { expect(out).toBeVec(4, 5, 6); }); - }); - - describe("from a translation and rotation matrix", () => { - beforeEach(() => { - let q = new Quat(); - let v = new Vec3(5, 6, 7); - Quat.setAxisAngle(q, [0.26726124, 0.534522474, 0.8017837], 0.55); - Mat4.fromRotationTranslation(out, q, v); - - result = new Vec3(); - Mat4.getTranslation(result, out); - }); - it("should keep the same translation vector, regardless of rotation", () => { - expect(result).toBeVec(5, 6, 7); - }); - }); - }); - - describe("getScaling", () => { - describe("from the identity matrix", () => { - beforeEach(() => { - result = new Vec3(1, 2, 3); - out = new Vec3(1, 2, 3); - result = Mat4.getScaling(out, identity); - }); - it("should place result both in result and out", () => { expect(result).toBe(out); }); - it("should return the identity vector", () => { expect(result).toBeVec(1, 1, 1); }); - }); - - describe("from a scale-only matrix", () => { - beforeEach(() => { - let v = new Vec3(4, 5, 6); - result = new Vec3(1, 2, 3) - out = new Vec3(1, 2, 3); - Mat4.fromScaling(matA, v); - result = Mat4.getScaling(out, matA); - }); - it("should return translation vector", () => { expect(out).toBeVec(4, 5, 6); }); - }); - - describe("from a translation and rotation matrix", () => { - beforeEach(() => { - let q = Quat.create(); - let v = Vec3.fromValues(5, 6, 7); - q = Quat.setAxisAngle(q, [1, 0, 0], 0.5); - Mat4.fromRotationTranslation(out, q, v); - - result = Vec3.fromValues(1, 2, 3); - Mat4.getScaling(result, out); - }) - it("should return the identity vector", () => { expect(result).toBeVec(1, 1, 1); }); - }); - - describe("from a translation, rotation and scale matrix", () => { - beforeEach(() => { - let q = Quat.create(); - let t = Vec3.fromValues(1, 2, 3); - let s = Vec3.fromValues(5, 6, 7); - q = Quat.setAxisAngle(q, [0, 1, 0], 0.7); - Mat4.fromRotationTranslationScale(out, q, t, s); - result = Vec3.fromValues(5, 6, 7); - Mat4.getScaling(result, out); - }) - it("should return the same scaling factor when created", () => { expect(result).toBeVec(5, 6, 7); }); - }); - - }); - - describe("getRotation", () => { - describe("from the identity matrix", () => { - beforeEach(() => { - result = Quat.fromValues(1, 2, 3, 4); - out = Quat.fromValues(1, 2, 3, 4); - result = Mat4.getRotation(out, identity); - }); - it("should place result both in result and out", () => { expect(result).toBe(out); }); - it("should return the unit quaternion", () => { - let unitQuat = Quat.create(); - Quat.identity(unitQuat); - expect(result).toBeVec(unitQuat); - }); - }); - - describe("from a translation-only matrix", () => { - beforeEach(() => { - result = Quat.fromValues(1, 2, 3, 4); - out = Quat.fromValues(1, 2, 3, 4); - result = Mat4.getRotation(out, matB); - }); - it("should return the unit quaternion", () => { - let unitQuat = Quat.create(); - Quat.identity(unitQuat); - expect(result).toBeVec(unitQuat); - }); - }); - - describe("from a translation and rotation matrix", () => { - it("should keep the same rotation as when created", () => { - let q = Quat.create(); - let outVec = Vec3.fromValues(5, 6, 7); - let testVec = Vec3.fromValues(1, 5, 2); - let ang = 0.78972; - - Vec3.normalize(testVec, testVec); - q = Quat.setAxisAngle(q, testVec, ang); - Mat4.fromRotationTranslation(out, q, outVec); - - result = Quat.fromValues(2, 3, 4, 6); - Mat4.getRotation(result, out); - let outaxis = Vec3.create(); - let outangle = Quat.getAxisAngle(outaxis, result); - - expect(outaxis).toBeVec(testVec); - expect(outangle).toBeCloseTo(ang); - }); - }); - }); - - describe("frustumNO", () => { - it("should have an alias called 'frustum'", () => { expect(Mat4.frustumNO).toEqual(Mat4.frustum); }); - - beforeEach(() => { result = Mat4.frustumNO(out, -1, 1, -1, 1, -1, 1); }); - it("should place values into out", () => { expect(result).toBeVec( - -1, 0, 0, 0, - 0, -1, 0, 0, - 0, 0, 0, -1, - 0, 0, 1, 0 - ); - }); - it("should return out", () => { expect(result).toBe(out); }); - - describe("with an Infinite far plane", () => { - beforeEach(() => { result = Mat4.frustumNO(out, -1, 1, -1, 1, -1, Infinity); }); - it("should calculate correct matrix", () => { expect(result).toBeVec( - -1, 0, 0, 0, - 0, -1, 0, 0, - 0, 0, -1, -1, - 0, 0, 2, 0 - ); }); - }); - }); - - describe("frustumZO", () => { - beforeEach(() => { result = Mat4.frustumZO(out, -1, 1, -1, 1, -1, 1); }); - it("should place values into out", () => { expect(result).toBeVec( - -1, 0, 0, 0, - 0, -1, 0, 0, - 0, 0, -0.5, -1, - 0, 0, 0.5, 0 - ); - }); - it("should return out", () => { expect(result).toBe(out); }); - - describe("with an Infinite far plane", () => { - beforeEach(() => { result = Mat4.frustumZO(out, -1, 1, -1, 1, -1, Infinity); }); - it("should calculate correct matrix", () => { expect(result).toBeVec( - -1, 0, 0, 0, - 0, -1, 0, 0, - 0, 0, -1, -1, - 0, 0, 1, 0 - ); }); - }); - }); - - describe("perspectiveNO", () => { - it("should have an alias called 'perspective'", () => { expect(Mat4.perspectiveNO).toEqual(Mat4.perspective); }); - - let fovy = Math.PI * 0.5; - beforeEach(() => { result = Mat4.perspectiveNO(out, fovy, 1, 0, 1); }); - it("should place values into out", () => { expect(result).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, -1, -1, - 0, 0, 0, 0 - ); - }); - it("should return out", () => { expect(result).toBe(out); }); - - describe("with nonzero near, 45deg fovy, and realistic aspect ratio", () => { - beforeEach(() => { result = Mat4.perspectiveNO(out, 45 * Math.PI / 180.0, 640/480, 0.1, 200); }); - it("should calculate correct matrix", () => { expect(result).toBeVec( - 1.81066, 0, 0, 0, - 0, 2.414213, 0, 0, - 0, 0, -1.001, -1, - 0, 0, -0.2001, 0 - ); }); - }); - - describe("with no far plane, 45deg fovy, and realistic aspect ratio", () => { - beforeEach(() => { result = Mat4.perspectiveNO(out, 45 * Math.PI / 180.0, 640/480, 0.1); }); - it("should calculate correct matrix", () => { expect(result).toBeVec( - 1.81066, 0, 0, 0, - 0, 2.414213, 0, 0, - 0, 0, -1, -1, - 0, 0, -0.2, 0 - ); }); - }); - - describe("with infinite far plane, 45deg fovy, and realistic aspect ratio", () => { - beforeEach(() => { result = Mat4.perspectiveNO(out, 45 * Math.PI / 180.0, 640/480, 0.1, Infinity); }); - it("should calculate correct matrix", () => { expect(result).toBeVec( - 1.81066, 0, 0, 0, - 0, 2.414213, 0, 0, - 0, 0, -1, -1, - 0, 0, -0.2, 0 - ); }); - }); - }); - - describe("orthoNO", () => { - it("should have an alias called 'ortho'", () => { expect(Mat4.orthoNO).toEqual(Mat4.ortho); }); - - beforeEach(() => { result = Mat4.orthoNO(out, -1, 1, -1, 1, -1, 1); }); - it("should place values into out", () => { expect(result).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, -1, 0, - 0, 0, 0, 1 - ); - }); - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("lookAt", () => { - let eye = new Float32Array([0, 0, 1]); - let center = new Float32Array([0, 0, -1]); - let up = new Float32Array([0, 1, 0]); - let view, right; - - describe("looking down", () => { - beforeEach(() => { - view = new Float32Array([0, -1, 0]); - up = new Float32Array([0, 0, -1]); - right= new Float32Array([1, 0, 0]); - result = Mat4.lookAt(out, [0, 0, 0], view, up); - }); - - it("should transform view into local -Z", () => { - result = Vec3.transformMat4(new Float32Array(3), view, out); - expect(result).toBeVec(0, 0, -1); - }); - - it("should transform up into local +Y", () => { - result = Vec3.transformMat4(new Float32Array(3), up, out); - expect(result).toBeVec(0, 1, 0); - }); - - it("should transform right into local +X", () => { - result = Vec3.transformMat4(new Float32Array(3), right, out); - expect(result).toBeVec(1, 0, 0); - }); - - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("#74", () => { - beforeEach(() => { - Mat4.lookAt(out, - new Float32Array([0,2,0]), - new Float32Array([0,0.6,0]), - new Float32Array([0,0,-1])); - }); - - it("should transform a point 'above' into local +Y", () => { - result = Vec3.transformMat4(new Float32Array(3), [0, 2, -1], out); - expect(result).toBeVec(0, 1, 0); - }); - - it("should transform a point 'right of' into local +X", () => { - result = Vec3.transformMat4(new Float32Array(3), [1, 2, 0], out); - expect(result).toBeVec(1, 0, 0); - }); - - it("should transform a point 'in front of' into local -Z", () => { - result = Vec3.transformMat4(new Float32Array(3), [0, 1, 0], out); - expect(result).toBeVec(0, 0, -1); - }); - }); - - beforeEach(() => { - eye = new Float32Array([0, 0, 1]); - center = new Float32Array([0, 0, -1]); - up = new Float32Array([0, 1, 0]); - result = Mat4.lookAt(out, eye, center, up); - }); - it("should place values into out", () => { expect(result).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, -1, 1 - ); - }); - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("targetTo", () => { - var eye = new Float32Array([0, 0, 1]); - var center = new Float32Array([0, 0, -1]); - var up = new Float32Array([0, 1, 0]); - var view, up, right; - - describe("looking down", () => { - beforeEach(() => { - view = new Float32Array([0, -1, 0]); - up = new Float32Array([0, 0, -1]); - right= new Float32Array([1, 0, 0]); - result = Mat4.targetTo(out, [0, 0, 0], view, up); - }); - - it("should transform view into local Z", () => { - result = Vec3.transformMat4(new Float32Array(3), view, out); - expect(result).toBeVec(0, 0, 1); - }); - - it("should transform up into local -Y", () => { - result = Vec3.transformMat4(new Float32Array(3), up, out); - expect(result).toBeVec(0, -1, 0); - }); - - it("should transform right into local +X", () => { - result = Vec3.transformMat4(new Float32Array(3), right, out); - expect(result).toBeVec(1, 0, 0); - }); - - it("should return out", () => { expect(result).toBe(out); }); - - it("scaling should be [1, 1, 1]", () => { - var scaling = Mat4.getScaling(new Float32Array(3), out); - expect(scaling).toBeVec(1, 1, 1); - }); - }); - - describe("#74", () => { - beforeEach(() => { - Mat4.targetTo(out, - new Float32Array([0,2,0]), - new Float32Array([0,0.6,0]), - new Float32Array([0,0,-1])); - }); - - it("should transform a point 'above' into local +Y", () => { - result = Vec3.transformMat4(new Float32Array(3), [0, 2, -1], out); - expect(result).toBeVec(0, 1, -2); - }); - - it("should transform a point 'right of' into local +X", () => { - result = Vec3.transformMat4(new Float32Array(3), [1, 2, 0], out); - expect(result).toBeVec(1, 2, -2); - }); - - it("should transform a point 'in front of' into local -Z", () => { - result = Vec3.transformMat4(new Float32Array(3), [0, 1, 0], out); - expect(result).toBeVec(0, 2, -1); - }); - - it("scaling should be [1, 1, 1]", () => { - var scaling = Mat4.getScaling(new Float32Array(3), out); - expect(scaling).toBeVec(1, 1, 1); - }); - }); - - describe("scaling test", () => { - beforeEach(() => { - Mat4.targetTo(out, - new Float32Array([0,1,0]), - new Float32Array([0,0,1]), - new Float32Array([0,0,-1])); - }); - - it("scaling should be [1, 1, 1]", () => { - var scaling = Mat4.getScaling(new Float32Array(3), out); - expect(scaling).toBeVec(1, 1, 1); - }); - }); - - beforeEach(() => { - eye = new Float32Array([0, 0, 1]); - center = new Float32Array([0, 0, -1]); - up = new Float32Array([0, 1, 0]); - result = Mat4.targetTo(out, eye, center, up); - }); - it("should place values into out", () => { expect(result).toBeVec( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 1, 1 - ); - }); - it("should return out", () => { expect(result).toBe(out); }); - it("scaling should be [1, 1, 1]", () => { - var scaling = Mat4.getScaling(new Float32Array(3), out); - expect(scaling).toBeVec(1, 1, 1); - }); - }); - - describe("str", () => { - beforeEach(() => { result = Mat4.str(matA); }); - - it("should return a string representation of the matrix", () => { expect(result).toEqual("Mat4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 2, 3, 1)"); }); - }); - - describe("frob", () => { - beforeEach(() => { result = Mat4.frob(matA); }); - it("should return the Frobenius Norm of the matrix", () => { expect(result).toBeCloseTo( Math.sqrt(Math.pow(1, 2) + Math.pow(1, 2) + Math.pow(1, 2) + Math.pow(1, 2) + Math.pow(1, 2) + Math.pow(2, 2) + Math.pow(3, 2) )); }); - }); - - describe("add", () => { - beforeEach(() => { - matA = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; - matB = [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]; - }); - describe("with a separate output matrix", () => { - beforeEach(() => { - result = Mat4.add(out, matA, matB); - }); - - it("should place values into out", () => { expect(out).toBeVec(18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify matA", () => { expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); }); - it("should not modify matB", () => { expect(matB).toBeVec(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); }); - }); - - describe("when matA is the output matrix", () => { - beforeEach(() => { result = Mat4.add(matA, matA, matB); }); - - it("should place values into matA", () => { expect(matA).toBeVec(18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48); }); - it("should return matA", () => { expect(result).toBe(matA); }); - it("should not modify matB", () => { expect(matB).toBeVec(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); }); - }); - - describe("when matB is the output matrix", () => { - beforeEach(() => { result = Mat4.add(matB, matA, matB); }); - - it("should place values into matB", () => { expect(matB).toBeVec(18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48); }); - it("should return matB", () => { expect(result).toBe(matB); }); - it("should not modify matA", () => { expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); }); - }); - }); - - describe("subtract", () => { - beforeEach(() => { - matA = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; - matB = [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]; - }); - it("should have an alias called 'sub'", () => { expect(Mat4.sub).toEqual(Mat4.subtract); }); - - describe("with a separate output matrix", () => { - beforeEach(() => { result = Mat4.subtract(out, matA, matB); }); - - it("should place values into out", () => { expect(out).toBeVec(-16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify matA", () => { expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); }); - it("should not modify matB", () => { expect(matB).toBeVec(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); }); - }); - - describe("when matA is the output matrix", () => { - beforeEach(() => { result = Mat4.subtract(matA, matA, matB); }); - - it("should place values into matA", () => { expect(matA).toBeVec(-16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16); }); - it("should return matA", () => { expect(result).toBe(matA); }); - it("should not modify matB", () => { expect(matB).toBeVec(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); }); - }); - - describe("when matB is the output matrix", () => { - beforeEach(() => { result = Mat4.subtract(matB, matA, matB); }); - - it("should place values into matB", () => { expect(matB).toBeVec(-16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16); }); - it("should return matB", () => { expect(result).toBe(matB); }); - it("should not modify matA", () => { expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); }); - }); - }); - - describe("fromValues", () => { - beforeEach(() => { result = Mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); }); - it("should return a 16 element array initialized to the values passed", () => { expect(result).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); }); - }); - - describe("set", () => { - beforeEach(() => { result = Mat4.set(out, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); }); - it("should place values into out", () => { expect(out).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); }); - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("multiplyScalar", () => { - beforeEach(() => { - matA = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; - }); - describe("with a separate output matrix", () => { - beforeEach(() => { result = Mat4.multiplyScalar(out, matA, 2); }); - - it("should place values into out", () => { expect(out).toBeVec(2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify matA", () => { expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); }); - }); - - describe("when matA is the output matrix", () => { - beforeEach(() => { result = Mat4.multiplyScalar(matA, matA, 2); }); - - it("should place values into matA", () => { expect(matA).toBeVec(2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32); }); - it("should return matA", () => { expect(result).toBe(matA); }); - }); - }); - - describe("multiplyScalarAndAdd", () => { - beforeEach(() => { - matA = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; - matB = [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]; - }); - describe("with a separate output matrix", () => { - beforeEach(() => { result = Mat4.multiplyScalarAndAdd(out, matA, matB, 0.5); }); - - it("should place values into out", () => { expect(out).toBeVec(9.5, 11, 12.5, 14, 15.5, 17, 18.5, 20, 21.5, 23, 24.5, 26, 27.5, 29, 30.5, 32); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify matA", () => { expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); }); - it("should not modify matB", () => { expect(matB).toBeVec(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); }); - }); - - describe("when matA is the output matrix", () => { - beforeEach(() => { result = Mat4.multiplyScalarAndAdd(matA, matA, matB, 0.5); }); - - it("should place values into matA", () => { expect(matA).toBeVec(9.5, 11, 12.5, 14, 15.5, 17, 18.5, 20, 21.5, 23, 24.5, 26, 27.5, 29, 30.5, 32); }); - it("should return matA", () => { expect(result).toBe(matA); }); - it("should not modify matB", () => { expect(matB).toBeVec(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); }); - }); - - describe("when matB is the output matrix", () => { - beforeEach(() => { result = Mat4.multiplyScalarAndAdd(matB, matA, matB, 0.5); }); - - it("should place values into matB", () => { expect(matB).toBeVec(9.5, 11, 12.5, 14, 15.5, 17, 18.5, 20, 21.5, 23, 24.5, 26, 27.5, 29, 30.5, 32); }); - it("should return matB", () => { expect(result).toBe(matB); }); - it("should not modify matA", () => { expect(matA).toBeVec(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); }); - }); - }); - - describe("exactEquals", () => { - let matC, r0, r1; - beforeEach(() => { - matA = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; - matB = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; - matC = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; - r0 = Mat4.exactEquals(matA, matB); - r1 = Mat4.exactEquals(matA, matC); - }); - - it("should return true for identical matrices", () => { expect(r0).toBe(true); }); - it("should return false for different matrices", () => { expect(r1).toBe(false); }); - it("should not modify matA", () => { expect(matA).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); }); - it("should not modify matB", () => { expect(matB).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); }); - }); - - describe("equals", () => { - let matC, matD, r0, r1, r2; - beforeEach(() => { - matA = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; - matB = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; - matC = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; - matD = [1e-16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; - r0 = Mat4.equals(matA, matB); - r1 = Mat4.equals(matA, matC); - r2 = Mat4.equals(matA, matD); - }); - it("should return true for identical matrices", () => { expect(r0).toBe(true); }); - it("should return false for different matrices", () => { expect(r1).toBe(false); }); - it("should return true for close but not identical matrices", () => { expect(r2).toBe(true); }); - it("should not modify matA", () => { expect(matA).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); }); - it("should not modify matB", () => { expect(matB).toBeVec(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); }); - }); - }); -}); \ No newline at end of file diff --git a/tests/other/classic-api.spec.ts b/tests/other/classic-api.spec.ts new file mode 100644 index 00000000..e37b407a --- /dev/null +++ b/tests/other/classic-api.spec.ts @@ -0,0 +1,21 @@ +import { expect, describe, it } from 'vitest'; + +import * as modern from '#gl-matrix'; +import * as classic from '#gl-matrix/classic'; + +const toUpper = (string: string) => string.charAt(0).toUpperCase() + string.slice(1); + +describe('Classic API', () => { + const classicKeys = Object.keys(classic); + const modernKeys = Object.keys(modern); + + it('Classic API re-exports Modern API', () => { + // Ensure that the Classic & Modern APIs export the same amount of symbols. + expect(classicKeys.length).toEqual(modernKeys.length); + + // Verify that Classic API re-exports the Modern API. + for (const key of classicKeys) { + expect(classic[key]).toEqual(modern[toUpper(key)]); + } + }); +}); diff --git a/tests/quat.spec.ts b/tests/quat.spec.ts deleted file mode 100644 index 1cbd6985..00000000 --- a/tests/quat.spec.ts +++ /dev/null @@ -1,801 +0,0 @@ -import { expect, describe, it, beforeEach } from 'vitest'; -import { Quat, QuatLike } from "../src/quat" -import { Vec3, Vec3Like } from "../src/vec3" -import "./test-utils" - -describe("Quat", () => { - describe("constructor", () => { - it("should return Quat(0, 0, 0, 1) if called with no arguments", () => { - expect(new Quat()).toBeVec(0, 0, 0, 1); - }); - - it("should return Quat(x, y, z, w) if called with (x, y, z, w)", () => { - expect(new Quat(1, 2, 3, 4)).toBeVec(1, 2, 3, 4); - expect(new Quat(-3, 4.4, -5.6, 7.8)).toBeVec(-3, 4.4, -5.6, 7.8); - }); - - it("should return Quat(x, x, x, x) if called with (x)", () => { - expect(new Quat(1)).toBeVec(1, 1, 1, 1); - expect(new Quat(-2.3)).toBeVec(-2.3, -2.3, -2.3, -2.3); - }); - - it("should return Quat(x, y, z, w) if called with ([x, y, z, w])", () => { - expect(new Quat([1, 2, 3, 4])).toBeVec(1, 2, 3, 4); - expect(new Quat([-3, 4.4, -5.6, 7.8])).toBeVec(-3, 4.4, -5.6, 7.8); - }); - - it("should return Quat(x, y, z, w) if called with (Quat(x, y, z, w))", () => { - let v = new Quat(3.4, 5.6, 7.8, 9); - expect(new Quat(v)).toBeVec(v); - }); - - it("should return Quat(x, y, z, w) if called with (Float32Array([x, y, z, w]))", () => { - let arr = new Float32Array([1.2, 3.4, 5.6, 7.8]); - expect(new Quat(arr)).toBeVec(arr); - }); - }); - - describe("static", () => { - let out: Quat - let quatA: Quat; - let quatB: Quat; - let result: any; - let vec: Vec3Like; - - const id = new Quat(0, 0, 0, 1); - const deg90 = Math.PI / 2; - - beforeEach(() => { - quatA = new Quat(1, 2, 3, 4); - quatB = new Quat(5, 6, 7, 8); - out = new Quat(0, 0, 0, 0); - vec = [1, 1, -1]; - }); - - describe("slerp", () => { - describe("the normal case", () => { - beforeEach(() => { - result = Quat.slerp(out, [0, 0, 0, 1], [0, 1, 0, 0], 0.5); - }); - - it("should return out", () => { expect(result).toBe(out); }); - it("should calculate proper quat", () => { - expect(result).toBeVec(0, 0.707106, 0, 0.707106); - }); - }); - - describe("where a == b", () => { - beforeEach(() => { - result = Quat.slerp(out, [0, 0, 0, 1], [0, 0, 0, 1], 0.5); - }); - - it("should return out", () => { expect(result).toBe(out); }); - it("should calculate proper quat", () => { - expect(result).toBeVec(0, 0, 0, 1); - }); - }); - - describe("where theta == 180deg", () => { - beforeEach(() => { - Quat.rotateX(quatA, [1,0,0,0], Math.PI); // 180 deg - result = Quat.slerp(out, [1,0,0,0], quatA, 1); - }); - - it("should calculate proper quat", () => { - expect(result).toBeVec(0,0,0,-1); - }); - }); - - describe("where a == -b", () => { - beforeEach(() => { - result = Quat.slerp(out, [1, 0, 0, 0], [-1, 0, 0, 0], 0.5); - }); - - it("should return out", () => { expect(result).toBe(out); }); - it("should calculate proper quat", () => { - expect(result).toBeVec(1, 0, 0, 0); - }); - }); - }); - - describe("pow", () => { - describe("identity quat", () => { - beforeEach(() => { - result = Quat.pow(out, id, 2.1 /* random number */); - }); - - it("should return out", () => { expect(result).toBe(out); }); - it("should be the identity", () => { - expect(result).toBeVec(id); - }); - }); - - describe("power of one", () => { - beforeEach(() => { - Quat.normalize(quatA, quatA); - - result = Quat.pow(out, quatA, 1); - }); - - it("should be the identity", () => { - expect(result).toBeVec(quatA); - }); - it("should be normalized", () => { - expect(Quat.length(result)).toBeCloseTo(1); - }); - }); - - describe("squared", () => { - beforeEach(() => { - Quat.normalize(quatA, quatA); - - result = Quat.pow(out, quatA, 2); - }); - - it("should be the square", () => { - let reference = Quat.multiply(Quat.create(), quatA, quatA); - expect(result).toBeVec(reference); - }); - it("should be normalized", () => { - expect(Quat.length(result)).toBeCloseTo(1); - }); - }); - - describe("conjugate", () => { - beforeEach(() => { - Quat.normalize(quatA, quatA); - - result = Quat.pow(out, quatA, -1); - }); - - it("should be the conjugate", () => { - let reference = Quat.conjugate(Quat.create(), quatA); - expect(result).toBeVec(reference); - }); - it("should be normalized", () => { - expect(Quat.length(result)).toBeCloseTo(1); - }); - }); - - describe("reversible", () => { - beforeEach(() => { - Quat.normalize(quatA, quatA); - - let b = 2.1; // random number - result = Quat.pow(out, quatA, b); - result = Quat.pow(out, result, 1/b); - }); - - it("should be reverted", () => { - expect(result).toBeVec(quatA); - }); - it("should be normalized", () => { - expect(Quat.length(result)).toBeCloseTo(1); - }); - }); - }); - - describe("rotateX", () => { - beforeEach(() => { - result = Quat.rotateX(out, id, deg90); - }); - - it("should return out", () => { expect(result).toBe(out); }); - it("should transform vec accordingly", () => { - Vec3.transformQuat(vec, [0,0,-1], out); - expect(vec).toBeVec(0, 1, 0); - }); - }); - - describe("rotateY", () => { - beforeEach(() => { - result = Quat.rotateY(out, id, deg90); - }); - - it("should return out", () => { expect(result).toBe(out); }); - it("should transform vec accordingly", () => { - Vec3.transformQuat(vec, [0,0,-1], out); - expect(vec).toBeVec(-1, 0, 0); - }); - }); - - describe("rotateZ", () => { - beforeEach(() => { - result = Quat.rotateZ(out, id, deg90); - }); - - it("should return out", () => { expect(result).toBe(out); }); - it("should transform vec accordingly", () => { - Vec3.transformQuat(vec, [0,1,0], out); - expect(vec).toBeVec(-1, 0, 0); - }); - }); - - /*describe("fromMat3", () => { - let matr; - - describe("legacy", () => { - beforeEach(() => { - matr = [ 1, 0, 0, - 0, 0, -1, - 0, 1, 0 ]; - result = Quat.fromMat3(out, matr); - }); - - it("should set dest to the correct value", () => { - expect(result).toBeVec(-0.707106, 0, 0, 0.707106); - }); - }); - - describe("where trace > 0", () => { - beforeEach(() => { - matr = [ 1, 0, 0, - 0, 0, -1, - 0, 1, 0 ]; - result = Quat.fromMat3(out, matr); - }); - - it("should return out", () => { expect(result).toBe(out); }); - - it("should produce the correct transformation", () => { - expect(Vec3.transformQuat([], [0,1,0], out)).toBeVec(0,0,-1); - }); - }); - - describe("from a normal matrix looking 'backward'", () => { - beforeEach(() => { - matr = mat3.create(); - mat3.transpose(matr, mat3.invert(matr, mat3.fromMat4(matr, mat4.lookAt(mat4.create(), [0, 0, 0], [0, 0, 1], [0, 1, 0])))); - result = Quat.fromMat3(out, matr); - }); - - it("should return out", () => { expect(result).toBe(out); }); - - it("should produce the same transformation as the given matrix", () => { - expect(Vec3.transformQuat([], [3,2,-1], Quat.normalize(out, out))).toBeEqualish(Vec3.transformMat3([], [3,2,-1], matr)); - }); - }); - - describe("from a normal matrix looking 'left' and 'upside down'", () => { - beforeEach(() => { - matr = mat3.create(); - mat3.transpose(matr, mat3.invert(matr, mat3.fromMat4(matr, mat4.lookAt(mat4.create(), [0, 0, 0], [-1, 0, 0], [0, -1, 0])))); - result = Quat.fromMat3(out, matr); - }); - - it("should return out", () => { expect(result).toBe(out); }); - - it("should produce the same transformation as the given matrix", () => { - expect(Vec3.transformQuat([], [3,2,-1], Quat.normalize(out, out))).toBeEqualish(Vec3.transformMat3([], [3,2,-1], matr)); - }); - }); - - describe("from a normal matrix looking 'upside down'", () => { - beforeEach(() => { - matr = mat3.create(); - mat3.transpose(matr, mat3.invert(matr, mat3.fromMat4(matr, mat4.lookAt(mat4.create(), [0, 0, 0], [0, 0, -1], [0, -1, 0])))); - result = Quat.fromMat3(out, matr); - }); - - it("should return out", () => { expect(result).toBe(out); }); - - it("should produce the same transformation as the given matrix", () => { - expect(Vec3.transformQuat([], [3,2,-1], Quat.normalize(out, out))).toBeEqualish(Vec3.transformMat3([], [3,2,-1], matr)); - }); - }); - });*/ - - describe("fromEuler", () => { - describe("legacy", () => { - beforeEach(() => { - result = Quat.fromEuler(out, -90, 0, 0); - }); - - it("should set dest to the correct value", () => { - expect(result).toBeVec(-0.707106, 0, 0, 0.707106); - }); - }); - - describe("where trace > 0", () => { - beforeEach(() => { - result = Quat.fromEuler(out, -90, 0, 0); - }); - - it("should return out", () => { expect(result).toBe(out); }); - - it("should produce the correct transformation", () => { - expect(Vec3.transformQuat([], [0,1,0], out)).toBeVec(0,0,-1); - }); - }); - }); - - /*describe("setAxes", () => { - let r; - beforeEach(() => { r = Vec3.create(); }); - - describe("looking left", () => { - let view, up, right; - beforeEach(() => { - view = [-1, 0, 0]; - up = [ 0, 1, 0]; - right= [ 0, 0,-1]; - result = Quat.setAxes([], view, right, up); - }); - - it("should transform local view into world left", () => { - r = Vec3.transformQuat([], [0,0,-1], result); - expect(r).toBeVec(1, 0, 0); - }); - - it("should transform local right into world front", () => { - r = Vec3.transformQuat([], [1,0,0], result); - expect(r).toBeVec(0, 0, 1); - }); - }); - - describe("given opengl defaults", () => { - let view, up, right; - beforeEach(() => { - view = [0, 0, -1]; - up = [0, 1, 0]; - right= [1, 0, 0]; - result = Quat.setAxes(out, view, right, up); - }); - - it("should return out", () => { - expect(result).toBe(out); - }); - - it("should produce identity", () => { - expect(out).toBeVec(0, 0, 0, 1); - }); - }); - - describe("legacy example", () => { - let view, up, right; - beforeEach(() => { - right= [1, 0, 0]; - up = [0, 0, 1]; - view = [0, -1, 0]; - result = Quat.setAxes(out, view, right, up); - }); - - xit("should set correct quat4 values", () => { - expect(result).toBeVec(0.707106, 0, 0, 0.707106); - }); - }); - });*/ - - describe("rotationTo", () => { - let r; - beforeEach(() => { r = Vec3.create(); }); - - describe("at right angle", () => { - beforeEach(() => { - result = Quat.rotationTo(out, [0, 1, 0], [1, 0, 0]); - }); - - it("should return out", () => { expect(result).toBe(out); }); - - it("should calculate proper quaternion", () => { - expect(out).toBeVec(0, 0, -0.707106, 0.707106); - }); - }); - - describe("when vectors are parallel", () => { - beforeEach(() => { - result = Quat.rotationTo(out, [0, 1, 0], [0, 1, 0]); - }); - - it("should return out", () => { expect(result).toBe(out); }); - - it("multiplying A should produce B", () => { - expect(Vec3.transformQuat(r, [0, 1, 0], out)).toBeVec(0, 1, 0); - }); - }); - - describe("when vectors are opposed X", () => { - beforeEach(() => { - result = Quat.rotationTo(out, [1, 0, 0], [-1, 0, 0]); - }); - - it("should return out", () => { expect(result).toBe(out); }); - - it("multiplying A should produce B", () => { - expect(Vec3.transformQuat(r, [1, 0, 0], out)).toBeVec(-1, 0, 0); - }); - }); - - describe("when vectors are opposed Y", () => { - beforeEach(() => { - result = Quat.rotationTo(out, [0, 1, 0], [0, -1, 0]); - }); - - it("should return out", () => { expect(result).toBe(out); }); - - it("multiplying A should produce B", () => { - expect(Vec3.transformQuat(r, [0, 1, 0], out)).toBeVec(0, -1, 0); - }); - }); - - describe("when vectors are opposed Z", () => { - beforeEach(() => { - result = Quat.rotationTo(out, [0, 0, 1], [0, 0, -1]); - }); - - it("should return out", () => { expect(result).toBe(out); }); - - it("multiplying A should produce B", () => { - expect(Vec3.transformQuat(r, [0, 0, 1], out)).toBeVec(0, 0, -1); - }); - }); - }); - - describe("create", () => { - beforeEach(() => { result = Quat.create(); }); - it("should return a 4 element array initialized to an identity quaternion", () => { expect(result).toBeVec(0, 0, 0, 1); }); - }); - - describe("clone", () => { - beforeEach(() => { result = Quat.clone(quatA); }); - it("should return a 4 element array initialized to the values in quatA", () => { expect(result).toBeVec(quatA); }); - }); - - describe("fromValues", () => { - beforeEach(() => { result = Quat.fromValues(1, 2, 3, 4); }); - it("should return a 4 element array initialized to the values passed", () => { expect(result).toBeVec(1, 2, 3, 4); }); - }); - - describe("copy", () => { - beforeEach(() => { result = Quat.copy(out, quatA); }); - it("should place values into out", () => { expect(out).toBeVec(1, 2, 3, 4); }); - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("set", () => { - beforeEach(() => { result = Quat.set(out, 1, 2, 3, 4); }); - it("should place values into out", () => { expect(out).toBeVec(1, 2, 3, 4); }); - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("identity", () => { - beforeEach(() => { result = Quat.identity(out); }); - it("should place values into out", () => { expect(result).toBeVec(0, 0, 0, 1); }); - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("setAxisAngle", () => { - beforeEach(() => { result = Quat.setAxisAngle(out, [1, 0, 0], Math.PI * 0.5); }); - it("should place values into out", () => { expect(result).toBeVec(0.707106, 0, 0, 0.707106); }); - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("getAxisAngle", () => { - let angle: number; - describe("for a quaternion representing no rotation", () => { - beforeEach(() => { result = Quat.setAxisAngle(out, [0, 1, 0], 0.0); angle = Quat.getAxisAngle(vec, out); }); - it("should return a multiple of 2*PI as the angle component", () => { expect(angle % (Math.PI * 2.0)).toBeCloseTo(0.0); }); - }); - - describe("for a simple rotation about X axis", () => { - beforeEach(() => { result = Quat.setAxisAngle(out, [1, 0, 0], 0.7778); angle = Quat.getAxisAngle(vec, out); }); - it("should return the same provided angle", () => { expect(angle).toBeCloseTo(0.7778); }); - it("should return the X axis as the angle", () => { expect(vec).toBeVec(1, 0, 0); }); - }); - - describe("for a simple rotation about Y axis", () => { - beforeEach(() => { result = Quat.setAxisAngle(out, [0, 1, 0], 0.879546); angle = Quat.getAxisAngle(vec, out); }); - it("should return the same provided angle", () => { expect(angle).toBeCloseTo(0.879546); }); - it("should return the X axis as the angle", () => { expect(vec).toBeVec(0, 1, 0); }); - }); - - describe("for a simple rotation about Z axis", () => { - beforeEach(() => { result = Quat.setAxisAngle(out, [0, 0, 1], 0.123456); angle = Quat.getAxisAngle(vec, out); }); - it("should return the same provided angle", () => { expect(angle).toBeCloseTo(0.123456); }); - it("should return the X axis as the angle", () => { expect(vec).toBeVec(0, 0, 1); }); - }); - - describe("for a slightly irregular axis and right angle", () => { - beforeEach(() => { result = Quat.setAxisAngle(out, [0.707106, 0, 0.707106], Math.PI * 0.5); angle = Quat.getAxisAngle(vec, out); }); - it("should place values into vec", () => { expect(vec).toBeVec(0.707106, 0, 0.707106); }); - it("should return a numeric angle", () => { expect(angle).toBeCloseTo(Math.PI * 0.5); }); - }); - - describe("for a very irregular axis and negative input angle", () => { - beforeEach(() => { - quatA = Quat.setAxisAngle(quatA, [0.65538555, 0.49153915, 0.57346237], 8.8888); - angle = Quat.getAxisAngle(vec, quatA); - quatB = Quat.setAxisAngle(quatB, vec, angle); - }); - it("should return an angle between 0 and 2*PI", () => { expect(angle).toBeGreaterThan(0.0); expect(angle).toBeLessThan(Math.PI * 2.0); }); - it("should create the same quaternion from axis and angle extracted", () => { expect(quatA).toBeVec(quatB); }); - }); - }); - - describe("getAngle", () => { - describe("from itself", () => { - beforeEach(() => { - Quat.normalize(quatA, quatA); - }); - - it("should be zero", () => { - expect(Quat.getAngle(quatA, quatA)).toBeCloseTo(0); - }); - }); - - describe("from rotated", () => { - beforeEach(() => { - Quat.normalize(quatA, quatA); - Quat.rotateX(quatB, quatA, Math.PI / 4); - }); - - it("should be 45 degrees", () => { - expect(Quat.getAngle(quatA, quatB)).toBeCloseTo(Math.PI / 4); - }); - }); - - describe("compare with axisAngle", () => { - beforeEach(() => { - Quat.normalize(quatA, quatA); - Quat.normalize(quatB, quatB); - }); - - it("should be equalish", () => { - // compute reference value as axisAngle of quatA^{-1} * quatB - let quatAInv = Quat.conjugate(Quat.create(), quatA); - let quatAB = Quat.multiply(quatAInv, quatAInv, quatB); - let dummy = Vec3.create(); - let reference = Quat.getAxisAngle(dummy, quatAB); - - expect(Quat.getAngle(quatA, quatB)).toBeCloseTo(reference); - }); - }); - }); - - describe("add", () => { - describe("with a separate output quaternion", () => { - beforeEach(() => { result = Quat.add(out, quatA, quatB); }); - - it("should place values into out", () => { expect(out).toBeVec(6, 8, 10, 12); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify quatA", () => { expect(quatA).toBeVec(1, 2, 3, 4); }); - it("should not modify quatB", () => { expect(quatB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when quatA is the output quaternion", () => { - beforeEach(() => { result = Quat.add(quatA, quatA, quatB); }); - - it("should place values into quatA", () => { expect(quatA).toBeVec(6, 8, 10, 12); }); - it("should return quatA", () => { expect(result).toBe(quatA); }); - it("should not modify quatB", () => { expect(quatB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when quatB is the output quaternion", () => { - beforeEach(() => { result = Quat.add(quatB, quatA, quatB); }); - - it("should place values into quatB", () => { expect(quatB).toBeVec(6, 8, 10, 12); }); - it("should return quatB", () => { expect(result).toBe(quatB); }); - it("should not modify quatA", () => { expect(quatA).toBeVec(1, 2, 3, 4); }); - }); - }); - - describe("multiply", () => { - it("should have an alias called 'mul'", () => { expect(Quat.mul).toEqual(Quat.multiply); }); - - describe("with a separate output quaternion", () => { - beforeEach(() => { result = Quat.multiply(out, quatA, quatB); }); - - it("should place values into out", () => { expect(out).toBeVec(24, 48, 48, -6); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify quatA", () => { expect(quatA).toBeVec(1, 2, 3, 4); }); - it("should not modify quatB", () => { expect(quatB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when quatA is the output quaternion", () => { - beforeEach(() => { result = Quat.multiply(quatA, quatA, quatB); }); - - it("should place values into quatA", () => { expect(quatA).toBeVec(24, 48, 48, -6); }); - it("should return quatA", () => { expect(result).toBe(quatA); }); - it("should not modify quatB", () => { expect(quatB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when quatB is the output quaternion", () => { - beforeEach(() => { result = Quat.multiply(quatB, quatA, quatB); }); - - it("should place values into quatB", () => { expect(quatB).toBeVec(24, 48, 48, -6); }); - it("should return quatB", () => { expect(result).toBe(quatB); }); - it("should not modify quatA", () => { expect(quatA).toBeVec(1, 2, 3, 4); }); - }); - }); - - describe("scale", () => { - describe("with a separate output quaternion", () => { - beforeEach(() => { result = Quat.scale(out, quatA, 2); }); - - it("should place values into out", () => { expect(out).toBeVec(2, 4, 6, 8); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify quatA", () => { expect(quatA).toBeVec(1, 2, 3, 4); }); - }); - - describe("when quatA is the output quaternion", () => { - beforeEach(() => { result = Quat.scale(quatA, quatA, 2); }); - - it("should place values into quatA", () => { expect(quatA).toBeVec(2, 4, 6, 8); }); - it("should return quatA", () => { expect(result).toBe(quatA); }); - }); - }); - - describe("length", () => { - it("should have an alias called 'len'", () => { expect(Quat.len).toEqual(Quat.length); }); - - beforeEach(() => { result = Quat.len(quatA); }); - - it("should return the length", () => { expect(result).toBeCloseTo(5.477225); }); - }); - - describe("squaredLength", () => { - it("should have an alias called 'sqrLen'", () => { expect(Quat.sqrLen).toEqual(Quat.squaredLength); }); - - beforeEach(() => { result = Quat.squaredLength(quatA); }); - - it("should return the squared length", () => { expect(result).toEqual(30); }); - }); - - describe("normalize", () => { - beforeEach(() => { quatA = [5, 0, 0, 0]; }); - - describe("with a separate output quaternion", () => { - beforeEach(() => { result = Quat.normalize(out, quatA); }); - - it("should place values into out", () => { expect(out).toBeVec(1, 0, 0, 0); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify quatA", () => { expect(quatA).toBeVec(5, 0, 0, 0); }); - }); - - describe("when quatA is the output quaternion", () => { - beforeEach(() => { result = Quat.normalize(quatA, quatA); }); - - it("should place values into quatA", () => { expect(quatA).toBeVec(1, 0, 0, 0); }); - it("should return quatA", () => { expect(result).toBe(quatA); }); - }); - }); - - describe("lerp", () => { - describe("with a separate output quaternion", () => { - beforeEach(() => { result = Quat.lerp(out, quatA, quatB, 0.5); }); - - it("should place values into out", () => { expect(out).toBeVec(3, 4, 5, 6); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify quatA", () => { expect(quatA).toBeVec(1, 2, 3, 4); }); - it("should not modify quatB", () => { expect(quatB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when quatA is the output quaternion", () => { - beforeEach(() => { result = Quat.lerp(quatA, quatA, quatB, 0.5); }); - - it("should place values into quatA", () => { expect(quatA).toBeVec(3, 4, 5, 6); }); - it("should return quatA", () => { expect(result).toBe(quatA); }); - it("should not modify quatB", () => { expect(quatB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when quatB is the output quaternion", () => { - beforeEach(() => { result = Quat.lerp(quatB, quatA, quatB, 0.5); }); - - it("should place values into quatB", () => { expect(quatB).toBeVec(3, 4, 5, 6); }); - it("should return quatB", () => { expect(result).toBe(quatB); }); - it("should not modify quatA", () => { expect(quatA).toBeVec(1, 2, 3, 4); }); - }); - }); - - describe("slerp", () => { - describe("with a separate output quaternion", () => { - beforeEach(() => { result = Quat.slerp(out, quatA, quatB, 0.5); }); - - it("should place values into out", () => { expect(out).toBeVec(3, 4, 5, 6); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify quatA", () => { expect(quatA).toBeVec(1, 2, 3, 4); }); - it("should not modify quatB", () => { expect(quatB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when quatA is the output quaternion", () => { - beforeEach(() => { result = Quat.slerp(quatA, quatA, quatB, 0.5); }); - - it("should place values into quatA", () => { expect(quatA).toBeVec(3, 4, 5, 6); }); - it("should return quatA", () => { expect(result).toBe(quatA); }); - it("should not modify quatB", () => { expect(quatB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when quatB is the output quaternion", () => { - beforeEach(() => { result = Quat.slerp(quatB, quatA, quatB, 0.5); }); - - it("should place values into quatB", () => { expect(quatB).toBeVec(3, 4, 5, 6); }); - it("should return quatB", () => { expect(result).toBe(quatB); }); - it("should not modify quatA", () => { expect(quatA).toBeVec(1, 2, 3, 4); }); - }); - }); - - /*describe("random", () => { - beforeEach(() => { result = Quat.random(out); }); - - it("should result in a normalized quaternion", () => { - let copy = Quat.clone(out); - expect(Quat.normalize(out, out)).toBeVec(copy); - }); - it("should return out", () => { expect(result).toBe(out); }); - });*/ - - describe("invert", () => { - describe("with a separate output quaternion", () => { - beforeEach(() => { result = Quat.invert(out, quatA); }); - - it("should place values into out", () => { expect(out).toBeVec(-0.033333, -0.066666, -0.1, 0.133333); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify quatA", () => { expect(quatA).toBeVec(1, 2, 3, 4); }); - }); - - describe("when quatA is the output quaternion", () => { - beforeEach(() => { result = Quat.invert(quatA, quatA); }); - - it("should place values into quatA", () => { expect(quatA).toBeVec(-0.033333, -0.066666, -0.1, 0.133333); }); - it("should return quatA", () => { expect(result).toBe(quatA); }); - }); - }); - - describe("conjugate", () => { - describe("with a separate output quaternion", () => { - beforeEach(() => { result = Quat.conjugate(out, quatA); }); - - it("should place values into out", () => { expect(out).toBeVec(-1, -2, -3, 4); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify quatA", () => { expect(quatA).toBeVec(1, 2, 3, 4); }); - }); - - describe("when quatA is the output quaternion", () => { - beforeEach(() => { result = Quat.conjugate(quatA, quatA); }); - - it("should place values into quatA", () => { expect(quatA).toBeVec(-1, -2, -3, 4); }); - it("should return quatA", () => { expect(result).toBe(quatA); }); - }); - }); - - describe("str", () => { - beforeEach(() => { result = Quat.str(quatA); }); - - it("should return a string representation of the quaternion", () => { expect(result).toEqual("Quat(1, 2, 3, 4)"); }); - }); - - describe("exactEquals", () => { - let quatC, r0, r1; - beforeEach(() => { - quatA = [0, 1, 2, 3]; - quatB = [0, 1, 2, 3]; - quatC = [1, 2, 3, 4]; - r0 = Quat.exactEquals(quatA, quatB); - r1 = Quat.exactEquals(quatA, quatC); - }); - - it("should return true for identical quaternions", () => { expect(r0).toBe(true); }); - it("should return false for different quaternions", () => { expect(r1).toBe(false); }); - it("should not modify quatA", () => { expect(quatA).toBeVec(0, 1, 2, 3); }); - it("should not modify quatB", () => { expect(quatB).toBeVec(0, 1, 2, 3); }); - }); - - describe("equals", () => { - let quatC, quatD, r0, r1, r2; - beforeEach(() => { - quatA = [0, 1, 2, 3]; - quatB = [0, 1, 2, 3]; - quatC = [1, 2, 3, 4]; - quatD = [1e-16, 1, 2, 3]; - r0 = Quat.equals(quatA, quatB); - r1 = Quat.equals(quatA, quatC); - r2 = Quat.equals(quatA, quatD); - }); - it("should return true for identical quaternions", () => { expect(r0).toBe(true); }); - it("should return false for different quaternions", () => { expect(r1).toBe(false); }); - it("should return true for close but not identical quaternions", () => { expect(r2).toBe(true); }); - it("should not modify quatA", () => { expect(quatA).toBeVec(0, 1, 2, 3); }); - it("should not modify quatB", () => { expect(quatB).toBeVec(0, 1, 2, 3); }); - }); - }); -}); \ No newline at end of file diff --git a/tests/quat2.spec.ts b/tests/quat2.spec.ts deleted file mode 100644 index c959e724..00000000 --- a/tests/quat2.spec.ts +++ /dev/null @@ -1,759 +0,0 @@ -import { expect, describe, it, beforeEach } from 'vitest'; -import { Quat2, Quat2Like } from "../src/quat2" -import "./test-utils" -import { Vec3, Vec3Like } from '../src/vec3'; -import { Quat, QuatLike } from '../src/quat'; -import { Mat4 } from '../src/mat4'; - -describe("Quat2", () => { - describe("constructor", () => { - it("should return Quat2(0, 0, 0, 1, 0, 0, 0, 0) if called with no arguments", () => { - expect(new Quat2()).toBeVec(0, 0, 0, 1, 0, 0, 0, 0); - }); - - it("should return Quat(x, y, z, w, x2, y2, z2, w2) if called with (x, y, z, w, x2, y2, z2, w2)", () => { - expect(new Quat2(1, 2, 3, 4, 5, 6, 7, 8)).toBeVec(1, 2, 3, 4, 5, 6, 7, 8); - expect(new Quat2(-3, 4.4, -5.6, 7.8, 9.0, -10.11, 12.13, -14.15)).toBeVec(-3, 4.4, -5.6, 7.8, 9.0, -10.11, 12.13, -14.15); - }); - - it("should return Quat(x, x, x, x, x, x, x, x) if called with (x)", () => { - expect(new Quat2(1)).toBeVec(1, 1, 1, 1, 1, 1, 1, 1); - expect(new Quat2(-2.3)).toBeVec(-2.3, -2.3, -2.3, -2.3, -2.3, -2.3, -2.3, -2.3); - }); - - it("should return Quat(x, y, z, w) if called with ([x, y, z, w])", () => { - expect(new Quat2([1, 2, 3, 4, 5, 6, 7, 8])).toBeVec(1, 2, 3, 4, 5, 6, 7, 8); - expect(new Quat2([-3, 4.4, -5.6, 7.8, 9.0, -10.11, 12.13, -14.15])).toBeVec(-3, 4.4, -5.6, 7.8, 9.0, -10.11, 12.13, -14.15); - }); - - it("should return Quat(x, y, z, w, x2, y2, z2, w2) if called with (Quat(x, y, z, w, x2, y2, z2, w2))", () => { - let v = new Quat2(1, 2, 3, 4, 5, 6, 7, 8); - expect(new Quat2(v)).toBeVec(v); - }); - - it("should return Quat(x, y, z, w, x2, y2, z2, w2) if called with (Float32Array([x, y, z, w, x2, y2, z2, w2]))", () => { - let arr = new Float32Array([1.2, 3.4, 5.6, 7.8, 9.10, 11.12, 13.14, 15.16]); - expect(new Quat2(arr)).toBeVec(arr); - }); - }); - - describe("static", () => { - let out: Quat2; - let outVec: Vec3; - let quat2A: Quat2Like; - let quat2B: Quat2Like; - let result: any; - let resultVec: Vec3Like; - let outQuat: QuatLike; - let vec: Vec3Like; - - beforeEach(function() { - quat2A = new Quat2(1, 2, 3, 4, 2, 5, 6, -2); - quat2B = new Quat2(5, 6, 7, 8, 9, 8, 6, -4); - out = new Quat2(); - outVec = new Vec3(); - outQuat = new Quat(); - vec = new Vec3(1, 1, -1); - }); - - describe("translate", function() { - let matrixA = Mat4.create(), matOut = Mat4.create(), quatOut = Quat2.create(); - beforeEach(function() { - //quat2A only seems to work when created using this function? - quat2B = Quat2.fromRotationTranslation(quat2A, [1,2,3,4], [-5, 4, 10]); - Quat2.normalize(quat2A, quat2A); - Mat4.fromQuat2(matrixA, quat2A); - }); - - describe("with a separate output quaternion", function() { - beforeEach(function() { - result = Quat2.translate(out, quat2A, vec); - //Same thing with a matrix - Mat4.translate(matOut, matrixA, vec); - Quat2.fromMat4(quatOut, matOut); - }); - - it("should place values into out", function() { expect(out).toBeQuat2(quatOut); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2(quat2B); }); - it("should not modify vec", function() { expect(vec).toBeVec(1,1,-1); }); - }); - - describe("when quat2A is the output quaternion", function() { - beforeEach(function() { - result = Quat2.translate(quat2A, quat2A, vec); - //Same thing with a matrix - Mat4.translate(matOut, matrixA, vec); - Quat2.fromMat4(quatOut, matOut); - }); - - it("should place values into quat2A", function() { expect(quat2A).toBeQuat2(quatOut); }); - it("should return quat2A", function() { expect(result).toBe(quat2A); }); - }); - }); - - describe("rotateAroundAxis", function() { - let matrixA = new Mat4(); - let matOut = new Mat4(); - let ax: Vec3Like = [1,4,2]; - beforeEach(function() { - //quat2A only seems to work when created using this function? - Quat2.fromRotationTranslation(quat2A, [1,2,3,4], [-5, 4, 10]); - Quat2.normalize(quat2A, quat2A); - Mat4.fromQuat2(matrixA, quat2A); - }); - - - describe("with a separate output quaternion", function() { - beforeEach(function() { - result = Quat2.rotateAroundAxis(out, quat2A, ax, 5); - - //Same thing with a matrix - Mat4.rotate(matOut, matrixA, 5, ax); - Quat2.fromMat4(quat2B, matOut); - }); - - it("should place values into out", function() { expect(out).toBeQuat2(quat2B); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2( - 0.18257418583505536, 0.3651483716701107, 0.5477225575051661, 0.7302967433402214, - -2.556038601690775, 3.742770809618635, 2.37346441585572, -3.0124740662784135 - ); }); - it("should not modify ax", function() { expect(ax).toBeVec(1, 4, 2); }); - }); - - describe("when quat2A is the output quaternion", function() { - beforeEach(function() { - result = Quat2.rotateAroundAxis(quat2A, quat2A, ax, 5); - //Same thing with a matrix - - Mat4.rotate(matOut, matrixA, 5, ax); - Quat2.fromMat4(quat2B, matOut); - }); - - it("should place values into quat2A", function() { expect(quat2A).toBeQuat2(quat2B); }); - it("should return quat2A", function() { expect(result).toBe(quat2A); }); - it("should not modify ax", function() { expect(ax).toBeVec(1, 4, 2); }); - }); - }); - - describe("rotateByQuatAppend", function() { - let correctResult = Quat2.create(); - let rotationQuat = Quat2.create(); - beforeEach(function() { - rotationQuat[0] = 2; - rotationQuat[1] = 5; - rotationQuat[2] = 2; - rotationQuat[3] = -10; - Quat2.multiply(correctResult, quat2A, rotationQuat); - }) - describe("with a separate output quaternion", function() { - beforeEach(function() { - result = Quat2.rotateByQuatAppend(out, quat2A, [2, 5, 2, -10]); - }); - - it("should place values into out", function() { expect(out).toBeQuat2(correctResult); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2); }); - it("should not modify the rotation quaternion", function() { expect(rotationQuat).toBeQuat2(2,5,2,-10,0,0,0,0); }); - }); - - describe("when quat2A is the output quaternion", function() { - beforeEach(function() { result = Quat2.rotateByQuatAppend(quat2A, quat2A, [2, 5, 2, -10]); }); - - it("should place values into quat2A", function() { expect(quat2A).toBeQuat2(correctResult); }); - it("should return quat2A", function() { expect(result).toBe(quat2A); }); - it("should not modify the rotation quaternion", function() { expect(rotationQuat).toBeQuat2(2,5,2,-10,0,0,0,0); }); - }); - }); - - describe("rotateByQuatPrepend", function() { - let correctResult = Quat2.create(); - let rotationQuat = Quat2.create(); - beforeEach(function() { - rotationQuat[0] = 2; - rotationQuat[1] = 5; - rotationQuat[2] = 2; - rotationQuat[3] = -10; - Quat2.multiply(correctResult, rotationQuat, quat2A); - }) - describe("with a separate output quaternion", function() { - beforeEach(function() { - result = Quat2.rotateByQuatPrepend(out, Quat2.getReal(outQuat, rotationQuat), quat2A); - }); - - it("should place values into out", function() { expect(out).toBeQuat2(correctResult); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2); }); - it("should not modify the rotation quaternion", function() { expect(rotationQuat).toBeQuat2(2,5,2,-10,0,0,0,0); }); - }); - - describe("when quat2A is the output quaternion", function() { - beforeEach(function() { result = Quat2.rotateByQuatPrepend(quat2A, Quat2.getReal(outQuat, rotationQuat), quat2A); }); - - it("should place values into quat2A", function() { expect(quat2A).toBeQuat2(correctResult); }); - it("should return quat2A", function() { expect(result).toBe(quat2A); }); - it("should not modify the rotation quaternion", function() { expect(rotationQuat).toBeQuat2(2,5,2,-10,0,0,0,0); }); - }); - }); - - describe("rotateX", function() { - let matrixA = Mat4.create(), matOut = Mat4.create(), quatOut = Quat2.create(); - beforeEach(function() { - //quat2A only seems to work when created using this function? - quat2B = Quat2.fromRotationTranslation(quat2A, [1,2,3,4], [-5, 4, 10]) as Quat2; - Quat2.normalize(quat2A, quat2A); - Mat4.fromQuat2(matrixA, quat2A); - }); - describe("with a separate output quaternion", function() { - beforeEach(function() { - result = Quat2.rotateX(out, quat2A, 5); - //Same thing with a matrix - Mat4.rotateX(matOut, matrixA, 5); - Quat2.fromMat4(quatOut, matOut); - }); - - it("should place values into out", function() { expect(out).toBeQuat2(quatOut); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2(quat2B); }); - }); - - describe("when quat2A is the output quaternion", function() { - beforeEach(function() { - result = Quat2.rotateX(quat2A, quat2A, 5); - //Same thing with a matrix - Mat4.rotateX(matOut, matrixA, 5); - Quat2.fromMat4(quatOut, matOut); - }); - - it("should place values into quat2A", function() { expect(quat2A).toBeQuat2(quatOut); }); - it("should return quat2A", function() { expect(result).toBe(quat2A); }); - }); - }); - - describe("rotateY", function() { - let matrixA = Mat4.create(), matOut = Mat4.create(), quatOut = Quat2.create(); - beforeEach(function() { - //quat2A only seems to work when created using this function? - quat2B = Quat2.fromRotationTranslation(quat2A, [1,2,3,4], [5, 4, -10]) as Quat2; - Quat2.normalize(quat2A, quat2A); - Mat4.fromQuat2(matrixA, quat2A); - }); - - describe("with a separate output quaternion", function() { - beforeEach(function() { - result = Quat2.rotateY(out, quat2A, -2); - //Same thing with a matrix - Mat4.rotateY(matOut, matrixA, -2); - Quat2.fromMat4(quatOut, matOut); - }); - - it("should place values into out", function() { expect(out).toBeQuat2(quatOut); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2(quat2B); }); - }); - - describe("when quat2A is the output quaternion", function() { - beforeEach(function() { - result = Quat2.rotateY(quat2A, quat2A, -2); - //Same thing with a matrix - Mat4.rotateY(matOut, matrixA, -2); - Quat2.fromMat4(quatOut, matOut); - }); - - it("should place values into quat2A", function() { expect(quat2A).toBeQuat2(quatOut); }); - it("should return quat2A", function() { expect(result).toBe(quat2A); }); - }); - }); - - describe("rotateZ", function() { - let matrixA = Mat4.create(), matOut = Mat4.create(), quatOut = Quat2.create(); - beforeEach(function() { - //quat2A only seems to work when created using this function? - quat2B = Quat2.fromRotationTranslation(quat2A, [1,0,3,-4], [0, -4, -10]) as Quat2; - Quat2.normalize(quat2A, quat2A); - Mat4.fromQuat2(matrixA, quat2A); - }); - describe("with a separate output quaternion", function() { - beforeEach(function() { - result = Quat2.rotateZ(out, quat2A, 1); - //Same thing with a matrix - Mat4.rotateZ(matOut, matrixA, 1); - Quat2.fromMat4(quatOut, matOut); - }); - - it("should place values into out", function() { expect(out).toBeQuat2(quatOut); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2(quat2B); }); - }); - - describe("when quat2A is the output quaternion", function() { - beforeEach(function() { - result = Quat2.rotateZ(quat2A, quat2A, 1); - //Same thing with a matrix - Mat4.rotateZ(matOut, matrixA, 1); - Quat2.fromMat4(quatOut, matOut); - }); - - it("should place values into quat2A", function() { expect(quat2A).toBeQuat2(quatOut); }); - it("should return quat2A", function() { expect(result).toBe(quat2A); }); - }); - }); - - describe("from/toMat4", function() { - let matRes = Mat4.create(), matOut = Mat4.create(); - let rotationQuat = Quat.create(); - describe("quat to matrix and back", function() { - beforeEach(function() { - Quat.normalize(rotationQuat, [1,2,3,4]); - - Quat2.fromRotationTranslation(quat2A, rotationQuat, [1,-5,3]); - matRes = Mat4.fromQuat2(matOut, quat2A) as Mat4; - - result = Quat2.fromMat4(out, matRes); - }); - - it("should return out", function() { expect(result).toBe(out); }); - it("should return matOut", function() { expect(matRes).toBe(matOut); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2(0.18257418, 0.36514836, 0.54772257, 0.73029673, -1.5518806, -1.82574184, 1.73445473, 0 ); }); - - it("should be equal to the starting dual quat", function() { - expect(quat2A).toBeQuat2(result); - }); - - }); - }); - - describe("create", function() { - beforeEach(function() { result = Quat2.create(); }); - it("should return 2 4 element arrays initialized to an identity dual quaternion", function() { expect(result).toBeQuat2(0, 0, 0, 1, 0, 0, 0, 0); }); - }); - - describe("clone", function() { - beforeEach(function() { result = Quat2.clone(quat2A); }); - it("should return 2 4 element arrays initialized to the values in quat2A", function() { expect(result).toBeQuat2(quat2A); }); - }); - - describe("fromValues", function() { - beforeEach(function() { result = Quat2.fromValues(1, 2, 3, 4, 5, 7, 8, -2); }); - it("should return 2 4 element arrays initialized to the values passedd to the values passed", function() { - expect(result).toBeQuat2(1, 2, 3, 4, 5, 7, 8, -2); - }); - }); - - describe("copy", function() { - beforeEach(function() { result = Quat2.copy(out, quat2A); }); - it("should place values into out", function() { expect(out).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2); }); - it("should return out", function() { expect(result).toBe(out); }); - }); - - describe("set", function() { - beforeEach(function() { result = Quat2.set(out, 1, 2, 3, 4, 2, 5, 6, -2); }); - it("should place values into out", function() { expect(out).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2); }); - it("should return out", function() { expect(result).toBe(out); }); - }); - - describe("identity", function() { - beforeEach(function() { result = Quat2.identity(out); }); - it("should place values into out", function() { expect(result).toBeQuat2(0, 0, 0, 1, 0, 0, 0, 0); }); - it("should return out", function() { expect(result).toBe(out); }); - }); - - describe("add", function() { - describe("with a separate output dual quaternion", function() { - beforeEach(function() { result = Quat2.add(out, quat2A, quat2B); }); - - it("should place values into out", function() { expect(out).toBeQuat2(6, 8, 10, 12, 11, 13, 12, -6); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2); }); - it("should not modify quat2B", function() { expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4); }); - }); - - describe("when quat2A is the output dual quaternion", function() { - beforeEach(function() { result = Quat2.add(quat2A, quat2A, quat2B); }); - - it("should place values into quat2A", function() { expect(quat2A).toBeQuat2(6, 8, 10, 12, 11, 13, 12, -6); }); - it("should return quat2A", function() { expect(result).toBe(quat2A); }); - it("should not modify quat2B", function() { expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4)}); - }); - - describe("when quat2B is the output dual quaternion", function() { - beforeEach(function() { result = Quat2.add(quat2B, quat2A, quat2B); }); - - it("should place values into quat2B", function() { expect(quat2B).toBeQuat2(6, 8, 10, 12, 11, 13, 12, -6); }); - it("should return quat2B", function() { expect(result).toBe(quat2B); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2); }); - }); - }); - - describe("multiply", function() { - it("should have an alias called 'mul'", function() { expect(Quat2.mul).toEqual(Quat2.multiply); }); - - describe("with a separate output quaternion", function() { - beforeEach(function() { result = Quat2.multiply(out, quat2A, quat2B); }); - - it("should place values into out", function() { expect(out).toBeQuat2(24, 48, 48, -6, 25, 89, 23, -157); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2); }); - it("should not modify quat2B", function() { expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4); }); - }); - - describe("when quat2A is the output quaternion", function() { - beforeEach(function() { result = Quat2.multiply(quat2A, quat2A, quat2B); }); - - it("should place values into quat2A", function() { expect(quat2A).toBeQuat2(24, 48, 48, -6, 25, 89, 23, -157 ); }); - it("should return quat2A", function() { expect(result).toBe(quat2A); }); - it("should not modify quat2B", function() { expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4); }); - }); - - describe("when quat2B is the output quaternion", function() { - beforeEach(function() { result = Quat2.multiply(quat2B, quat2A, quat2B); }); - - it("should place values into quat2B", function() { expect(quat2B).toBeQuat2(24, 48, 48, -6, 25, 89, 23, -157); }); - it("should return quat2B", function() { expect(result).toBe(quat2B); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2); }); - }); - - describe("same as matrix multiplication", function() { - let matrixA = Mat4.create(), matrixB = Mat4.create(); - let matOut = Mat4.create(), quatOut = Quat2.create(); - beforeEach(function() { - //quat2A and quat2B only seem to work when created using this function? - Quat2.fromRotationTranslation(quat2A, [1,2,3,4], [-5, 4, 10]); - Quat2.normalize(quat2A, quat2A); - Mat4.fromQuat2(matrixA, quat2A); - - Quat2.fromRotationTranslation(quat2B, [5, 6, 7, 8], [9, 8, 6]); - Quat2.normalize(quat2B, quat2B); - Mat4.fromQuat2(matrixB, quat2B); - - }); - it("the matrices should be equal to the dual quaternions", function() { - let testQuat = Quat2.create(); - Quat2.fromMat4(testQuat, matrixA); - expect(testQuat).toBeQuat2(...quat2A); - - Quat2.fromMat4(testQuat, matrixB); - expect(testQuat).toBeQuat2(...quat2B); - }); - - it("should be equal to the matrix multiplication", function() { - Quat2.multiply(out, quat2A, quat2B); - Mat4.mul(matOut, matrixA, matrixB); - Quat2.fromMat4(quatOut, matOut); - expect(out).toBeQuat2(quatOut); - }); - - }); - }); - - describe("scale", function() { - describe("with a separate output dual quaternion", function() { - beforeEach(function() { result = Quat2.scale(out, quat2A, 2); }); - it("should place values into out", function() { expect(out).toBeQuat2(2, 4, 6, 8, 4, 10, 12, -4); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2); }); - }); - - describe("when quat2A is the output dual quaternion", function() { - beforeEach(function() { result = Quat2.scale(quat2A, quat2A, 2); }); - - it("should place values into quat2A", function() { expect(quat2A).toBeQuat2(2, 4, 6, 8, 4, 10, 12, -4); }); - it("should return quat2A", function() { expect(result).toBe(quat2A); }); - }); - }); - - describe("length", function() { - it("should have an alias called 'len'", function() { expect(Quat2.len).toEqual(Quat2.length); }); - - beforeEach(function() { result = Quat2.length(quat2A); }); - - it("should return the length", function() { expect(result).toBeCloseTo(5.477225); }); - }); - - describe("squaredLength", function() { - it("should have an alias called 'sqrLen'", function() { expect(Quat2.sqrLen).toEqual(Quat2.squaredLength); }); - - beforeEach(function() { result = Quat2.squaredLength(quat2A); }); - - it("should return the squared length", function() { expect(result).toBeCloseTo(30); }); - }); - - describe("fromRotation", function() { - beforeEach(function() { result = Quat2.fromRotation(out, [1, 2, 3, 4]); }); - it("should place values into out", function() { expect(out).toBeQuat2(1, 2, 3, 4, 0, 0, 0, 0); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify the quaternion", function() { expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2); }); - }); - - describe("fromTranslation", function(){ - beforeEach(function() { vec = [1, 2, 3]; result = Quat2.fromTranslation(out, vec); }); - it("should place values into out", function() { expect(out).toBeQuat2(0, 0, 0, 1, 0.5, 1, 1.5, 0); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify the vector", function() { expect(vec).toBeVec(1, 2, 3); }); - }); - - describe("fromRotationTranslation", function() { - beforeEach(function() { - vec = [1, 2, 3]; - result = Quat2.fromRotationTranslation(out, [1, 2, 3, 4], vec); - }); - it("should place values into out", function() { expect(out).toBeQuat2(1, 2, 3, 4, 2, 4, 6, -7); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify the quaternion", function() { expect(Quat2.getReal(outQuat, quat2A)).toBeVec(1, 2, 3, 4); }); - it("should not modify the vector", function() { expect(vec).toBeVec(1, 2, 3); }); - it("should have a translation that can be retrieved with getTranslation", function() { - let t: Vec3Like = [0, 0, 0]; - Quat2.normalize(out, out); - Quat2.getTranslation(t, out); - - expect(t).toBeVec(1, 2, 3); - }); - }); - - describe("fromRotationTranslationValues", function() { - beforeEach(function() { result = Quat2.fromRotationTranslationValues(1,2,3,4, 1,2,3); }); - it("should return the correct result", function() { expect(result).toBeQuat2(1, 2, 3, 4, 2, 4, 6, -7); }); - it("should have a translation that can be retrieved with getTranslation", function() { - let t: Vec3Like = [0, 0, 0]; - Quat2.normalize(result, result); - Quat2.getTranslation(t, result); - expect(t).toBeVec(1, 2, 3); - }); - }); - - describe("getTranslation", function() { - describe("without a real part", function() { - beforeEach(function() { - Quat2.fromTranslation(out, [1,2,3]); - resultVec = Quat2.getTranslation(outVec, out); - }); - describe("not normalized", function() { - it("should return the same translation value", function() { expect(outVec).toBeVec(1, 2, 3); }); - it("should return out", function() { expect(outVec).toBe(resultVec); }); - }); - describe("normalized", function() { - it("should return the same translation value", function() { - Quat2.normalize(outVec, outVec); - expect(outVec).toBeVec(1, 2, 3); - }); - }); - }); - describe("with a real part", function() { - beforeEach(function() { - Quat2.fromRotationTranslation(out, [2, 4, 6, 2], [1, 2, 3]); - resultVec = Quat2.getTranslation(outVec, out); - }); - describe("not normalized", function() { - it("should not return the same translation value", function() { expect(outVec).not.toBeVec(1, 2, 3); }); - it("should return out", function() { expect(outVec).toBe(resultVec); }); - }); - describe("normalized", function() { - it("should return the same translation value", function() { - Quat2.normalize(out, out); - Quat2.getTranslation(outVec, out); - expect(outVec).toBeVec(1, 2, 3); - }); - }); - }); - }); - - describe("normalize", function() { - describe("when it is normalizing quat2A", function() { - beforeEach(function() { - quat2A = [1, 2, 3, 4, 2, 5, 6, -2]; - Quat2.normalize(out, quat2A); - }); - it("both parts should have been normalized", function() { expect(out).toBeQuat2(1/5.4772255, 2/5.4772255, 3/5.4772255, 4/5.4772255, 0.231260, 0.6450954, 0.693781,-0.9006993); }); - }); - - beforeEach(function() { quat2A = [5, 0, 0, 0, 0, 0, 0, 0]; }); - - describe("with a separate output quaternion", function() { - beforeEach(function() { result = Quat2.normalize(out, quat2A); }); - - it("should place values into out", function() { expect(out).toBeQuat2(1, 0, 0, 0, 0, 0, 0, 0); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2(5, 0, 0, 0, 0, 0, 0, 0); }); - }); - - describe("when quat2A is the output quaternion", function() { - beforeEach(function() { result = Quat2.normalize(quat2A, quat2A); }); - - it("should place values into quat2A", function() { expect(quat2A).toBeQuat2(1, 0, 0, 0, 0, 0, 0, 0); }); - it("should return quat2A", function() { expect(result).toBe(quat2A); }); - }); - - describe("when it contains a translation", function() { - beforeEach(function() { - Quat2.set(out, 5, 0, 0, 0, 1, 2, 3, 5); - Quat2.normalize(out, out); - }); - it("both parts should have been normalized", function() { expect(out).toBeQuat2(1, 0, 0, 0, 0, 0.4, 0.6, 1); }); - }); - }); - - describe("lerp", function() { - describe("with a separate output quaternion", function() { - beforeEach(function() { result = Quat2.lerp(out, quat2A, quat2B, 0.7); }); - - it("should place values into out", function() { expect(out).toBeQuat2(3.8, 4.8, 5.8, 6.8, 6.9, 7.1, 6.0, -3.4); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2); }); - it("should not modify quat2B", function() { expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4); }); - }); - - describe("when quat2A is the output quaternion", function() { - beforeEach(function() { result = Quat2.lerp(quat2A, quat2A, quat2B, 0.5); }); - - it("should place values into quat2A", function() { expect(quat2A).toBeQuat2(3, 4, 5, 6,5.5, 6.5, 6, -3); }); - it("should return quat2A", function() { expect(result).toBe(quat2A); }); - it("should not modify quat2B", function() { expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4); }); - }); - - describe("when quat2B is the output quaternion", function() { - beforeEach(function() { result = Quat2.lerp(quat2B, quat2A, quat2B, 0.5); }); - - it("should place values into quat2B", function() { expect(quat2B).toBeQuat2(3, 4, 5, 6,5.5, 6.5, 6, -3); }); - it("should return quat2B", function() { expect(result).toBe(quat2B); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2); }); - }); - - describe("shortest path", function() { - beforeEach(function() { result = Quat2.lerp(out, [1, 2, 3, -4, 2, 5, 6, -2], [5, -6, 7, 8, 9, 8, 6, -4], 0.4); }); - it("should pick the shorter path", function() { expect(out).toBeQuat2( -1.4, 3.6, -1, -5.6, -2.4, -0.2, 1.2, 0.4 ); }); - }); - }); - - describe("dot", function() { - describe("with a separate output dual quaternion", function() { - beforeEach(function() { result = Quat2.dot(quat2A, quat2B); }); - it("should return the dot product", function() { expect(result).toBe(70); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2); }); - it("should not modify quat2B", function() { expect(quat2B).toBeQuat2(5, 6, 7, 8, 9, 8, 6, -4); }); - }); - }); - - describe("invert", function() { - describe("with a separate output dual quaternion", function() { - beforeEach(function() { result = Quat2.invert(out, quat2A); }); - - it("should place values into out", function() { expect(out).toBeQuat2(-0.0333333333, -0.06666666666, -0.1, 0.13333333333, -2/30, -5/30, -6/30, -2/30); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2); }); - it("the real part should be equal to a inverted quaternion", function() { - Quat.invert(outQuat, [1, 2, 3, 4]); - - expect(Quat2.getReal(outQuat, out)).toBeVec(...outQuat); - }); - }); - - describe("when quat2A is the output quaternion", function() { - beforeEach(function() { result = Quat2.invert(quat2A, quat2A); }); - - it("should place values into quat2A", function() { expect(quat2A).toBeVec(-0.0333333333, -0.06666666666, -0.1, 0.13333333333, -2/30, -5/30, -6/30, -2/30); }); - it("should return quat2A", function() { expect(result).toBe(quat2A); }); - - }); - }); - - describe("get real/dual", function() { - describe("get real", function() { - beforeEach(function() { result = Quat2.getReal(outQuat, quat2A); }); - - it("should place values into out", function() { expect(outQuat).toBeVec(1, 2, 3, 4); }); - it("should return out", function() { expect(result).toBe(outQuat); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2); }); - }); - - describe("get dual", function() { - beforeEach(function() { result = Quat2.getDual(outQuat, quat2A); }); - - it("should place values into out", function() { expect(outQuat).toBeVec(2, 5, 6, -2); }); - it("should return out", function() { expect(result).toBe(outQuat); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2); }); - }); - }); - - describe("set real/dual", function() { - describe("set real", function() { - beforeEach(function() { - outQuat = [4, 6, 8, -100]; - result = Quat2.setReal(quat2A, outQuat); - }); - - it("should place values into out", function() { expect(quat2A).toBeQuat2(4, 6, 8, -100, 2, 5, 6, -2); }); - it("should return out", function() { expect(result).toBe(quat2A); }); - it("should not modify outQuat", function() { expect(outQuat).toBeVec(4, 6, 8, -100); }); - }); - - describe("set dual", function() { - beforeEach(function() { - outQuat = [4.3, 6, 8, -100]; - result = Quat2.setDual(quat2A, outQuat); - }); - - it("should place values into out", function() { expect(quat2A).toBeQuat2(1, 2, 3, 4, 4.3, 6, 8, -100); }); - it("should return out", function() { expect(result).toBe(quat2A); }); - it("should not modify outQuat", function() { expect(outQuat).toBeVec(4.3, 6, 8, -100); }); - }); - }); - - describe("conjugate", function() { - describe("with a separate output dual quaternion", function() { - beforeEach(function() { result = Quat2.conjugate(out, quat2A); }); - - it("should place values into out", function() { expect(out).toBeQuat2(-1, -2, -3, 4, -2, -5, -6, -2); }); - it("should return out", function() { expect(result).toBe(out); }); - it("should not modify quat2A", function() { expect(quat2A).toBeQuat2(1, 2, 3, 4, 2, 5, 6, -2); }); - }); - - describe("when quat2A is the output dual quaternion", function() { - beforeEach(function() { result = Quat2.conjugate(quat2A, quat2A); }); - - it("should place values into quat2A", function() { expect(quat2A).toBeQuat2(-1, -2, -3, 4, -2, -5, -6, -2); }); - it("should return quat2A", function() { expect(result).toBe(quat2A); }); - }); - }); - - describe("str", function() { - beforeEach(function() { result = Quat2.str(quat2A); }); - - it("should return a string representation of the quaternion", function() { expect(result).toEqual("Quat2(1, 2, 3, 4, 2, 5, 6, -2)"); }); - }); - - describe("exactEquals", function() { - let quat2C, r0, r1; - beforeEach(function() { - quat2A = [0, 1, 2, 3, 4, 5, 6, 7]; - quat2B = [0, 1, 2, 3, 4, 5, 6, 7]; - quat2C = [1, 2, 3, 4, 5, 6, 7, 8]; - r0 = Quat2.exactEquals(quat2A, quat2B); - r1 = Quat2.exactEquals(quat2A, quat2C); - }); - - it("should return true for identical quaternions", function() { expect(r0).toBe(true); }); - it("should return false for different quaternions", function() { expect(r1).toBe(false); }); - it("should not modify quat2A", function() { expect(quat2A).toBeVec(0, 1, 2, 3, 4, 5, 6, 7); }); - it("should not modify quat2B", function() { expect(quat2B).toBeVec(0, 1, 2, 3, 4, 5, 6, 7); }); - }); - - describe("equals", function() { - let quat2C, quat2D, r0, r1, r2; - beforeEach(function() { - quat2A = [0, 1, 2, 3, 4, 5, 6, 7]; - quat2B = [0, 1, 2, 3, 4, 5, 6, 7]; - quat2C = [1, 2, 3, 4, 5, 6, 7, 8]; - quat2D = [1e-16, 1, 2, 3, 4, 5, 6, 7]; - r0 = Quat2.equals(quat2A, quat2B); - r1 = Quat2.equals(quat2A, quat2C); - r2 = Quat2.equals(quat2A, quat2D); - }); - it("should return true for identical dual quaternions", function() { expect(r0).toBe(true); }); - it("should return false for different dual quaternions", function() { expect(r1).toBe(false); }); - it("should return true for close but not identical quaternions", function() { expect(r2).toBe(true); }); - it("should not modify quat2A", function() { expect(quat2A).toBeVec(0, 1, 2, 3, 4, 5, 6, 7); }); - it("should not modify quat2B", function() { expect(quat2B).toBeVec(0, 1, 2, 3, 4, 5, 6, 7); }); - }); - }); -}); \ No newline at end of file diff --git a/tests/setupExtend.ts b/tests/setupExtend.ts new file mode 100644 index 00000000..1aaebd88 --- /dev/null +++ b/tests/setupExtend.ts @@ -0,0 +1,103 @@ +import { expect } from 'vitest'; + +import type { + FloatArray, + Quat2Like, + Mat2Like, + Mat2dLike, + Mat3Like, + Mat4Like, + Vec2Like, + Vec3Like, + Vec4Like } from '#gl-matrix/types'; + +/** Less precision than `GSM_EPSILON` from #gl-matrix/common. */ +const TEST_EPSILON = 0.00001; + +interface MatcherResult { + pass: boolean + message: () => string +} + +expect.extend({ + toBeVec(received: FloatArray, ...expected: number[] | [FloatArray] | [Mat2Like] | [Mat2dLike] | [Mat3Like] | + [Mat4Like] | [Vec2Like] | [Vec3Like] | [Vec4Like]): + MatcherResult { + let values: number[] | FloatArray; + if (expected[0] instanceof Float32Array || expected[0] instanceof Float64Array) { + values = expected[0]; + } else { + values = expected as number[]; + } + if (received.length != values.length) { + return ({ + pass: false, + message: () => `Expected (${received}) and (${values}) to have the same length. (${ + received.length} != ${values.length})` + }); + } + for (let i = 0; i < values.length; ++i) { + if (Math.abs(received[i] - values[i]) >= TEST_EPSILON) { + return ({ + pass: false, + message: () => `Expected (${received}) to be (${values}), but value[${i}] is not within tolerance. (${ + received[i]} != ${values[i]})` + }); + } + } + + return ({ + pass: true, + message: () => `Expected (${received}) to be (${values}).` + }); + }, + + // Dual quaternions are very special & unique snowflakes + toBeQuat2(received: FloatArray, ...expected: number[] | [FloatArray] | [Quat2Like]): MatcherResult { + let values: number[] | FloatArray; + if (expected[0] instanceof Float32Array || expected[0] instanceof Float64Array) { + values = expected[0]; + } else { + values = expected as number[]; + } + + let allSignsFlipped = false; + if (received.length != values.length) { + return ({ + pass: false, + message: () => `Expected (${received}) and (${values}) to have the same length. (${ + received.length} != ${values.length})` + }); + } + + for (let i = 0; i < values.length; i++) { + if (isNaN(received[i]) !== isNaN(values[i])) { + return ({ + pass: false, + message: () => `Expected (${received}) and (${values}) to be equalish. (${ + received.length} != ${values.length})` + }); + } + + if (allSignsFlipped) { + if (Math.abs(received[i] - (-values[i])) >= TEST_EPSILON) { + return ({ + pass: false, + message: () => `Expected (${received}) and (${values}) to be equalish. (${ + received.length} != ${values.length})` + }); + } + } else { + if (Math.abs(received[i] - values[i]) >= TEST_EPSILON) { + allSignsFlipped = true; + i = 0; + } + } + } + + return ({ + pass: true, + message: () => `Expected (${received}) to be (${values}).` + }); + } +}); diff --git a/tests/setupGlobal.js b/tests/setupGlobal.js new file mode 100644 index 00000000..35af2a07 --- /dev/null +++ b/tests/setupGlobal.js @@ -0,0 +1,6 @@ +import { executeGenF64 } from '../scripts/gen-f64.js'; + +// Creates F64 source and tests once before Vitest execution. Use the NPM script `gen64` to trigger testing reruns. +export function setup() { + executeGenF64(); +} diff --git a/tests/test-utils.ts b/tests/test-utils.ts deleted file mode 100644 index 8ef929c7..00000000 --- a/tests/test-utils.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { expect } from 'vitest'; -import { Quat2Like } from '../src/quat2'; - -declare global { - namespace jest { - interface Matchers { - toBeVec(...expected: number[] | [Float32Array]): CustomMatcherResult; - toBeQuat2(...expected: number[] | [Float32Array] | [Quat2Like]): jest.CustomMatcherResult; - } - } -} - -const EPSILON = 0.00001; -expect.extend({ - toBeVec(received: Float32Array, ...expected: number[] | [Float32Array]): jest.CustomMatcherResult { - let values: number[] | Float32Array; - if (expected[0] instanceof Float32Array) { - values = expected[0]; - } else { - values = expected as number[]; - } - if (received.length != values.length) { - return ({ - pass: false, - message: () => `Expected (${received}) and (${values}) to have the same length. (${received.length} != ${values.length})` - }); - } - for(let i = 0; i < values.length; ++i) { - if(Math.abs(received[i] - values[i]) >= EPSILON) { - return ({ - pass: false, - message: () => `Expected (${received}) to be (${values}), but value[${i}] is not within tolerance. (${received[i]} != ${values[i]})` - }); - } - } - - return ({ - pass: true, - message: () => `Expected (${received}) to be (${values}).` - }); - }, - - //Dual quaternions are very special & unique snowflakes - toBeQuat2(received: Float32Array, ...expected: number[] | [Float32Array]): jest.CustomMatcherResult { - let values: number[] | Float32Array; - if (expected[0] instanceof Float32Array) { - values = expected[0]; - } else { - values = expected as number[]; - } - - let allSignsFlipped = false; - if (received.length != values.length) { - return ({ - pass: false, - message: () => `Expected (${received}) and (${values}) to have the same length. (${received.length} != ${values.length})` - }); - } - - for (let i = 0; i < values.length; i++) { - if (isNaN(received[i]) !== isNaN(values[i])) { - return ({ - pass: false, - message: () => `Expected (${received}) and (${values}) to be equalish. (${received.length} != ${values.length})` - }); - } - - if (allSignsFlipped) { - if (Math.abs(received[i] - (-values[i])) >= EPSILON) { - return ({ - pass: false, - message: () => `Expected (${received}) and (${values}) to be equalish. (${received.length} != ${values.length})` - }); - } - } else { - if (Math.abs(received[i] - values[i]) >= EPSILON) { - allSignsFlipped = true; - i = 0; - } - } - } - - return ({ - pass: true, - message: () => `Expected (${received}) to be (${values}).` - }); - } -}); \ No newline at end of file diff --git a/tests/vec2-swizzle.spec.ts b/tests/vec2-swizzle.spec.ts deleted file mode 100644 index 0dfd1955..00000000 --- a/tests/vec2-swizzle.spec.ts +++ /dev/null @@ -1,633 +0,0 @@ -import { expect, describe, it, beforeEach } from 'vitest'; -import { Vec2 } from "../src/vec2" -import { EnableSwizzles } from '../src/swizzle'; -import "./test-utils" - -describe("Vec2 Swizzles", () => { - EnableSwizzles(); - - let v: Vec2; - beforeEach(() => { v = new Vec2(1, 2); }); - - // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should - // not be modified by hand. - // [Swizzle Autogen] - - describe("Vec2().xx", () => { - it("should return Vec2(x, x)", () => { - expect(v.xx).toBeVec(v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().xy", () => { - it("should return Vec2(x, y)", () => { - expect(v.xy).toBeVec(v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().yx", () => { - it("should return Vec2(y, x)", () => { - expect(v.yx).toBeVec(v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().yy", () => { - it("should return Vec2(y, y)", () => { - expect(v.yy).toBeVec(v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().xxx", () => { - it("should return Vec3(x, x, x)", () => { - expect(v.xxx).toBeVec(v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().xxy", () => { - it("should return Vec3(x, x, y)", () => { - expect(v.xxy).toBeVec(v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().xyx", () => { - it("should return Vec3(x, y, x)", () => { - expect(v.xyx).toBeVec(v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().xyy", () => { - it("should return Vec3(x, y, y)", () => { - expect(v.xyy).toBeVec(v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().yxx", () => { - it("should return Vec3(y, x, x)", () => { - expect(v.yxx).toBeVec(v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().yxy", () => { - it("should return Vec3(y, x, y)", () => { - expect(v.yxy).toBeVec(v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().yyx", () => { - it("should return Vec3(y, y, x)", () => { - expect(v.yyx).toBeVec(v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().yyy", () => { - it("should return Vec3(y, y, y)", () => { - expect(v.yyy).toBeVec(v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().xxxx", () => { - it("should return Vec4(x, x, x, x)", () => { - expect(v.xxxx).toBeVec(v[0], v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xxxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().xxxy", () => { - it("should return Vec4(x, x, x, y)", () => { - expect(v.xxxy).toBeVec(v[0], v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xxxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().xxyx", () => { - it("should return Vec4(x, x, y, x)", () => { - expect(v.xxyx).toBeVec(v[0], v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xxyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().xxyy", () => { - it("should return Vec4(x, x, y, y)", () => { - expect(v.xxyy).toBeVec(v[0], v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xxyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().xyxx", () => { - it("should return Vec4(x, y, x, x)", () => { - expect(v.xyxx).toBeVec(v[0], v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xyxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().xyxy", () => { - it("should return Vec4(x, y, x, y)", () => { - expect(v.xyxy).toBeVec(v[0], v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xyxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().xyyx", () => { - it("should return Vec4(x, y, y, x)", () => { - expect(v.xyyx).toBeVec(v[0], v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xyyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().xyyy", () => { - it("should return Vec4(x, y, y, y)", () => { - expect(v.xyyy).toBeVec(v[0], v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xyyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().yxxx", () => { - it("should return Vec4(y, x, x, x)", () => { - expect(v.yxxx).toBeVec(v[1], v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yxxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().yxxy", () => { - it("should return Vec4(y, x, x, y)", () => { - expect(v.yxxy).toBeVec(v[1], v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yxxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().yxyx", () => { - it("should return Vec4(y, x, y, x)", () => { - expect(v.yxyx).toBeVec(v[1], v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yxyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().yxyy", () => { - it("should return Vec4(y, x, y, y)", () => { - expect(v.yxyy).toBeVec(v[1], v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yxyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().yyxx", () => { - it("should return Vec4(y, y, x, x)", () => { - expect(v.yyxx).toBeVec(v[1], v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yyxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().yyxy", () => { - it("should return Vec4(y, y, x, y)", () => { - expect(v.yyxy).toBeVec(v[1], v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yyxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().yyyx", () => { - it("should return Vec4(y, y, y, x)", () => { - expect(v.yyyx).toBeVec(v[1], v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yyyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().yyyy", () => { - it("should return Vec4(y, y, y, y)", () => { - expect(v.yyyy).toBeVec(v[1], v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yyyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().rr", () => { - it("should return Vec2(r, r)", () => { - expect(v.rr).toBeVec(v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().rg", () => { - it("should return Vec2(r, g)", () => { - expect(v.rg).toBeVec(v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().gr", () => { - it("should return Vec2(g, r)", () => { - expect(v.gr).toBeVec(v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.gr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().gg", () => { - it("should return Vec2(g, g)", () => { - expect(v.gg).toBeVec(v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.gg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().rrr", () => { - it("should return Vec3(r, r, r)", () => { - expect(v.rrr).toBeVec(v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().rrg", () => { - it("should return Vec3(r, r, g)", () => { - expect(v.rrg).toBeVec(v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().rgr", () => { - it("should return Vec3(r, g, r)", () => { - expect(v.rgr).toBeVec(v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rgr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().rgg", () => { - it("should return Vec3(r, g, g)", () => { - expect(v.rgg).toBeVec(v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rgg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().grr", () => { - it("should return Vec3(g, r, r)", () => { - expect(v.grr).toBeVec(v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.grr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().grg", () => { - it("should return Vec3(g, r, g)", () => { - expect(v.grg).toBeVec(v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.grg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().ggr", () => { - it("should return Vec3(g, g, r)", () => { - expect(v.ggr).toBeVec(v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.ggr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().ggg", () => { - it("should return Vec3(g, g, g)", () => { - expect(v.ggg).toBeVec(v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.ggg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().rrrr", () => { - it("should return Vec4(r, r, r, r)", () => { - expect(v.rrrr).toBeVec(v[0], v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rrrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().rrrg", () => { - it("should return Vec4(r, r, r, g)", () => { - expect(v.rrrg).toBeVec(v[0], v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rrrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().rrgr", () => { - it("should return Vec4(r, r, g, r)", () => { - expect(v.rrgr).toBeVec(v[0], v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rrgr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().rrgg", () => { - it("should return Vec4(r, r, g, g)", () => { - expect(v.rrgg).toBeVec(v[0], v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rrgg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().rgrr", () => { - it("should return Vec4(r, g, r, r)", () => { - expect(v.rgrr).toBeVec(v[0], v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rgrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().rgrg", () => { - it("should return Vec4(r, g, r, g)", () => { - expect(v.rgrg).toBeVec(v[0], v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rgrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().rggr", () => { - it("should return Vec4(r, g, g, r)", () => { - expect(v.rggr).toBeVec(v[0], v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rggr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().rggg", () => { - it("should return Vec4(r, g, g, g)", () => { - expect(v.rggg).toBeVec(v[0], v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rggg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().grrr", () => { - it("should return Vec4(g, r, r, r)", () => { - expect(v.grrr).toBeVec(v[1], v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.grrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().grrg", () => { - it("should return Vec4(g, r, r, g)", () => { - expect(v.grrg).toBeVec(v[1], v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.grrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().grgr", () => { - it("should return Vec4(g, r, g, r)", () => { - expect(v.grgr).toBeVec(v[1], v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.grgr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().grgg", () => { - it("should return Vec4(g, r, g, g)", () => { - expect(v.grgg).toBeVec(v[1], v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.grgg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().ggrr", () => { - it("should return Vec4(g, g, r, r)", () => { - expect(v.ggrr).toBeVec(v[1], v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.ggrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().ggrg", () => { - it("should return Vec4(g, g, r, g)", () => { - expect(v.ggrg).toBeVec(v[1], v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.ggrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().gggr", () => { - it("should return Vec4(g, g, g, r)", () => { - expect(v.gggr).toBeVec(v[1], v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.gggr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec2().gggg", () => { - it("should return Vec4(g, g, g, g)", () => { - expect(v.gggg).toBeVec(v[1], v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.gggg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - // [/Swizzle Autogen] -}); \ No newline at end of file diff --git a/tests/vec2.spec.ts b/tests/vec2.spec.ts deleted file mode 100644 index 299ad4bb..00000000 --- a/tests/vec2.spec.ts +++ /dev/null @@ -1,785 +0,0 @@ -import { expect, describe, it, beforeEach } from 'vitest'; -import { Vec2, Vec2Like } from "../src/vec2" -import "./test-utils" - -describe("Vec2", () => { - let vecA: Vec2; - let vecB: Vec2; - let out: Vec2; - - beforeEach(() => { - vecA = new Vec2(1, 2); - vecB = new Vec2([3, 4]); - out = new Vec2(); - }); - - describe("constructor", () => { - it("should return Vec2(0, 0) if called with no arguments", () => { - expect(new Vec2()).toBeVec(0, 0); - }); - - it("should return Vec2(x, y) if called with (x, y)", () => { - expect(new Vec2(1, 2)).toBeVec(1, 2); - expect(new Vec2(-3, 4.4)).toBeVec(-3, 4.4); - }); - - it("should return Vec2(x, x) if called with (x)", () => { - expect(new Vec2(1)).toBeVec(1, 1); - expect(new Vec2(-2.3)).toBeVec(-2.3, -2.3); - }); - - it("should return Vec2(x, y) if called with ([x, y])", () => { - expect(new Vec2([1, 2])).toBeVec(1, 2); - expect(new Vec2([-3, 4.4])).toBeVec(-3, 4.4); - }); - - it("should return Vec2(x, y) if called with (Vec2(x, y))", () => { - let v = new Vec2(3.4, 5.6); - expect(new Vec2(v)).toBeVec(v); - }); - - it("should return Vec2(x, y) if called with (Float32Array([x, y]))", () => { - let arr = new Float32Array([1.2, 3.4]); - expect(new Vec2(arr)).toBeVec(arr); - }); - }); - - describe("static methods", () => { - describe("create", () => { - it("should return Vec2(0, 0)", () => { - expect(Vec2.create()).toBeVec(0, 0); - }); - }); - - describe("add", () => { - let result: Vec2Like; - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec2.add(out, vecA, vecB); }); - - it("should place values into out", () => { expect(out).toBeVec(4, 6); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 4); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec2.add(vecA, vecA, vecB); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(4, 6); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 4); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec2.add(vecB, vecA, vecB); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(4, 6); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - }); - - describe("with raw array as the output", () => { - let outArray: Vec2Like = [0, 0]; - beforeEach(() => { result = Vec2.add(outArray, vecA, vecB); }); - - it("should place values into out", () => { expect(outArray).toBeVec(4, 6); }); - it("should return out", () => { expect(result).toBe(outArray); }); - }); - - describe("with raw arrays as the inputs", () => { - beforeEach(() => { result = Vec2.add(out, [1, 2], [3, 4]); }); - - it("should place values into out", () => { expect(out).toBeVec(4, 6); }); - it("should return out", () => { expect(result).toBe(out); }); - }); - }); - }); - - describe("static", () => { - let out: Vec2Like, vecA: Vec2Like, vecB: Vec2Like, result: any; - - beforeEach(() => { - vecA = new Vec2(1, 2); - vecB = new Vec2(3, 4); - out = new Vec2(0, 0); - }); - - describe("create", () => { - beforeEach(() => { result = Vec2.create(); }); - it("should return a 2 element array initialized to 0s", () => { expect(result).toBeVec(0, 0); }); - }); - - describe("clone", () => { - beforeEach(() => { result = Vec2.clone(vecA); }); - it("should return a 2 element array initialized to the values in vecA", () => { expect(result).toBeVec(vecA); }); - }); - - describe("fromValues", () => { - beforeEach(() => { result = Vec2.fromValues(1, 2); }); - it("should return a 2 element array initialized to the values passed", () => { expect(result).toBeVec(1, 2); }); - }); - - describe("copy", () => { - beforeEach(() => { result = Vec2.copy(out, vecA); }); - it("should place values into out", () => { expect(out).toBeVec(1, 2); }); - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("set", () => { - beforeEach(() => { result = Vec2.set(out, 1, 2); }); - it("should place values into out", () => { expect(out).toBeVec(1, 2); }); - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("add", () => { - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec2.add(out, vecA, vecB); }); - - it("should place values into out", () => { expect(out).toBeVec(4, 6); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 4); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec2.add(vecA, vecA, vecB); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(4, 6); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 4); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec2.add(vecB, vecA, vecB); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(4, 6); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - }); - }); - - describe("subtract", () => { - it("should have an alias called 'sub'", () => { expect(Vec2.sub).toEqual(Vec2.subtract); }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec2.subtract(out, vecA, vecB); }); - - it("should place values into out", () => { expect(out).toBeVec(-2, -2); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 4); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec2.subtract(vecA, vecA, vecB); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(-2, -2); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 4); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec2.subtract(vecB, vecA, vecB); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(-2, -2); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - }); - }); - - describe("multiply", () => { - it("should have an alias called 'mul'", () => { expect(Vec2.mul).toEqual(Vec2.multiply); }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec2.multiply(out, vecA, vecB); }); - - it("should place values into out", () => { expect(out).toBeVec(3, 8); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 4); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec2.multiply(vecA, vecA, vecB); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(3, 8); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 4); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec2.multiply(vecB, vecA, vecB); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(3, 8); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - }); - }); - - describe("divide", () => { - it("should have an alias called 'div'", () => { expect(Vec2.div).toEqual(Vec2.divide); }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec2.divide(out, vecA, vecB); }); - - it("should place values into out", () => { expect(out).toBeVec(0.3333333, 0.5); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 4); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec2.divide(vecA, vecA, vecB); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(0.3333333, 0.5); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 4); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec2.divide(vecB, vecA, vecB); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(0.3333333, 0.5); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - }); - }); - - describe("ceil", () => { - beforeEach(() => { vecA = [Math.E, Math.PI]; }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec2.ceil(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(3, 4); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(Math.E, Math.PI); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec2.ceil(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(3, 4); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("floor", () => { - beforeEach(() => { vecA = [Math.E, Math.PI]; }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec2.floor(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(2, 3); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(Math.E, Math.PI); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec2.floor(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(2, 3); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("min", () => { - beforeEach(() => { vecA = [1, 4]; vecB = [3, 2]; }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec2.min(out, vecA, vecB); }); - - it("should place values into out", () => { expect(out).toBeVec(1, 2); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 4); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 2); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec2.min(vecA, vecA, vecB); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(1, 2); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 2); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec2.min(vecB, vecA, vecB); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(1, 2); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 4); }); - }); - }); - - describe("max", () => { - beforeEach(() => { vecA = [1, 4]; vecB = [3, 2]; }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec2.max(out, vecA, vecB); }); - - it("should place values into out", () => { expect(out).toBeVec(3, 4); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 4); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 2); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec2.max(vecA, vecA, vecB); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(3, 4); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 2); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec2.max(vecB, vecA, vecB); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(3, 4); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 4); }); - }); - }); - - describe("round", () => { - beforeEach(() => { vecA = [Math.E, Math.PI]; }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec2.round(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(3, 3); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(Math.E, Math.PI); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec2.round(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(3, 3); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("scale", () => { - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec2.scale(out, vecA, 2); }); - - it("should place values into out", () => { expect(out).toBeVec(2, 4); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec2.scale(vecA, vecA, 2); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(2, 4); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("scaleAndAdd", () => { - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec2.scaleAndAdd(out, vecA, vecB, 0.5); }); - - it("should place values into out", () => { expect(out).toBeVec(2.5, 4); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 4); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec2.scaleAndAdd(vecA, vecA, vecB, 0.5); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(2.5, 4); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 4); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec2.scaleAndAdd(vecB, vecA, vecB, 0.5); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(2.5, 4); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - }); - }); - - describe("distance", () => { - it("should have an alias called 'dist'", () => { expect(Vec2.dist).toEqual(Vec2.distance); }); - - beforeEach(() => { result = Vec2.distance(vecA, vecB); }); - - it("should return the distance", () => { expect(result).toBeCloseTo(2.828427); }); - }); - - describe("squaredDistance", () => { - it("should have an alias called 'sqrDist'", () => { expect(Vec2.sqrDist).toEqual(Vec2.squaredDistance); }); - - beforeEach(() => { result = Vec2.squaredDistance(vecA, vecB); }); - - it("should return the squared distance", () => { expect(result).toEqual(8); }); - }); - - describe("length", () => { - it("should have an alias called 'len'", () => { expect(Vec2.len).toEqual(Vec2.length); }); - - beforeEach(() => { result = Vec2.len(vecA); }); - - it("should return the length", () => { expect(result).toBeCloseTo(2.236067); }); - }); - - describe("squaredLength", () => { - it("should have an alias called 'sqrLen'", () => { expect(Vec2.sqrLen).toEqual(Vec2.squaredLength); }); - - beforeEach(() => { result = Vec2.squaredLength(vecA); }); - - it("should return the squared length", () => { expect(result).toEqual(5); }); - }); - - describe("negate", () => { - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec2.negate(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(-1, -2); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec2.negate(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(-1, -2); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("inverse", () => { - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec2.inverse(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(1, 1/2); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec2.inverse(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(1, 1/2); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("abs", () => { - beforeEach(() => { vecA = [-1, -2]; }); - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec2.abs(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(1, 2); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(-1, -2); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec2.abs(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(1, 2); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("normalize", () => { - beforeEach(() => { vecA = [5, 0]; }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec2.normalize(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(1, 0); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(5, 0); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec2.normalize(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(1, 0); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("dot", () => { - beforeEach(() => { result = Vec2.dot(vecA, vecB); }); - - it("should return the dot product", () => { expect(result).toEqual(11); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 4); }); - }); - - describe("cross", () => { - let out3; - - beforeEach(() => { - out3 = [0, 0, 0]; - result = Vec2.cross(out3, vecA, vecB); - }); - - it("should place values into out", () => { expect(out3).toBeVec(0, 0, -2); }); - it("should return out", () => { expect(result).toBe(out3); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 4); }); - }); - - describe("lerp", () => { - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec2.lerp(out, vecA, vecB, 0.5); }); - - it("should place values into out", () => { expect(out).toBeVec(2, 3); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 4); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec2.lerp(vecA, vecA, vecB, 0.5); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(2, 3); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 4); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec2.lerp(vecB, vecA, vecB, 0.5); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(2, 3); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - }); - }); - - /*describe("random", () => { - describe("with no scale", () => { - beforeEach(() => { result = Vec2.random(out); }); - - it("should result in a unit length vector", () => { expect(Vec2.len(out)).toBeCloseTo(1.0); }); - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("with a scale", () => { - beforeEach(() => { result = Vec2.random(out, 5.0); }); - - it("should result in a unit length vector", () => { expect(Vec2.len(out)).toBeCloseTo(5.0); }); - it("should return out", () => { expect(result).toBe(out); }); - }); - });*/ - - describe("transformMat2", () => { - let matA; - beforeEach(() => { matA = [1, 2, 3, 4]; }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec2.transformMat2(out, vecA, matA); }); - - it("should place values into out", () => { expect(out).toBeVec(7, 10); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - it("should not modify matA", () => { expect(matA).toBeVec(1, 2, 3, 4); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec2.transformMat2(vecA, vecA, matA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(7, 10); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify matA", () => { expect(matA).toBeVec(1, 2, 3, 4); }); - }); - }); - - describe("transformMat2d", () => { - let matA; - beforeEach(() => { matA = [1, 2, 3, 4, 5, 6]; }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec2.transformMat2d(out, vecA, matA); }); - - it("should place values into out", () => { expect(out).toBeVec(12, 16); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - it("should not modify matA", () => { expect(matA).toBeVec(1, 2, 3, 4, 5, 6); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec2.transformMat2d(vecA, vecA, matA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(12, 16); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify matA", () => { expect(matA).toBeVec(1, 2, 3, 4, 5, 6); }); - }); - }); - - /*describe("forEach", () => { - let vecArray; - - beforeEach(() => { - vecArray = [ - 1, 2, - 3, 4, - 0, 0 - ]; - }); - - describe("when performing operations that take no extra arguments", () => { - beforeEach(() => { result = Vec2.forEach(vecArray, 0, 0, 0, Vec2.normalize); }); - - it("should update all values", () => { - expect(vecArray).toBeEqualish([ - 0.447214, 0.894427, - 0.6, 0.8, - 0, 0 - ]); - }); - it("should return vecArray", () => { expect(result).toBe(vecArray); }); - }); - - describe("when performing operations that takes one extra arguments", () => { - beforeEach(() => { result = Vec2.forEach(vecArray, 0, 0, 0, Vec2.add, vecA); }); - - it("should update all values", () => { - expect(vecArray).toBeEqualish([ - 2, 4, - 4, 6, - 1, 2 - ]); - }); - it("should return vecArray", () => { expect(result).toBe(vecArray); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - }); - - describe("when specifying an offset", () => { - beforeEach(() => { result = Vec2.forEach(vecArray, 0, 2, 0, Vec2.add, vecA); }); - - it("should update all values except the first vector", () => { - expect(vecArray).toBeEqualish([ - 1, 2, - 4, 6, - 1, 2 - ]); - }); - it("should return vecArray", () => { expect(result).toBe(vecArray); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - }); - - describe("when specifying a count", () => { - beforeEach(() => { result = Vec2.forEach(vecArray, 0, 0, 2, Vec2.add, vecA); }); - - it("should update all values except the last vector", () => { - expect(vecArray).toBeEqualish([ - 2, 4, - 4, 6, - 0, 0 - ]); - }); - it("should return vecArray", () => { expect(result).toBe(vecArray); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - }); - - describe("when specifying a stride", () => { - beforeEach(() => { result = Vec2.forEach(vecArray, 4, 0, 0, Vec2.add, vecA); }); - - it("should update all values except the second vector", () => { - expect(vecArray).toBeEqualish([ - 2, 4, - 3, 4, - 1, 2 - ]); - }); - it("should return vecArray", () => { expect(result).toBe(vecArray); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2); }); - }); - - describe("when calling a function that does not modify the out variable", () => { - beforeEach(() => { - result = Vec2.forEach(vecArray, 0, 0, 0, function(out, vec) {}); - }); - - it("values should remain unchanged", () => { - expect(vecArray).toBeEqualish([ - 1, 2, - 3, 4, - 0, 0, - ]); - }); - it("should return vecArray", () => { expect(result).toBe(vecArray); }); - }); - });*/ - - describe('rotate', () => { - describe('rotation around world origin [0, 0, 0]', () => { - beforeEach(() => { vecA = [0, 1]; vecB = [0, 0]; result = Vec2.rotate(out, vecA, vecB, Math.PI); }); - it("should return the rotated vector", () => { expect(result).toBeVec(0, -1); }); - }); - describe('rotation around an arbitrary origin', () => { - beforeEach(() => { vecA = [6, -5]; vecB = [0, -5]; result = Vec2.rotate(out, vecA, vecB, Math.PI); }); - it("should return the rotated vector", () => { expect(result).toBeVec(-6, -5); }); - }); - }); - - describe("angle", () => { - beforeEach(() => { - vecA = [1,0]; - vecB = [1,2]; - result = Vec2.angle(vecA, vecB); - }); - - it("should return the angle", () => { expect(result).toBeCloseTo(1.10714); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 0); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(1, 2); }); - }); - - describe("str", () => { - it("should return a string representation of the vector", () => { expect(Vec2.str(vecA)).toEqual("Vec2(1, 2)"); }); - }); - - describe("exactEquals", () => { - let vecC, r0, r1; - beforeEach(() => { - vecA = [0, 1]; - vecB = [0, 1]; - vecC = [1, 2]; - r0 = Vec2.exactEquals(vecA, vecB); - r1 = Vec2.exactEquals(vecA, vecC); - }); - - it("should return true for identical vectors", () => { expect(r0).toBe(true); }); - it("should return false for different vectors", () => { expect(r1).toBe(false); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(0, 1); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(0, 1); }); - }); - - describe("equals", () => { - let vecC, vecD, r0, r1, r2; - beforeEach(() => { - vecA = [0, 1]; - vecB = [0, 1]; - vecC = [1, 2]; - vecD = [1e-16, 1]; - r0 = Vec2.equals(vecA, vecB); - r1 = Vec2.equals(vecA, vecC); - r2 = Vec2.equals(vecA, vecD); - }); - it("should return true for identical vectors", () => { expect(r0).toBe(true); }); - it("should return false for different vectors", () => { expect(r1).toBe(false); }); - it("should return true for close but not identical vectors", () => { expect(r2).toBe(true); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(0, 1); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(0, 1); }); - }); - - describe("zero", () => { - beforeEach(() => { - vecA = [1, 2]; - result = Vec2.zero(vecA); - }); - it("should result in a 2 element vector with zeros", () => { expect(result).toBeVec(0, 0); }); - }); - }); -}); \ No newline at end of file diff --git a/tests/vec3-swizzle.spec.ts b/tests/vec3-swizzle.spec.ts deleted file mode 100644 index 01e4d180..00000000 --- a/tests/vec3-swizzle.spec.ts +++ /dev/null @@ -1,2591 +0,0 @@ -import { expect, describe, it, beforeEach } from 'vitest'; -import { Vec3 } from "../src/vec3" -import { EnableSwizzles } from '../src/swizzle'; -import "./test-utils" - -describe("Vec3 Swizzles", () => { - EnableSwizzles(); - - let v: Vec3; - beforeEach(() => { v = new Vec3(1, 2, 3); }); - - // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should - // not be modified by hand. - // [Swizzle Autogen] - - describe("Vec3().xx", () => { - it("should return Vec2(x, x)", () => { - expect(v.xx).toBeVec(v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xy", () => { - it("should return Vec2(x, y)", () => { - expect(v.xy).toBeVec(v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xz", () => { - it("should return Vec2(x, z)", () => { - expect(v.xz).toBeVec(v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yx", () => { - it("should return Vec2(y, x)", () => { - expect(v.yx).toBeVec(v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yy", () => { - it("should return Vec2(y, y)", () => { - expect(v.yy).toBeVec(v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yz", () => { - it("should return Vec2(y, z)", () => { - expect(v.yz).toBeVec(v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zx", () => { - it("should return Vec2(z, x)", () => { - expect(v.zx).toBeVec(v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zy", () => { - it("should return Vec2(z, y)", () => { - expect(v.zy).toBeVec(v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zz", () => { - it("should return Vec2(z, z)", () => { - expect(v.zz).toBeVec(v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xxx", () => { - it("should return Vec3(x, x, x)", () => { - expect(v.xxx).toBeVec(v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xxy", () => { - it("should return Vec3(x, x, y)", () => { - expect(v.xxy).toBeVec(v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xxz", () => { - it("should return Vec3(x, x, z)", () => { - expect(v.xxz).toBeVec(v[0], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xyx", () => { - it("should return Vec3(x, y, x)", () => { - expect(v.xyx).toBeVec(v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xyy", () => { - it("should return Vec3(x, y, y)", () => { - expect(v.xyy).toBeVec(v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xyz", () => { - it("should return Vec3(x, y, z)", () => { - expect(v.xyz).toBeVec(v[0], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xzx", () => { - it("should return Vec3(x, z, x)", () => { - expect(v.xzx).toBeVec(v[0], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xzy", () => { - it("should return Vec3(x, z, y)", () => { - expect(v.xzy).toBeVec(v[0], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xzz", () => { - it("should return Vec3(x, z, z)", () => { - expect(v.xzz).toBeVec(v[0], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yxx", () => { - it("should return Vec3(y, x, x)", () => { - expect(v.yxx).toBeVec(v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yxy", () => { - it("should return Vec3(y, x, y)", () => { - expect(v.yxy).toBeVec(v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yxz", () => { - it("should return Vec3(y, x, z)", () => { - expect(v.yxz).toBeVec(v[1], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yyx", () => { - it("should return Vec3(y, y, x)", () => { - expect(v.yyx).toBeVec(v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yyy", () => { - it("should return Vec3(y, y, y)", () => { - expect(v.yyy).toBeVec(v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yyz", () => { - it("should return Vec3(y, y, z)", () => { - expect(v.yyz).toBeVec(v[1], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yzx", () => { - it("should return Vec3(y, z, x)", () => { - expect(v.yzx).toBeVec(v[1], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yzy", () => { - it("should return Vec3(y, z, y)", () => { - expect(v.yzy).toBeVec(v[1], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yzz", () => { - it("should return Vec3(y, z, z)", () => { - expect(v.yzz).toBeVec(v[1], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zxx", () => { - it("should return Vec3(z, x, x)", () => { - expect(v.zxx).toBeVec(v[2], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zxy", () => { - it("should return Vec3(z, x, y)", () => { - expect(v.zxy).toBeVec(v[2], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zxz", () => { - it("should return Vec3(z, x, z)", () => { - expect(v.zxz).toBeVec(v[2], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zyx", () => { - it("should return Vec3(z, y, x)", () => { - expect(v.zyx).toBeVec(v[2], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zyy", () => { - it("should return Vec3(z, y, y)", () => { - expect(v.zyy).toBeVec(v[2], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zyz", () => { - it("should return Vec3(z, y, z)", () => { - expect(v.zyz).toBeVec(v[2], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zzx", () => { - it("should return Vec3(z, z, x)", () => { - expect(v.zzx).toBeVec(v[2], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zzy", () => { - it("should return Vec3(z, z, y)", () => { - expect(v.zzy).toBeVec(v[2], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zzz", () => { - it("should return Vec3(z, z, z)", () => { - expect(v.zzz).toBeVec(v[2], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xxxx", () => { - it("should return Vec4(x, x, x, x)", () => { - expect(v.xxxx).toBeVec(v[0], v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xxxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xxxy", () => { - it("should return Vec4(x, x, x, y)", () => { - expect(v.xxxy).toBeVec(v[0], v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xxxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xxxz", () => { - it("should return Vec4(x, x, x, z)", () => { - expect(v.xxxz).toBeVec(v[0], v[0], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xxxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xxyx", () => { - it("should return Vec4(x, x, y, x)", () => { - expect(v.xxyx).toBeVec(v[0], v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xxyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xxyy", () => { - it("should return Vec4(x, x, y, y)", () => { - expect(v.xxyy).toBeVec(v[0], v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xxyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xxyz", () => { - it("should return Vec4(x, x, y, z)", () => { - expect(v.xxyz).toBeVec(v[0], v[0], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xxyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xxzx", () => { - it("should return Vec4(x, x, z, x)", () => { - expect(v.xxzx).toBeVec(v[0], v[0], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xxzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xxzy", () => { - it("should return Vec4(x, x, z, y)", () => { - expect(v.xxzy).toBeVec(v[0], v[0], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xxzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xxzz", () => { - it("should return Vec4(x, x, z, z)", () => { - expect(v.xxzz).toBeVec(v[0], v[0], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xxzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xyxx", () => { - it("should return Vec4(x, y, x, x)", () => { - expect(v.xyxx).toBeVec(v[0], v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xyxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xyxy", () => { - it("should return Vec4(x, y, x, y)", () => { - expect(v.xyxy).toBeVec(v[0], v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xyxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xyxz", () => { - it("should return Vec4(x, y, x, z)", () => { - expect(v.xyxz).toBeVec(v[0], v[1], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xyxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xyyx", () => { - it("should return Vec4(x, y, y, x)", () => { - expect(v.xyyx).toBeVec(v[0], v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xyyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xyyy", () => { - it("should return Vec4(x, y, y, y)", () => { - expect(v.xyyy).toBeVec(v[0], v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xyyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xyyz", () => { - it("should return Vec4(x, y, y, z)", () => { - expect(v.xyyz).toBeVec(v[0], v[1], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xyyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xyzx", () => { - it("should return Vec4(x, y, z, x)", () => { - expect(v.xyzx).toBeVec(v[0], v[1], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xyzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xyzy", () => { - it("should return Vec4(x, y, z, y)", () => { - expect(v.xyzy).toBeVec(v[0], v[1], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xyzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xyzz", () => { - it("should return Vec4(x, y, z, z)", () => { - expect(v.xyzz).toBeVec(v[0], v[1], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xyzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xzxx", () => { - it("should return Vec4(x, z, x, x)", () => { - expect(v.xzxx).toBeVec(v[0], v[2], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xzxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xzxy", () => { - it("should return Vec4(x, z, x, y)", () => { - expect(v.xzxy).toBeVec(v[0], v[2], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xzxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xzxz", () => { - it("should return Vec4(x, z, x, z)", () => { - expect(v.xzxz).toBeVec(v[0], v[2], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xzxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xzyx", () => { - it("should return Vec4(x, z, y, x)", () => { - expect(v.xzyx).toBeVec(v[0], v[2], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xzyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xzyy", () => { - it("should return Vec4(x, z, y, y)", () => { - expect(v.xzyy).toBeVec(v[0], v[2], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xzyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xzyz", () => { - it("should return Vec4(x, z, y, z)", () => { - expect(v.xzyz).toBeVec(v[0], v[2], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xzyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xzzx", () => { - it("should return Vec4(x, z, z, x)", () => { - expect(v.xzzx).toBeVec(v[0], v[2], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xzzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xzzy", () => { - it("should return Vec4(x, z, z, y)", () => { - expect(v.xzzy).toBeVec(v[0], v[2], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xzzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().xzzz", () => { - it("should return Vec4(x, z, z, z)", () => { - expect(v.xzzz).toBeVec(v[0], v[2], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xzzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yxxx", () => { - it("should return Vec4(y, x, x, x)", () => { - expect(v.yxxx).toBeVec(v[1], v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yxxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yxxy", () => { - it("should return Vec4(y, x, x, y)", () => { - expect(v.yxxy).toBeVec(v[1], v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yxxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yxxz", () => { - it("should return Vec4(y, x, x, z)", () => { - expect(v.yxxz).toBeVec(v[1], v[0], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yxxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yxyx", () => { - it("should return Vec4(y, x, y, x)", () => { - expect(v.yxyx).toBeVec(v[1], v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yxyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yxyy", () => { - it("should return Vec4(y, x, y, y)", () => { - expect(v.yxyy).toBeVec(v[1], v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yxyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yxyz", () => { - it("should return Vec4(y, x, y, z)", () => { - expect(v.yxyz).toBeVec(v[1], v[0], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yxyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yxzx", () => { - it("should return Vec4(y, x, z, x)", () => { - expect(v.yxzx).toBeVec(v[1], v[0], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yxzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yxzy", () => { - it("should return Vec4(y, x, z, y)", () => { - expect(v.yxzy).toBeVec(v[1], v[0], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yxzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yxzz", () => { - it("should return Vec4(y, x, z, z)", () => { - expect(v.yxzz).toBeVec(v[1], v[0], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yxzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yyxx", () => { - it("should return Vec4(y, y, x, x)", () => { - expect(v.yyxx).toBeVec(v[1], v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yyxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yyxy", () => { - it("should return Vec4(y, y, x, y)", () => { - expect(v.yyxy).toBeVec(v[1], v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yyxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yyxz", () => { - it("should return Vec4(y, y, x, z)", () => { - expect(v.yyxz).toBeVec(v[1], v[1], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yyxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yyyx", () => { - it("should return Vec4(y, y, y, x)", () => { - expect(v.yyyx).toBeVec(v[1], v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yyyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yyyy", () => { - it("should return Vec4(y, y, y, y)", () => { - expect(v.yyyy).toBeVec(v[1], v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yyyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yyyz", () => { - it("should return Vec4(y, y, y, z)", () => { - expect(v.yyyz).toBeVec(v[1], v[1], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yyyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yyzx", () => { - it("should return Vec4(y, y, z, x)", () => { - expect(v.yyzx).toBeVec(v[1], v[1], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yyzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yyzy", () => { - it("should return Vec4(y, y, z, y)", () => { - expect(v.yyzy).toBeVec(v[1], v[1], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yyzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yyzz", () => { - it("should return Vec4(y, y, z, z)", () => { - expect(v.yyzz).toBeVec(v[1], v[1], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yyzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yzxx", () => { - it("should return Vec4(y, z, x, x)", () => { - expect(v.yzxx).toBeVec(v[1], v[2], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yzxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yzxy", () => { - it("should return Vec4(y, z, x, y)", () => { - expect(v.yzxy).toBeVec(v[1], v[2], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yzxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yzxz", () => { - it("should return Vec4(y, z, x, z)", () => { - expect(v.yzxz).toBeVec(v[1], v[2], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yzxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yzyx", () => { - it("should return Vec4(y, z, y, x)", () => { - expect(v.yzyx).toBeVec(v[1], v[2], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yzyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yzyy", () => { - it("should return Vec4(y, z, y, y)", () => { - expect(v.yzyy).toBeVec(v[1], v[2], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yzyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yzyz", () => { - it("should return Vec4(y, z, y, z)", () => { - expect(v.yzyz).toBeVec(v[1], v[2], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yzyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yzzx", () => { - it("should return Vec4(y, z, z, x)", () => { - expect(v.yzzx).toBeVec(v[1], v[2], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yzzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yzzy", () => { - it("should return Vec4(y, z, z, y)", () => { - expect(v.yzzy).toBeVec(v[1], v[2], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yzzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().yzzz", () => { - it("should return Vec4(y, z, z, z)", () => { - expect(v.yzzz).toBeVec(v[1], v[2], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yzzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zxxx", () => { - it("should return Vec4(z, x, x, x)", () => { - expect(v.zxxx).toBeVec(v[2], v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zxxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zxxy", () => { - it("should return Vec4(z, x, x, y)", () => { - expect(v.zxxy).toBeVec(v[2], v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zxxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zxxz", () => { - it("should return Vec4(z, x, x, z)", () => { - expect(v.zxxz).toBeVec(v[2], v[0], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zxxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zxyx", () => { - it("should return Vec4(z, x, y, x)", () => { - expect(v.zxyx).toBeVec(v[2], v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zxyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zxyy", () => { - it("should return Vec4(z, x, y, y)", () => { - expect(v.zxyy).toBeVec(v[2], v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zxyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zxyz", () => { - it("should return Vec4(z, x, y, z)", () => { - expect(v.zxyz).toBeVec(v[2], v[0], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zxyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zxzx", () => { - it("should return Vec4(z, x, z, x)", () => { - expect(v.zxzx).toBeVec(v[2], v[0], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zxzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zxzy", () => { - it("should return Vec4(z, x, z, y)", () => { - expect(v.zxzy).toBeVec(v[2], v[0], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zxzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zxzz", () => { - it("should return Vec4(z, x, z, z)", () => { - expect(v.zxzz).toBeVec(v[2], v[0], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zxzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zyxx", () => { - it("should return Vec4(z, y, x, x)", () => { - expect(v.zyxx).toBeVec(v[2], v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zyxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zyxy", () => { - it("should return Vec4(z, y, x, y)", () => { - expect(v.zyxy).toBeVec(v[2], v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zyxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zyxz", () => { - it("should return Vec4(z, y, x, z)", () => { - expect(v.zyxz).toBeVec(v[2], v[1], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zyxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zyyx", () => { - it("should return Vec4(z, y, y, x)", () => { - expect(v.zyyx).toBeVec(v[2], v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zyyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zyyy", () => { - it("should return Vec4(z, y, y, y)", () => { - expect(v.zyyy).toBeVec(v[2], v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zyyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zyyz", () => { - it("should return Vec4(z, y, y, z)", () => { - expect(v.zyyz).toBeVec(v[2], v[1], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zyyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zyzx", () => { - it("should return Vec4(z, y, z, x)", () => { - expect(v.zyzx).toBeVec(v[2], v[1], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zyzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zyzy", () => { - it("should return Vec4(z, y, z, y)", () => { - expect(v.zyzy).toBeVec(v[2], v[1], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zyzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zyzz", () => { - it("should return Vec4(z, y, z, z)", () => { - expect(v.zyzz).toBeVec(v[2], v[1], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zyzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zzxx", () => { - it("should return Vec4(z, z, x, x)", () => { - expect(v.zzxx).toBeVec(v[2], v[2], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zzxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zzxy", () => { - it("should return Vec4(z, z, x, y)", () => { - expect(v.zzxy).toBeVec(v[2], v[2], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zzxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zzxz", () => { - it("should return Vec4(z, z, x, z)", () => { - expect(v.zzxz).toBeVec(v[2], v[2], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zzxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zzyx", () => { - it("should return Vec4(z, z, y, x)", () => { - expect(v.zzyx).toBeVec(v[2], v[2], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zzyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zzyy", () => { - it("should return Vec4(z, z, y, y)", () => { - expect(v.zzyy).toBeVec(v[2], v[2], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zzyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zzyz", () => { - it("should return Vec4(z, z, y, z)", () => { - expect(v.zzyz).toBeVec(v[2], v[2], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zzyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zzzx", () => { - it("should return Vec4(z, z, z, x)", () => { - expect(v.zzzx).toBeVec(v[2], v[2], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zzzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zzzy", () => { - it("should return Vec4(z, z, z, y)", () => { - expect(v.zzzy).toBeVec(v[2], v[2], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zzzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().zzzz", () => { - it("should return Vec4(z, z, z, z)", () => { - expect(v.zzzz).toBeVec(v[2], v[2], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zzzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rr", () => { - it("should return Vec2(r, r)", () => { - expect(v.rr).toBeVec(v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rg", () => { - it("should return Vec2(r, g)", () => { - expect(v.rg).toBeVec(v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rb", () => { - it("should return Vec2(r, b)", () => { - expect(v.rb).toBeVec(v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().gr", () => { - it("should return Vec2(g, r)", () => { - expect(v.gr).toBeVec(v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.gr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().gg", () => { - it("should return Vec2(g, g)", () => { - expect(v.gg).toBeVec(v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.gg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().gb", () => { - it("should return Vec2(g, b)", () => { - expect(v.gb).toBeVec(v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.gb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().br", () => { - it("should return Vec2(b, r)", () => { - expect(v.br).toBeVec(v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.br; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bg", () => { - it("should return Vec2(b, g)", () => { - expect(v.bg).toBeVec(v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bb", () => { - it("should return Vec2(b, b)", () => { - expect(v.bb).toBeVec(v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rrr", () => { - it("should return Vec3(r, r, r)", () => { - expect(v.rrr).toBeVec(v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rrg", () => { - it("should return Vec3(r, r, g)", () => { - expect(v.rrg).toBeVec(v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rrb", () => { - it("should return Vec3(r, r, b)", () => { - expect(v.rrb).toBeVec(v[0], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rgr", () => { - it("should return Vec3(r, g, r)", () => { - expect(v.rgr).toBeVec(v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rgr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rgg", () => { - it("should return Vec3(r, g, g)", () => { - expect(v.rgg).toBeVec(v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rgg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rgb", () => { - it("should return Vec3(r, g, b)", () => { - expect(v.rgb).toBeVec(v[0], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rgb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rbr", () => { - it("should return Vec3(r, b, r)", () => { - expect(v.rbr).toBeVec(v[0], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rbg", () => { - it("should return Vec3(r, b, g)", () => { - expect(v.rbg).toBeVec(v[0], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rbb", () => { - it("should return Vec3(r, b, b)", () => { - expect(v.rbb).toBeVec(v[0], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().grr", () => { - it("should return Vec3(g, r, r)", () => { - expect(v.grr).toBeVec(v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.grr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().grg", () => { - it("should return Vec3(g, r, g)", () => { - expect(v.grg).toBeVec(v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.grg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().grb", () => { - it("should return Vec3(g, r, b)", () => { - expect(v.grb).toBeVec(v[1], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.grb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().ggr", () => { - it("should return Vec3(g, g, r)", () => { - expect(v.ggr).toBeVec(v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.ggr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().ggg", () => { - it("should return Vec3(g, g, g)", () => { - expect(v.ggg).toBeVec(v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.ggg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().ggb", () => { - it("should return Vec3(g, g, b)", () => { - expect(v.ggb).toBeVec(v[1], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.ggb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().gbr", () => { - it("should return Vec3(g, b, r)", () => { - expect(v.gbr).toBeVec(v[1], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.gbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().gbg", () => { - it("should return Vec3(g, b, g)", () => { - expect(v.gbg).toBeVec(v[1], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.gbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().gbb", () => { - it("should return Vec3(g, b, b)", () => { - expect(v.gbb).toBeVec(v[1], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.gbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().brr", () => { - it("should return Vec3(b, r, r)", () => { - expect(v.brr).toBeVec(v[2], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.brr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().brg", () => { - it("should return Vec3(b, r, g)", () => { - expect(v.brg).toBeVec(v[2], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.brg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().brb", () => { - it("should return Vec3(b, r, b)", () => { - expect(v.brb).toBeVec(v[2], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.brb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bgr", () => { - it("should return Vec3(b, g, r)", () => { - expect(v.bgr).toBeVec(v[2], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.bgr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bgg", () => { - it("should return Vec3(b, g, g)", () => { - expect(v.bgg).toBeVec(v[2], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bgg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bgb", () => { - it("should return Vec3(b, g, b)", () => { - expect(v.bgb).toBeVec(v[2], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bgb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bbr", () => { - it("should return Vec3(b, b, r)", () => { - expect(v.bbr).toBeVec(v[2], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.bbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bbg", () => { - it("should return Vec3(b, b, g)", () => { - expect(v.bbg).toBeVec(v[2], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bbb", () => { - it("should return Vec3(b, b, b)", () => { - expect(v.bbb).toBeVec(v[2], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rrrr", () => { - it("should return Vec4(r, r, r, r)", () => { - expect(v.rrrr).toBeVec(v[0], v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rrrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rrrg", () => { - it("should return Vec4(r, r, r, g)", () => { - expect(v.rrrg).toBeVec(v[0], v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rrrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rrrb", () => { - it("should return Vec4(r, r, r, b)", () => { - expect(v.rrrb).toBeVec(v[0], v[0], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rrrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rrgr", () => { - it("should return Vec4(r, r, g, r)", () => { - expect(v.rrgr).toBeVec(v[0], v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rrgr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rrgg", () => { - it("should return Vec4(r, r, g, g)", () => { - expect(v.rrgg).toBeVec(v[0], v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rrgg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rrgb", () => { - it("should return Vec4(r, r, g, b)", () => { - expect(v.rrgb).toBeVec(v[0], v[0], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rrgb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rrbr", () => { - it("should return Vec4(r, r, b, r)", () => { - expect(v.rrbr).toBeVec(v[0], v[0], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rrbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rrbg", () => { - it("should return Vec4(r, r, b, g)", () => { - expect(v.rrbg).toBeVec(v[0], v[0], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rrbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rrbb", () => { - it("should return Vec4(r, r, b, b)", () => { - expect(v.rrbb).toBeVec(v[0], v[0], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rrbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rgrr", () => { - it("should return Vec4(r, g, r, r)", () => { - expect(v.rgrr).toBeVec(v[0], v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rgrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rgrg", () => { - it("should return Vec4(r, g, r, g)", () => { - expect(v.rgrg).toBeVec(v[0], v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rgrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rgrb", () => { - it("should return Vec4(r, g, r, b)", () => { - expect(v.rgrb).toBeVec(v[0], v[1], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rgrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rggr", () => { - it("should return Vec4(r, g, g, r)", () => { - expect(v.rggr).toBeVec(v[0], v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rggr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rggg", () => { - it("should return Vec4(r, g, g, g)", () => { - expect(v.rggg).toBeVec(v[0], v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rggg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rggb", () => { - it("should return Vec4(r, g, g, b)", () => { - expect(v.rggb).toBeVec(v[0], v[1], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rggb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rgbr", () => { - it("should return Vec4(r, g, b, r)", () => { - expect(v.rgbr).toBeVec(v[0], v[1], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rgbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rgbg", () => { - it("should return Vec4(r, g, b, g)", () => { - expect(v.rgbg).toBeVec(v[0], v[1], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rgbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rgbb", () => { - it("should return Vec4(r, g, b, b)", () => { - expect(v.rgbb).toBeVec(v[0], v[1], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rgbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rbrr", () => { - it("should return Vec4(r, b, r, r)", () => { - expect(v.rbrr).toBeVec(v[0], v[2], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rbrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rbrg", () => { - it("should return Vec4(r, b, r, g)", () => { - expect(v.rbrg).toBeVec(v[0], v[2], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rbrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rbrb", () => { - it("should return Vec4(r, b, r, b)", () => { - expect(v.rbrb).toBeVec(v[0], v[2], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rbrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rbgr", () => { - it("should return Vec4(r, b, g, r)", () => { - expect(v.rbgr).toBeVec(v[0], v[2], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rbgr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rbgg", () => { - it("should return Vec4(r, b, g, g)", () => { - expect(v.rbgg).toBeVec(v[0], v[2], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rbgg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rbgb", () => { - it("should return Vec4(r, b, g, b)", () => { - expect(v.rbgb).toBeVec(v[0], v[2], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rbgb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rbbr", () => { - it("should return Vec4(r, b, b, r)", () => { - expect(v.rbbr).toBeVec(v[0], v[2], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rbbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rbbg", () => { - it("should return Vec4(r, b, b, g)", () => { - expect(v.rbbg).toBeVec(v[0], v[2], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rbbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().rbbb", () => { - it("should return Vec4(r, b, b, b)", () => { - expect(v.rbbb).toBeVec(v[0], v[2], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rbbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().grrr", () => { - it("should return Vec4(g, r, r, r)", () => { - expect(v.grrr).toBeVec(v[1], v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.grrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().grrg", () => { - it("should return Vec4(g, r, r, g)", () => { - expect(v.grrg).toBeVec(v[1], v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.grrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().grrb", () => { - it("should return Vec4(g, r, r, b)", () => { - expect(v.grrb).toBeVec(v[1], v[0], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.grrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().grgr", () => { - it("should return Vec4(g, r, g, r)", () => { - expect(v.grgr).toBeVec(v[1], v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.grgr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().grgg", () => { - it("should return Vec4(g, r, g, g)", () => { - expect(v.grgg).toBeVec(v[1], v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.grgg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().grgb", () => { - it("should return Vec4(g, r, g, b)", () => { - expect(v.grgb).toBeVec(v[1], v[0], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.grgb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().grbr", () => { - it("should return Vec4(g, r, b, r)", () => { - expect(v.grbr).toBeVec(v[1], v[0], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.grbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().grbg", () => { - it("should return Vec4(g, r, b, g)", () => { - expect(v.grbg).toBeVec(v[1], v[0], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.grbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().grbb", () => { - it("should return Vec4(g, r, b, b)", () => { - expect(v.grbb).toBeVec(v[1], v[0], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.grbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().ggrr", () => { - it("should return Vec4(g, g, r, r)", () => { - expect(v.ggrr).toBeVec(v[1], v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.ggrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().ggrg", () => { - it("should return Vec4(g, g, r, g)", () => { - expect(v.ggrg).toBeVec(v[1], v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.ggrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().ggrb", () => { - it("should return Vec4(g, g, r, b)", () => { - expect(v.ggrb).toBeVec(v[1], v[1], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.ggrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().gggr", () => { - it("should return Vec4(g, g, g, r)", () => { - expect(v.gggr).toBeVec(v[1], v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.gggr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().gggg", () => { - it("should return Vec4(g, g, g, g)", () => { - expect(v.gggg).toBeVec(v[1], v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.gggg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().gggb", () => { - it("should return Vec4(g, g, g, b)", () => { - expect(v.gggb).toBeVec(v[1], v[1], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.gggb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().ggbr", () => { - it("should return Vec4(g, g, b, r)", () => { - expect(v.ggbr).toBeVec(v[1], v[1], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.ggbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().ggbg", () => { - it("should return Vec4(g, g, b, g)", () => { - expect(v.ggbg).toBeVec(v[1], v[1], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.ggbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().ggbb", () => { - it("should return Vec4(g, g, b, b)", () => { - expect(v.ggbb).toBeVec(v[1], v[1], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.ggbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().gbrr", () => { - it("should return Vec4(g, b, r, r)", () => { - expect(v.gbrr).toBeVec(v[1], v[2], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.gbrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().gbrg", () => { - it("should return Vec4(g, b, r, g)", () => { - expect(v.gbrg).toBeVec(v[1], v[2], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.gbrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().gbrb", () => { - it("should return Vec4(g, b, r, b)", () => { - expect(v.gbrb).toBeVec(v[1], v[2], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.gbrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().gbgr", () => { - it("should return Vec4(g, b, g, r)", () => { - expect(v.gbgr).toBeVec(v[1], v[2], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.gbgr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().gbgg", () => { - it("should return Vec4(g, b, g, g)", () => { - expect(v.gbgg).toBeVec(v[1], v[2], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.gbgg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().gbgb", () => { - it("should return Vec4(g, b, g, b)", () => { - expect(v.gbgb).toBeVec(v[1], v[2], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.gbgb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().gbbr", () => { - it("should return Vec4(g, b, b, r)", () => { - expect(v.gbbr).toBeVec(v[1], v[2], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.gbbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().gbbg", () => { - it("should return Vec4(g, b, b, g)", () => { - expect(v.gbbg).toBeVec(v[1], v[2], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.gbbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().gbbb", () => { - it("should return Vec4(g, b, b, b)", () => { - expect(v.gbbb).toBeVec(v[1], v[2], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.gbbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().brrr", () => { - it("should return Vec4(b, r, r, r)", () => { - expect(v.brrr).toBeVec(v[2], v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.brrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().brrg", () => { - it("should return Vec4(b, r, r, g)", () => { - expect(v.brrg).toBeVec(v[2], v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.brrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().brrb", () => { - it("should return Vec4(b, r, r, b)", () => { - expect(v.brrb).toBeVec(v[2], v[0], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.brrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().brgr", () => { - it("should return Vec4(b, r, g, r)", () => { - expect(v.brgr).toBeVec(v[2], v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.brgr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().brgg", () => { - it("should return Vec4(b, r, g, g)", () => { - expect(v.brgg).toBeVec(v[2], v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.brgg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().brgb", () => { - it("should return Vec4(b, r, g, b)", () => { - expect(v.brgb).toBeVec(v[2], v[0], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.brgb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().brbr", () => { - it("should return Vec4(b, r, b, r)", () => { - expect(v.brbr).toBeVec(v[2], v[0], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.brbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().brbg", () => { - it("should return Vec4(b, r, b, g)", () => { - expect(v.brbg).toBeVec(v[2], v[0], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.brbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().brbb", () => { - it("should return Vec4(b, r, b, b)", () => { - expect(v.brbb).toBeVec(v[2], v[0], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.brbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bgrr", () => { - it("should return Vec4(b, g, r, r)", () => { - expect(v.bgrr).toBeVec(v[2], v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.bgrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bgrg", () => { - it("should return Vec4(b, g, r, g)", () => { - expect(v.bgrg).toBeVec(v[2], v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bgrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bgrb", () => { - it("should return Vec4(b, g, r, b)", () => { - expect(v.bgrb).toBeVec(v[2], v[1], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bgrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bggr", () => { - it("should return Vec4(b, g, g, r)", () => { - expect(v.bggr).toBeVec(v[2], v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.bggr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bggg", () => { - it("should return Vec4(b, g, g, g)", () => { - expect(v.bggg).toBeVec(v[2], v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bggg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bggb", () => { - it("should return Vec4(b, g, g, b)", () => { - expect(v.bggb).toBeVec(v[2], v[1], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bggb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bgbr", () => { - it("should return Vec4(b, g, b, r)", () => { - expect(v.bgbr).toBeVec(v[2], v[1], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.bgbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bgbg", () => { - it("should return Vec4(b, g, b, g)", () => { - expect(v.bgbg).toBeVec(v[2], v[1], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bgbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bgbb", () => { - it("should return Vec4(b, g, b, b)", () => { - expect(v.bgbb).toBeVec(v[2], v[1], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bgbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bbrr", () => { - it("should return Vec4(b, b, r, r)", () => { - expect(v.bbrr).toBeVec(v[2], v[2], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.bbrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bbrg", () => { - it("should return Vec4(b, b, r, g)", () => { - expect(v.bbrg).toBeVec(v[2], v[2], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bbrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bbrb", () => { - it("should return Vec4(b, b, r, b)", () => { - expect(v.bbrb).toBeVec(v[2], v[2], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bbrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bbgr", () => { - it("should return Vec4(b, b, g, r)", () => { - expect(v.bbgr).toBeVec(v[2], v[2], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.bbgr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bbgg", () => { - it("should return Vec4(b, b, g, g)", () => { - expect(v.bbgg).toBeVec(v[2], v[2], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bbgg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bbgb", () => { - it("should return Vec4(b, b, g, b)", () => { - expect(v.bbgb).toBeVec(v[2], v[2], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bbgb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bbbr", () => { - it("should return Vec4(b, b, b, r)", () => { - expect(v.bbbr).toBeVec(v[2], v[2], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.bbbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bbbg", () => { - it("should return Vec4(b, b, b, g)", () => { - expect(v.bbbg).toBeVec(v[2], v[2], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bbbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec3().bbbb", () => { - it("should return Vec4(b, b, b, b)", () => { - expect(v.bbbb).toBeVec(v[2], v[2], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bbbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - // [/Swizzle Autogen] -}); \ No newline at end of file diff --git a/tests/vec3.spec.ts b/tests/vec3.spec.ts deleted file mode 100644 index 1e49181b..00000000 --- a/tests/vec3.spec.ts +++ /dev/null @@ -1,702 +0,0 @@ -import { expect, describe, it, beforeEach } from 'vitest'; -import { Vec3, Vec3Like } from "../src/vec3" -import { Mat4, Mat4Like } from "../src/mat4" -import "./test-utils" - -describe("Vec3", () => { - describe("constructor", () => { - it("should return Vec3(0, 0, 0) if called with no arguments", () => { - expect(new Vec3()).toBeVec(0, 0, 0); - }); - - it("should return Vec3(x, y, z) if called with (x, y, z)", () => { - expect(new Vec3(1, 2, 3)).toBeVec(1, 2, 3); - expect(new Vec3(-3, 4.4, -5.6)).toBeVec(-3, 4.4, -5.6); - }); - - it("should return Vec3(x, x, x) if called with (x)", () => { - expect(new Vec3(1)).toBeVec(1, 1, 1); - expect(new Vec3(-2.3)).toBeVec(-2.3, -2.3, -2.3); - }); - - it("should return Vec3(x, y, z) if called with ([x, y, z])", () => { - expect(new Vec3([1, 2, 3])).toBeVec(1, 2, 3); - expect(new Vec3([-3, 4.4, -5.6])).toBeVec(-3, 4.4, -5.6); - }); - - it("should return Vec3(x, y, z) if called with (Vec3(x, y, z))", () => { - let v = new Vec3(3.4, 5.6, 7.8); - expect(new Vec3(v)).toBeVec(v); - }); - - it("should return Vec3(x, y, z) if called with (Float32Array([x, y, z]))", () => { - let arr = new Float32Array([1.2, 3.4, 5.6]); - expect(new Vec3(arr)).toBeVec(arr); - }); - }); - - describe("static", () => { - let out: Vec3Like; - let vecA: Vec3Like; - let vecB: Vec3Like; - let result: Vec3Like; - - beforeEach(() => { - vecA = new Vec3(1, 2, 3); - vecB = new Vec3(4, 5, 6); - out = new Vec3(0, 0, 0); - }); - - describe('rotateX', () => { - describe('rotation around world origin [0, 0, 0]', () => { - beforeEach(() => { vecA = [0, 1, 0]; vecB = [0, 0, 0]; result = Vec3.rotateX(out, vecA, vecB, Math.PI); }); - it("should return the rotated vector", () => { expect(result).toBeVec(0, -1, 0); }); - }); - describe('rotation around an arbitrary origin', () => { - beforeEach(() => { vecA = [2, 7, 0]; vecB = [2, 5, 0]; result = Vec3.rotateX(out, vecA, vecB, Math.PI); }); - it("should return the rotated vector", () => { expect(result).toBeVec(2, 3, 0); }); - }); - }); - - describe('rotateY', () => { - describe('rotation around world origin [0, 0, 0]', () => { - beforeEach(() => { vecA = [1, 0, 0]; vecB = [0, 0, 0]; result = Vec3.rotateY(out, vecA, vecB, Math.PI); }); - it("should return the rotated vector", () => { expect(result).toBeVec(-1, 0, 0); }); - }); - describe('rotation around an arbitrary origin', () => { - beforeEach(() => { vecA = [-2, 3, 10]; vecB = [-4, 3, 10]; result = Vec3.rotateY(out, vecA, vecB, Math.PI); }); - it("should return the rotated vector", () => { expect(result).toBeVec(-6, 3, 10); }); - }); - }); - - describe('rotateZ', () => { - describe('rotation around world origin [0, 0, 0]', () => { - beforeEach(() => { vecA = [0, 1, 0]; vecB = [0, 0, 0]; result = Vec3.rotateZ(out, vecA, vecB, Math.PI); }); - it("should return the rotated vector", () => { expect(result).toBeVec(0, -1, 0); }); - }); - describe('rotation around an arbitrary origin', () => { - beforeEach(() => { vecA = [0, 6, -5]; vecB = [0, 0, -5]; result = Vec3.rotateZ(out, vecA, vecB, Math.PI); }); - it("should return the rotated vector", () => { expect(result).toBeVec(0, -6, -5); }); - }); - }); - - describe('transformMat4', () => { - let matr : Mat4Like; - describe("with an identity", () => { - beforeEach(() => { matr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ] }); - - beforeEach(() => { result = Vec3.transformMat4(out, vecA, matr); }); - - it("should produce the input", () => { - expect(out).toBeVec(1, 2, 3); - }); - - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("with a lookAt", () => { - beforeEach(() => { matr = Mat4.lookAt(new Mat4(), [5, 6, 7], [2, 6, 7], [0, 1, 0]); }); - - beforeEach(() => { result = Vec3.transformMat4(out, vecA, matr); }); - - it("should rotate and translate the input", () => { - expect(out).toBeVec( 4, -4, -4 ); - }); - - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("with a perspective matrix (#92)", () => { - it("should transform a point from perspective(pi/2, 4/3, 1, 100)", () => { - matr = [0.750, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, -1.02, -1, - 0, 0, -2.02, 0]; - result = Vec3.transformMat4([0, 0, 0], [10, 20, 30], matr); - expect(result).toBeVec(-0.25, -0.666666, 1.087333); - }); - }); - - }); - - /*describe('transformMat3', () => { - let matr; - describe("with an identity", () => { - beforeEach(() => { matr = [1, 0, 0, 0, 1, 0, 0, 0, 1 ] }); - - beforeEach(() => { result = Vec3.transformMat3(out, vecA, matr); }); - - it("should produce the input", () => { - expect(out).toBeVec(1, 2, 3); - }); - - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("with 90deg about X", () => { - beforeEach(() => { - result = Vec3.transformMat3(out, [0,1,0], [1,0,0,0,0,1,0,-1,0]); - }); - - it("should produce correct output", () => { - expect(out).toBeVec(0,0,1); - }); - }); - - describe("with 90deg about Y", () => { - beforeEach(() => { - result = Vec3.transformMat3(out, [1,0,0], [0,0,-1,0,1,0,1,0,0]); - }); - - it("should produce correct output", () => { - expect(out).toBeVec(0,0,-1); - }); - }); - - describe("with 90deg about Z", () => { - beforeEach(() => { - result = Vec3.transformMat3(out, [1,0,0], [0,1,0,-1,0,0,0,0,1]); - }); - - it("should produce correct output", () => { - expect(out).toBeVec(0,1,0); - }); - }); - - describe("with a lookAt normal matrix", () => { - beforeEach(() => { - matr = mat4.lookAt(mat4.create(), [5, 6, 7], [2, 6, 7], [0, 1, 0]); - let n = mat3.create(); - matr = mat3.transpose(n, mat3.invert(n, mat3.fromMat4(n, matr))); - }); - - beforeEach(() => { result = Vec3.transformMat3(out, [1,0,0], matr); }); - - it("should rotate the input", () => { - expect(out).toBeVec( 0,0,1 ); - }); - - it("should return out", () => { expect(result).toBe(out); }); - }); - });*/ - - describe("transformQuat", () => { - beforeEach(() => { result = Vec3.transformQuat(out, vecA, [0.18257418567011074, 0.3651483713402215, 0.5477225570103322, 0.730296742680443]); }); - it("should rotate the input vector", () => { expect(out).toBeVec(1, 2, 3); }); - it("should return out", () => { expect(result).not.toBe([1,2,3,4]); }); - }); - - describe("create", () => { - beforeEach(() => { result = Vec3.create(); }); - it("should return a 3 element array initialized to 0s", () => { expect(result).toBeVec(0, 0, 0); }); - }); - - describe("clone", () => { - beforeEach(() => { result = Vec3.clone(vecA); }); - it("should return a 3 element array initialized to the values in vecA", () => { expect(result).toBeVec(vecA); }); - }); - - describe("fromValues", () => { - beforeEach(() => { result = Vec3.fromValues(1, 2, 3); }); - it("should return a 3 element array initialized to the values passed", () => { expect(result).toBeVec(1, 2, 3); }); - }); - - describe("copy", () => { - beforeEach(() => { result = Vec3.copy(out, vecA); }); - it("should place values into out", () => { expect(out).toBeVec(1, 2, 3); }); - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("set", () => { - beforeEach(() => { result = Vec3.set(out, 1, 2, 3); }); - it("should place values into out", () => { expect(out).toBeVec(1, 2, 3); }); - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("add", () => { - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec3.add(out, vecA, vecB); }); - - it("should place values into out", () => { expect(out).toBeVec(5, 7, 9); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(4, 5, 6); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec3.add(vecA, vecA, vecB); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(5, 7, 9); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(4, 5, 6); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec3.add(vecB, vecA, vecB); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(5, 7, 9); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3); }); - }); - }); - - describe("subtract", () => { - it("should have an alias called 'sub'", () => { expect(Vec3.sub).toEqual(Vec3.subtract); }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec3.subtract(out, vecA, vecB); }); - - it("should place values into out", () => { expect(out).toBeVec(-3, -3, -3); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(4, 5, 6); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec3.subtract(vecA, vecA, vecB); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(-3, -3, -3); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(4, 5, 6); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec3.subtract(vecB, vecA, vecB); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(-3, -3, -3); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3); }); - }); - }); - - describe("multiply", () => { - it("should have an alias called 'mul'", () => { expect(Vec3.mul).toEqual(Vec3.multiply); }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec3.multiply(out, vecA, vecB); }); - - it("should place values into out", () => { expect(out).toBeVec(4, 10, 18); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(4, 5, 6); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec3.multiply(vecA, vecA, vecB); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(4, 10, 18); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(4, 5, 6); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec3.multiply(vecB, vecA, vecB); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(4, 10, 18); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3); }); - }); - }); - - describe("divide", () => { - it("should have an alias called 'div'", () => { expect(Vec3.div).toEqual(Vec3.divide); }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec3.divide(out, vecA, vecB); }); - - it("should place values into out", () => { expect(out).toBeVec(0.25, 0.4, 0.5); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(4, 5, 6); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec3.divide(vecA, vecA, vecB); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(0.25, 0.4, 0.5); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(4, 5, 6); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec3.divide(vecB, vecA, vecB); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(0.25, 0.4, 0.5); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3); }); - }); - }); - - describe("ceil", () => { - beforeEach(() => { vecA = [Math.E, Math.PI, Math.SQRT2]; }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec3.ceil(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(3, 4, 2); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(Math.E, Math.PI, Math.SQRT2); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec3.ceil(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(3, 4, 2); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("floor", () => { - beforeEach(() => { vecA = [Math.E, Math.PI, Math.SQRT2]; }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec3.floor(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(2, 3, 1); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(Math.E, Math.PI, Math.SQRT2); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec3.floor(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(2, 3, 1); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("min", () => { - beforeEach(() => { vecA = [1, 3, 1]; vecB = [3, 1, 3]; }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec3.min(out, vecA, vecB); }); - - it("should place values into out", () => { expect(out).toBeVec(1, 1, 1); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 3, 1); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 1, 3); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec3.min(vecA, vecA, vecB); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(1, 1, 1); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 1, 3); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec3.min(vecB, vecA, vecB); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(1, 1, 1); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 3, 1); }); - }); - }); - - describe("max", () => { - beforeEach(() => { vecA = [1, 3, 1]; vecB = [3, 1, 3]; }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec3.max(out, vecA, vecB); }); - - it("should place values into out", () => { expect(out).toBeVec(3, 3, 3); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 3, 1); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 1, 3); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec3.max(vecA, vecA, vecB); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(3, 3, 3); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 1, 3); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec3.max(vecB, vecA, vecB); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(3, 3, 3); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 3, 1); }); - }); - }); - - /*describe("round", () => { - beforeEach(() => { vecA = [Math.E, Math.PI, Math.SQRT2]; }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec3.round(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(3, 3, 1); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(Math.E, Math.PI, Math.SQRT2); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec3.round(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(3, 3, 1); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - });*/ - - describe("scale", () => { - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec3.scale(out, vecA, 2); }); - - it("should place values into out", () => { expect(out).toBeVec(2, 4, 6); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec3.scale(vecA, vecA, 2); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(2, 4, 6); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("scaleAndAdd", () => { - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec3.scaleAndAdd(out, vecA, vecB, 0.5); }); - - it("should place values into out", () => { expect(out).toBeVec(3, 4.5, 6); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(4, 5, 6); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec3.scaleAndAdd(vecA, vecA, vecB, 0.5); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(3, 4.5, 6); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(4, 5, 6); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec3.scaleAndAdd(vecB, vecA, vecB, 0.5); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(3, 4.5, 6); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3); }); - }); - }); - - describe("distance", () => { - it("should have an alias called 'dist'", () => { expect(Vec3.dist).toEqual(Vec3.distance); }); - it("should return the distance", () => { expect(Vec3.distance(vecA, vecB)).toBeCloseTo(5.196152); }); - }); - - describe("squaredDistance", () => { - it("should have an alias called 'sqrDist'", () => { expect(Vec3.sqrDist).toEqual(Vec3.squaredDistance); }); - it("should return the squared distance", () => { expect(Vec3.squaredDistance(vecA, vecB)).toEqual(27); }); - }); - - describe("length", () => { - it("should have an alias called 'len'", () => { expect(Vec3.len).toEqual(Vec3.length); }); - it("should return the length", () => { expect(Vec3.len(vecA)).toBeCloseTo(3.741657); }); - }); - - describe("squaredLength", () => { - it("should have an alias called 'sqrLen'", () => { expect(Vec3.sqrLen).toEqual(Vec3.squaredLength); }); - it("should return the squared length", () => { expect(Vec3.squaredLength(vecA)).toEqual(14); }); - }); - - describe("negate", () => { - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec3.negate(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(-1, -2, -3); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec3.negate(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(-1, -2, -3); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("inverse", () => { - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec3.inverse(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(1, 1/2, 1/3); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec3.inverse(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(1, 1/2, 1/3); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("abs", () => { - beforeEach(() => { vecA = [-1, -2, -3]; }); - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec3.abs(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(1, 2, 3); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(-1, -2, -3); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec3.abs(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(1, 2, 3); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("normalize", () => { - beforeEach(() => { vecA = [5, 0, 0]; }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec3.normalize(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(1, 0, 0); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(5, 0, 0); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec3.normalize(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(1, 0, 0); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("dot", () => { - let value: number; - beforeEach(() => { value = Vec3.dot(vecA, vecB); }); - - it("should return the dot product", () => { expect(value).toEqual(32); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(4, 5, 6); }); - }); - - describe("cross", () => { - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec3.cross(out, vecA, vecB); }); - - it("should place values into out", () => { expect(out).toBeVec(-3, 6, -3); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(4, 5, 6); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec3.cross(vecA, vecA, vecB); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(-3, 6, -3); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(4, 5, 6); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec3.cross(vecB, vecA, vecB); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(-3, 6, -3); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3); }); - }); - }); - - describe("lerp", () => { - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec3.lerp(out, vecA, vecB, 0.5); }); - - it("should place values into out", () => { expect(out).toBeVec(2.5, 3.5, 4.5); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(4, 5, 6); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec3.lerp(vecA, vecA, vecB, 0.5); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(2.5, 3.5, 4.5); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(4, 5, 6); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec3.lerp(vecB, vecA, vecB, 0.5); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(2.5, 3.5, 4.5); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3); }); - }); - }); - - describe("angle", () => { - let value: number; - beforeEach(() => { value = Vec3.angle(vecA, vecB); }); - - it("should return the angle", () => { expect(value).toBeCloseTo(0.225726); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(4, 5, 6); }); - }); - - describe("str", () => { - it("should return a string representation of the vector", () => { expect(Vec3.str(vecA)).toEqual("Vec3(1, 2, 3)"); }); - }); - - describe("exactEquals", () => { - let vecC: Vec3Like, r0: boolean, r1: boolean; - beforeEach(() => { - vecA = [0, 1, 2]; - vecB = [0, 1, 2]; - vecC = [1, 2, 3]; - r0 = Vec3.exactEquals(vecA, vecB); - r1 = Vec3.exactEquals(vecA, vecC); - }); - - it("should return true for identical vectors", () => { expect(r0).toBe(true); }); - it("should return false for different vectors", () => { expect(r1).toBe(false); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(0, 1, 2); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(0, 1, 2); }); - }); - - describe("equals", () => { - let vecC: Vec3Like, - vecD: Vec3Like, - r0: boolean, - r1: boolean, - r2: boolean; - beforeEach(() => { - vecA = [0, 1, 2]; - vecB = [0, 1, 2]; - vecC = [1, 2, 3]; - vecD = [1e-16, 1, 2]; - r0 = Vec3.equals(vecA, vecB); - r1 = Vec3.equals(vecA, vecC); - r2 = Vec3.equals(vecA, vecD); - }); - it("should return true for identical vectors", () => { expect(r0).toBe(true); }); - it("should return false for different vectors", () => { expect(r1).toBe(false); }); - it("should return true for close but not identical vectors", () => { expect(r2).toBe(true); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(0, 1, 2); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(0, 1, 2); }); - }); - - describe("zero", () => { - beforeEach(() => { - vecA = [1, 2, 3]; - result = Vec3.zero(vecA); - }); - it("should result in a 3 element vector with zeros", () => { expect(result).toBeVec(0, 0, 0); }); - }); - }); -}); \ No newline at end of file diff --git a/tests/vec4-swizzle.spec.ts b/tests/vec4-swizzle.spec.ts deleted file mode 100644 index 66d512c2..00000000 --- a/tests/vec4-swizzle.spec.ts +++ /dev/null @@ -1,7409 +0,0 @@ -import { expect, describe, it, beforeEach } from 'vitest'; -import { Vec4 } from "../src/vec4" -import { EnableSwizzles } from '../src/swizzle'; -import "./test-utils" - -describe("Vec4 Swizzles", () => { - EnableSwizzles(); - - let v: Vec4; - beforeEach(() => { v = new Vec4(1, 2, 3); }); - - // The contents of the following section are autogenerated by scripts/gen-swizzle.js and should - // not be modified by hand. - // [Swizzle Autogen] - - describe("Vec4().xx", () => { - it("should return Vec2(x, x)", () => { - expect(v.xx).toBeVec(v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xy", () => { - it("should return Vec2(x, y)", () => { - expect(v.xy).toBeVec(v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xz", () => { - it("should return Vec2(x, z)", () => { - expect(v.xz).toBeVec(v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xw", () => { - it("should return Vec2(x, w)", () => { - expect(v.xw).toBeVec(v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yx", () => { - it("should return Vec2(y, x)", () => { - expect(v.yx).toBeVec(v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yy", () => { - it("should return Vec2(y, y)", () => { - expect(v.yy).toBeVec(v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yz", () => { - it("should return Vec2(y, z)", () => { - expect(v.yz).toBeVec(v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yw", () => { - it("should return Vec2(y, w)", () => { - expect(v.yw).toBeVec(v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.yw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zx", () => { - it("should return Vec2(z, x)", () => { - expect(v.zx).toBeVec(v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zy", () => { - it("should return Vec2(z, y)", () => { - expect(v.zy).toBeVec(v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zz", () => { - it("should return Vec2(z, z)", () => { - expect(v.zz).toBeVec(v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zw", () => { - it("should return Vec2(z, w)", () => { - expect(v.zw).toBeVec(v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wx", () => { - it("should return Vec2(w, x)", () => { - expect(v.wx).toBeVec(v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wy", () => { - it("should return Vec2(w, y)", () => { - expect(v.wy).toBeVec(v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wz", () => { - it("should return Vec2(w, z)", () => { - expect(v.wz).toBeVec(v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ww", () => { - it("should return Vec2(w, w)", () => { - expect(v.ww).toBeVec(v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.ww; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xxx", () => { - it("should return Vec3(x, x, x)", () => { - expect(v.xxx).toBeVec(v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xxy", () => { - it("should return Vec3(x, x, y)", () => { - expect(v.xxy).toBeVec(v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xxz", () => { - it("should return Vec3(x, x, z)", () => { - expect(v.xxz).toBeVec(v[0], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xxw", () => { - it("should return Vec3(x, x, w)", () => { - expect(v.xxw).toBeVec(v[0], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xxw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xyx", () => { - it("should return Vec3(x, y, x)", () => { - expect(v.xyx).toBeVec(v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xyy", () => { - it("should return Vec3(x, y, y)", () => { - expect(v.xyy).toBeVec(v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xyz", () => { - it("should return Vec3(x, y, z)", () => { - expect(v.xyz).toBeVec(v[0], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xyw", () => { - it("should return Vec3(x, y, w)", () => { - expect(v.xyw).toBeVec(v[0], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xyw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xzx", () => { - it("should return Vec3(x, z, x)", () => { - expect(v.xzx).toBeVec(v[0], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xzy", () => { - it("should return Vec3(x, z, y)", () => { - expect(v.xzy).toBeVec(v[0], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xzz", () => { - it("should return Vec3(x, z, z)", () => { - expect(v.xzz).toBeVec(v[0], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xzw", () => { - it("should return Vec3(x, z, w)", () => { - expect(v.xzw).toBeVec(v[0], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xzw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xwx", () => { - it("should return Vec3(x, w, x)", () => { - expect(v.xwx).toBeVec(v[0], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xwx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xwy", () => { - it("should return Vec3(x, w, y)", () => { - expect(v.xwy).toBeVec(v[0], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xwy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xwz", () => { - it("should return Vec3(x, w, z)", () => { - expect(v.xwz).toBeVec(v[0], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xwz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xww", () => { - it("should return Vec3(x, w, w)", () => { - expect(v.xww).toBeVec(v[0], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xww; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yxx", () => { - it("should return Vec3(y, x, x)", () => { - expect(v.yxx).toBeVec(v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yxy", () => { - it("should return Vec3(y, x, y)", () => { - expect(v.yxy).toBeVec(v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yxz", () => { - it("should return Vec3(y, x, z)", () => { - expect(v.yxz).toBeVec(v[1], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yxw", () => { - it("should return Vec3(y, x, w)", () => { - expect(v.yxw).toBeVec(v[1], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.yxw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yyx", () => { - it("should return Vec3(y, y, x)", () => { - expect(v.yyx).toBeVec(v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yyy", () => { - it("should return Vec3(y, y, y)", () => { - expect(v.yyy).toBeVec(v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yyz", () => { - it("should return Vec3(y, y, z)", () => { - expect(v.yyz).toBeVec(v[1], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yyw", () => { - it("should return Vec3(y, y, w)", () => { - expect(v.yyw).toBeVec(v[1], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.yyw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yzx", () => { - it("should return Vec3(y, z, x)", () => { - expect(v.yzx).toBeVec(v[1], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yzy", () => { - it("should return Vec3(y, z, y)", () => { - expect(v.yzy).toBeVec(v[1], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yzz", () => { - it("should return Vec3(y, z, z)", () => { - expect(v.yzz).toBeVec(v[1], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yzw", () => { - it("should return Vec3(y, z, w)", () => { - expect(v.yzw).toBeVec(v[1], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.yzw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ywx", () => { - it("should return Vec3(y, w, x)", () => { - expect(v.ywx).toBeVec(v[1], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.ywx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ywy", () => { - it("should return Vec3(y, w, y)", () => { - expect(v.ywy).toBeVec(v[1], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.ywy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ywz", () => { - it("should return Vec3(y, w, z)", () => { - expect(v.ywz).toBeVec(v[1], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.ywz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yww", () => { - it("should return Vec3(y, w, w)", () => { - expect(v.yww).toBeVec(v[1], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.yww; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zxx", () => { - it("should return Vec3(z, x, x)", () => { - expect(v.zxx).toBeVec(v[2], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zxy", () => { - it("should return Vec3(z, x, y)", () => { - expect(v.zxy).toBeVec(v[2], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zxz", () => { - it("should return Vec3(z, x, z)", () => { - expect(v.zxz).toBeVec(v[2], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zxw", () => { - it("should return Vec3(z, x, w)", () => { - expect(v.zxw).toBeVec(v[2], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zxw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zyx", () => { - it("should return Vec3(z, y, x)", () => { - expect(v.zyx).toBeVec(v[2], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zyy", () => { - it("should return Vec3(z, y, y)", () => { - expect(v.zyy).toBeVec(v[2], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zyz", () => { - it("should return Vec3(z, y, z)", () => { - expect(v.zyz).toBeVec(v[2], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zyw", () => { - it("should return Vec3(z, y, w)", () => { - expect(v.zyw).toBeVec(v[2], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zyw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zzx", () => { - it("should return Vec3(z, z, x)", () => { - expect(v.zzx).toBeVec(v[2], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zzy", () => { - it("should return Vec3(z, z, y)", () => { - expect(v.zzy).toBeVec(v[2], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zzz", () => { - it("should return Vec3(z, z, z)", () => { - expect(v.zzz).toBeVec(v[2], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zzw", () => { - it("should return Vec3(z, z, w)", () => { - expect(v.zzw).toBeVec(v[2], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zzw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zwx", () => { - it("should return Vec3(z, w, x)", () => { - expect(v.zwx).toBeVec(v[2], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zwx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zwy", () => { - it("should return Vec3(z, w, y)", () => { - expect(v.zwy).toBeVec(v[2], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zwy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zwz", () => { - it("should return Vec3(z, w, z)", () => { - expect(v.zwz).toBeVec(v[2], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zwz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zww", () => { - it("should return Vec3(z, w, w)", () => { - expect(v.zww).toBeVec(v[2], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zww; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wxx", () => { - it("should return Vec3(w, x, x)", () => { - expect(v.wxx).toBeVec(v[3], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wxy", () => { - it("should return Vec3(w, x, y)", () => { - expect(v.wxy).toBeVec(v[3], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wxz", () => { - it("should return Vec3(w, x, z)", () => { - expect(v.wxz).toBeVec(v[3], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wxw", () => { - it("should return Vec3(w, x, w)", () => { - expect(v.wxw).toBeVec(v[3], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.wxw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wyx", () => { - it("should return Vec3(w, y, x)", () => { - expect(v.wyx).toBeVec(v[3], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wyy", () => { - it("should return Vec3(w, y, y)", () => { - expect(v.wyy).toBeVec(v[3], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wyz", () => { - it("should return Vec3(w, y, z)", () => { - expect(v.wyz).toBeVec(v[3], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wyw", () => { - it("should return Vec3(w, y, w)", () => { - expect(v.wyw).toBeVec(v[3], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.wyw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wzx", () => { - it("should return Vec3(w, z, x)", () => { - expect(v.wzx).toBeVec(v[3], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wzy", () => { - it("should return Vec3(w, z, y)", () => { - expect(v.wzy).toBeVec(v[3], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wzz", () => { - it("should return Vec3(w, z, z)", () => { - expect(v.wzz).toBeVec(v[3], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wzw", () => { - it("should return Vec3(w, z, w)", () => { - expect(v.wzw).toBeVec(v[3], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.wzw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wwx", () => { - it("should return Vec3(w, w, x)", () => { - expect(v.wwx).toBeVec(v[3], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wwx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wwy", () => { - it("should return Vec3(w, w, y)", () => { - expect(v.wwy).toBeVec(v[3], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wwy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wwz", () => { - it("should return Vec3(w, w, z)", () => { - expect(v.wwz).toBeVec(v[3], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wwz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().www", () => { - it("should return Vec3(w, w, w)", () => { - expect(v.www).toBeVec(v[3], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.www; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xxxx", () => { - it("should return Vec4(x, x, x, x)", () => { - expect(v.xxxx).toBeVec(v[0], v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xxxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xxxy", () => { - it("should return Vec4(x, x, x, y)", () => { - expect(v.xxxy).toBeVec(v[0], v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xxxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xxxz", () => { - it("should return Vec4(x, x, x, z)", () => { - expect(v.xxxz).toBeVec(v[0], v[0], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xxxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xxxw", () => { - it("should return Vec4(x, x, x, w)", () => { - expect(v.xxxw).toBeVec(v[0], v[0], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xxxw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xxyx", () => { - it("should return Vec4(x, x, y, x)", () => { - expect(v.xxyx).toBeVec(v[0], v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xxyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xxyy", () => { - it("should return Vec4(x, x, y, y)", () => { - expect(v.xxyy).toBeVec(v[0], v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xxyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xxyz", () => { - it("should return Vec4(x, x, y, z)", () => { - expect(v.xxyz).toBeVec(v[0], v[0], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xxyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xxyw", () => { - it("should return Vec4(x, x, y, w)", () => { - expect(v.xxyw).toBeVec(v[0], v[0], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xxyw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xxzx", () => { - it("should return Vec4(x, x, z, x)", () => { - expect(v.xxzx).toBeVec(v[0], v[0], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xxzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xxzy", () => { - it("should return Vec4(x, x, z, y)", () => { - expect(v.xxzy).toBeVec(v[0], v[0], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xxzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xxzz", () => { - it("should return Vec4(x, x, z, z)", () => { - expect(v.xxzz).toBeVec(v[0], v[0], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xxzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xxzw", () => { - it("should return Vec4(x, x, z, w)", () => { - expect(v.xxzw).toBeVec(v[0], v[0], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xxzw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xxwx", () => { - it("should return Vec4(x, x, w, x)", () => { - expect(v.xxwx).toBeVec(v[0], v[0], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xxwx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xxwy", () => { - it("should return Vec4(x, x, w, y)", () => { - expect(v.xxwy).toBeVec(v[0], v[0], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xxwy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xxwz", () => { - it("should return Vec4(x, x, w, z)", () => { - expect(v.xxwz).toBeVec(v[0], v[0], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xxwz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xxww", () => { - it("should return Vec4(x, x, w, w)", () => { - expect(v.xxww).toBeVec(v[0], v[0], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xxww; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xyxx", () => { - it("should return Vec4(x, y, x, x)", () => { - expect(v.xyxx).toBeVec(v[0], v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xyxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xyxy", () => { - it("should return Vec4(x, y, x, y)", () => { - expect(v.xyxy).toBeVec(v[0], v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xyxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xyxz", () => { - it("should return Vec4(x, y, x, z)", () => { - expect(v.xyxz).toBeVec(v[0], v[1], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xyxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xyxw", () => { - it("should return Vec4(x, y, x, w)", () => { - expect(v.xyxw).toBeVec(v[0], v[1], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xyxw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xyyx", () => { - it("should return Vec4(x, y, y, x)", () => { - expect(v.xyyx).toBeVec(v[0], v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xyyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xyyy", () => { - it("should return Vec4(x, y, y, y)", () => { - expect(v.xyyy).toBeVec(v[0], v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xyyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xyyz", () => { - it("should return Vec4(x, y, y, z)", () => { - expect(v.xyyz).toBeVec(v[0], v[1], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xyyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xyyw", () => { - it("should return Vec4(x, y, y, w)", () => { - expect(v.xyyw).toBeVec(v[0], v[1], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xyyw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xyzx", () => { - it("should return Vec4(x, y, z, x)", () => { - expect(v.xyzx).toBeVec(v[0], v[1], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xyzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xyzy", () => { - it("should return Vec4(x, y, z, y)", () => { - expect(v.xyzy).toBeVec(v[0], v[1], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xyzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xyzz", () => { - it("should return Vec4(x, y, z, z)", () => { - expect(v.xyzz).toBeVec(v[0], v[1], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xyzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xyzw", () => { - it("should return Vec4(x, y, z, w)", () => { - expect(v.xyzw).toBeVec(v[0], v[1], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xyzw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xywx", () => { - it("should return Vec4(x, y, w, x)", () => { - expect(v.xywx).toBeVec(v[0], v[1], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xywx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xywy", () => { - it("should return Vec4(x, y, w, y)", () => { - expect(v.xywy).toBeVec(v[0], v[1], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xywy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xywz", () => { - it("should return Vec4(x, y, w, z)", () => { - expect(v.xywz).toBeVec(v[0], v[1], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xywz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xyww", () => { - it("should return Vec4(x, y, w, w)", () => { - expect(v.xyww).toBeVec(v[0], v[1], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xyww; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xzxx", () => { - it("should return Vec4(x, z, x, x)", () => { - expect(v.xzxx).toBeVec(v[0], v[2], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xzxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xzxy", () => { - it("should return Vec4(x, z, x, y)", () => { - expect(v.xzxy).toBeVec(v[0], v[2], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xzxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xzxz", () => { - it("should return Vec4(x, z, x, z)", () => { - expect(v.xzxz).toBeVec(v[0], v[2], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xzxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xzxw", () => { - it("should return Vec4(x, z, x, w)", () => { - expect(v.xzxw).toBeVec(v[0], v[2], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xzxw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xzyx", () => { - it("should return Vec4(x, z, y, x)", () => { - expect(v.xzyx).toBeVec(v[0], v[2], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xzyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xzyy", () => { - it("should return Vec4(x, z, y, y)", () => { - expect(v.xzyy).toBeVec(v[0], v[2], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xzyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xzyz", () => { - it("should return Vec4(x, z, y, z)", () => { - expect(v.xzyz).toBeVec(v[0], v[2], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xzyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xzyw", () => { - it("should return Vec4(x, z, y, w)", () => { - expect(v.xzyw).toBeVec(v[0], v[2], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xzyw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xzzx", () => { - it("should return Vec4(x, z, z, x)", () => { - expect(v.xzzx).toBeVec(v[0], v[2], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xzzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xzzy", () => { - it("should return Vec4(x, z, z, y)", () => { - expect(v.xzzy).toBeVec(v[0], v[2], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xzzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xzzz", () => { - it("should return Vec4(x, z, z, z)", () => { - expect(v.xzzz).toBeVec(v[0], v[2], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xzzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xzzw", () => { - it("should return Vec4(x, z, z, w)", () => { - expect(v.xzzw).toBeVec(v[0], v[2], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xzzw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xzwx", () => { - it("should return Vec4(x, z, w, x)", () => { - expect(v.xzwx).toBeVec(v[0], v[2], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xzwx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xzwy", () => { - it("should return Vec4(x, z, w, y)", () => { - expect(v.xzwy).toBeVec(v[0], v[2], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xzwy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xzwz", () => { - it("should return Vec4(x, z, w, z)", () => { - expect(v.xzwz).toBeVec(v[0], v[2], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xzwz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xzww", () => { - it("should return Vec4(x, z, w, w)", () => { - expect(v.xzww).toBeVec(v[0], v[2], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xzww; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xwxx", () => { - it("should return Vec4(x, w, x, x)", () => { - expect(v.xwxx).toBeVec(v[0], v[3], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xwxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xwxy", () => { - it("should return Vec4(x, w, x, y)", () => { - expect(v.xwxy).toBeVec(v[0], v[3], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xwxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xwxz", () => { - it("should return Vec4(x, w, x, z)", () => { - expect(v.xwxz).toBeVec(v[0], v[3], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xwxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xwxw", () => { - it("should return Vec4(x, w, x, w)", () => { - expect(v.xwxw).toBeVec(v[0], v[3], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xwxw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xwyx", () => { - it("should return Vec4(x, w, y, x)", () => { - expect(v.xwyx).toBeVec(v[0], v[3], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xwyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xwyy", () => { - it("should return Vec4(x, w, y, y)", () => { - expect(v.xwyy).toBeVec(v[0], v[3], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xwyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xwyz", () => { - it("should return Vec4(x, w, y, z)", () => { - expect(v.xwyz).toBeVec(v[0], v[3], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xwyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xwyw", () => { - it("should return Vec4(x, w, y, w)", () => { - expect(v.xwyw).toBeVec(v[0], v[3], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xwyw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xwzx", () => { - it("should return Vec4(x, w, z, x)", () => { - expect(v.xwzx).toBeVec(v[0], v[3], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xwzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xwzy", () => { - it("should return Vec4(x, w, z, y)", () => { - expect(v.xwzy).toBeVec(v[0], v[3], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xwzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xwzz", () => { - it("should return Vec4(x, w, z, z)", () => { - expect(v.xwzz).toBeVec(v[0], v[3], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xwzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xwzw", () => { - it("should return Vec4(x, w, z, w)", () => { - expect(v.xwzw).toBeVec(v[0], v[3], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xwzw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xwwx", () => { - it("should return Vec4(x, w, w, x)", () => { - expect(v.xwwx).toBeVec(v[0], v[3], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.xwwx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xwwy", () => { - it("should return Vec4(x, w, w, y)", () => { - expect(v.xwwy).toBeVec(v[0], v[3], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.xwwy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xwwz", () => { - it("should return Vec4(x, w, w, z)", () => { - expect(v.xwwz).toBeVec(v[0], v[3], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.xwwz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().xwww", () => { - it("should return Vec4(x, w, w, w)", () => { - expect(v.xwww).toBeVec(v[0], v[3], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.xwww; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yxxx", () => { - it("should return Vec4(y, x, x, x)", () => { - expect(v.yxxx).toBeVec(v[1], v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yxxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yxxy", () => { - it("should return Vec4(y, x, x, y)", () => { - expect(v.yxxy).toBeVec(v[1], v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yxxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yxxz", () => { - it("should return Vec4(y, x, x, z)", () => { - expect(v.yxxz).toBeVec(v[1], v[0], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yxxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yxxw", () => { - it("should return Vec4(y, x, x, w)", () => { - expect(v.yxxw).toBeVec(v[1], v[0], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.yxxw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yxyx", () => { - it("should return Vec4(y, x, y, x)", () => { - expect(v.yxyx).toBeVec(v[1], v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yxyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yxyy", () => { - it("should return Vec4(y, x, y, y)", () => { - expect(v.yxyy).toBeVec(v[1], v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yxyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yxyz", () => { - it("should return Vec4(y, x, y, z)", () => { - expect(v.yxyz).toBeVec(v[1], v[0], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yxyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yxyw", () => { - it("should return Vec4(y, x, y, w)", () => { - expect(v.yxyw).toBeVec(v[1], v[0], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.yxyw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yxzx", () => { - it("should return Vec4(y, x, z, x)", () => { - expect(v.yxzx).toBeVec(v[1], v[0], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yxzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yxzy", () => { - it("should return Vec4(y, x, z, y)", () => { - expect(v.yxzy).toBeVec(v[1], v[0], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yxzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yxzz", () => { - it("should return Vec4(y, x, z, z)", () => { - expect(v.yxzz).toBeVec(v[1], v[0], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yxzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yxzw", () => { - it("should return Vec4(y, x, z, w)", () => { - expect(v.yxzw).toBeVec(v[1], v[0], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.yxzw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yxwx", () => { - it("should return Vec4(y, x, w, x)", () => { - expect(v.yxwx).toBeVec(v[1], v[0], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yxwx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yxwy", () => { - it("should return Vec4(y, x, w, y)", () => { - expect(v.yxwy).toBeVec(v[1], v[0], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yxwy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yxwz", () => { - it("should return Vec4(y, x, w, z)", () => { - expect(v.yxwz).toBeVec(v[1], v[0], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yxwz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yxww", () => { - it("should return Vec4(y, x, w, w)", () => { - expect(v.yxww).toBeVec(v[1], v[0], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.yxww; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yyxx", () => { - it("should return Vec4(y, y, x, x)", () => { - expect(v.yyxx).toBeVec(v[1], v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yyxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yyxy", () => { - it("should return Vec4(y, y, x, y)", () => { - expect(v.yyxy).toBeVec(v[1], v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yyxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yyxz", () => { - it("should return Vec4(y, y, x, z)", () => { - expect(v.yyxz).toBeVec(v[1], v[1], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yyxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yyxw", () => { - it("should return Vec4(y, y, x, w)", () => { - expect(v.yyxw).toBeVec(v[1], v[1], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.yyxw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yyyx", () => { - it("should return Vec4(y, y, y, x)", () => { - expect(v.yyyx).toBeVec(v[1], v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yyyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yyyy", () => { - it("should return Vec4(y, y, y, y)", () => { - expect(v.yyyy).toBeVec(v[1], v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yyyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yyyz", () => { - it("should return Vec4(y, y, y, z)", () => { - expect(v.yyyz).toBeVec(v[1], v[1], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yyyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yyyw", () => { - it("should return Vec4(y, y, y, w)", () => { - expect(v.yyyw).toBeVec(v[1], v[1], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.yyyw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yyzx", () => { - it("should return Vec4(y, y, z, x)", () => { - expect(v.yyzx).toBeVec(v[1], v[1], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yyzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yyzy", () => { - it("should return Vec4(y, y, z, y)", () => { - expect(v.yyzy).toBeVec(v[1], v[1], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yyzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yyzz", () => { - it("should return Vec4(y, y, z, z)", () => { - expect(v.yyzz).toBeVec(v[1], v[1], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yyzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yyzw", () => { - it("should return Vec4(y, y, z, w)", () => { - expect(v.yyzw).toBeVec(v[1], v[1], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.yyzw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yywx", () => { - it("should return Vec4(y, y, w, x)", () => { - expect(v.yywx).toBeVec(v[1], v[1], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yywx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yywy", () => { - it("should return Vec4(y, y, w, y)", () => { - expect(v.yywy).toBeVec(v[1], v[1], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yywy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yywz", () => { - it("should return Vec4(y, y, w, z)", () => { - expect(v.yywz).toBeVec(v[1], v[1], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yywz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yyww", () => { - it("should return Vec4(y, y, w, w)", () => { - expect(v.yyww).toBeVec(v[1], v[1], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.yyww; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yzxx", () => { - it("should return Vec4(y, z, x, x)", () => { - expect(v.yzxx).toBeVec(v[1], v[2], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yzxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yzxy", () => { - it("should return Vec4(y, z, x, y)", () => { - expect(v.yzxy).toBeVec(v[1], v[2], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yzxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yzxz", () => { - it("should return Vec4(y, z, x, z)", () => { - expect(v.yzxz).toBeVec(v[1], v[2], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yzxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yzxw", () => { - it("should return Vec4(y, z, x, w)", () => { - expect(v.yzxw).toBeVec(v[1], v[2], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.yzxw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yzyx", () => { - it("should return Vec4(y, z, y, x)", () => { - expect(v.yzyx).toBeVec(v[1], v[2], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yzyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yzyy", () => { - it("should return Vec4(y, z, y, y)", () => { - expect(v.yzyy).toBeVec(v[1], v[2], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yzyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yzyz", () => { - it("should return Vec4(y, z, y, z)", () => { - expect(v.yzyz).toBeVec(v[1], v[2], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yzyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yzyw", () => { - it("should return Vec4(y, z, y, w)", () => { - expect(v.yzyw).toBeVec(v[1], v[2], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.yzyw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yzzx", () => { - it("should return Vec4(y, z, z, x)", () => { - expect(v.yzzx).toBeVec(v[1], v[2], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yzzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yzzy", () => { - it("should return Vec4(y, z, z, y)", () => { - expect(v.yzzy).toBeVec(v[1], v[2], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yzzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yzzz", () => { - it("should return Vec4(y, z, z, z)", () => { - expect(v.yzzz).toBeVec(v[1], v[2], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yzzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yzzw", () => { - it("should return Vec4(y, z, z, w)", () => { - expect(v.yzzw).toBeVec(v[1], v[2], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.yzzw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yzwx", () => { - it("should return Vec4(y, z, w, x)", () => { - expect(v.yzwx).toBeVec(v[1], v[2], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.yzwx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yzwy", () => { - it("should return Vec4(y, z, w, y)", () => { - expect(v.yzwy).toBeVec(v[1], v[2], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.yzwy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yzwz", () => { - it("should return Vec4(y, z, w, z)", () => { - expect(v.yzwz).toBeVec(v[1], v[2], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.yzwz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().yzww", () => { - it("should return Vec4(y, z, w, w)", () => { - expect(v.yzww).toBeVec(v[1], v[2], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.yzww; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ywxx", () => { - it("should return Vec4(y, w, x, x)", () => { - expect(v.ywxx).toBeVec(v[1], v[3], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.ywxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ywxy", () => { - it("should return Vec4(y, w, x, y)", () => { - expect(v.ywxy).toBeVec(v[1], v[3], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.ywxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ywxz", () => { - it("should return Vec4(y, w, x, z)", () => { - expect(v.ywxz).toBeVec(v[1], v[3], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.ywxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ywxw", () => { - it("should return Vec4(y, w, x, w)", () => { - expect(v.ywxw).toBeVec(v[1], v[3], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.ywxw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ywyx", () => { - it("should return Vec4(y, w, y, x)", () => { - expect(v.ywyx).toBeVec(v[1], v[3], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.ywyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ywyy", () => { - it("should return Vec4(y, w, y, y)", () => { - expect(v.ywyy).toBeVec(v[1], v[3], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.ywyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ywyz", () => { - it("should return Vec4(y, w, y, z)", () => { - expect(v.ywyz).toBeVec(v[1], v[3], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.ywyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ywyw", () => { - it("should return Vec4(y, w, y, w)", () => { - expect(v.ywyw).toBeVec(v[1], v[3], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.ywyw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ywzx", () => { - it("should return Vec4(y, w, z, x)", () => { - expect(v.ywzx).toBeVec(v[1], v[3], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.ywzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ywzy", () => { - it("should return Vec4(y, w, z, y)", () => { - expect(v.ywzy).toBeVec(v[1], v[3], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.ywzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ywzz", () => { - it("should return Vec4(y, w, z, z)", () => { - expect(v.ywzz).toBeVec(v[1], v[3], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.ywzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ywzw", () => { - it("should return Vec4(y, w, z, w)", () => { - expect(v.ywzw).toBeVec(v[1], v[3], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.ywzw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ywwx", () => { - it("should return Vec4(y, w, w, x)", () => { - expect(v.ywwx).toBeVec(v[1], v[3], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.ywwx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ywwy", () => { - it("should return Vec4(y, w, w, y)", () => { - expect(v.ywwy).toBeVec(v[1], v[3], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.ywwy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ywwz", () => { - it("should return Vec4(y, w, w, z)", () => { - expect(v.ywwz).toBeVec(v[1], v[3], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.ywwz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ywww", () => { - it("should return Vec4(y, w, w, w)", () => { - expect(v.ywww).toBeVec(v[1], v[3], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.ywww; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zxxx", () => { - it("should return Vec4(z, x, x, x)", () => { - expect(v.zxxx).toBeVec(v[2], v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zxxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zxxy", () => { - it("should return Vec4(z, x, x, y)", () => { - expect(v.zxxy).toBeVec(v[2], v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zxxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zxxz", () => { - it("should return Vec4(z, x, x, z)", () => { - expect(v.zxxz).toBeVec(v[2], v[0], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zxxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zxxw", () => { - it("should return Vec4(z, x, x, w)", () => { - expect(v.zxxw).toBeVec(v[2], v[0], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zxxw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zxyx", () => { - it("should return Vec4(z, x, y, x)", () => { - expect(v.zxyx).toBeVec(v[2], v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zxyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zxyy", () => { - it("should return Vec4(z, x, y, y)", () => { - expect(v.zxyy).toBeVec(v[2], v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zxyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zxyz", () => { - it("should return Vec4(z, x, y, z)", () => { - expect(v.zxyz).toBeVec(v[2], v[0], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zxyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zxyw", () => { - it("should return Vec4(z, x, y, w)", () => { - expect(v.zxyw).toBeVec(v[2], v[0], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zxyw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zxzx", () => { - it("should return Vec4(z, x, z, x)", () => { - expect(v.zxzx).toBeVec(v[2], v[0], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zxzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zxzy", () => { - it("should return Vec4(z, x, z, y)", () => { - expect(v.zxzy).toBeVec(v[2], v[0], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zxzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zxzz", () => { - it("should return Vec4(z, x, z, z)", () => { - expect(v.zxzz).toBeVec(v[2], v[0], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zxzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zxzw", () => { - it("should return Vec4(z, x, z, w)", () => { - expect(v.zxzw).toBeVec(v[2], v[0], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zxzw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zxwx", () => { - it("should return Vec4(z, x, w, x)", () => { - expect(v.zxwx).toBeVec(v[2], v[0], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zxwx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zxwy", () => { - it("should return Vec4(z, x, w, y)", () => { - expect(v.zxwy).toBeVec(v[2], v[0], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zxwy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zxwz", () => { - it("should return Vec4(z, x, w, z)", () => { - expect(v.zxwz).toBeVec(v[2], v[0], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zxwz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zxww", () => { - it("should return Vec4(z, x, w, w)", () => { - expect(v.zxww).toBeVec(v[2], v[0], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zxww; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zyxx", () => { - it("should return Vec4(z, y, x, x)", () => { - expect(v.zyxx).toBeVec(v[2], v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zyxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zyxy", () => { - it("should return Vec4(z, y, x, y)", () => { - expect(v.zyxy).toBeVec(v[2], v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zyxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zyxz", () => { - it("should return Vec4(z, y, x, z)", () => { - expect(v.zyxz).toBeVec(v[2], v[1], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zyxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zyxw", () => { - it("should return Vec4(z, y, x, w)", () => { - expect(v.zyxw).toBeVec(v[2], v[1], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zyxw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zyyx", () => { - it("should return Vec4(z, y, y, x)", () => { - expect(v.zyyx).toBeVec(v[2], v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zyyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zyyy", () => { - it("should return Vec4(z, y, y, y)", () => { - expect(v.zyyy).toBeVec(v[2], v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zyyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zyyz", () => { - it("should return Vec4(z, y, y, z)", () => { - expect(v.zyyz).toBeVec(v[2], v[1], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zyyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zyyw", () => { - it("should return Vec4(z, y, y, w)", () => { - expect(v.zyyw).toBeVec(v[2], v[1], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zyyw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zyzx", () => { - it("should return Vec4(z, y, z, x)", () => { - expect(v.zyzx).toBeVec(v[2], v[1], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zyzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zyzy", () => { - it("should return Vec4(z, y, z, y)", () => { - expect(v.zyzy).toBeVec(v[2], v[1], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zyzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zyzz", () => { - it("should return Vec4(z, y, z, z)", () => { - expect(v.zyzz).toBeVec(v[2], v[1], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zyzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zyzw", () => { - it("should return Vec4(z, y, z, w)", () => { - expect(v.zyzw).toBeVec(v[2], v[1], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zyzw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zywx", () => { - it("should return Vec4(z, y, w, x)", () => { - expect(v.zywx).toBeVec(v[2], v[1], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zywx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zywy", () => { - it("should return Vec4(z, y, w, y)", () => { - expect(v.zywy).toBeVec(v[2], v[1], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zywy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zywz", () => { - it("should return Vec4(z, y, w, z)", () => { - expect(v.zywz).toBeVec(v[2], v[1], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zywz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zyww", () => { - it("should return Vec4(z, y, w, w)", () => { - expect(v.zyww).toBeVec(v[2], v[1], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zyww; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zzxx", () => { - it("should return Vec4(z, z, x, x)", () => { - expect(v.zzxx).toBeVec(v[2], v[2], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zzxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zzxy", () => { - it("should return Vec4(z, z, x, y)", () => { - expect(v.zzxy).toBeVec(v[2], v[2], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zzxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zzxz", () => { - it("should return Vec4(z, z, x, z)", () => { - expect(v.zzxz).toBeVec(v[2], v[2], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zzxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zzxw", () => { - it("should return Vec4(z, z, x, w)", () => { - expect(v.zzxw).toBeVec(v[2], v[2], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zzxw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zzyx", () => { - it("should return Vec4(z, z, y, x)", () => { - expect(v.zzyx).toBeVec(v[2], v[2], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zzyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zzyy", () => { - it("should return Vec4(z, z, y, y)", () => { - expect(v.zzyy).toBeVec(v[2], v[2], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zzyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zzyz", () => { - it("should return Vec4(z, z, y, z)", () => { - expect(v.zzyz).toBeVec(v[2], v[2], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zzyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zzyw", () => { - it("should return Vec4(z, z, y, w)", () => { - expect(v.zzyw).toBeVec(v[2], v[2], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zzyw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zzzx", () => { - it("should return Vec4(z, z, z, x)", () => { - expect(v.zzzx).toBeVec(v[2], v[2], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zzzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zzzy", () => { - it("should return Vec4(z, z, z, y)", () => { - expect(v.zzzy).toBeVec(v[2], v[2], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zzzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zzzz", () => { - it("should return Vec4(z, z, z, z)", () => { - expect(v.zzzz).toBeVec(v[2], v[2], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zzzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zzzw", () => { - it("should return Vec4(z, z, z, w)", () => { - expect(v.zzzw).toBeVec(v[2], v[2], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zzzw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zzwx", () => { - it("should return Vec4(z, z, w, x)", () => { - expect(v.zzwx).toBeVec(v[2], v[2], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zzwx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zzwy", () => { - it("should return Vec4(z, z, w, y)", () => { - expect(v.zzwy).toBeVec(v[2], v[2], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zzwy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zzwz", () => { - it("should return Vec4(z, z, w, z)", () => { - expect(v.zzwz).toBeVec(v[2], v[2], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zzwz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zzww", () => { - it("should return Vec4(z, z, w, w)", () => { - expect(v.zzww).toBeVec(v[2], v[2], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zzww; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zwxx", () => { - it("should return Vec4(z, w, x, x)", () => { - expect(v.zwxx).toBeVec(v[2], v[3], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zwxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zwxy", () => { - it("should return Vec4(z, w, x, y)", () => { - expect(v.zwxy).toBeVec(v[2], v[3], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zwxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zwxz", () => { - it("should return Vec4(z, w, x, z)", () => { - expect(v.zwxz).toBeVec(v[2], v[3], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zwxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zwxw", () => { - it("should return Vec4(z, w, x, w)", () => { - expect(v.zwxw).toBeVec(v[2], v[3], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zwxw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zwyx", () => { - it("should return Vec4(z, w, y, x)", () => { - expect(v.zwyx).toBeVec(v[2], v[3], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zwyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zwyy", () => { - it("should return Vec4(z, w, y, y)", () => { - expect(v.zwyy).toBeVec(v[2], v[3], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zwyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zwyz", () => { - it("should return Vec4(z, w, y, z)", () => { - expect(v.zwyz).toBeVec(v[2], v[3], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zwyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zwyw", () => { - it("should return Vec4(z, w, y, w)", () => { - expect(v.zwyw).toBeVec(v[2], v[3], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zwyw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zwzx", () => { - it("should return Vec4(z, w, z, x)", () => { - expect(v.zwzx).toBeVec(v[2], v[3], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zwzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zwzy", () => { - it("should return Vec4(z, w, z, y)", () => { - expect(v.zwzy).toBeVec(v[2], v[3], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zwzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zwzz", () => { - it("should return Vec4(z, w, z, z)", () => { - expect(v.zwzz).toBeVec(v[2], v[3], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zwzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zwzw", () => { - it("should return Vec4(z, w, z, w)", () => { - expect(v.zwzw).toBeVec(v[2], v[3], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zwzw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zwwx", () => { - it("should return Vec4(z, w, w, x)", () => { - expect(v.zwwx).toBeVec(v[2], v[3], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.zwwx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zwwy", () => { - it("should return Vec4(z, w, w, y)", () => { - expect(v.zwwy).toBeVec(v[2], v[3], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.zwwy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zwwz", () => { - it("should return Vec4(z, w, w, z)", () => { - expect(v.zwwz).toBeVec(v[2], v[3], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.zwwz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().zwww", () => { - it("should return Vec4(z, w, w, w)", () => { - expect(v.zwww).toBeVec(v[2], v[3], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.zwww; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wxxx", () => { - it("should return Vec4(w, x, x, x)", () => { - expect(v.wxxx).toBeVec(v[3], v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wxxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wxxy", () => { - it("should return Vec4(w, x, x, y)", () => { - expect(v.wxxy).toBeVec(v[3], v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wxxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wxxz", () => { - it("should return Vec4(w, x, x, z)", () => { - expect(v.wxxz).toBeVec(v[3], v[0], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wxxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wxxw", () => { - it("should return Vec4(w, x, x, w)", () => { - expect(v.wxxw).toBeVec(v[3], v[0], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.wxxw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wxyx", () => { - it("should return Vec4(w, x, y, x)", () => { - expect(v.wxyx).toBeVec(v[3], v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wxyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wxyy", () => { - it("should return Vec4(w, x, y, y)", () => { - expect(v.wxyy).toBeVec(v[3], v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wxyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wxyz", () => { - it("should return Vec4(w, x, y, z)", () => { - expect(v.wxyz).toBeVec(v[3], v[0], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wxyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wxyw", () => { - it("should return Vec4(w, x, y, w)", () => { - expect(v.wxyw).toBeVec(v[3], v[0], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.wxyw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wxzx", () => { - it("should return Vec4(w, x, z, x)", () => { - expect(v.wxzx).toBeVec(v[3], v[0], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wxzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wxzy", () => { - it("should return Vec4(w, x, z, y)", () => { - expect(v.wxzy).toBeVec(v[3], v[0], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wxzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wxzz", () => { - it("should return Vec4(w, x, z, z)", () => { - expect(v.wxzz).toBeVec(v[3], v[0], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wxzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wxzw", () => { - it("should return Vec4(w, x, z, w)", () => { - expect(v.wxzw).toBeVec(v[3], v[0], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.wxzw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wxwx", () => { - it("should return Vec4(w, x, w, x)", () => { - expect(v.wxwx).toBeVec(v[3], v[0], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wxwx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wxwy", () => { - it("should return Vec4(w, x, w, y)", () => { - expect(v.wxwy).toBeVec(v[3], v[0], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wxwy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wxwz", () => { - it("should return Vec4(w, x, w, z)", () => { - expect(v.wxwz).toBeVec(v[3], v[0], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wxwz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wxww", () => { - it("should return Vec4(w, x, w, w)", () => { - expect(v.wxww).toBeVec(v[3], v[0], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.wxww; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wyxx", () => { - it("should return Vec4(w, y, x, x)", () => { - expect(v.wyxx).toBeVec(v[3], v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wyxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wyxy", () => { - it("should return Vec4(w, y, x, y)", () => { - expect(v.wyxy).toBeVec(v[3], v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wyxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wyxz", () => { - it("should return Vec4(w, y, x, z)", () => { - expect(v.wyxz).toBeVec(v[3], v[1], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wyxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wyxw", () => { - it("should return Vec4(w, y, x, w)", () => { - expect(v.wyxw).toBeVec(v[3], v[1], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.wyxw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wyyx", () => { - it("should return Vec4(w, y, y, x)", () => { - expect(v.wyyx).toBeVec(v[3], v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wyyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wyyy", () => { - it("should return Vec4(w, y, y, y)", () => { - expect(v.wyyy).toBeVec(v[3], v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wyyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wyyz", () => { - it("should return Vec4(w, y, y, z)", () => { - expect(v.wyyz).toBeVec(v[3], v[1], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wyyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wyyw", () => { - it("should return Vec4(w, y, y, w)", () => { - expect(v.wyyw).toBeVec(v[3], v[1], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.wyyw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wyzx", () => { - it("should return Vec4(w, y, z, x)", () => { - expect(v.wyzx).toBeVec(v[3], v[1], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wyzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wyzy", () => { - it("should return Vec4(w, y, z, y)", () => { - expect(v.wyzy).toBeVec(v[3], v[1], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wyzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wyzz", () => { - it("should return Vec4(w, y, z, z)", () => { - expect(v.wyzz).toBeVec(v[3], v[1], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wyzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wyzw", () => { - it("should return Vec4(w, y, z, w)", () => { - expect(v.wyzw).toBeVec(v[3], v[1], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.wyzw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wywx", () => { - it("should return Vec4(w, y, w, x)", () => { - expect(v.wywx).toBeVec(v[3], v[1], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wywx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wywy", () => { - it("should return Vec4(w, y, w, y)", () => { - expect(v.wywy).toBeVec(v[3], v[1], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wywy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wywz", () => { - it("should return Vec4(w, y, w, z)", () => { - expect(v.wywz).toBeVec(v[3], v[1], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wywz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wyww", () => { - it("should return Vec4(w, y, w, w)", () => { - expect(v.wyww).toBeVec(v[3], v[1], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.wyww; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wzxx", () => { - it("should return Vec4(w, z, x, x)", () => { - expect(v.wzxx).toBeVec(v[3], v[2], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wzxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wzxy", () => { - it("should return Vec4(w, z, x, y)", () => { - expect(v.wzxy).toBeVec(v[3], v[2], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wzxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wzxz", () => { - it("should return Vec4(w, z, x, z)", () => { - expect(v.wzxz).toBeVec(v[3], v[2], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wzxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wzxw", () => { - it("should return Vec4(w, z, x, w)", () => { - expect(v.wzxw).toBeVec(v[3], v[2], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.wzxw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wzyx", () => { - it("should return Vec4(w, z, y, x)", () => { - expect(v.wzyx).toBeVec(v[3], v[2], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wzyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wzyy", () => { - it("should return Vec4(w, z, y, y)", () => { - expect(v.wzyy).toBeVec(v[3], v[2], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wzyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wzyz", () => { - it("should return Vec4(w, z, y, z)", () => { - expect(v.wzyz).toBeVec(v[3], v[2], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wzyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wzyw", () => { - it("should return Vec4(w, z, y, w)", () => { - expect(v.wzyw).toBeVec(v[3], v[2], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.wzyw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wzzx", () => { - it("should return Vec4(w, z, z, x)", () => { - expect(v.wzzx).toBeVec(v[3], v[2], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wzzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wzzy", () => { - it("should return Vec4(w, z, z, y)", () => { - expect(v.wzzy).toBeVec(v[3], v[2], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wzzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wzzz", () => { - it("should return Vec4(w, z, z, z)", () => { - expect(v.wzzz).toBeVec(v[3], v[2], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wzzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wzzw", () => { - it("should return Vec4(w, z, z, w)", () => { - expect(v.wzzw).toBeVec(v[3], v[2], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.wzzw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wzwx", () => { - it("should return Vec4(w, z, w, x)", () => { - expect(v.wzwx).toBeVec(v[3], v[2], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wzwx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wzwy", () => { - it("should return Vec4(w, z, w, y)", () => { - expect(v.wzwy).toBeVec(v[3], v[2], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wzwy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wzwz", () => { - it("should return Vec4(w, z, w, z)", () => { - expect(v.wzwz).toBeVec(v[3], v[2], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wzwz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wzww", () => { - it("should return Vec4(w, z, w, w)", () => { - expect(v.wzww).toBeVec(v[3], v[2], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.wzww; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wwxx", () => { - it("should return Vec4(w, w, x, x)", () => { - expect(v.wwxx).toBeVec(v[3], v[3], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wwxx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wwxy", () => { - it("should return Vec4(w, w, x, y)", () => { - expect(v.wwxy).toBeVec(v[3], v[3], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wwxy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wwxz", () => { - it("should return Vec4(w, w, x, z)", () => { - expect(v.wwxz).toBeVec(v[3], v[3], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wwxz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wwxw", () => { - it("should return Vec4(w, w, x, w)", () => { - expect(v.wwxw).toBeVec(v[3], v[3], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.wwxw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wwyx", () => { - it("should return Vec4(w, w, y, x)", () => { - expect(v.wwyx).toBeVec(v[3], v[3], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wwyx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wwyy", () => { - it("should return Vec4(w, w, y, y)", () => { - expect(v.wwyy).toBeVec(v[3], v[3], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wwyy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wwyz", () => { - it("should return Vec4(w, w, y, z)", () => { - expect(v.wwyz).toBeVec(v[3], v[3], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wwyz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wwyw", () => { - it("should return Vec4(w, w, y, w)", () => { - expect(v.wwyw).toBeVec(v[3], v[3], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.wwyw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wwzx", () => { - it("should return Vec4(w, w, z, x)", () => { - expect(v.wwzx).toBeVec(v[3], v[3], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wwzx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wwzy", () => { - it("should return Vec4(w, w, z, y)", () => { - expect(v.wwzy).toBeVec(v[3], v[3], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wwzy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wwzz", () => { - it("should return Vec4(w, w, z, z)", () => { - expect(v.wwzz).toBeVec(v[3], v[3], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wwzz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wwzw", () => { - it("should return Vec4(w, w, z, w)", () => { - expect(v.wwzw).toBeVec(v[3], v[3], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.wwzw; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wwwx", () => { - it("should return Vec4(w, w, w, x)", () => { - expect(v.wwwx).toBeVec(v[3], v[3], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.wwwx; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wwwy", () => { - it("should return Vec4(w, w, w, y)", () => { - expect(v.wwwy).toBeVec(v[3], v[3], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.wwwy; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wwwz", () => { - it("should return Vec4(w, w, w, z)", () => { - expect(v.wwwz).toBeVec(v[3], v[3], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.wwwz; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().wwww", () => { - it("should return Vec4(w, w, w, w)", () => { - expect(v.wwww).toBeVec(v[3], v[3], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.wwww; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rr", () => { - it("should return Vec2(r, r)", () => { - expect(v.rr).toBeVec(v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rg", () => { - it("should return Vec2(r, g)", () => { - expect(v.rg).toBeVec(v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rb", () => { - it("should return Vec2(r, b)", () => { - expect(v.rb).toBeVec(v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ra", () => { - it("should return Vec2(r, a)", () => { - expect(v.ra).toBeVec(v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.ra; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gr", () => { - it("should return Vec2(g, r)", () => { - expect(v.gr).toBeVec(v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.gr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gg", () => { - it("should return Vec2(g, g)", () => { - expect(v.gg).toBeVec(v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.gg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gb", () => { - it("should return Vec2(g, b)", () => { - expect(v.gb).toBeVec(v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.gb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ga", () => { - it("should return Vec2(g, a)", () => { - expect(v.ga).toBeVec(v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.ga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().br", () => { - it("should return Vec2(b, r)", () => { - expect(v.br).toBeVec(v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.br; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bg", () => { - it("should return Vec2(b, g)", () => { - expect(v.bg).toBeVec(v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bb", () => { - it("should return Vec2(b, b)", () => { - expect(v.bb).toBeVec(v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ba", () => { - it("should return Vec2(b, a)", () => { - expect(v.ba).toBeVec(v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.ba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ar", () => { - it("should return Vec2(a, r)", () => { - expect(v.ar).toBeVec(v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.ar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ag", () => { - it("should return Vec2(a, g)", () => { - expect(v.ag).toBeVec(v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.ag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ab", () => { - it("should return Vec2(a, b)", () => { - expect(v.ab).toBeVec(v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.ab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aa", () => { - it("should return Vec2(a, a)", () => { - expect(v.aa).toBeVec(v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.aa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rrr", () => { - it("should return Vec3(r, r, r)", () => { - expect(v.rrr).toBeVec(v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rrg", () => { - it("should return Vec3(r, r, g)", () => { - expect(v.rrg).toBeVec(v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rrb", () => { - it("should return Vec3(r, r, b)", () => { - expect(v.rrb).toBeVec(v[0], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rra", () => { - it("should return Vec3(r, r, a)", () => { - expect(v.rra).toBeVec(v[0], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.rra; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rgr", () => { - it("should return Vec3(r, g, r)", () => { - expect(v.rgr).toBeVec(v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rgr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rgg", () => { - it("should return Vec3(r, g, g)", () => { - expect(v.rgg).toBeVec(v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rgg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rgb", () => { - it("should return Vec3(r, g, b)", () => { - expect(v.rgb).toBeVec(v[0], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rgb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rga", () => { - it("should return Vec3(r, g, a)", () => { - expect(v.rga).toBeVec(v[0], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.rga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rbr", () => { - it("should return Vec3(r, b, r)", () => { - expect(v.rbr).toBeVec(v[0], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rbg", () => { - it("should return Vec3(r, b, g)", () => { - expect(v.rbg).toBeVec(v[0], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rbb", () => { - it("should return Vec3(r, b, b)", () => { - expect(v.rbb).toBeVec(v[0], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rba", () => { - it("should return Vec3(r, b, a)", () => { - expect(v.rba).toBeVec(v[0], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.rba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rar", () => { - it("should return Vec3(r, a, r)", () => { - expect(v.rar).toBeVec(v[0], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rag", () => { - it("should return Vec3(r, a, g)", () => { - expect(v.rag).toBeVec(v[0], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rab", () => { - it("should return Vec3(r, a, b)", () => { - expect(v.rab).toBeVec(v[0], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().raa", () => { - it("should return Vec3(r, a, a)", () => { - expect(v.raa).toBeVec(v[0], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.raa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().grr", () => { - it("should return Vec3(g, r, r)", () => { - expect(v.grr).toBeVec(v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.grr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().grg", () => { - it("should return Vec3(g, r, g)", () => { - expect(v.grg).toBeVec(v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.grg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().grb", () => { - it("should return Vec3(g, r, b)", () => { - expect(v.grb).toBeVec(v[1], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.grb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gra", () => { - it("should return Vec3(g, r, a)", () => { - expect(v.gra).toBeVec(v[1], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.gra; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ggr", () => { - it("should return Vec3(g, g, r)", () => { - expect(v.ggr).toBeVec(v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.ggr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ggg", () => { - it("should return Vec3(g, g, g)", () => { - expect(v.ggg).toBeVec(v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.ggg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ggb", () => { - it("should return Vec3(g, g, b)", () => { - expect(v.ggb).toBeVec(v[1], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.ggb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gga", () => { - it("should return Vec3(g, g, a)", () => { - expect(v.gga).toBeVec(v[1], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.gga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gbr", () => { - it("should return Vec3(g, b, r)", () => { - expect(v.gbr).toBeVec(v[1], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.gbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gbg", () => { - it("should return Vec3(g, b, g)", () => { - expect(v.gbg).toBeVec(v[1], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.gbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gbb", () => { - it("should return Vec3(g, b, b)", () => { - expect(v.gbb).toBeVec(v[1], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.gbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gba", () => { - it("should return Vec3(g, b, a)", () => { - expect(v.gba).toBeVec(v[1], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.gba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gar", () => { - it("should return Vec3(g, a, r)", () => { - expect(v.gar).toBeVec(v[1], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.gar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gag", () => { - it("should return Vec3(g, a, g)", () => { - expect(v.gag).toBeVec(v[1], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.gag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gab", () => { - it("should return Vec3(g, a, b)", () => { - expect(v.gab).toBeVec(v[1], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.gab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gaa", () => { - it("should return Vec3(g, a, a)", () => { - expect(v.gaa).toBeVec(v[1], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.gaa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().brr", () => { - it("should return Vec3(b, r, r)", () => { - expect(v.brr).toBeVec(v[2], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.brr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().brg", () => { - it("should return Vec3(b, r, g)", () => { - expect(v.brg).toBeVec(v[2], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.brg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().brb", () => { - it("should return Vec3(b, r, b)", () => { - expect(v.brb).toBeVec(v[2], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.brb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bra", () => { - it("should return Vec3(b, r, a)", () => { - expect(v.bra).toBeVec(v[2], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.bra; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bgr", () => { - it("should return Vec3(b, g, r)", () => { - expect(v.bgr).toBeVec(v[2], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.bgr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bgg", () => { - it("should return Vec3(b, g, g)", () => { - expect(v.bgg).toBeVec(v[2], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bgg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bgb", () => { - it("should return Vec3(b, g, b)", () => { - expect(v.bgb).toBeVec(v[2], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bgb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bga", () => { - it("should return Vec3(b, g, a)", () => { - expect(v.bga).toBeVec(v[2], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.bga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bbr", () => { - it("should return Vec3(b, b, r)", () => { - expect(v.bbr).toBeVec(v[2], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.bbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bbg", () => { - it("should return Vec3(b, b, g)", () => { - expect(v.bbg).toBeVec(v[2], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bbb", () => { - it("should return Vec3(b, b, b)", () => { - expect(v.bbb).toBeVec(v[2], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bba", () => { - it("should return Vec3(b, b, a)", () => { - expect(v.bba).toBeVec(v[2], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.bba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bar", () => { - it("should return Vec3(b, a, r)", () => { - expect(v.bar).toBeVec(v[2], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.bar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bag", () => { - it("should return Vec3(b, a, g)", () => { - expect(v.bag).toBeVec(v[2], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bab", () => { - it("should return Vec3(b, a, b)", () => { - expect(v.bab).toBeVec(v[2], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().baa", () => { - it("should return Vec3(b, a, a)", () => { - expect(v.baa).toBeVec(v[2], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.baa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().arr", () => { - it("should return Vec3(a, r, r)", () => { - expect(v.arr).toBeVec(v[3], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.arr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().arg", () => { - it("should return Vec3(a, r, g)", () => { - expect(v.arg).toBeVec(v[3], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.arg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().arb", () => { - it("should return Vec3(a, r, b)", () => { - expect(v.arb).toBeVec(v[3], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.arb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ara", () => { - it("should return Vec3(a, r, a)", () => { - expect(v.ara).toBeVec(v[3], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.ara; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().agr", () => { - it("should return Vec3(a, g, r)", () => { - expect(v.agr).toBeVec(v[3], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.agr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().agg", () => { - it("should return Vec3(a, g, g)", () => { - expect(v.agg).toBeVec(v[3], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.agg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().agb", () => { - it("should return Vec3(a, g, b)", () => { - expect(v.agb).toBeVec(v[3], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.agb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aga", () => { - it("should return Vec3(a, g, a)", () => { - expect(v.aga).toBeVec(v[3], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.aga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().abr", () => { - it("should return Vec3(a, b, r)", () => { - expect(v.abr).toBeVec(v[3], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.abr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().abg", () => { - it("should return Vec3(a, b, g)", () => { - expect(v.abg).toBeVec(v[3], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.abg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().abb", () => { - it("should return Vec3(a, b, b)", () => { - expect(v.abb).toBeVec(v[3], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.abb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aba", () => { - it("should return Vec3(a, b, a)", () => { - expect(v.aba).toBeVec(v[3], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.aba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aar", () => { - it("should return Vec3(a, a, r)", () => { - expect(v.aar).toBeVec(v[3], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.aar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aag", () => { - it("should return Vec3(a, a, g)", () => { - expect(v.aag).toBeVec(v[3], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.aag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aab", () => { - it("should return Vec3(a, a, b)", () => { - expect(v.aab).toBeVec(v[3], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.aab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aaa", () => { - it("should return Vec3(a, a, a)", () => { - expect(v.aaa).toBeVec(v[3], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.aaa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rrrr", () => { - it("should return Vec4(r, r, r, r)", () => { - expect(v.rrrr).toBeVec(v[0], v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rrrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rrrg", () => { - it("should return Vec4(r, r, r, g)", () => { - expect(v.rrrg).toBeVec(v[0], v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rrrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rrrb", () => { - it("should return Vec4(r, r, r, b)", () => { - expect(v.rrrb).toBeVec(v[0], v[0], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rrrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rrra", () => { - it("should return Vec4(r, r, r, a)", () => { - expect(v.rrra).toBeVec(v[0], v[0], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.rrra; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rrgr", () => { - it("should return Vec4(r, r, g, r)", () => { - expect(v.rrgr).toBeVec(v[0], v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rrgr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rrgg", () => { - it("should return Vec4(r, r, g, g)", () => { - expect(v.rrgg).toBeVec(v[0], v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rrgg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rrgb", () => { - it("should return Vec4(r, r, g, b)", () => { - expect(v.rrgb).toBeVec(v[0], v[0], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rrgb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rrga", () => { - it("should return Vec4(r, r, g, a)", () => { - expect(v.rrga).toBeVec(v[0], v[0], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.rrga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rrbr", () => { - it("should return Vec4(r, r, b, r)", () => { - expect(v.rrbr).toBeVec(v[0], v[0], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rrbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rrbg", () => { - it("should return Vec4(r, r, b, g)", () => { - expect(v.rrbg).toBeVec(v[0], v[0], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rrbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rrbb", () => { - it("should return Vec4(r, r, b, b)", () => { - expect(v.rrbb).toBeVec(v[0], v[0], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rrbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rrba", () => { - it("should return Vec4(r, r, b, a)", () => { - expect(v.rrba).toBeVec(v[0], v[0], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.rrba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rrar", () => { - it("should return Vec4(r, r, a, r)", () => { - expect(v.rrar).toBeVec(v[0], v[0], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rrar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rrag", () => { - it("should return Vec4(r, r, a, g)", () => { - expect(v.rrag).toBeVec(v[0], v[0], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rrag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rrab", () => { - it("should return Vec4(r, r, a, b)", () => { - expect(v.rrab).toBeVec(v[0], v[0], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rrab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rraa", () => { - it("should return Vec4(r, r, a, a)", () => { - expect(v.rraa).toBeVec(v[0], v[0], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.rraa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rgrr", () => { - it("should return Vec4(r, g, r, r)", () => { - expect(v.rgrr).toBeVec(v[0], v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rgrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rgrg", () => { - it("should return Vec4(r, g, r, g)", () => { - expect(v.rgrg).toBeVec(v[0], v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rgrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rgrb", () => { - it("should return Vec4(r, g, r, b)", () => { - expect(v.rgrb).toBeVec(v[0], v[1], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rgrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rgra", () => { - it("should return Vec4(r, g, r, a)", () => { - expect(v.rgra).toBeVec(v[0], v[1], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.rgra; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rggr", () => { - it("should return Vec4(r, g, g, r)", () => { - expect(v.rggr).toBeVec(v[0], v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rggr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rggg", () => { - it("should return Vec4(r, g, g, g)", () => { - expect(v.rggg).toBeVec(v[0], v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rggg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rggb", () => { - it("should return Vec4(r, g, g, b)", () => { - expect(v.rggb).toBeVec(v[0], v[1], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rggb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rgga", () => { - it("should return Vec4(r, g, g, a)", () => { - expect(v.rgga).toBeVec(v[0], v[1], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.rgga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rgbr", () => { - it("should return Vec4(r, g, b, r)", () => { - expect(v.rgbr).toBeVec(v[0], v[1], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rgbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rgbg", () => { - it("should return Vec4(r, g, b, g)", () => { - expect(v.rgbg).toBeVec(v[0], v[1], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rgbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rgbb", () => { - it("should return Vec4(r, g, b, b)", () => { - expect(v.rgbb).toBeVec(v[0], v[1], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rgbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rgba", () => { - it("should return Vec4(r, g, b, a)", () => { - expect(v.rgba).toBeVec(v[0], v[1], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.rgba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rgar", () => { - it("should return Vec4(r, g, a, r)", () => { - expect(v.rgar).toBeVec(v[0], v[1], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rgar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rgag", () => { - it("should return Vec4(r, g, a, g)", () => { - expect(v.rgag).toBeVec(v[0], v[1], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rgag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rgab", () => { - it("should return Vec4(r, g, a, b)", () => { - expect(v.rgab).toBeVec(v[0], v[1], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rgab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rgaa", () => { - it("should return Vec4(r, g, a, a)", () => { - expect(v.rgaa).toBeVec(v[0], v[1], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.rgaa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rbrr", () => { - it("should return Vec4(r, b, r, r)", () => { - expect(v.rbrr).toBeVec(v[0], v[2], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rbrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rbrg", () => { - it("should return Vec4(r, b, r, g)", () => { - expect(v.rbrg).toBeVec(v[0], v[2], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rbrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rbrb", () => { - it("should return Vec4(r, b, r, b)", () => { - expect(v.rbrb).toBeVec(v[0], v[2], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rbrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rbra", () => { - it("should return Vec4(r, b, r, a)", () => { - expect(v.rbra).toBeVec(v[0], v[2], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.rbra; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rbgr", () => { - it("should return Vec4(r, b, g, r)", () => { - expect(v.rbgr).toBeVec(v[0], v[2], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rbgr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rbgg", () => { - it("should return Vec4(r, b, g, g)", () => { - expect(v.rbgg).toBeVec(v[0], v[2], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rbgg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rbgb", () => { - it("should return Vec4(r, b, g, b)", () => { - expect(v.rbgb).toBeVec(v[0], v[2], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rbgb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rbga", () => { - it("should return Vec4(r, b, g, a)", () => { - expect(v.rbga).toBeVec(v[0], v[2], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.rbga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rbbr", () => { - it("should return Vec4(r, b, b, r)", () => { - expect(v.rbbr).toBeVec(v[0], v[2], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rbbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rbbg", () => { - it("should return Vec4(r, b, b, g)", () => { - expect(v.rbbg).toBeVec(v[0], v[2], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rbbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rbbb", () => { - it("should return Vec4(r, b, b, b)", () => { - expect(v.rbbb).toBeVec(v[0], v[2], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rbbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rbba", () => { - it("should return Vec4(r, b, b, a)", () => { - expect(v.rbba).toBeVec(v[0], v[2], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.rbba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rbar", () => { - it("should return Vec4(r, b, a, r)", () => { - expect(v.rbar).toBeVec(v[0], v[2], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rbar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rbag", () => { - it("should return Vec4(r, b, a, g)", () => { - expect(v.rbag).toBeVec(v[0], v[2], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rbag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rbab", () => { - it("should return Vec4(r, b, a, b)", () => { - expect(v.rbab).toBeVec(v[0], v[2], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rbab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rbaa", () => { - it("should return Vec4(r, b, a, a)", () => { - expect(v.rbaa).toBeVec(v[0], v[2], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.rbaa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rarr", () => { - it("should return Vec4(r, a, r, r)", () => { - expect(v.rarr).toBeVec(v[0], v[3], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rarr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rarg", () => { - it("should return Vec4(r, a, r, g)", () => { - expect(v.rarg).toBeVec(v[0], v[3], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rarg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rarb", () => { - it("should return Vec4(r, a, r, b)", () => { - expect(v.rarb).toBeVec(v[0], v[3], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rarb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rara", () => { - it("should return Vec4(r, a, r, a)", () => { - expect(v.rara).toBeVec(v[0], v[3], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.rara; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ragr", () => { - it("should return Vec4(r, a, g, r)", () => { - expect(v.ragr).toBeVec(v[0], v[3], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.ragr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ragg", () => { - it("should return Vec4(r, a, g, g)", () => { - expect(v.ragg).toBeVec(v[0], v[3], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.ragg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ragb", () => { - it("should return Vec4(r, a, g, b)", () => { - expect(v.ragb).toBeVec(v[0], v[3], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.ragb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().raga", () => { - it("should return Vec4(r, a, g, a)", () => { - expect(v.raga).toBeVec(v[0], v[3], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.raga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rabr", () => { - it("should return Vec4(r, a, b, r)", () => { - expect(v.rabr).toBeVec(v[0], v[3], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.rabr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rabg", () => { - it("should return Vec4(r, a, b, g)", () => { - expect(v.rabg).toBeVec(v[0], v[3], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.rabg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().rabb", () => { - it("should return Vec4(r, a, b, b)", () => { - expect(v.rabb).toBeVec(v[0], v[3], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.rabb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().raba", () => { - it("should return Vec4(r, a, b, a)", () => { - expect(v.raba).toBeVec(v[0], v[3], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.raba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().raar", () => { - it("should return Vec4(r, a, a, r)", () => { - expect(v.raar).toBeVec(v[0], v[3], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.raar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().raag", () => { - it("should return Vec4(r, a, a, g)", () => { - expect(v.raag).toBeVec(v[0], v[3], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.raag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().raab", () => { - it("should return Vec4(r, a, a, b)", () => { - expect(v.raab).toBeVec(v[0], v[3], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.raab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().raaa", () => { - it("should return Vec4(r, a, a, a)", () => { - expect(v.raaa).toBeVec(v[0], v[3], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.raaa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().grrr", () => { - it("should return Vec4(g, r, r, r)", () => { - expect(v.grrr).toBeVec(v[1], v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.grrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().grrg", () => { - it("should return Vec4(g, r, r, g)", () => { - expect(v.grrg).toBeVec(v[1], v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.grrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().grrb", () => { - it("should return Vec4(g, r, r, b)", () => { - expect(v.grrb).toBeVec(v[1], v[0], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.grrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().grra", () => { - it("should return Vec4(g, r, r, a)", () => { - expect(v.grra).toBeVec(v[1], v[0], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.grra; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().grgr", () => { - it("should return Vec4(g, r, g, r)", () => { - expect(v.grgr).toBeVec(v[1], v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.grgr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().grgg", () => { - it("should return Vec4(g, r, g, g)", () => { - expect(v.grgg).toBeVec(v[1], v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.grgg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().grgb", () => { - it("should return Vec4(g, r, g, b)", () => { - expect(v.grgb).toBeVec(v[1], v[0], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.grgb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().grga", () => { - it("should return Vec4(g, r, g, a)", () => { - expect(v.grga).toBeVec(v[1], v[0], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.grga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().grbr", () => { - it("should return Vec4(g, r, b, r)", () => { - expect(v.grbr).toBeVec(v[1], v[0], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.grbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().grbg", () => { - it("should return Vec4(g, r, b, g)", () => { - expect(v.grbg).toBeVec(v[1], v[0], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.grbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().grbb", () => { - it("should return Vec4(g, r, b, b)", () => { - expect(v.grbb).toBeVec(v[1], v[0], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.grbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().grba", () => { - it("should return Vec4(g, r, b, a)", () => { - expect(v.grba).toBeVec(v[1], v[0], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.grba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().grar", () => { - it("should return Vec4(g, r, a, r)", () => { - expect(v.grar).toBeVec(v[1], v[0], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.grar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().grag", () => { - it("should return Vec4(g, r, a, g)", () => { - expect(v.grag).toBeVec(v[1], v[0], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.grag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().grab", () => { - it("should return Vec4(g, r, a, b)", () => { - expect(v.grab).toBeVec(v[1], v[0], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.grab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().graa", () => { - it("should return Vec4(g, r, a, a)", () => { - expect(v.graa).toBeVec(v[1], v[0], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.graa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ggrr", () => { - it("should return Vec4(g, g, r, r)", () => { - expect(v.ggrr).toBeVec(v[1], v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.ggrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ggrg", () => { - it("should return Vec4(g, g, r, g)", () => { - expect(v.ggrg).toBeVec(v[1], v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.ggrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ggrb", () => { - it("should return Vec4(g, g, r, b)", () => { - expect(v.ggrb).toBeVec(v[1], v[1], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.ggrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ggra", () => { - it("should return Vec4(g, g, r, a)", () => { - expect(v.ggra).toBeVec(v[1], v[1], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.ggra; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gggr", () => { - it("should return Vec4(g, g, g, r)", () => { - expect(v.gggr).toBeVec(v[1], v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.gggr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gggg", () => { - it("should return Vec4(g, g, g, g)", () => { - expect(v.gggg).toBeVec(v[1], v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.gggg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gggb", () => { - it("should return Vec4(g, g, g, b)", () => { - expect(v.gggb).toBeVec(v[1], v[1], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.gggb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ggga", () => { - it("should return Vec4(g, g, g, a)", () => { - expect(v.ggga).toBeVec(v[1], v[1], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.ggga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ggbr", () => { - it("should return Vec4(g, g, b, r)", () => { - expect(v.ggbr).toBeVec(v[1], v[1], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.ggbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ggbg", () => { - it("should return Vec4(g, g, b, g)", () => { - expect(v.ggbg).toBeVec(v[1], v[1], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.ggbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ggbb", () => { - it("should return Vec4(g, g, b, b)", () => { - expect(v.ggbb).toBeVec(v[1], v[1], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.ggbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ggba", () => { - it("should return Vec4(g, g, b, a)", () => { - expect(v.ggba).toBeVec(v[1], v[1], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.ggba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ggar", () => { - it("should return Vec4(g, g, a, r)", () => { - expect(v.ggar).toBeVec(v[1], v[1], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.ggar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ggag", () => { - it("should return Vec4(g, g, a, g)", () => { - expect(v.ggag).toBeVec(v[1], v[1], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.ggag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ggab", () => { - it("should return Vec4(g, g, a, b)", () => { - expect(v.ggab).toBeVec(v[1], v[1], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.ggab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().ggaa", () => { - it("should return Vec4(g, g, a, a)", () => { - expect(v.ggaa).toBeVec(v[1], v[1], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.ggaa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gbrr", () => { - it("should return Vec4(g, b, r, r)", () => { - expect(v.gbrr).toBeVec(v[1], v[2], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.gbrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gbrg", () => { - it("should return Vec4(g, b, r, g)", () => { - expect(v.gbrg).toBeVec(v[1], v[2], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.gbrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gbrb", () => { - it("should return Vec4(g, b, r, b)", () => { - expect(v.gbrb).toBeVec(v[1], v[2], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.gbrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gbra", () => { - it("should return Vec4(g, b, r, a)", () => { - expect(v.gbra).toBeVec(v[1], v[2], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.gbra; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gbgr", () => { - it("should return Vec4(g, b, g, r)", () => { - expect(v.gbgr).toBeVec(v[1], v[2], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.gbgr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gbgg", () => { - it("should return Vec4(g, b, g, g)", () => { - expect(v.gbgg).toBeVec(v[1], v[2], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.gbgg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gbgb", () => { - it("should return Vec4(g, b, g, b)", () => { - expect(v.gbgb).toBeVec(v[1], v[2], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.gbgb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gbga", () => { - it("should return Vec4(g, b, g, a)", () => { - expect(v.gbga).toBeVec(v[1], v[2], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.gbga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gbbr", () => { - it("should return Vec4(g, b, b, r)", () => { - expect(v.gbbr).toBeVec(v[1], v[2], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.gbbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gbbg", () => { - it("should return Vec4(g, b, b, g)", () => { - expect(v.gbbg).toBeVec(v[1], v[2], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.gbbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gbbb", () => { - it("should return Vec4(g, b, b, b)", () => { - expect(v.gbbb).toBeVec(v[1], v[2], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.gbbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gbba", () => { - it("should return Vec4(g, b, b, a)", () => { - expect(v.gbba).toBeVec(v[1], v[2], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.gbba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gbar", () => { - it("should return Vec4(g, b, a, r)", () => { - expect(v.gbar).toBeVec(v[1], v[2], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.gbar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gbag", () => { - it("should return Vec4(g, b, a, g)", () => { - expect(v.gbag).toBeVec(v[1], v[2], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.gbag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gbab", () => { - it("should return Vec4(g, b, a, b)", () => { - expect(v.gbab).toBeVec(v[1], v[2], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.gbab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gbaa", () => { - it("should return Vec4(g, b, a, a)", () => { - expect(v.gbaa).toBeVec(v[1], v[2], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.gbaa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().garr", () => { - it("should return Vec4(g, a, r, r)", () => { - expect(v.garr).toBeVec(v[1], v[3], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.garr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().garg", () => { - it("should return Vec4(g, a, r, g)", () => { - expect(v.garg).toBeVec(v[1], v[3], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.garg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().garb", () => { - it("should return Vec4(g, a, r, b)", () => { - expect(v.garb).toBeVec(v[1], v[3], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.garb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gara", () => { - it("should return Vec4(g, a, r, a)", () => { - expect(v.gara).toBeVec(v[1], v[3], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.gara; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gagr", () => { - it("should return Vec4(g, a, g, r)", () => { - expect(v.gagr).toBeVec(v[1], v[3], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.gagr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gagg", () => { - it("should return Vec4(g, a, g, g)", () => { - expect(v.gagg).toBeVec(v[1], v[3], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.gagg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gagb", () => { - it("should return Vec4(g, a, g, b)", () => { - expect(v.gagb).toBeVec(v[1], v[3], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.gagb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gaga", () => { - it("should return Vec4(g, a, g, a)", () => { - expect(v.gaga).toBeVec(v[1], v[3], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.gaga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gabr", () => { - it("should return Vec4(g, a, b, r)", () => { - expect(v.gabr).toBeVec(v[1], v[3], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.gabr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gabg", () => { - it("should return Vec4(g, a, b, g)", () => { - expect(v.gabg).toBeVec(v[1], v[3], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.gabg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gabb", () => { - it("should return Vec4(g, a, b, b)", () => { - expect(v.gabb).toBeVec(v[1], v[3], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.gabb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gaba", () => { - it("should return Vec4(g, a, b, a)", () => { - expect(v.gaba).toBeVec(v[1], v[3], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.gaba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gaar", () => { - it("should return Vec4(g, a, a, r)", () => { - expect(v.gaar).toBeVec(v[1], v[3], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.gaar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gaag", () => { - it("should return Vec4(g, a, a, g)", () => { - expect(v.gaag).toBeVec(v[1], v[3], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.gaag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gaab", () => { - it("should return Vec4(g, a, a, b)", () => { - expect(v.gaab).toBeVec(v[1], v[3], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.gaab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().gaaa", () => { - it("should return Vec4(g, a, a, a)", () => { - expect(v.gaaa).toBeVec(v[1], v[3], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.gaaa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().brrr", () => { - it("should return Vec4(b, r, r, r)", () => { - expect(v.brrr).toBeVec(v[2], v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.brrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().brrg", () => { - it("should return Vec4(b, r, r, g)", () => { - expect(v.brrg).toBeVec(v[2], v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.brrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().brrb", () => { - it("should return Vec4(b, r, r, b)", () => { - expect(v.brrb).toBeVec(v[2], v[0], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.brrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().brra", () => { - it("should return Vec4(b, r, r, a)", () => { - expect(v.brra).toBeVec(v[2], v[0], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.brra; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().brgr", () => { - it("should return Vec4(b, r, g, r)", () => { - expect(v.brgr).toBeVec(v[2], v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.brgr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().brgg", () => { - it("should return Vec4(b, r, g, g)", () => { - expect(v.brgg).toBeVec(v[2], v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.brgg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().brgb", () => { - it("should return Vec4(b, r, g, b)", () => { - expect(v.brgb).toBeVec(v[2], v[0], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.brgb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().brga", () => { - it("should return Vec4(b, r, g, a)", () => { - expect(v.brga).toBeVec(v[2], v[0], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.brga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().brbr", () => { - it("should return Vec4(b, r, b, r)", () => { - expect(v.brbr).toBeVec(v[2], v[0], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.brbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().brbg", () => { - it("should return Vec4(b, r, b, g)", () => { - expect(v.brbg).toBeVec(v[2], v[0], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.brbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().brbb", () => { - it("should return Vec4(b, r, b, b)", () => { - expect(v.brbb).toBeVec(v[2], v[0], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.brbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().brba", () => { - it("should return Vec4(b, r, b, a)", () => { - expect(v.brba).toBeVec(v[2], v[0], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.brba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().brar", () => { - it("should return Vec4(b, r, a, r)", () => { - expect(v.brar).toBeVec(v[2], v[0], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.brar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().brag", () => { - it("should return Vec4(b, r, a, g)", () => { - expect(v.brag).toBeVec(v[2], v[0], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.brag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().brab", () => { - it("should return Vec4(b, r, a, b)", () => { - expect(v.brab).toBeVec(v[2], v[0], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.brab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().braa", () => { - it("should return Vec4(b, r, a, a)", () => { - expect(v.braa).toBeVec(v[2], v[0], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.braa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bgrr", () => { - it("should return Vec4(b, g, r, r)", () => { - expect(v.bgrr).toBeVec(v[2], v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.bgrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bgrg", () => { - it("should return Vec4(b, g, r, g)", () => { - expect(v.bgrg).toBeVec(v[2], v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bgrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bgrb", () => { - it("should return Vec4(b, g, r, b)", () => { - expect(v.bgrb).toBeVec(v[2], v[1], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bgrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bgra", () => { - it("should return Vec4(b, g, r, a)", () => { - expect(v.bgra).toBeVec(v[2], v[1], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.bgra; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bggr", () => { - it("should return Vec4(b, g, g, r)", () => { - expect(v.bggr).toBeVec(v[2], v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.bggr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bggg", () => { - it("should return Vec4(b, g, g, g)", () => { - expect(v.bggg).toBeVec(v[2], v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bggg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bggb", () => { - it("should return Vec4(b, g, g, b)", () => { - expect(v.bggb).toBeVec(v[2], v[1], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bggb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bgga", () => { - it("should return Vec4(b, g, g, a)", () => { - expect(v.bgga).toBeVec(v[2], v[1], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.bgga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bgbr", () => { - it("should return Vec4(b, g, b, r)", () => { - expect(v.bgbr).toBeVec(v[2], v[1], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.bgbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bgbg", () => { - it("should return Vec4(b, g, b, g)", () => { - expect(v.bgbg).toBeVec(v[2], v[1], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bgbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bgbb", () => { - it("should return Vec4(b, g, b, b)", () => { - expect(v.bgbb).toBeVec(v[2], v[1], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bgbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bgba", () => { - it("should return Vec4(b, g, b, a)", () => { - expect(v.bgba).toBeVec(v[2], v[1], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.bgba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bgar", () => { - it("should return Vec4(b, g, a, r)", () => { - expect(v.bgar).toBeVec(v[2], v[1], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.bgar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bgag", () => { - it("should return Vec4(b, g, a, g)", () => { - expect(v.bgag).toBeVec(v[2], v[1], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bgag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bgab", () => { - it("should return Vec4(b, g, a, b)", () => { - expect(v.bgab).toBeVec(v[2], v[1], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bgab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bgaa", () => { - it("should return Vec4(b, g, a, a)", () => { - expect(v.bgaa).toBeVec(v[2], v[1], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.bgaa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bbrr", () => { - it("should return Vec4(b, b, r, r)", () => { - expect(v.bbrr).toBeVec(v[2], v[2], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.bbrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bbrg", () => { - it("should return Vec4(b, b, r, g)", () => { - expect(v.bbrg).toBeVec(v[2], v[2], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bbrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bbrb", () => { - it("should return Vec4(b, b, r, b)", () => { - expect(v.bbrb).toBeVec(v[2], v[2], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bbrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bbra", () => { - it("should return Vec4(b, b, r, a)", () => { - expect(v.bbra).toBeVec(v[2], v[2], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.bbra; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bbgr", () => { - it("should return Vec4(b, b, g, r)", () => { - expect(v.bbgr).toBeVec(v[2], v[2], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.bbgr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bbgg", () => { - it("should return Vec4(b, b, g, g)", () => { - expect(v.bbgg).toBeVec(v[2], v[2], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bbgg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bbgb", () => { - it("should return Vec4(b, b, g, b)", () => { - expect(v.bbgb).toBeVec(v[2], v[2], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bbgb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bbga", () => { - it("should return Vec4(b, b, g, a)", () => { - expect(v.bbga).toBeVec(v[2], v[2], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.bbga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bbbr", () => { - it("should return Vec4(b, b, b, r)", () => { - expect(v.bbbr).toBeVec(v[2], v[2], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.bbbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bbbg", () => { - it("should return Vec4(b, b, b, g)", () => { - expect(v.bbbg).toBeVec(v[2], v[2], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bbbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bbbb", () => { - it("should return Vec4(b, b, b, b)", () => { - expect(v.bbbb).toBeVec(v[2], v[2], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bbbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bbba", () => { - it("should return Vec4(b, b, b, a)", () => { - expect(v.bbba).toBeVec(v[2], v[2], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.bbba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bbar", () => { - it("should return Vec4(b, b, a, r)", () => { - expect(v.bbar).toBeVec(v[2], v[2], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.bbar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bbag", () => { - it("should return Vec4(b, b, a, g)", () => { - expect(v.bbag).toBeVec(v[2], v[2], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bbag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bbab", () => { - it("should return Vec4(b, b, a, b)", () => { - expect(v.bbab).toBeVec(v[2], v[2], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bbab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bbaa", () => { - it("should return Vec4(b, b, a, a)", () => { - expect(v.bbaa).toBeVec(v[2], v[2], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.bbaa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().barr", () => { - it("should return Vec4(b, a, r, r)", () => { - expect(v.barr).toBeVec(v[2], v[3], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.barr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().barg", () => { - it("should return Vec4(b, a, r, g)", () => { - expect(v.barg).toBeVec(v[2], v[3], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.barg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().barb", () => { - it("should return Vec4(b, a, r, b)", () => { - expect(v.barb).toBeVec(v[2], v[3], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.barb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bara", () => { - it("should return Vec4(b, a, r, a)", () => { - expect(v.bara).toBeVec(v[2], v[3], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.bara; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bagr", () => { - it("should return Vec4(b, a, g, r)", () => { - expect(v.bagr).toBeVec(v[2], v[3], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.bagr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bagg", () => { - it("should return Vec4(b, a, g, g)", () => { - expect(v.bagg).toBeVec(v[2], v[3], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.bagg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().bagb", () => { - it("should return Vec4(b, a, g, b)", () => { - expect(v.bagb).toBeVec(v[2], v[3], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.bagb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().baga", () => { - it("should return Vec4(b, a, g, a)", () => { - expect(v.baga).toBeVec(v[2], v[3], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.baga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().babr", () => { - it("should return Vec4(b, a, b, r)", () => { - expect(v.babr).toBeVec(v[2], v[3], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.babr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().babg", () => { - it("should return Vec4(b, a, b, g)", () => { - expect(v.babg).toBeVec(v[2], v[3], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.babg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().babb", () => { - it("should return Vec4(b, a, b, b)", () => { - expect(v.babb).toBeVec(v[2], v[3], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.babb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().baba", () => { - it("should return Vec4(b, a, b, a)", () => { - expect(v.baba).toBeVec(v[2], v[3], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.baba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().baar", () => { - it("should return Vec4(b, a, a, r)", () => { - expect(v.baar).toBeVec(v[2], v[3], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.baar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().baag", () => { - it("should return Vec4(b, a, a, g)", () => { - expect(v.baag).toBeVec(v[2], v[3], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.baag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().baab", () => { - it("should return Vec4(b, a, a, b)", () => { - expect(v.baab).toBeVec(v[2], v[3], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.baab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().baaa", () => { - it("should return Vec4(b, a, a, a)", () => { - expect(v.baaa).toBeVec(v[2], v[3], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.baaa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().arrr", () => { - it("should return Vec4(a, r, r, r)", () => { - expect(v.arrr).toBeVec(v[3], v[0], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.arrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().arrg", () => { - it("should return Vec4(a, r, r, g)", () => { - expect(v.arrg).toBeVec(v[3], v[0], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.arrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().arrb", () => { - it("should return Vec4(a, r, r, b)", () => { - expect(v.arrb).toBeVec(v[3], v[0], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.arrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().arra", () => { - it("should return Vec4(a, r, r, a)", () => { - expect(v.arra).toBeVec(v[3], v[0], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.arra; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().argr", () => { - it("should return Vec4(a, r, g, r)", () => { - expect(v.argr).toBeVec(v[3], v[0], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.argr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().argg", () => { - it("should return Vec4(a, r, g, g)", () => { - expect(v.argg).toBeVec(v[3], v[0], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.argg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().argb", () => { - it("should return Vec4(a, r, g, b)", () => { - expect(v.argb).toBeVec(v[3], v[0], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.argb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().arga", () => { - it("should return Vec4(a, r, g, a)", () => { - expect(v.arga).toBeVec(v[3], v[0], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.arga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().arbr", () => { - it("should return Vec4(a, r, b, r)", () => { - expect(v.arbr).toBeVec(v[3], v[0], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.arbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().arbg", () => { - it("should return Vec4(a, r, b, g)", () => { - expect(v.arbg).toBeVec(v[3], v[0], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.arbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().arbb", () => { - it("should return Vec4(a, r, b, b)", () => { - expect(v.arbb).toBeVec(v[3], v[0], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.arbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().arba", () => { - it("should return Vec4(a, r, b, a)", () => { - expect(v.arba).toBeVec(v[3], v[0], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.arba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().arar", () => { - it("should return Vec4(a, r, a, r)", () => { - expect(v.arar).toBeVec(v[3], v[0], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.arar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().arag", () => { - it("should return Vec4(a, r, a, g)", () => { - expect(v.arag).toBeVec(v[3], v[0], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.arag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().arab", () => { - it("should return Vec4(a, r, a, b)", () => { - expect(v.arab).toBeVec(v[3], v[0], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.arab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().araa", () => { - it("should return Vec4(a, r, a, a)", () => { - expect(v.araa).toBeVec(v[3], v[0], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.araa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().agrr", () => { - it("should return Vec4(a, g, r, r)", () => { - expect(v.agrr).toBeVec(v[3], v[1], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.agrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().agrg", () => { - it("should return Vec4(a, g, r, g)", () => { - expect(v.agrg).toBeVec(v[3], v[1], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.agrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().agrb", () => { - it("should return Vec4(a, g, r, b)", () => { - expect(v.agrb).toBeVec(v[3], v[1], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.agrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().agra", () => { - it("should return Vec4(a, g, r, a)", () => { - expect(v.agra).toBeVec(v[3], v[1], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.agra; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aggr", () => { - it("should return Vec4(a, g, g, r)", () => { - expect(v.aggr).toBeVec(v[3], v[1], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.aggr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aggg", () => { - it("should return Vec4(a, g, g, g)", () => { - expect(v.aggg).toBeVec(v[3], v[1], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.aggg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aggb", () => { - it("should return Vec4(a, g, g, b)", () => { - expect(v.aggb).toBeVec(v[3], v[1], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.aggb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().agga", () => { - it("should return Vec4(a, g, g, a)", () => { - expect(v.agga).toBeVec(v[3], v[1], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.agga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().agbr", () => { - it("should return Vec4(a, g, b, r)", () => { - expect(v.agbr).toBeVec(v[3], v[1], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.agbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().agbg", () => { - it("should return Vec4(a, g, b, g)", () => { - expect(v.agbg).toBeVec(v[3], v[1], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.agbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().agbb", () => { - it("should return Vec4(a, g, b, b)", () => { - expect(v.agbb).toBeVec(v[3], v[1], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.agbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().agba", () => { - it("should return Vec4(a, g, b, a)", () => { - expect(v.agba).toBeVec(v[3], v[1], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.agba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().agar", () => { - it("should return Vec4(a, g, a, r)", () => { - expect(v.agar).toBeVec(v[3], v[1], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.agar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().agag", () => { - it("should return Vec4(a, g, a, g)", () => { - expect(v.agag).toBeVec(v[3], v[1], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.agag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().agab", () => { - it("should return Vec4(a, g, a, b)", () => { - expect(v.agab).toBeVec(v[3], v[1], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.agab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().agaa", () => { - it("should return Vec4(a, g, a, a)", () => { - expect(v.agaa).toBeVec(v[3], v[1], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.agaa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().abrr", () => { - it("should return Vec4(a, b, r, r)", () => { - expect(v.abrr).toBeVec(v[3], v[2], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.abrr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().abrg", () => { - it("should return Vec4(a, b, r, g)", () => { - expect(v.abrg).toBeVec(v[3], v[2], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.abrg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().abrb", () => { - it("should return Vec4(a, b, r, b)", () => { - expect(v.abrb).toBeVec(v[3], v[2], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.abrb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().abra", () => { - it("should return Vec4(a, b, r, a)", () => { - expect(v.abra).toBeVec(v[3], v[2], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.abra; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().abgr", () => { - it("should return Vec4(a, b, g, r)", () => { - expect(v.abgr).toBeVec(v[3], v[2], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.abgr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().abgg", () => { - it("should return Vec4(a, b, g, g)", () => { - expect(v.abgg).toBeVec(v[3], v[2], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.abgg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().abgb", () => { - it("should return Vec4(a, b, g, b)", () => { - expect(v.abgb).toBeVec(v[3], v[2], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.abgb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().abga", () => { - it("should return Vec4(a, b, g, a)", () => { - expect(v.abga).toBeVec(v[3], v[2], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.abga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().abbr", () => { - it("should return Vec4(a, b, b, r)", () => { - expect(v.abbr).toBeVec(v[3], v[2], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.abbr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().abbg", () => { - it("should return Vec4(a, b, b, g)", () => { - expect(v.abbg).toBeVec(v[3], v[2], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.abbg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().abbb", () => { - it("should return Vec4(a, b, b, b)", () => { - expect(v.abbb).toBeVec(v[3], v[2], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.abbb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().abba", () => { - it("should return Vec4(a, b, b, a)", () => { - expect(v.abba).toBeVec(v[3], v[2], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.abba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().abar", () => { - it("should return Vec4(a, b, a, r)", () => { - expect(v.abar).toBeVec(v[3], v[2], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.abar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().abag", () => { - it("should return Vec4(a, b, a, g)", () => { - expect(v.abag).toBeVec(v[3], v[2], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.abag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().abab", () => { - it("should return Vec4(a, b, a, b)", () => { - expect(v.abab).toBeVec(v[3], v[2], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.abab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().abaa", () => { - it("should return Vec4(a, b, a, a)", () => { - expect(v.abaa).toBeVec(v[3], v[2], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.abaa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aarr", () => { - it("should return Vec4(a, a, r, r)", () => { - expect(v.aarr).toBeVec(v[3], v[3], v[0], v[0]); - }); - it("should be return a copy", () => { - let sw = v.aarr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aarg", () => { - it("should return Vec4(a, a, r, g)", () => { - expect(v.aarg).toBeVec(v[3], v[3], v[0], v[1]); - }); - it("should be return a copy", () => { - let sw = v.aarg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aarb", () => { - it("should return Vec4(a, a, r, b)", () => { - expect(v.aarb).toBeVec(v[3], v[3], v[0], v[2]); - }); - it("should be return a copy", () => { - let sw = v.aarb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aara", () => { - it("should return Vec4(a, a, r, a)", () => { - expect(v.aara).toBeVec(v[3], v[3], v[0], v[3]); - }); - it("should be return a copy", () => { - let sw = v.aara; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aagr", () => { - it("should return Vec4(a, a, g, r)", () => { - expect(v.aagr).toBeVec(v[3], v[3], v[1], v[0]); - }); - it("should be return a copy", () => { - let sw = v.aagr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aagg", () => { - it("should return Vec4(a, a, g, g)", () => { - expect(v.aagg).toBeVec(v[3], v[3], v[1], v[1]); - }); - it("should be return a copy", () => { - let sw = v.aagg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aagb", () => { - it("should return Vec4(a, a, g, b)", () => { - expect(v.aagb).toBeVec(v[3], v[3], v[1], v[2]); - }); - it("should be return a copy", () => { - let sw = v.aagb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aaga", () => { - it("should return Vec4(a, a, g, a)", () => { - expect(v.aaga).toBeVec(v[3], v[3], v[1], v[3]); - }); - it("should be return a copy", () => { - let sw = v.aaga; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aabr", () => { - it("should return Vec4(a, a, b, r)", () => { - expect(v.aabr).toBeVec(v[3], v[3], v[2], v[0]); - }); - it("should be return a copy", () => { - let sw = v.aabr; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aabg", () => { - it("should return Vec4(a, a, b, g)", () => { - expect(v.aabg).toBeVec(v[3], v[3], v[2], v[1]); - }); - it("should be return a copy", () => { - let sw = v.aabg; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aabb", () => { - it("should return Vec4(a, a, b, b)", () => { - expect(v.aabb).toBeVec(v[3], v[3], v[2], v[2]); - }); - it("should be return a copy", () => { - let sw = v.aabb; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aaba", () => { - it("should return Vec4(a, a, b, a)", () => { - expect(v.aaba).toBeVec(v[3], v[3], v[2], v[3]); - }); - it("should be return a copy", () => { - let sw = v.aaba; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aaar", () => { - it("should return Vec4(a, a, a, r)", () => { - expect(v.aaar).toBeVec(v[3], v[3], v[3], v[0]); - }); - it("should be return a copy", () => { - let sw = v.aaar; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aaag", () => { - it("should return Vec4(a, a, a, g)", () => { - expect(v.aaag).toBeVec(v[3], v[3], v[3], v[1]); - }); - it("should be return a copy", () => { - let sw = v.aaag; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aaab", () => { - it("should return Vec4(a, a, a, b)", () => { - expect(v.aaab).toBeVec(v[3], v[3], v[3], v[2]); - }); - it("should be return a copy", () => { - let sw = v.aaab; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - describe("Vec4().aaaa", () => { - it("should return Vec4(a, a, a, a)", () => { - expect(v.aaaa).toBeVec(v[3], v[3], v[3], v[3]); - }); - it("should be return a copy", () => { - let sw = v.aaaa; - sw[0] += 1; - expect(v[0]).not.toEqual(sw[0]); - }); - }); - - // [/Swizzle Autogen] -}); \ No newline at end of file diff --git a/tests/vec4.spec.ts b/tests/vec4.spec.ts deleted file mode 100644 index 3669d442..00000000 --- a/tests/vec4.spec.ts +++ /dev/null @@ -1,689 +0,0 @@ -import { expect, describe, it, beforeEach } from 'vitest'; -import { Vec4, Vec4Like } from "../src/vec4" -import "./test-utils" - -describe("Vec4", () => { - describe("constructor", () => { - it("should return Vec4(0, 0, 0, 0) if called with no arguments", () => { - expect(new Vec4()).toBeVec(0, 0, 0, 0); - }); - - it("should return Vec4(x, y, z, w) if called with (x, y, z, w)", () => { - expect(new Vec4(1, 2, 3, 4)).toBeVec(1, 2, 3, 4); - expect(new Vec4(-3, 4.4, -5.6, 7.8)).toBeVec(-3, 4.4, -5.6, 7.8); - }); - - it("should return Vec4(x, x, x) if called with (x)", () => { - expect(new Vec4(1)).toBeVec(1, 1, 1, 1); - expect(new Vec4(-2.3)).toBeVec(-2.3, -2.3, -2.3, -2.3); - }); - - it("should return Vec4(x, y, z, w) if called with ([x, y, z, w])", () => { - expect(new Vec4([1, 2, 3, 4])).toBeVec(1, 2, 3, 4); - expect(new Vec4([-3, 4.4, -5.6, 7.8])).toBeVec(-3, 4.4, -5.6, 7.8); - }); - - it("should return Vec4(x, y, z, w) if called with (Vec4(x, y, z, w))", () => { - let v = new Vec4(3.4, 5.6, 7.8, 9); - expect(new Vec4(v)).toBeVec(v); - }); - - it("should return Vec4(x, y, z, w) if called with (Float32Array([x, y, z, w]))", () => { - let arr = new Float32Array([1.2, 3.4, 5.6, 7.8]); - expect(new Vec4(arr)).toBeVec(arr); - }); - }); - - describe("static", () => { - let out: Vec4Like; - let vecA: Vec4Like; - let vecB: Vec4Like; - let result: any; - - beforeEach(() => { - vecA = new Vec4(1, 2, 3, 4); - vecB = new Vec4(5, 6, 7, 8); - out = new Vec4(0, 0, 0, 0); - }); - - describe("create", () => { - beforeEach(() => { result = Vec4.create(); }); - it("should return a 4 element array initialized to 0s", () => { expect(result).toBeVec(0, 0, 0, 0); }); - }); - - describe("clone", () => { - beforeEach(() => { result = Vec4.clone(vecA); }); - it("should return a 4 element array initialized to the values in vecA", () => { expect(result).toBeVec(vecA); }); - }); - - describe("fromValues", () => { - beforeEach(() => { result = Vec4.fromValues(1, 2, 3, 4); }); - it("should return a 4 element array initialized to the values passed", () => { expect(result).toBeVec(1, 2, 3, 4); }); - }); - - describe("copy", () => { - beforeEach(() => { result = Vec4.copy(out, vecA); }); - it("should place values into out", () => { expect(out).toBeVec(1, 2, 3, 4); }); - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("set", () => { - beforeEach(() => { result = Vec4.set(out, 1, 2, 3, 4); }); - it("should place values into out", () => { expect(out).toBeVec(1, 2, 3, 4); }); - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("add", () => { - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec4.add(out, vecA, vecB); }); - - it("should place values into out", () => { expect(out).toBeVec(6, 8, 10, 12); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec4.add(vecA, vecA, vecB); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(6, 8, 10, 12); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec4.add(vecB, vecA, vecB); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(6, 8, 10, 12); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - }); - }); - - describe("subtract", () => { - it("should have an alias called 'sub'", () => { expect(Vec4.sub).toEqual(Vec4.subtract); }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec4.subtract(out, vecA, vecB); }); - - it("should place values into out", () => { expect(out).toBeVec(-4, -4, -4, -4); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec4.subtract(vecA, vecA, vecB); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(-4, -4, -4, -4); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec4.subtract(vecB, vecA, vecB); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(-4, -4, -4, -4); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - }); - }); - - describe("multiply", () => { - it("should have an alias called 'mul'", () => { expect(Vec4.mul).toEqual(Vec4.multiply); }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec4.multiply(out, vecA, vecB); }); - - it("should place values into out", () => { expect(out).toBeVec(5, 12, 21, 32); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec4.multiply(vecA, vecA, vecB); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(5, 12, 21, 32); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec4.multiply(vecB, vecA, vecB); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(5, 12, 21, 32); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - }); - }); - - describe("divide", () => { - it("should have an alias called 'div'", () => { expect(Vec4.div).toEqual(Vec4.divide); }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec4.divide(out, vecA, vecB); }); - - it("should place values into out", () => { expect(out).toBeVec(0.2, 0.333333, 0.428571, 0.5); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec4.divide(vecA, vecA, vecB); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(0.2, 0.333333, 0.428571, 0.5); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec4.divide(vecB, vecA, vecB); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(0.2, 0.333333, 0.428571, 0.5); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - }); - }); - - describe("ceil", () => { - beforeEach(() => { vecA = [Math.E, Math.PI, Math.SQRT2, Math.SQRT1_2]; }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec4.ceil(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(3, 4, 2, 1); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(Math.E, Math.PI, Math.SQRT2, Math.SQRT1_2); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec4.ceil(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(3, 4, 2, 1); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("floor", () => { - beforeEach(() => { vecA = [Math.E, Math.PI, Math.SQRT2, Math.SQRT1_2]; }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec4.floor(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(2, 3, 1, 0); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(Math.E, Math.PI, Math.SQRT2, Math.SQRT1_2); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec4.floor(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(2, 3, 1, 0); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("min", () => { - beforeEach(() => { vecA = [1, 3, 1, 3]; vecB = [3, 1, 3, 1]; }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec4.min(out, vecA, vecB); }); - - it("should place values into out", () => { expect(out).toBeVec(1, 1, 1, 1); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 3, 1, 3); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 1, 3, 1); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec4.min(vecA, vecA, vecB); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(1, 1, 1, 1); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 1, 3, 1); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec4.min(vecB, vecA, vecB); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(1, 1, 1, 1); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 3, 1, 3); }); - }); - }); - - describe("max", () => { - beforeEach(() => { vecA = [1, 3, 1, 3]; vecB = [3, 1, 3, 1]; }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec4.max(out, vecA, vecB); }); - - it("should place values into out", () => { expect(out).toBeVec(3, 3, 3, 3); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 3, 1, 3); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 1, 3, 1); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec4.max(vecA, vecA, vecB); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(3, 3, 3, 3); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(3, 1, 3, 1); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec4.max(vecB, vecA, vecB); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(3, 3, 3, 3); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 3, 1, 3); }); - }); - }); - - describe("round", () => { - beforeEach(() => { vecA = [Math.E, Math.PI, Math.SQRT2, Math.SQRT1_2]; }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec4.round(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(3, 3, 1, 1); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(Math.E, Math.PI, Math.SQRT2, Math.SQRT1_2); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec4.round(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(3, 3, 1, 1); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("scale", () => { - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec4.scale(out, vecA, 2); }); - - it("should place values into out", () => { expect(out).toBeVec(2, 4, 6, 8); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec4.scale(vecA, vecA, 2); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(2, 4, 6, 8); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("scaleAndAdd", () => { - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec4.scaleAndAdd(out, vecA, vecB, 0.5); }); - - it("should place values into out", () => { expect(out).toBeVec(3.5, 5, 6.5, 8); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec4.scaleAndAdd(vecA, vecA, vecB, 0.5); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(3.5, 5, 6.5, 8); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec4.scaleAndAdd(vecB, vecA, vecB, 0.5); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(3.5, 5, 6.5, 8); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - }); - }); - - describe("distance", () => { - it("should have an alias called 'dist'", () => { expect(Vec4.dist).toEqual(Vec4.distance); }); - - beforeEach(() => { result = Vec4.distance(vecA, vecB); }); - - it("should return the distance", () => { expect(result).toBeCloseTo(8); }); - }); - - describe("squaredDistance", () => { - it("should have an alias called 'sqrDist'", () => { expect(Vec4.sqrDist).toEqual(Vec4.squaredDistance); }); - - beforeEach(() => { result = Vec4.squaredDistance(vecA, vecB); }); - - it("should return the squared distance", () => { expect(result).toEqual(64); }); - }); - - describe("length", () => { - it("should have an alias called 'len'", () => { expect(Vec4.len).toEqual(Vec4.length); }); - - beforeEach(() => { result = Vec4.len(vecA); }); - - it("should return the length", () => { expect(result).toBeCloseTo(5.477225); }); - }); - - describe("squaredLength", () => { - it("should have an alias called 'sqrLen'", () => { expect(Vec4.sqrLen).toEqual(Vec4.squaredLength); }); - - beforeEach(() => { result = Vec4.squaredLength(vecA); }); - - it("should return the squared length", () => { expect(result).toEqual(30); }); - }); - - describe("negate", () => { - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec4.negate(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(-1, -2, -3, -4); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec4.negate(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(-1, -2, -3, -4); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("inverse", () => { - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec4.inverse(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(1, 1/2, 1/3, 1/4); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec4.inverse(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(1, 1/2, 1/3, 1/4); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("abs", () => { - beforeEach(() => { vecA = [-1, -2, -3, -4]; }); - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec4.abs(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(1, 2, 3, 4); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(-1, -2, -3, -4); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec4.abs(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("normalize", () => { - beforeEach(() => { vecA = [5, 0, 0, 0]; }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec4.normalize(out, vecA); }); - - it("should place values into out", () => { expect(out).toBeVec(1, 0, 0, 0); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(5, 0, 0, 0); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec4.normalize(vecA, vecA); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(1, 0, 0, 0); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - }); - }); - - describe("dot", () => { - beforeEach(() => { result = Vec4.dot(vecA, vecB); }); - - it("should return the dot product", () => { expect(result).toEqual(70); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(5, 6, 7, 8); }); - }); - - describe("lerp", () => { - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec4.lerp(out, vecA, vecB, 0.5); }); - - it("should place values into out", () => { expect(out).toBeVec(3, 4, 5, 6); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec4.lerp(vecA, vecA, vecB, 0.5); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(3, 4, 5, 6); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(5, 6, 7, 8); }); - }); - - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec4.lerp(vecB, vecA, vecB, 0.5); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(3, 4, 5, 6); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - }); - }); - - /*describe("random", () => { - describe("with no scale", () => { - beforeEach(() => { result = Vec4.random(out); }); - - it("should result in a unit length vector", () => { expect(Vec4.len(out)).toBeCloseTo(1.0); }); - it("should return out", () => { expect(result).toBe(out); }); - }); - - describe("with a scale", () => { - beforeEach(() => { result = Vec4.random(out, 5.0); }); - - it("should result in a unit length vector", () => { expect(Vec4.len(out)).toBeCloseTo(5.0); }); - it("should return out", () => { expect(result).toBe(out); }); - }); - });*/ - - describe("cross", () => { - let vecC: Vec4Like; - beforeEach(() => { - vecA = new Vec4(1, 0, 0, 0); - vecB = new Vec4(0, 1, 0, 0); - vecC = [0, 0, 1, 0]; - }); - - describe("with a separate output vector", () => { - beforeEach(() => { result = Vec4.cross(out, vecA,vecB,vecC); }); - - it("should place values into out", () => { expect(out).toBeVec(0, 0, 0, -1); }); - it("should return out", () => { expect(result).toBe(out); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 0, 0, 0); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(0, 1, 0, 0); }); - it("should not modify vecC", () => { expect(vecC).toBeVec(0, 0, 1, 0); }); - }); - - describe("when vecA is the output vector", () => { - beforeEach(() => { result = Vec4.cross(vecA, vecA,vecB,vecC); }); - - it("should place values into vecA", () => { expect(vecA).toBeVec(0, 0, 0,-1); }); - it("should return vecA", () => { expect(result).toBe(vecA); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(0, 1, 0, 0); }); - it("should not modify vecC", () => { expect(vecC).toBeVec(0, 0, 1, 0); }); - }); - describe("when vecB is the output vector", () => { - beforeEach(() => { result = Vec4.cross(vecB, vecA,vecB,vecC); }); - - it("should place values into vecB", () => { expect(vecB).toBeVec(0, 0, 0,-1); }); - it("should return vecB", () => { expect(result).toBe(vecB); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 0, 0, 0); }); - it("should not modify vecC", () => { expect(vecC).toBeVec(0, 0, 1, 0); }); - }); - describe("when vecC is the output vector", () => { - beforeEach(() => { result = Vec4.cross(vecC, vecA,vecB,vecC); }); - - it("should place values into vecC", () => { expect(vecC).toBeVec(0, 0, 0,-1); }); - it("should return vecC", () => { expect(result).toBe(vecC); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 0, 0, 0); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(0, 1, 0, 0); }); - }); - }); - - /*describe("forEach", () => { - let vecArray; - - beforeEach(() => { - vecArray = [ - 1, 2, 3, 4, - 5, 6, 7, 8, - 0, 0, 0, 0 - ]; - }); - - describe("when performing operations that take no extra arguments", () => { - beforeEach(() => { result = Vec4.forEach(vecArray, 0, 0, 0, Vec4.normalize); }); - - it("should update all values", () => { - expect(vecArray).toBeEqualish([ - 0.182574, 0.365148, 0.547722, 0.730296, - 0.379049, 0.454858, 0.530668, 0.606478, - 0, 0, 0, 0 - ]); - }); - it("should return vecArray", () => { expect(result).toBe(vecArray); }); - }); - - describe("when performing operations that takes one extra arguments", () => { - beforeEach(() => { result = Vec4.forEach(vecArray, 0, 0, 0, Vec4.add, vecA); }); - - it("should update all values", () => { - expect(vecArray).toBeEqualish([ - 2, 4, 6, 8, - 6, 8, 10, 12, - 1, 2, 3, 4 - ]); - }); - it("should return vecArray", () => { expect(result).toBe(vecArray); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - }); - - describe("when specifying an offset", () => { - beforeEach(() => { result = Vec4.forEach(vecArray, 0, 4, 0, Vec4.add, vecA); }); - - it("should update all values except the first vector", () => { - expect(vecArray).toBeEqualish([ - 1, 2, 3, 4, - 6, 8, 10, 12, - 1, 2, 3, 4 - ]); - }); - it("should return vecArray", () => { expect(result).toBe(vecArray); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - }); - - describe("when specifying a count", () => { - beforeEach(() => { result = Vec4.forEach(vecArray, 0, 0, 2, Vec4.add, vecA); }); - - it("should update all values except the last vector", () => { - expect(vecArray).toBeEqualish([ - 2, 4, 6, 8, - 6, 8, 10, 12, - 0, 0, 0, 0 - ]); - }); - it("should return vecArray", () => { expect(result).toBe(vecArray); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - }); - - describe("when specifying a stride", () => { - beforeEach(() => { result = Vec4.forEach(vecArray, 8, 0, 0, Vec4.add, vecA); }); - - it("should update all values except the second vector", () => { - expect(vecArray).toBeEqualish([ - 2, 4, 6, 8, - 5, 6, 7, 8, - 1, 2, 3, 4 - ]); - }); - it("should return vecArray", () => { expect(result).toBe(vecArray); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(1, 2, 3, 4); }); - }); - - describe("when calling a function that does not modify the out variable", () => { - beforeEach(() => { - result = vec3.forEach(vecArray, 0, 0, 0, function(out, vec) {}); - }); - - it("values should remain unchanged", () => { - expect(vecArray).toBeEqualish([ - 1, 2, 3, 4, - 5, 6, 7, 8, - 0, 0, 0, 0 - ]); - }); - it("should return vecArray", () => { expect(result).toBe(vecArray); }); - }); - });*/ - - describe("str", () => { - it("should return a string representation of the vector", () => { expect(Vec4.str(vecA)).toEqual("Vec4(1, 2, 3, 4)"); }); - }); - - describe("exactEquals", () => { - let vecC: Vec4Like, r0: boolean, r1: boolean; - beforeEach(() => { - vecA = [0, 1, 2, 3]; - vecB = [0, 1, 2, 3]; - vecC = [1, 2, 3, 4]; - r0 = Vec4.exactEquals(vecA, vecB); - r1 = Vec4.exactEquals(vecA, vecC); - }); - - it("should return true for identical vectors", () => { expect(r0).toBe(true); }); - it("should return false for different vectors", () => { expect(r1).toBe(false); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(0, 1, 2, 3); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(0, 1, 2, 3); }); - }); - - describe("equals", () => { - let vecC: Vec4Like, vecD: Vec4Like, r0: boolean, r1: boolean, r2: boolean; - beforeEach(() => { - vecA = [0, 1, 2, 3]; - vecB = [0, 1, 2, 3]; - vecC = [1, 2, 3, 4]; - vecD = [1e-16, 1, 2, 3]; - r0 = Vec4.equals(vecA, vecB); - r1 = Vec4.equals(vecA, vecC); - r2 = Vec4.equals(vecA, vecD); - }); - it("should return true for identical vectors", () => { expect(r0).toBe(true); }); - it("should return false for different vectors", () => { expect(r1).toBe(false); }); - it("should return true for close but not identical vectors", () => { expect(r2).toBe(true); }); - it("should not modify vecA", () => { expect(vecA).toBeVec(0, 1, 2, 3); }); - it("should not modify vecB", () => { expect(vecB).toBeVec(0, 1, 2, 3); }); - }); - - describe("zero", () => { - beforeEach(() => { - vecA = [1, 2, 3, 4]; - result = Vec4.zero(vecA); - }); - it("should result in a 4 element vector with zeros", () => { expect(result).toBeVec(0, 0, 0, 0); }); - }); - }); -}); \ No newline at end of file diff --git a/tests/vitest.d.ts b/tests/vitest.d.ts new file mode 100644 index 00000000..caf7ce8c --- /dev/null +++ b/tests/vitest.d.ts @@ -0,0 +1,24 @@ +import type { + FloatArray, + Quat2Like, + Mat2Like, + Mat2dLike, + Mat3Like, + Mat4Like, + Vec2Like, + Vec3Like, + Vec4Like } from '#gl-matrix/types'; + +/** + * Defines custom matchers set in `./setupExtend.ts` via `expect.extend`. + */ +interface CustomMatchers { + toBeVec: (...expected: number[] | [FloatArray] | [Mat2Like] | [Mat2dLike] | [Mat3Like] | [Mat4Like] | [Vec2Like] | + [Vec3Like] | [Vec4Like]) => R + toBeQuat2: (...expected: number[] | [FloatArray] | [Quat2Like]) => R +} + +declare module 'vitest' { + // eslint-disable-next-line + interface Assertion extends CustomMatchers {} +} diff --git a/tsconfig.json b/tsconfig.json index c01e450f..6ef0b5c2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,14 +1,12 @@ { "compilerOptions": { - "target": "esnext", - "module": "esnext", - "lib": ["esnext", "dom"], - "outDir": "dist/esm", - "rootDir": "./src", - "sourceMap": true, - "moduleResolution": "node", - "esModuleInterop": true, - "declaration": true + "lib": ["ESNext", "DOM"], + "module": "NodeNext", + "moduleResolution": "NodeNext", + "strictNullChecks": true }, - "include": ["src/**/*"], -} \ No newline at end of file + "include": [ + "src/**/*", + "tests/**/*" + ] +} diff --git a/tsconfig64.json b/tsconfig64.json deleted file mode 100644 index a13d9c70..00000000 --- a/tsconfig64.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "compilerOptions": { - "target": "esnext", - "module": "esnext", - "lib": ["esnext", "dom"], - "outDir": "dist/esm/f64", - "rootDir": "./f64/src", - "sourceMap": true, - "moduleResolution": "node", - "esModuleInterop": true, - "declaration": true - }, - "include": ["f64/src/**/*"], -} \ No newline at end of file diff --git a/typedoc-cdn.json b/typedoc-cdn.json new file mode 100644 index 00000000..90f97dd8 --- /dev/null +++ b/typedoc-cdn.json @@ -0,0 +1,36 @@ +{ + "name": "gl-matrix (CDN Distribution)", + "basePath": ".", + "exclude": ["./dist/**/*"], + "out": "docs/cdn", + "readme": "./README-CDN.md", + "categoryOrder": [ + "Constructor", + "Static", + "Accessors", + "Methods", + "Color Components", + "Vector Components", + "Quaternion Components", + "Swizzle Accessors (Optional)", + "*" + ], + "defaultCategory": "Inherited", + "dmtLinksIcon": [ + { + "icon": "./assets/icon/gl-matrix-icon-mono-64.webp", + "title": "Homepage", + "url": "https://glmatrix.net/" + } + ], + "dmtLinksService": { + "GitHub": "https://github.com/toji/gl-matrix", + "NPM": "https://www.npmjs.com/package/gl-matrix" + }, + "navigation": { + "includeCategories": true + }, + "sidebarLinks": { + "Go to: Node / NPM Distribution": "https://typhonjs-svelte-scratch.github.io/gl-matrix-beta3-dist/" + } +} diff --git a/typedoc.json b/typedoc.json index ea39c572..e76d7b13 100644 --- a/typedoc.json +++ b/typedoc.json @@ -1,15 +1,35 @@ { - "out": "docs", - "readme": "README.md", - "defaultCategory": "Instance", + "name": "gl-matrix (Node / NPM Distribution)", + "basePath": ".", + "exclude": ["dist-cdn/types/*"], "categoryOrder": [ - "Vector components", - "Color components", - "Swizzle", + "Constructor", + "Static", + "Accessors", + "Methods", + "Color Components", + "Vector Components", + "Quaternion Components", + "Swizzle Accessors (Optional)", "*" ], - "sort": ["instance-first", "source-order"], + "defaultCategory": "Inherited", + "dmtLinksIcon": [ + { + "icon": "./assets/icon/gl-matrix-icon-mono-64.webp", + "title": "Homepage", + "url": "https://glmatrix.net/" + } + ], + "dmtLinksService": { + "GitHub": "https://github.com/toji/gl-matrix", + "NPM": "https://www.npmjs.com/package/gl-matrix" + }, + "navigation": { + "includeCategories": true + }, + "projectDocuments": ["docs-md/main/**/*.md"], "sidebarLinks": { - "GitHub Repo": "https://github.com/toji/gl-matrix" + "Go to: CDN Distribution": "https://typhonjs-svelte-scratch.github.io/gl-matrix-beta3-dist/cdn" } -} \ No newline at end of file +} diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 00000000..1738f122 --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,20 @@ +import { + configDefaults, + defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + exclude: [...configDefaults.exclude], + include: ['./tests/**/*.spec.ts'], + coverage: { + include: ['src/**'], + exclude: ['test/**'], + provider: 'v8', + reporter: ['text', 'json', 'html'] + }, + environment: 'node', + reporters: ['default', 'html'], + setupFiles: './tests/setupExtend.ts', // Extends `expect` with custom matchers. + globalSetup: './tests/setupGlobal.js' // Generate F64 source / tests once before tests runs. + } +});